editor-para-debug.js revision c03e8210b031a389a9441f7f550a03d1272bac31
/**
* 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() {
sel.selectNode(n, true, 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) {
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) {
}
}
//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 '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 (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');