修改fckeditor编辑器下的分页代码

阅读更多
[技巧] 修改fckeditor编辑器下的分页代码。(fck2.6)
因为fck有二个js文件。一个js是针对非ie的。一个是针对ie的。所以我们需要更改二个js的文件。
这样方便我们以后插入分页时,就不需要那么一大串的了。只要[next]就可以分页了。
一:editor/js/fckeditorcode_ie.js 这是针对ie浏览器的 查找:

var FCKPageBreakCommand=function(){this.Name=’PageBreak’;};FCKPageBreakCommand.prototype.Execute=function(){FCKUndo.SaveUndoStep();var e=FCK.EditorDocument.createElement(‘DIV’);e.style.pageBreakAfter=’always’;e.innerHTML=’ ’;var A=FCKDocumentProcessor_CreateFakeImage(‘FCK__PageBreak’,e);var B=new FCKDomRange(FCK.EditorWindow);B.MoveToSelection();var C=B.SplitBlock();B.InsertNode(A);FCK.Events.FireEvent(‘OnSelectionChange’);};FCKPageBreakCommand.prototype.GetState=function(){if (FCK.EditMode!=0) return -1;return 0;};
复制代码替换成:
var FCKPageBreakCommand=function(){this.Name=’PageBreak’;};FCKPageBreakCommand.prototype.Execute=function(){var e=FCK.EditorDocument.createElement(‘Span’);e.innerHTML=’[next]‘;FCK.InsertElement(e);};

FCKPageBreakCommand.prototype.GetState=function(){return 0;};

二:一:editor/js/fckeditorcode_gecko.js 查找:

var FCKPageBreakCommand=function(){this.Name=’PageBreak’;};FCKPageBreakCommand.prototype.Execute=function(){var e=FCK.EditorDocument.createElement(‘DIV’);e.style.pageBreakAfter=’always’;e.innerHTML=’ ’;var A=FCKDocumentProcessors_CreateFakeImage(‘FCK__PageBreak’,e);A=FCK.InsertElement(A);};FCKPageBreakCommand.prototype.GetState=function(){return 0;}
复制代码替换成:
var FCKPageBreakCommand=function(){this.Name=’PageBreak’;};FCKPageBreakCommand.prototype.Execute=function(){var e=FCK.EditorDocument.createElement(”);e.innerHTML=’[next]‘;FCK.InsertElement(e);};

FCKPageBreakCommand.prototype.GetState=function(){return 0;};

你可能感兴趣的:(fck,fckeditor)