exec-command.js revision a2621d519886de7d60c30c5a0850f5c17fd2fb36
145N/A * Plugin for the frame module to handle execCommands for Editor 145N/A * @submodule exec-command 145N/A * Plugin for the frame module to handle execCommands for Editor 145N/A * @class Plugin.ExecCommand 145N/A * An internal reference to the instance of the frame plugged into. 187N/A * Execute a command on the frame's document. 187N/A * @param {String} action The action to perform (bold, italic, fontname) 145N/A * @param {String} value The optional value (helvetica) 187N/A * The private version of execCommand that doesn't filter for overrides. 187N/A * @param {String} action The action to perform (bold, italic, fontname) 187N/A * @param {String} value The optional value (helvetica) 187N/A * Get's the instance of YUI bound to the parent frame 187N/A * @return {YUI} The YUI instance bound to the parent frame * Static object literal of execCommand overrides * Wraps the content with a new element of type (tag) * @param {String} cmd The command executed: wrap * @param {String} tag The tag to wrap the selection with * @return {NodeList} NodeList of the items touched by this command. * Inserts the provided HTML at the cursor, should be a single element. * @method COMMANDS.inserthtml * @param {String} cmd The command executed: inserthtml * @param {String} html The html to insert * @return {Node} Node instance of the item touched by this command. * Inserts the provided HTML at the cursor, and focuses the cursor afterwards. * @method COMMANDS.insertandfocus * @param {String} cmd The command executed: insertandfocus * @param {String} html The html to insert * @return {Node} Node instance of the item touched by this command. * Inserts an image at the cursor position * @method COMMANDS.insertimage * @param {String} cmd The command executed: insertimage * @param {String} img The url of the image to be inserted * @return {Node} Node instance of the item touched by this command. return this.
command(
'inserthtml',
'<img src="' +
img +
'">');
* Add a class to all of the elements in the selection * @method COMMANDS.addclass * @param {String} cmd The command executed: addclass * @param {String} cls The className to add * @return {NodeList} NodeList of the items touched by this command. * Remove a class from all of the elements in the selection * @method COMMANDS.removeclass * @param {String} cmd The command executed: removeclass * @param {String} cls The className to remove * @return {NodeList} NodeList of the items touched by this command. * Adds a background color to the current selection, or creates a new element and applies it * @method COMMANDS.backcolor * @param {String} cmd The command executed: backcolor * @param {String} val The color value to apply * @return {NodeList} NodeList of the items touched by this command. n =
this.
command(
'inserthtml',
'<span style="background-color: ' +
val +
'"><span> </span> </span>');
* Sugar method, calles backcolor * @method COMMANDS.hilitecolor * @param {String} cmd The command executed: backcolor * @param {String} val The color value to apply * @return {NodeList} NodeList of the items touched by this command. * Adds a font name to the current selection, or creates a new element and applies it * @method COMMANDS.fontname * @param {String} cmd The command executed: fontname * @param {String} val The font name to apply * @return {NodeList} NodeList of the items touched by this command. n =
this.
command(
'inserthtml',
'<span style="font-family: ' +
val +
'"> </span>');
* Adds a fontsize to the current selection, or creates a new element and applies it * @method COMMANDS.fontsize * @param {String} cmd The command executed: fontsize * @param {String} val The font size to apply * @return {NodeList} NodeList of the items touched by this command. n =
this.
command(
'inserthtml',
'<font size="' +
val +
'"> </font>');