Plugins must be added as a property of the sceditor.plugins.*
object.
For example to create a plugin called myplugin
it would be:
// Created in sceditor.plugins.[name] object
sceditor.plugins.myplugin = function() {
// Place signal handlers and functions here
};
To then enable the plugin in the editor, add myplugin
to the plugins option when creating the editor.
Important: When creating a custom
plugin, it must be done before creating an instance of the editor,
e.g. before calling sceditor.create()
.
To create a signal handler, just create a function with the name of the signal and it will automatically be called whenever that signal is raised.
e.g.
sceditor.plugins.myplugin = function() {
base.signalKeydownEvent = function(e) {
// this will automatically be called when 'myplugin'
// is registered with an editor instance and there
// is a keydown event
};
};
All signals will have this
set to the editor instance that the plugin applies to.
Called when the plugin is registered to the editor.
Called when destroy()
is called on the editor or the plugin is removed from the editor.
This signal should be used to unbind any DOM events and to do any clean up so that any memory used can be freed by the browser.
Called after the editor is created.
Important: This can be called before the page fully loaded.
Parameters:
keydown
event objectCalled whenever the keydown
event is triggered in either the WYSIWYG or Source Mode editors.
Use this.sourceMode()
to check which mode the editor is in.
Parameters:
keyup
event objectCalled whenever the keyup
event is triggered in either the WYSIWYG or Source Mode editors.
Use this.sourceMode()
to check which mode the editor is in.
Parameters:
keypress
event objectCalled whenever the keypress
event is triggered in either the WYSIWYG or Source Mode editors.
Use this.sourceMode()
to check which mode the editor is in.
Parameters:
focus
event objectCalled whenever the focus
event is triggered in either the WYSIWYG or Source Mode editors.
Use this.sourceMode()
to check which mode the editor is in.
Parameters:
blur
event objectCalled whenever the blur
event is triggered in either the WYSIWYG or Source Mode editors.
Use this.sourceMode()
to check which mode the editor is in.
Parameters:
contextmenu
event objectCalled whenever the contextmenu
event is triggered in either the WYSIWYG or Source Mode editors.
Use this.sourceMode()
to check which mode the editor is in.
Parameters:
selectionchanged
event objectCalled whenever the selection has changed in the WYSIWYG editor.
Important: This event does not occur when in source mode.