10 __coverage__['build/editor-bidi/editor-bidi.js'] = {"path":"build/editor-bidi/editor-bidi.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":14,"loc":{"start":{"line":14,"column":21},"end":{"line":14,"column":32}}},"3":{"name":"(anonymous_3)","line":38,"loc":{"start":{"line":38,"column":25},"end":{"line":38,"column":36}}},"4":{"name":"(anonymous_4)","line":64,"loc":{"start":{"line":64,"column":26},"end":{"line":64,"column":38}}},"5":{"name":"(anonymous_5)","line":77,"loc":{"start":{"line":77,"column":23},"end":{"line":77,"column":34}}},"6":{"name":"(anonymous_6)","line":81,"loc":{"start":{"line":81,"column":21},"end":{"line":81,"column":32}}},"7":{"name":"(anonymous_7)","line":131,"loc":{"start":{"line":131,"column":21},"end":{"line":131,"column":48}}},"8":{"name":"(anonymous_8)","line":151,"loc":{"start":{"line":151,"column":44},"end":{"line":151,"column":66}}},"9":{"name":"(anonymous_9)","line":175,"loc":{"start":{"line":175,"column":20},"end":{"line":175,"column":46}}},"10":{"name":"(anonymous_10)","line":177,"loc":{"start":{"line":177,"column":25},"end":{"line":177,"column":43}}},"11":{"name":"(anonymous_11)","line":247,"loc":{"start":{"line":247,"column":25},"end":{"line":247,"column":37}}},"12":{"name":"(anonymous_12)","line":273,"loc":{"start":{"line":273,"column":41},"end":{"line":273,"column":66}}},"13":{"name":"(anonymous_13)","line":315,"loc":{"start":{"line":315,"column":26},"end":{"line":315,"column":41}}},"14":{"name":"(anonymous_14)","line":319,"loc":{"start":{"line":319,"column":32},"end":{"line":319,"column":44}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":339,"column":44}},"2":{"start":{"line":14,"column":4},"end":{"line":17,"column":54}},"3":{"start":{"line":15,"column":8},"end":{"line":15,"column":65}},"4":{"start":{"line":19,"column":4},"end":{"line":258,"column":7}},"5":{"start":{"line":39,"column":12},"end":{"line":42,"column":32}},"6":{"start":{"line":44,"column":12},"end":{"line":56,"column":13}},"7":{"start":{"line":45,"column":16},"end":{"line":45,"column":95}},"8":{"start":{"line":46,"column":16},"end":{"line":52,"column":17}},"9":{"start":{"line":47,"column":20},"end":{"line":47,"column":59}},"10":{"start":{"line":48,"column":20},"end":{"line":51,"column":21}},"11":{"start":{"line":49,"column":24},"end":{"line":49,"column":72}},"12":{"start":{"line":50,"column":24},"end":{"line":50,"column":55}},"13":{"start":{"line":54,"column":16},"end":{"line":54,"column":63}},"14":{"start":{"line":55,"column":16},"end":{"line":55,"column":42}},"15":{"start":{"line":66,"column":12},"end":{"line":69,"column":13}},"16":{"start":{"line":67,"column":16},"end":{"line":67,"column":39}},"17":{"start":{"line":68,"column":16},"end":{"line":68,"column":40}},"18":{"start":{"line":78,"column":12},"end":{"line":78,"column":35}},"19":{"start":{"line":79,"column":12},"end":{"line":79,"column":36}},"20":{"start":{"line":82,"column":12},"end":{"line":82,"column":38}},"21":{"start":{"line":84,"column":12},"end":{"line":84,"column":35}},"22":{"start":{"line":86,"column":12},"end":{"line":86,"column":73}},"23":{"start":{"line":87,"column":12},"end":{"line":87,"column":72}},"24":{"start":{"line":132,"column":12},"end":{"line":132,"column":51}},"25":{"start":{"line":134,"column":12},"end":{"line":134,"column":50}},"26":{"start":{"line":136,"column":12},"end":{"line":138,"column":13}},"27":{"start":{"line":137,"column":16},"end":{"line":137,"column":30}},"28":{"start":{"line":140,"column":12},"end":{"line":142,"column":13}},"29":{"start":{"line":141,"column":16},"end":{"line":141,"column":60}},"30":{"start":{"line":143,"column":12},"end":{"line":161,"column":13}},"31":{"start":{"line":150,"column":16},"end":{"line":150,"column":64}},"32":{"start":{"line":151,"column":16},"end":{"line":157,"column":19}},"33":{"start":{"line":152,"column":20},"end":{"line":156,"column":21}},"34":{"start":{"line":153,"column":24},"end":{"line":153,"column":42}},"35":{"start":{"line":155,"column":24},"end":{"line":155,"column":45}},"36":{"start":{"line":158,"column":16},"end":{"line":158,"column":44}},"37":{"start":{"line":159,"column":16},"end":{"line":159,"column":44}},"38":{"start":{"line":160,"column":16},"end":{"line":160,"column":33}},"39":{"start":{"line":162,"column":12},"end":{"line":162,"column":26}},"40":{"start":{"line":176,"column":12},"end":{"line":176,"column":37}},"41":{"start":{"line":177,"column":16},"end":{"line":182,"column":18}},"42":{"start":{"line":178,"column":20},"end":{"line":181,"column":21}},"43":{"start":{"line":179,"column":24},"end":{"line":179,"column":42}},"44":{"start":{"line":180,"column":24},"end":{"line":180,"column":36}},"45":{"start":{"line":184,"column":12},"end":{"line":184,"column":50}},"46":{"start":{"line":186,"column":12},"end":{"line":188,"column":13}},"47":{"start":{"line":187,"column":16},"end":{"line":187,"column":70}},"48":{"start":{"line":195,"column":12},"end":{"line":209,"column":13}},"49":{"start":{"line":196,"column":16},"end":{"line":196,"column":56}},"50":{"start":{"line":201,"column":16},"end":{"line":208,"column":17}},"51":{"start":{"line":202,"column":20},"end":{"line":202,"column":37}},"52":{"start":{"line":203,"column":20},"end":{"line":203,"column":56}},"53":{"start":{"line":204,"column":20},"end":{"line":207,"column":21}},"54":{"start":{"line":205,"column":24},"end":{"line":205,"column":47}},"55":{"start":{"line":206,"column":24},"end":{"line":206,"column":72}},"56":{"start":{"line":211,"column":12},"end":{"line":213,"column":13}},"57":{"start":{"line":212,"column":16},"end":{"line":212,"column":66}},"58":{"start":{"line":215,"column":12},"end":{"line":215,"column":29}},"59":{"start":{"line":248,"column":12},"end":{"line":255,"column":13}},"60":{"start":{"line":249,"column":16},"end":{"line":251,"column":17}},"61":{"start":{"line":250,"column":20},"end":{"line":250,"column":103}},"62":{"start":{"line":252,"column":16},"end":{"line":254,"column":17}},"63":{"start":{"line":253,"column":20},"end":{"line":253,"column":47}},"64":{"start":{"line":256,"column":12},"end":{"line":256,"column":21}},"65":{"start":{"line":260,"column":4},"end":{"line":260,"column":26}},"66":{"start":{"line":262,"column":4},"end":{"line":262,"column":37}},"67":{"start":{"line":273,"column":4},"end":{"line":337,"column":6}},"68":{"start":{"line":274,"column":8},"end":{"line":279,"column":42}},"69":{"start":{"line":281,"column":8},"end":{"line":284,"column":9}},"70":{"start":{"line":282,"column":12},"end":{"line":282,"column":88}},"71":{"start":{"line":283,"column":12},"end":{"line":283,"column":19}},"72":{"start":{"line":286,"column":8},"end":{"line":286,"column":44}},"73":{"start":{"line":288,"column":8},"end":{"line":334,"column":9}},"74":{"start":{"line":289,"column":12},"end":{"line":289,"column":72}},"75":{"start":{"line":290,"column":12},"end":{"line":292,"column":13}},"76":{"start":{"line":291,"column":16},"end":{"line":291,"column":62}},"77":{"start":{"line":294,"column":12},"end":{"line":294,"column":54}},"78":{"start":{"line":295,"column":12},"end":{"line":303,"column":13}},"79":{"start":{"line":297,"column":16},"end":{"line":297,"column":46}},"80":{"start":{"line":298,"column":16},"end":{"line":302,"column":17}},"81":{"start":{"line":299,"column":20},"end":{"line":299,"column":38}},"82":{"start":{"line":301,"column":20},"end":{"line":301,"column":38}},"83":{"start":{"line":304,"column":12},"end":{"line":304,"column":47}},"84":{"start":{"line":305,"column":12},"end":{"line":310,"column":13}},"85":{"start":{"line":306,"column":16},"end":{"line":306,"column":47}},"86":{"start":{"line":307,"column":16},"end":{"line":309,"column":17}},"87":{"start":{"line":308,"column":20},"end":{"line":308,"column":31}},"88":{"start":{"line":311,"column":12},"end":{"line":311,"column":32}},"89":{"start":{"line":313,"column":12},"end":{"line":313,"column":41}},"90":{"start":{"line":314,"column":12},"end":{"line":314,"column":32}},"91":{"start":{"line":315,"column":12},"end":{"line":317,"column":15}},"92":{"start":{"line":316,"column":16},"end":{"line":316,"column":79}},"93":{"start":{"line":318,"column":12},"end":{"line":318,"column":83}},"94":{"start":{"line":319,"column":12},"end":{"line":332,"column":15}},"95":{"start":{"line":320,"column":16},"end":{"line":320,"column":34}},"96":{"start":{"line":322,"column":16},"end":{"line":322,"column":50}},"97":{"start":{"line":323,"column":16},"end":{"line":330,"column":17}},"98":{"start":{"line":324,"column":20},"end":{"line":324,"column":46}},"99":{"start":{"line":325,"column":20},"end":{"line":329,"column":21}},"100":{"start":{"line":326,"column":24},"end":{"line":326,"column":34}},"101":{"start":{"line":328,"column":24},"end":{"line":328,"column":34}},"102":{"start":{"line":331,"column":16},"end":{"line":331,"column":39}},"103":{"start":{"line":333,"column":12},"end":{"line":333,"column":41}},"104":{"start":{"line":335,"column":8},"end":{"line":335,"column":29}},"105":{"start":{"line":336,"column":8},"end":{"line":336,"column":27}}},"branchMap":{"1":{"line":44,"type":"if","locations":[{"start":{"line":44,"column":12},"end":{"line":44,"column":12}},{"start":{"line":44,"column":12},"end":{"line":44,"column":12}}]},"2":{"line":46,"type":"if","locations":[{"start":{"line":46,"column":16},"end":{"line":46,"column":16}},{"start":{"line":46,"column":16},"end":{"line":46,"column":16}}]},"3":{"line":48,"type":"if","locations":[{"start":{"line":48,"column":20},"end":{"line":48,"column":20}},{"start":{"line":48,"column":20},"end":{"line":48,"column":20}}]},"4":{"line":66,"type":"if","locations":[{"start":{"line":66,"column":12},"end":{"line":66,"column":12}},{"start":{"line":66,"column":12},"end":{"line":66,"column":12}}]},"5":{"line":66,"type":"binary-expr","locations":[{"start":{"line":66,"column":16},"end":{"line":66,"column":31}},{"start":{"line":66,"column":35},"end":{"line":66,"column":67}}]},"6":{"line":134,"type":"binary-expr","locations":[{"start":{"line":134,"column":19},"end":{"line":134,"column":23}},{"start":{"line":134,"column":27},"end":{"line":134,"column":49}}]},"7":{"line":136,"type":"if","locations":[{"start":{"line":136,"column":12},"end":{"line":136,"column":12}},{"start":{"line":136,"column":12},"end":{"line":136,"column":12}}]},"8":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":12},"end":{"line":140,"column":12}},{"start":{"line":140,"column":12},"end":{"line":140,"column":12}}]},"9":{"line":143,"type":"if","locations":[{"start":{"line":143,"column":12},"end":{"line":143,"column":12}},{"start":{"line":143,"column":12},"end":{"line":143,"column":12}}]},"10":{"line":143,"type":"binary-expr","locations":[{"start":{"line":143,"column":16},"end":{"line":143,"column":20}},{"start":{"line":143,"column":24},"end":{"line":143,"column":46}}]},"11":{"line":152,"type":"if","locations":[{"start":{"line":152,"column":20},"end":{"line":152,"column":20}},{"start":{"line":152,"column":20},"end":{"line":152,"column":20}}]},"12":{"line":178,"type":"if","locations":[{"start":{"line":178,"column":20},"end":{"line":178,"column":20}},{"start":{"line":178,"column":20},"end":{"line":178,"column":20}}]},"13":{"line":184,"type":"binary-expr","locations":[{"start":{"line":184,"column":19},"end":{"line":184,"column":23}},{"start":{"line":184,"column":27},"end":{"line":184,"column":49}}]},"14":{"line":201,"type":"if","locations":[{"start":{"line":201,"column":16},"end":{"line":201,"column":16}},{"start":{"line":201,"column":16},"end":{"line":201,"column":16}}]},"15":{"line":201,"type":"binary-expr","locations":[{"start":{"line":201,"column":20},"end":{"line":201,"column":43}},{"start":{"line":201,"column":47},"end":{"line":201,"column":89}}]},"16":{"line":204,"type":"if","locations":[{"start":{"line":204,"column":20},"end":{"line":204,"column":20}},{"start":{"line":204,"column":20},"end":{"line":204,"column":20}}]},"17":{"line":248,"type":"if","locations":[{"start":{"line":248,"column":12},"end":{"line":248,"column":12}},{"start":{"line":248,"column":12},"end":{"line":248,"column":12}}]},"18":{"line":249,"type":"if","locations":[{"start":{"line":249,"column":16},"end":{"line":249,"column":16}},{"start":{"line":249,"column":16},"end":{"line":249,"column":16}}]},"19":{"line":252,"type":"if","locations":[{"start":{"line":252,"column":16},"end":{"line":252,"column":16}},{"start":{"line":252,"column":16},"end":{"line":252,"column":16}}]},"20":{"line":281,"type":"if","locations":[{"start":{"line":281,"column":8},"end":{"line":281,"column":8}},{"start":{"line":281,"column":8},"end":{"line":281,"column":8}}]},"21":{"line":288,"type":"if","locations":[{"start":{"line":288,"column":8},"end":{"line":288,"column":8}},{"start":{"line":288,"column":8},"end":{"line":288,"column":8}}]},"22":{"line":290,"type":"if","locations":[{"start":{"line":290,"column":12},"end":{"line":290,"column":12}},{"start":{"line":290,"column":12},"end":{"line":290,"column":12}}]},"23":{"line":295,"type":"if","locations":[{"start":{"line":295,"column":12},"end":{"line":295,"column":12}},{"start":{"line":295,"column":12},"end":{"line":295,"column":12}}]},"24":{"line":298,"type":"if","locations":[{"start":{"line":298,"column":16},"end":{"line":298,"column":16}},{"start":{"line":298,"column":16},"end":{"line":298,"column":16}}]},"25":{"line":298,"type":"binary-expr","locations":[{"start":{"line":298,"column":20},"end":{"line":298,"column":24}},{"start":{"line":298,"column":28},"end":{"line":298,"column":41}}]},"26":{"line":305,"type":"if","locations":[{"start":{"line":305,"column":12},"end":{"line":305,"column":12}},{"start":{"line":305,"column":12},"end":{"line":305,"column":12}}]},"27":{"line":307,"type":"if","locations":[{"start":{"line":307,"column":16},"end":{"line":307,"column":16}},{"start":{"line":307,"column":16},"end":{"line":307,"column":16}}]},"28":{"line":307,"type":"binary-expr","locations":[{"start":{"line":307,"column":20},"end":{"line":307,"column":34}},{"start":{"line":307,"column":38},"end":{"line":307,"column":74}}]},"29":{"line":323,"type":"if","locations":[{"start":{"line":323,"column":16},"end":{"line":323,"column":16}},{"start":{"line":323,"column":16},"end":{"line":323,"column":16}}]},"30":{"line":325,"type":"if","locations":[{"start":{"line":325,"column":20},"end":{"line":325,"column":20}},{"start":{"line":325,"column":20},"end":{"line":325,"column":20}}]},"31":{"line":325,"type":"binary-expr","locations":[{"start":{"line":325,"column":24},"end":{"line":325,"column":28}},{"start":{"line":325,"column":32},"end":{"line":325,"column":45}}]}},"code":["(function () { YUI.add('editor-bidi', function (Y, NAME) {","",""," /**"," * Plugin for Editor to support BiDirectional (bidi) text operations."," * @class Plugin.EditorBidi"," * @extends Base"," * @constructor"," * @module editor"," * @submodule editor-bidi"," */","",""," var EditorBidi = function() {"," EditorBidi.superclass.constructor.apply(this, arguments);"," }, HOST = 'host', DIR = 'dir', NODE_CHANGE = 'nodeChange',"," B_C_CHANGE = 'bidiContextChange', STYLE = 'style';",""," Y.extend(EditorBidi, Y.Base, {"," /**"," * Place holder for the last direction when checking for a switch"," * @private"," * @property lastDirection"," */"," lastDirection: null,"," /**"," * Tells us that an initial bidi check has already been performed"," * @private"," * @property firstEvent"," */"," firstEvent: null,",""," /**"," * Method checks to see if the direction of the text has changed based on a nodeChange event."," * @private"," * @method _checkForChange"," */"," _checkForChange: function() {"," var host = this.get(HOST),"," inst = host.getInstance(),"," sel = new inst.EditorSelection(),"," node, direction;",""," if (sel.isCollapsed) {"," node = EditorBidi.blockParent(sel.focusNode, false, inst.EditorSelection.ROOT);"," if (node) {"," direction = node.getStyle('direction');"," if (direction !== this.lastDirection) {"," host.fire(B_C_CHANGE, { changedTo: direction });"," this.lastDirection = direction;"," }"," }"," } else {"," host.fire(B_C_CHANGE, { changedTo: 'select' });"," this.lastDirection = null;"," }"," },",""," /**"," * Checked for a change after a specific nodeChange event has been fired."," * @private"," * @method _afterNodeChange"," */"," _afterNodeChange: function(e) {"," // If this is the first event ever, or an event that can result in a context change"," if (this.firstEvent || EditorBidi.EVENTS[e.changedType]) {"," this._checkForChange();"," this.firstEvent = false;"," }"," },",""," /**"," * Checks for a direction change after a mouseup occurs."," * @private"," * @method _afterMouseUp"," */"," _afterMouseUp: function() {"," this._checkForChange();"," this.firstEvent = false;"," },"," initializer: function() {"," var host = this.get(HOST);",""," this.firstEvent = true;",""," host.after(NODE_CHANGE, Y.bind(this._afterNodeChange, this));"," host.after('dom:mouseup', Y.bind(this._afterMouseUp, this));"," }"," }, {"," /**"," * The events to check for a direction change on"," * @property EVENTS"," * @static"," */"," EVENTS: {"," 'backspace-up': true,"," 'pageup-up': true,"," 'pagedown-down': true,"," 'end-up': true,"," 'home-up': true,"," 'left-up': true,"," 'up-up': true,"," 'right-up': true,"," 'down-up': true,"," 'delete-up': true"," },",""," /**"," * More elements may be needed. BODY *must* be in the list to take care of the special case."," *"," * blockParent could be changed to use inst.EditorSelection.BLOCKS"," * instead, but that would make Y.Plugin.EditorBidi.blockParent"," * unusable in non-RTE contexts (it being usable is a nice"," * side-effect)."," * @property BLOCKS"," * @static"," */"," //BLOCKS: Y.EditorSelection.BLOCKS+',LI,HR,' + BODY,"," BLOCKS: Y.EditorSelection.BLOCKS,"," /**"," * Template for creating a block element"," * @static"," * @property DIV_WRAPPER"," */"," DIV_WRAPPER: '<DIV></DIV>',"," /**"," * Returns a block parent for a given element"," * @static"," * @method blockParent"," */"," blockParent: function(node, wrap, root) {"," var parent = node, divNode, firstChild;",""," root = root || Y.EditorSelection.ROOT;"," "," if (!parent) {"," parent = root;"," }",""," if (!parent.test(EditorBidi.BLOCKS)) {"," parent = parent.ancestor(EditorBidi.BLOCKS);"," }"," if (wrap && parent.compareTo(root)) {"," // This shouldn't happen if the RTE handles everything"," // according to spec: we should get to a P before ROOT. But"," // we don't want to set the direction of ROOT even if that"," // happens, so we wrap everything in a DIV.",""," // The code is based on YUI3's Y.EditorSelection._wrapBlock function."," divNode = Y.Node.create(EditorBidi.DIV_WRAPPER);"," parent.get('children').each(function(node, index) {"," if (index === 0) {"," firstChild = node;"," } else {"," divNode.append(node);"," }"," });"," firstChild.replace(divNode);"," divNode.prepend(firstChild);"," parent = divNode;"," }"," return parent;"," },"," /**"," * The data key to store on the node."," * @static"," * @property _NODE_SELECTED"," */"," _NODE_SELECTED: 'bidiSelected',"," /**"," * Generates a list of all the block parents of the current NodeList"," * @static"," * @method addParents"," */"," addParents: function(nodeArray, root) {"," var i, parent, addParent;"," tester = function(sibling) {"," if (!sibling.getData(EditorBidi._NODE_SELECTED)) {"," addParent = false;"," return true; // stop more processing"," }"," };",""," root = root || Y.EditorSelection.ROOT;",""," for (i = 0; i < nodeArray.length; i += 1) {"," nodeArray[i].setData(EditorBidi._NODE_SELECTED, true);"," }",""," // This works automagically, since new parents added get processed"," // later themselves. So if there's a node early in the process that"," // we haven't discovered some of its siblings yet, thus resulting in"," // its parent not added, the parent will be added later, since those"," // siblings will be added to the array and then get processed."," for (i = 0; i < nodeArray.length; i += 1) {"," parent = nodeArray[i].get('parentNode');",""," // Don't add the parent if the parent is the ROOT element."," // We don't want to change the direction of ROOT. Also don't"," // do it if the parent is already in the list."," if (!root.compareTo(parent) && !parent.getData(EditorBidi._NODE_SELECTED)) {"," addParent = true;"," parent.get('children').some(tester);"," if (addParent) {"," nodeArray.push(parent);"," parent.setData(EditorBidi._NODE_SELECTED, true);"," }"," }"," }",""," for (i = 0; i < nodeArray.length; i += 1) {"," nodeArray[i].clearData(EditorBidi._NODE_SELECTED);"," }",""," return nodeArray;"," },","",""," /**"," * editorBidi"," * @static"," * @property NAME"," */"," NAME: 'editorBidi',"," /**"," * editorBidi"," * @static"," * @property NS"," */"," NS: 'editorBidi',"," ATTRS: {"," host: {"," value: false"," }"," },"," /**"," * Regex for testing/removing text-align style from an element"," * @static"," * @property RE_TEXT_ALIGN"," */"," RE_TEXT_ALIGN: /text-align:\\s*\\w*\\s*;/,"," /**"," * Method to test a node's style attribute for text-align and removing it."," * @static"," * @method removeTextAlign"," */"," removeTextAlign: function(n) {"," if (n) {"," if (n.getAttribute(STYLE).match(EditorBidi.RE_TEXT_ALIGN)) {"," n.setAttribute(STYLE, n.getAttribute(STYLE).replace(EditorBidi.RE_TEXT_ALIGN, ''));"," }"," if (n.hasAttribute('align')) {"," n.removeAttribute('align');"," }"," }"," return n;"," }"," });",""," Y.namespace('Plugin');",""," Y.Plugin.EditorBidi = EditorBidi;",""," /**"," * bidi execCommand override for setting the text direction of a node."," * This property is added to the `Y.Plugin.ExecCommands.COMMANDS`"," * collection."," *"," * @for Plugin.ExecCommand"," * @property bidi"," */"," //TODO -- This should not add this command unless the plugin is added to the instance.."," Y.Plugin.ExecCommand.COMMANDS.bidi = function(cmd, direction) {"," var inst = this.getInstance(),"," sel = new inst.EditorSelection(),"," ns = this.get(HOST).get(HOST).editorBidi,"," returnValue, block, b,"," root = inst.EditorSelection.ROOT,"," selected, selectedBlocks, dir;",""," if (!ns) {"," Y.error('bidi execCommand is not available without the EditorBiDi plugin.');"," return;"," }",""," inst.EditorSelection.filterBlocks();",""," if (sel.isCollapsed) { // No selection"," block = EditorBidi.blockParent(sel.anchorNode, false, root);"," if (!block) {"," block = root.one(inst.EditorSelection.BLOCKS);"," }"," //Remove text-align attribute if it exists"," block = EditorBidi.removeTextAlign(block);"," if (!direction) {"," //If no direction is set, auto-detect the proper setting to make it \"toggle\""," dir = block.getAttribute(DIR);"," if (!dir || dir === 'ltr') {"," direction = 'rtl';"," } else {"," direction = 'ltr';"," }"," }"," block.setAttribute(DIR, direction);"," if (Y.UA.ie) {"," b = block.all('br.yui-cursor');"," if (b.size() === 1 && block.get('childNodes').size() === 1) {"," b.remove();"," }"," }"," returnValue = block;"," } else { // some text is selected"," selected = sel.getSelected();"," selectedBlocks = [];"," selected.each(function(node) {"," selectedBlocks.push(EditorBidi.blockParent(node, false, root));"," });"," selectedBlocks = inst.all(EditorBidi.addParents(selectedBlocks, root));"," selectedBlocks.each(function(n) {"," var d = direction;"," //Remove text-align attribute if it exists"," n = EditorBidi.removeTextAlign(n);"," if (!d) {"," dir = n.getAttribute(DIR);"," if (!dir || dir === 'ltr') {"," d = 'rtl';"," } else {"," d = 'ltr';"," }"," }"," n.setAttribute(DIR, d);"," });"," returnValue = selectedBlocks;"," }"," ns._checkForChange();"," return returnValue;"," };","","}, '3.13.0', {\"requires\": [\"editor-base\"]});","","}());"]};