htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Add-Ons:
registered command handlers


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


mbeck
New User

Apr 28, 2004, 8:04 AM

Post #1 of 1 (9955 views)
Shortcut
registered command handlers Can't Post

It would be nice to be able to be able to register command handlers in plugins. Then, if a command such as "paste" is executed by the execCommand function in htmlarea.js, the plugin's onCommand handler could execute custom code.

That is ...

In htmlarea.js

HTMLArea.prototype.execCommand = function(cmdID, UI, param) {

...

// check if any plugins have registered command handlers
for (var i in editor.plugins) {
var plugin = editor.plugins.instance;
if (typeof plugin.onCommand == "function")
plugin.onCommand(cmdID, UI, param);
}

}

In plugin

// Object that will encapsulate all the extension node (XNode) operations
function MyPlugin(editor) {
this.editor = editor;

var cfg = editor.config;

this.onCommand = function (cmdID, UI, param) {alert("Do something here: " + cmdID);};

...

}
- Matthew Beck

 
 
 


Search for (options)