# Yahoo! UI Library

### editor 3.3.0

Yahoo! UI Library > editor > Plugin.ExecCommand
Search:
Filters Show Private Show Protected Show Deprecated

## Class Plugin.ExecCommand - extends Base

Plugin for the frame module to handle execCommands for Editor

### Constructor

Plugin.ExecCommand `( )`

### Properties

#### _inst - `private object`

An internal reference to the instance of the frame plugged into.

#### _lastKey - `private object`

An internal reference to the keyCode of the last key that was pressed.

#### COMMANDS - `static object`

Static object literal of execCommand overrides

#### COMMANDS.bidi - `object`

bidi execCommand override for setting the text direction of a node.

#### NAME - `static object`

execCommand

#### NS - `static object`

exec

#### Properties inherited from Plugin.Host:

`PluginHost`

#### Properties inherited from Attribute:

``

#### Properties inherited from Base:

`name`

### Methods

#### _command

`private void _command ( action , value )`
The private version of execCommand that doesn't filter for overrides.

Parameters:
  `action <String>` The action to perform (bold, italic, fontname)
  `value <String>` The optional value (helvetica)

#### command

`Node/NodeList command ( action , value )`
Execute a command on the frame's document.

Parameters:
  `action <String>` The action to perform (bold, italic, fontname)
  `value <String>` The optional value (helvetica)

Returns: `Node/NodeList`
  Should return the Node/Nodelist affected

#### COMMANDS.addclass

`static NodeList COMMANDS.addclass ( cmd , cls )`
Add a class to all of the elements in the selection

Parameters:
  `cmd <String>` The command executed: addclass
  `cls <String>` The className to add

Returns: `NodeList`
  NodeList of the items touched by this command.

#### COMMANDS.backcolor

`static NodeList COMMANDS.backcolor ( cmd , val )`
Adds a background color to the current selection, or creates a new element and applies it

Parameters:
  `cmd <String>` The command executed: backcolor
  `val <String>` The color value to apply

Returns: `NodeList`
  NodeList of the items touched by this command.

#### COMMANDS.fontname

`static NodeList COMMANDS.fontname ( cmd , val )`
Adds a font name to the current selection, or creates a new element and applies it

Parameters:
  `cmd <String>` The command executed: fontname
  `val <String>` The font name to apply

Returns: `NodeList`
  NodeList of the items touched by this command.

#### COMMANDS.fontsize

`static NodeList COMMANDS.fontsize ( cmd , val )`
Adds a fontsize to the current selection, or creates a new element and applies it

Parameters:
  `cmd <String>` The command executed: fontsize
  `val <String>` The font size to apply

Returns: `NodeList`
  NodeList of the items touched by this command.

#### COMMANDS.forecolor

`static NodeList COMMANDS.forecolor ( cmd , val )`
Adds a forecolor to the current selection, or creates a new element and applies it

Parameters:
  `cmd <String>` The command executed: forecolor
  `val <String>` The color value to apply

Returns: `NodeList`
  NodeList of the items touched by this command.

#### COMMANDS.hilitecolor

`static NodeList COMMANDS.hilitecolor ( cmd , val )`
Sugar method, calles backcolor

Parameters:
  `cmd <String>` The command executed: backcolor
  `val <String>` The color value to apply

Returns: `NodeList`
  NodeList of the items touched by this command.

#### COMMANDS.insertandfocus

`static Node COMMANDS.insertandfocus ( cmd , html )`
Inserts the provided HTML at the cursor, and focuses the cursor afterwards.

Parameters:
  `cmd <String>` The command executed: insertandfocus
  `html <String>` The html to insert

Returns: `Node`
  Node instance of the item touched by this command.

#### COMMANDS.insertbr

`static void COMMANDS.insertbr ( cmd )`
Inserts a BR at the current cursor position

Parameters:
  `cmd <String>` The command executed: insertbr

#### COMMANDS.inserthtml

`static Node COMMANDS.inserthtml ( cmd , html )`
Inserts the provided HTML at the cursor, should be a single element.

Parameters:
  `cmd <String>` The command executed: inserthtml
  `html <String>` The html to insert

Returns: `Node`
  Node instance of the item touched by this command.

#### COMMANDS.insertimage

`static Node COMMANDS.insertimage ( cmd , img )`
Inserts an image at the cursor position

Parameters:
  `cmd <String>` The command executed: insertimage
  `img <String>` The url of the image to be inserted

Returns: `Node`
  Node instance of the item touched by this command.

#### COMMANDS.removeclass

`static NodeList COMMANDS.removeclass ( cmd , cls )`
Remove a class from all of the elements in the selection

Parameters:
  `cmd <String>` The command executed: removeclass
  `cls <String>` The className to remove

Returns: `NodeList`
  NodeList of the items touched by this command.

#### COMMANDS.wrap

`static NodeList COMMANDS.wrap ( cmd , tag )`
Wraps the content with a new element of type (tag)

Parameters:
  `cmd <String>` The command executed: wrap
  `tag <String>` The tag to wrap the selection with

Returns: `NodeList`
  NodeList of the items touched by this command.

#### fixIETags

`protected void fixIETags ( cmd , tag , rule )`
This method is meant to normalize IE's in ability to exec the proper command on elements with CSS styling.

Parameters:
  `cmd <String>` The command to execute
  `tag <String>` The tag to create
  `rule <String>` The rule that we are looking for.

#### getInstance

`YUI getInstance ( )`
Get's the instance of YUI bound to the parent frame

Returns: `YUI`
  The YUI instance bound to the parent frame

#### Methods inherited from EventTarget:

`_getType, _monitor, _parseType, addTarget, after, before, bubble, detach, detachAll, fire, getEvent, getTargets, on, once, parseType, publish, removeTarget, subscribe, unsubscribe, unsubscribeAll`

#### Methods inherited from Attribute:

`_addAttrs, _addLazyAttr, _defAttrChangeFn, _fireAttrChange, _getAttr, _getAttrCfg, _getAttrInitVal, _getAttrs, _getStateVal, _isLazyAttr, _normAttrVals, _protectAttrs, _set, _setAttr, _setAttrs, _setAttrVal, _setStateVal, addAttr, addAttrs, attrAdded, get, getAttrs, modifyAttr, removeAttr, reset, set, setAttrs`

#### Methods inherited from Plugin.Host:

`_destroyPlugins, _initPlugins, hasPlugin, plug, unplug`

#### Methods inherited from Base:

`_aggregateAttrs, _defDestroyFn, _defInitFn, _destroyHierarchy, _filterAttrCfs, _getAttrCfgs, _getClasses, _initHierarchy, _initHierarchyData, _preInitEventCfg, destroy, init, toString`

#### Events inherited from Base:

`destroy, destroyedChange, init, initializedChange,`

#### Configuration attributes inherited from Base:

`destroyed initialized`

Copyright © 2011 Yahoo! Inc. All rights reserved.