2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('editor-para-ie', function (Y, NAME) {
12 * Extends EditorParaBase with IE support
13 * @class Plugin.EditorParaIE
14 * @extends Plugin.EditorParaBase
17 * @submodule editor-para-ie
21 var EditorParaIE = function() {
22 EditorParaIE.superclass.constructor.apply(this, arguments);
23 }, HOST = 'host', NODE_CHANGE = 'nodeChange',
27 Y.extend(EditorParaIE, Y.Plugin.EditorParaBase, {
29 * Resolves the ROOT editor element.
33 _getRoot: function() {
34 return this.get(HOST).getInstance().EditorSelection.ROOT;
38 * nodeChange handler to handle fixing an empty document.
40 * @method _onNodeChange
42 _onNodeChange: function(e) {
43 var host = this.get(HOST), inst = host.getInstance(),
44 btag = inst.EditorSelection.DEFAULT_BLOCK_TAG,
45 prev, LAST_CHILD = ':last-child', para, b, para2,
46 lc, lc2, found = false;
48 switch (e.changedType) {
50 para = ((this._lastPara) ? this._lastPara : e.changedNode);
51 b = para.one('br.yui-cursor');
54 delete this._lastPara;
58 if (b.previous() || b.next()) {
64 if (!para.test(btag)) {
65 para2 = para.ancestor(btag);
71 if (para.test(btag)) {
72 prev = para.previous();
74 lc = prev.one(LAST_CHILD);
77 lc2 = lc.one(LAST_CHILD);
88 host.copyStyles(lc, para);
94 if (e.changedNode.test('br')) {
95 e.changedNode.remove();
96 } else if (e.changedNode.test('p, span')) {
97 b = e.changedNode.one('br.yui-cursor');
105 initializer: function() {
106 var host = this.get(HOST);
108 Y.error('Can not plug EditorPara and EditorBR at the same time.');
112 host.on(NODE_CHANGE, Y.bind(this._onNodeChange, this));
134 Y.namespace('Plugin');
136 Y.Plugin.EditorPara = EditorParaIE;
141 }, '3.13.0', {"requires": ["editor-para-base"]});