exec-command-debug.js revision 453c0694eb896076de933e8d82bd76a9ad450b4d
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * Plugin for the frame module to handle execCommands for Editor
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @module editor
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @submodule exec-command
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * Plugin for the frame module to handle execCommands for Editor
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @class Plugin.ExecCommand
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @extends Base
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @constructor
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass var ExecCommand = function() {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass ExecCommand.superclass.constructor.apply(this, arguments);
d0199bcbfc68b65683c19c4e3e0c38e238142e7eDav Glass * An internal reference to the keyCode of the last key that was pressed.
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @property _lastKey
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * An internal reference to the instance of the frame plugged into.
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @property _inst
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * Execute a command on the frame's document.
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @method command
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @param {String} action The action to perform (bold, italic, fontname)
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @param {String} value The optional value (helvetica)
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @return {Node/NodeList} Should return the Node/Nodelist affected
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass Y.log('execCommand(' + action + '): "' + value + '"', 'info', 'exec-command');
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * The private version of execCommand that doesn't filter for overrides.
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @method _command
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @param {String} action The action to perform (bold, italic, fontname)
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @param {String} value The optional value (helvetica)
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass inst.config.doc.execCommand('styleWithCSS', null, 1);
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass } catch (e1) {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass } catch (e2) {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass Y.log('Internal execCommand(' + action + '): "' + value + '"', 'info', 'exec-command');
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass } catch (e) {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * Get's the instance of YUI bound to the parent frame
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @method getInstance
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @return {YUI} The YUI instance bound to the parent frame
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass getInstance: function() {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass if (!this._inst) {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass return this._inst;
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass initializer: function() {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass this.get('host').on('dom:keypress', Y.bind(function(e) {
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * execCommand
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @property NAME
33d85edf47749fa345d7b636b9b4b9d0d0386f44Dav Glass * @property NS
COMMANDS: {
return out;
var insert = function(n) {
last = s;
n.remove();
n = this.command('inserthtml', '<span style="color: ' + val + '">' + inst.Selection.CURSOR + '</span>');
n = this.command('inserthtml', '<span style="background-color: ' + val + '">' + inst.Selection.CURSOR + '</span>');
hilitecolor: function() {
* Noramlizes lists creation/destruction for IE. All others pass through to native calls
n.replace(s);
p.replace(l);
* This method is meant to normalize IE's in ability to exec the proper command on elements with CSS styling.
p = p.parentNode;
c = d.childNodes;
Y.each(c, function(f) {
s.appendChild(f);