1
/* YUI 3.9.1 (build 5852) Copyright 2013 Yahoo! Inc. http://yuilibrary.com/license/ */
2
YUI.add('editor-para-ie', function (Y, NAME) {
6
* Extends EditorParaBase with IE support
7
* @class Plugin.EditorParaIE
8
* @extends Plugin.EditorParaBase
11
* @submodule editor-para-ie
15
var EditorParaIE = function() {
16
EditorParaIE.superclass.constructor.apply(this, arguments);
17
}, HOST = 'host', NODE_CHANGE = 'nodeChange',
21
Y.extend(EditorParaIE, Y.Plugin.EditorParaBase, {
23
* nodeChange handler to handle fixing an empty document.
25
* @method _onNodeChange
27
_onNodeChange: function(e) {
28
var host = this.get(HOST), inst = host.getInstance(),
29
btag = inst.EditorSelection.DEFAULT_BLOCK_TAG,
30
prev, LAST_CHILD = ':last-child', para, b, para2,
31
lc, lc2, found = false;
33
switch (e.changedType) {
35
para = ((this._lastPara) ? this._lastPara : e.changedNode);
36
b = para.one('br.yui-cursor');
39
delete this._lastPara;
43
if (b.previous() || b.next()) {
49
if (!para.test(btag)) {
50
para2 = para.ancestor(btag);
56
if (para.test(btag)) {
57
prev = para.previous();
59
lc = prev.one(LAST_CHILD);
62
lc2 = lc.one(LAST_CHILD);
73
host.copyStyles(lc, para);
79
if (e.changedNode.test('br')) {
80
e.changedNode.remove();
81
} else if (e.changedNode.test('p, span')) {
82
b = e.changedNode.one('br.yui-cursor');
90
initializer: function() {
91
var host = this.get(HOST);
93
Y.error('Can not plug EditorPara and EditorBR at the same time.');
97
host.on(NODE_CHANGE, Y.bind(this._onNodeChange, this));
119
Y.namespace('Plugin');
121
Y.Plugin.EditorPara = EditorParaIE;
126
}, '3.9.1', {"requires": ["editor-para-base"]});