Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>OK. As I suspected, it is done nicely and there is really no need to modify Google Closure code. In case someone would be interested in one way of adding a plugin to GC Editor, here it is. </p> <p>Basically, I correctly created new plugin and I correctly registered it (as shown above). Just a <code>goog.ui.Control</code> was required to be added to <code>makeToolbar</code> array attribute, such as the following way.</p> <pre><code>var myLinkButton = goog.ui.editor.ToolbarFactory.makeButton('myLink', 'This is a tooltip', 'My Custom Link', goog.getCssName('tr-link')); var buttons = [ goog.editor.Command.BOLD, goog.editor.Command.ITALIC, goog.editor.Command.UNDERLINE, ... myLinkButton, ]; var toolbar = goog.ui.editor.DefaultToolbar.makeToolbar(buttons, toolbarDiv); var toolbarController = new goog.ui.editor.ToolbarController(editor, toolbar); </code></pre> <p>(the bottom two lines remain the same)</p> <p>After that, the editor plugin engine distributes the <code>myLink</code> command to all registered plugins and my plugin catches it and responds. If it was needed to modify a plugin instead of adding (and still something from the original plugin needs to be retained), it should be sufficient to register my modified plugin sooner than the original one.</p> <p>I was banging with my head to the keyboard for a while finding out that it is this easy. Why there is no guide for that available on the internet (while there are guides for almost everything including much more primitive things) is still a mystery to me.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload