1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
/* ###########################################################################
* IE functions
* ###########################################################################
*/
function Doc_OnKeyDown_IE()
{
var e = FCK.EditorWindow.event;
if (e.keyCode == 13) // ENTER
{
if (e.ctrlKey || e.altKey || e.shiftKey|| !FCKSelection.HasAncestorNode("PRE")) {
return true;
}
else
{
FCKSelection.Delete();
var oTmpNode = FCK.CreateElement("B");
oTmpNode.innerHTML = " ";
if (oTmpNode.previousSibling && oTmpNode.previousSibling.nodeType==3)
{
oTmpNode.previousSibling.nodeValue =
oTmpNode.previousSibling.nodeValue + '\r';
}
else
{
var oTxt = FCK.EditorDocument.createTextNode('\r');
oTmpNode.parentNode.insertBefore(oTxt, oTmpNode);
}
var oRange = FCK.EditorDocument.selection.createRange();
oRange.moveToElementText(oTmpNode);
oRange.select();
FCK.EditorDocument.selection.clear();
return false;
}
}
return true;
}
function Doc_OnKeyUp_IE()
{
/*
var e = FCK.EditorWindow.event;
if (e.keyCode == 8 || e.keyCode==46) // backspace, delete
{
*/
var oNode = FCKSelection.GetParentElement();
var siHTML = oNode.innerHTML;
if (siHTML.search(/ /i)!=-1)
{
oNode.normalize();
alert("DING");
}
// }
}
/* ##########################################################################
* Register event handlers
* ##########################################################################
*/
/*
// TODO FCK.EditorDocument is seems like deprecated, find alternative method for replace
if (FCK.EditorDocument.attachEvent) // IE
{
FCK.EditorDocument.attachEvent('onkeydown', Doc_OnKeyDown_IE);
//FCK.AttachToOnSelectionChange(Doc_OnKeyUp_IE);
}
*/
|