addCommand

public function addCommand(name:String, callback:addCommandCallback, scope:Object):void
Adds a custom command to the editor, you can also override existing commands with this method. The command that you add can be executed with execCommand.

Examples

// Adds a custom command that later can be executed using execCommand
tinyMCE.init({
   ...

   setup : function(ed) {
      // Register example command
      ed.addCommand('mycommand', function(ui, v) {
         ed.windowManager.alert('Hello world!! Selection: ' + ed.selection.getContent({format : 'text'}));
      });
   }
});

Params

Name Type Description
name String Command name to add/override.
callback addCommandCallback Function to execute when the command occurs.
scope Object Optional scope to execute the function in.
User Image
  • 2012-04-25 04:44:00

chungwufei

tnx

User Image
  • 2012-04-25 04:43:52

chungwufei

can you put demos? it could help... :)