exec-command-debug.js revision 7d6e4ebcb6f729d3cb2a62d328c40de1b7aee2b4
/**
* Plugin for the frame module to handle execCommands for Editor
* @module editor
* @submodule exec-command
*/
/**
* Plugin for the frame module to handle execCommands for Editor
* @class Plugin.ExecCommand
* @extends Base
* @constructor
*/
var ExecCommand = function() {
};
/**
* An internal reference to the keyCode of the last key that was pressed.
* @private
* @property _lastKey
*/
_lastKey: null,
/**
* An internal reference to the instance of the frame plugged into.
* @private
* @property _inst
*/
_inst: null,
/**
* Execute a command on the frame's document.
* @method command
* @param {String} action The action to perform (bold, italic, fontname)
* @param {String} value The optional value (helvetica)
*/
if (fn) {
} else {
}
},
/**
* The private version of execCommand that doesn't filter for overrides.
* @private
* @method _command
* @param {String} action The action to perform (bold, italic, fontname)
* @param {String} value The optional value (helvetica)
*/
var inst = this.getInstance();
try {
try {
} catch (e1) {
try {
} catch (e2) {
}
}
} catch (e) {
}
},
/**
* Get's the instance of YUI bound to the parent frame
* @method getInstance
* @return {YUI} The YUI instance bound to the parent frame
*/
getInstance: function() {
if (!this._inst) {
}
return this._inst;
},
initializer: function() {
},
}
});
}, this));
}
}, {
/**
* execCommand
* @property NAME
* @static
*/
NAME: 'execCommand',
/**
* exec
* @property NS
* @static
*/
NS: 'exec',
ATTRS: {
host: {
value: false
}
},
/**
* Static object literal of execCommand overrides
* @property COMMANDS
* @static
*/
COMMANDS: {
/**
* Wraps the content with a new element of type (tag)
* @method COMMANDS.wrap
* @static
* @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.
*/
var inst = this.getInstance();
},
/**
* Inserts the provided HTML at the cursor, should be a single element.
* @method COMMANDS.inserthtml
* @static
* @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.
*/
var inst = this.getInstance();
} else {
}
},
/**
* Inserts the provided HTML at the cursor, and focuses the cursor afterwards.
* @method COMMANDS.insertandfocus
* @static
* @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.
*/
sel.focusCursor(true, true);
} else {
}
return out;
},
/**
* Inserts a BR at the current cursor position
* @method COMMANDS.insertbr
* @static
* @param {String} cmd The command executed: insertbr
*/
sel.focusCursor(true, false);
},
/**
* Inserts an image at the cursor position
* @method COMMANDS.insertimage
* @static
* @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.
*/
},
/**
* Add a class to all of the elements in the selection
* @method COMMANDS.addclass
* @static
* @param {String} cmd The command executed: addclass
* @param {String} cls The className to add
* @return {NodeList} NodeList of the items touched by this command.
*/
var inst = this.getInstance();
},
/**
* Remove a class from all of the elements in the selection
* @method COMMANDS.removeclass
* @static
* @param {String} cmd The command executed: removeclass
* @param {String} cls The className to remove
* @return {NodeList} NodeList of the items touched by this command.
*/
var inst = this.getInstance();
},
/**
* Adds a forecolor to the current selection, or creates a new element and applies it
* @method COMMANDS.forecolor
* @static
* @param {String} cmd The command executed: forecolor
* @param {String} val The color value to apply
* @return {NodeList} NodeList of the items touched by this command.
*/
var inst = this.getInstance(),
this._command('useCSS', false);
}
if (sel.isCollapsed) {
n = sel.anchorNode;
} else {
n = this.command('inserthtml', '<span style="color: ' + val + '">' + inst.Selection.CURSOR + '</span>');
sel.focusCursor(true, true);
}
return n;
} else {
}
} else {
}
},
/**
* Adds a background color to the current selection, or creates a new element and applies it
* @method COMMANDS.backcolor
* @static
* @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.
*/
var inst = this.getInstance(),
cmd = 'hilitecolor';
}
this._command('useCSS', false);
}
if (sel.isCollapsed) {
n = sel.anchorNode;
} else {
n = this.command('inserthtml', '<span style="background-color: ' + val + '">' + inst.Selection.CURSOR + '</span>');
sel.focusCursor(true, true);
}
return n;
} else {
}
} else {
}
},
/**
* Sugar method, calles backcolor
* @method COMMANDS.hilitecolor
* @static
* @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.
*/
hilitecolor: function() {
},
/**
* Adds a font name to the current selection, or creates a new element and applies it
* @method COMMANDS.fontname2
* @deprecated
* @static
* @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.
*/
var inst = this.getInstance(),
}
}
},
/**
* Adds a fontsize to the current selection, or creates a new element and applies it
* @method COMMANDS.fontsize2
* @deprecated
* @static
* @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.
*/
var inst = this.getInstance(),
}
}
if (p) {
}
}
}
},
/**
* Overload for COMMANDS.list
* @method COMMANDS.insertorderedlist
* @static
* @param {String} cmd The command executed: list, ul
*/
insertunorderedlist: function(cmd) {
},
/**
* Overload for COMMANDS.list
* @method COMMANDS.insertunorderedlist
* @static
* @param {String} cmd The command executed: list, ol
*/
insertorderedlist: function(cmd) {
},
/**
* Noramlizes lists creation/destruction for IE. All others pass through to native calls
* @method COMMANDS.list
* @static
* @param {String} cmd The command executed: list (not used)
* @param {String} tag The tag to deal with
*/
var inst = this.getInstance(),
var str = '<div>';
});
str += '</div>';
n = n.get('parentNode');
}
n.replace(s);
} else {
});
}
} else {
}
},
/**
* Noramlizes alignment for Webkit Browsers
* @method COMMANDS.justify
* @static
* @param {String} cmd The command executed: justify (not used)
* @param {String} val The actual command from the justify{center,all,left,right} stubs
*/
var inst = this.getInstance(),
}
} else {
}
},
/**
* Override method for COMMANDS.justify
* @method COMMANDS.justifycenter
* @static
*/
justifycenter: function(cmd) {
},
/**
* Override method for COMMANDS.justify
* @method COMMANDS.justifyleft
* @static
*/
justifyleft: function(cmd) {
},
/**
* Override method for COMMANDS.justify
* @method COMMANDS.justifyright
* @static
*/
justifyright: function(cmd) {
},
/**
* Override method for COMMANDS.justify
* @method COMMANDS.justifyfull
* @static
*/
justifyfull: function(cmd) {
}
}
});
/**
* This method is meant to normalize IE's in ability to exec the proper command on elements with CSS styling.
* @method fixIETags
* @protected
* @param {String} cmd The command to execute
* @param {String} tag The tag to create
* @param {String} rule The rule that we are looking for.
*/
var inst = this.getInstance(),
if (o) {
if (m) {
p = p.parentNode;
}
c = d.childNodes;
p.parentNode.replaceChild(s, p);
Y.each(c, function(f) {
s.appendChild(f);
});
sel.moveToElementText(s);
}
}
};
};
};
};
}
Y.namespace('Plugin');