editor-para-debug.js revision 1d01372aa06d46fcbeeae1718c35cf404f412a85
/**
* Plugin for Editor to paragraph auto wrapping and correction.
* @class Plugin.EditorPara
* @extends Base
* @constructor
* @module editor
* @submodule editor-para
*/
var EditorPara = function() {
/**
* Utility method to create an empty paragraph when the document is empty.
* @private
* @method _fixFirstPara
*/
_fixFirstPara: function() {
html = '';
col = false;
}
},
/**
* nodeChange handler to handle fixing an empty document.
* @private
* @method _onNodeChange
*/
_onNodeChange: function(e) {
switch (e.changedType) {
case 'enter-up':
if (this._lastPara) {
delete this._lastPara;
}
if (b) {
if (b.ancestor(P)) {
b.remove();
}
}
}
if (para2) {
para2 = null;
}
}
if (prev) {
while (!found) {
if (lc) {
if (lc2) {
} else {
found = true;
}
} else {
found = true;
}
}
if (lc) {
}
}
}
break;
case 'enter':
e.changedNode.remove();
if (b) {
b.remove();
}
}
}
//Webkit doesn't support shift+enter as a BR, this fixes that.
if (e.changedEvent.shiftKey) {
}
}
if (html === '') {
if (dir !== '') {
}
e.changedNode.remove();
e.changedEvent.halt();
sel.selectNode(d, true, false);
}
}
//TODO Move this to a GECKO MODULE - Can't for the moment, requires no change to metadata (YMAIL)
par = e.changedNode;
}
if (sel.anchorOffset) {
top = false;
while (!top) {
//Get children..
var start = false;
if (start) {
n.append(c);
}
if (c === aNode) {
start = true;
}
});
node2 = n;
} else {
top = true;
}
}
if (txt2) {
}
}
}
sel.focusCursor(true, true);
if (html !== '') {
}
}
}
break;
case 'keyup':
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 (e.changedNode) {
item = e.changedNode;
if (html === '') {
e.preventDefault();
}
}
}
}
}
}
/*
* This forced FF to redraw the content on backspace.
* On some occasions FF will leave a cursor residue after content has been deleted.
* Dropping in the empty textnode and then removing it causes FF to redraw and
* remove the "ghost cursors"
*/
d = e.changedNode;
d.appendChild(t);
d.removeChild(t);
}
break;
}
if (p) {
this._lastPara = p;
}
}
}
},
/**
* Performs a block element filter when the Editor is first ready
* @private
* @method _afterEditorReady
*/
_afterEditorReady: function() {
if (inst) {
P = btag;
}
},
/**
* Performs a block element filter when the Editor after an content change
* @private
* @method _afterContentChange
*/
_afterContentChange: function() {
}
},
/**
* @private
* @method _afterPaste
*/
_afterPaste: function() {
});
},
initializer: function() {
Y.error('Can not plug EditorPara and EditorBR at the same time.');
return;
}
}
}
}, {
/**
* editorPara
* @static
* @property NAME
*/
NAME: 'editorPara',
/**
* editorPara
* @static
* @property NS
*/
NS: 'editorPara',
ATTRS: {
host: {
value: false
}
}
});
Y.namespace('Plugin');