mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-18 02:39:56 +09:00
17223554 : xquared upgrade to 0.7
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4968 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
5956e254e7
commit
7c3b336e41
59 changed files with 34562 additions and 8454 deletions
102
modules/editor/skins/xquared/javascripts/plugin/Base.js
Normal file
102
modules/editor/skins/xquared/javascripts/plugin/Base.js
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/**
|
||||
* @namespace
|
||||
*/
|
||||
xq.plugin = {};
|
||||
|
||||
/**
|
||||
* @requires Xquared.js
|
||||
*/
|
||||
xq.plugin.Base = xq.Class(/** @lends xq.plugin.Base.prototype */{
|
||||
/**
|
||||
* Abstract base class for Xquared plugins.
|
||||
*
|
||||
* @constructs
|
||||
*/
|
||||
initialize: function() {},
|
||||
|
||||
/**
|
||||
* Loads plugin. Automatically called by xq.Editor.
|
||||
*
|
||||
* @param {xq.Editor} editor Editor instance.
|
||||
*/
|
||||
load: function(editor) {
|
||||
this.editor = editor;
|
||||
if(this.isEventListener()) this.editor.addListener(this);
|
||||
|
||||
this.onBeforeLoad(this.editor);
|
||||
this.editor.addShortcuts(this.getShortcuts() || []);
|
||||
this.editor.addAutocorrections(this.getAutocorrections() || []);
|
||||
this.editor.addAutocompletions(this.getAutocompletions() || []);
|
||||
this.editor.addTemplateProcessors(this.getTemplateProcessors() || []);
|
||||
this.editor.addContextMenuHandlers(this.getContextMenuHandlers() || []);
|
||||
this.onAfterLoad(this.editor);
|
||||
},
|
||||
|
||||
/**
|
||||
* Unloads plugin. Automatically called by xq.Editor
|
||||
*/
|
||||
unload: function() {
|
||||
this.onBeforeUnload(this.editor);
|
||||
for(var key in this.getShortcuts()) this.editor.removeShortcut(key);
|
||||
for(var key in this.getAutocorrections()) this.editor.removeAutocorrection(key);
|
||||
for(var key in this.getAutocompletions()) this.editor.removeAutocompletion(key);
|
||||
for(var key in this.getTemplateProcessors()) this.editor.removeTemplateProcessor(key);
|
||||
for(var key in this.getContextMenuHandlers()) this.editor.removeContextMenuHandler(key);
|
||||
this.onAfterUnload(this.editor);
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Always returns false.<br />
|
||||
* <br />
|
||||
* Derived class may override this to make a plugin as a event listener.<br />
|
||||
* Whenever you override this function, you should also implement at least one event handler for xq.Editor.
|
||||
*/
|
||||
isEventListener: function() {return false},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
onBeforeLoad: function(editor) {},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
onAfterLoad: function(editor) {},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
onBeforeUnload: function(editor) {},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
onAfterUnload: function(editor) {},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
getShortcuts: function() {return [];},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
getAutocorrections: function() {return [];},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
getAutocompletions: function() {return [];},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
getTemplateProcessors: function() {return [];},
|
||||
|
||||
/**
|
||||
* Callback function. Derived class may override this.
|
||||
*/
|
||||
getContextMenuHandlers: function() {return [];}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue