• Idea
    • Resolution: Duplicate
    • Major
    • None
    • None
    • None
    • None


      As a Wiki UI developer I would like to be able to hook into CKEditor events so that I can perform customs actions with my skin.

      For instance, if I want to toggle a markdown guide to the user when a user clicks the 'Source' button, I have no way of knowing when the CKEditor instance has rendered so I can attach an onclick event handler to the button.

      It would be nice if CKEditor.EditSheet forwarded events fired from CKEditor to the rest of the platform so I can listen to these events.

      It would be nice if these events were XWiki events so that my script files will not need require( ['ckeditor'] ) in my script as that would require me copying the require.config section from CKEditor.EditSheet into another file, and then I have to maintain this file should CKEditor.EditSheet ever change.

      I could make changes to CKEditor.EditSheet to fire an event but any custom changes that I make to that pages makes upgrading the Extension more difficult.

      For example (cut from CKEditor.EditSheet):

       var editor = ckeditor.replace(this, {
              allowedContent: true,
              // ------- snip ----- //
              on: {
                  instanceReady: function(evnt) {
                    document.fire("xwiki:ckeditor:instance:created", {editor: evnt.editor});

      The above code will allow me to observe this XWiki event which can pass me the editor instance so I can make any custom modifications I desire, like this:

      document.observe("xwiki:ckeditor:instance:created", function(evnt) {
              var editor = evnt.memo.editor;
              editor.container.findOne(".cke_button__source").on("click", function() {

      Notice I can easily make any changes that I want to the ckeditor instance without any race conditions or needing to worry that ckeditor.js is loaded and available for my script.


       document.fire("xwiki:ckeditor:instance:beforeCreate", {options: {}}) 

      hook before the instance is created would be nice too so I can load custom configurations. I realize that there is already a task to add configuration of CKEditor through the Admin console, but allowing me to edit the configurations through code means I can source control the changes for disaster recovery. Or if the changes that I need to make are not exposed in the Admin console, I'll have to modify the CKEditor.EditSheet directly which creates a maintenance issue for me.


        Issue Links



              mflorea Marius Dumitru Florea
              jmiklos Jim Miklos
              0 Vote for this issue
              2 Start watching this issue