The API allows the creation of a 'Drupal WYSIWYG' plugin that acts as a generic way to develop a plugin for multiple WYSIWYG implementations including a button in an editor's menu and some detection of context that can be used to pass data about what is selected when a plugin's button is used. Some editors (CKEditor and TinyMCE to name a couple) also have a context menu plugin that appears when a user right clicks in the editor.

It could include some additions to the API, but I think the extra settings could be optional. This is what I would propose:

  • Title of context menu item - Use icon title by default.
  • When to show the menu item:
    • When the plugin's content is selected - Default.
    • Always.
    • Never.
    • Allow to provide custom function? (Not sure how well it would be supported)
  • Icon - Use regular menu icon by default. May not be necessary to allow it to be overridden.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jmuzz’s picture

Here's a sample implementation:

  • CKEditor only.
  • Menu entry text is configurable. A sample that can be applied to media is included.
  • The other stuff is not yet configurable.
  • The menu entries only appear if content from the plugin is selected in CKEditor.

I probably won't have time to do more work on this.