TinyMCE:API/tinymce.Editor/onBeforeExecCommand

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Event: onBeforeExecCommand

Summary

This event gets executed before a command is executed like Bold or CreateLink.

Syntax

event_callback(<tinymce.Editor> ed, <String> cmd, <Boolean> ui, <Object> val, <Object> o)

Parameters

ed
The Editor instance that is executing the command.
cmd
Command name such as 'Bold' or 'CreateLink'.
ui
User interface state: true if a dialog should be displayed, .
val
Value object: for example, it can be the URL for a link.
o
Context object: empty when passed in but if you set o.terminate = true then the command will not be executed.

Examples

// Adds an observer to the onBeforeExecCommand event using tinyMCE.init
tinyMCE.init({
   ...
   setup : function(ed) {
      ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
          console.debug('Command is to be executed: ' + cmd);
      });
   }
});

// Adds an observer to the onBeforeExecCommand event using the render method
var ed = new tinymce.Editor('someid', {
   .. Some settings
});

ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
   console.debug('Command is to be executed: ' + cmd);
});

ed.render();
Personal tools