editor-para.js revision 216633e2ad28e9568a902f3763c3bef052c5f908
/**
* Plugin for Editor to paragraph auto wrapping and correction.
* @module editor
* @submodule editor-para
*/
/**
* Plugin for Editor to paragraph auto wrapping and correction.
* @class Plugin.EditorPara
* @extends Base
* @constructor
*/
var EditorPara = function() {
/**
* Utility method to create an empty paragraph when the document is empty.
* @private
* @method _fixFirstPara
*/
_fixFirstPara: function() {
//inst.one('body').setContent('<p>' + inst.Selection.CURSOR + '</p>');
sel.focusCursor(true, false);
},
/**
* nodeChange handler to handle fixing an empty document.
* @private
* @method _onNodeChange
*/
_onNodeChange: function(e) {
switch (e.changedType) {
case 'keydown':
this._fixFirstPara();
}
}
break;
case 'backspace-up':
case 'backspace-down':
case 'delete-up':
}
if (br) {
}
//God this is horrible..
this._fixFirstPara();
}
p = null;
p = e.changedNode;
}
}
if (p && !p.test('p')) {
p = p.ancestor('p');
}
if (p) {
if (!p.previous()) {
}
}
}
/*
if (txt === '' && !item.test('p')) {
this._fixFirstPara();
e.changedEvent.frameEvent.halt();
//} else if (item.test('p') && (html.length === 0) || (txt == '') || (html == '<span><br></span>') || (html == '<br>')) {
} else if (item.test('p') && ((html.length === 0) || (txt.length === 0))) {
e.changedEvent.frameEvent.halt();
}
*/
}
break;
}
},
/**
* Performs a block element filter when the Editor is first ready
* @private
* @method _afterEditorReady
*/
_afterEditorReady: function() {
if (inst) {
}
},
/**
* Performs a block element filter when the Editor after an content change
* @private
* @method _afterContentChange
*/
_afterContentChange: function() {
}
},
/**
* @private
* @method _afterPaste
*/
_afterPaste: function() {
});
},
initializer: function() {
}
}
}, {
/**
* editorPara
* @static
* @property NAME
*/
NAME: 'editorPara',
/**
* editorPara
* @static
* @property NS
*/
NS: 'editorPara',
ATTRS: {
host: {
value: false
}
}
});
Y.namespace('Plugin');