JS 框架: JQuery
RichText插件 :KindEditor
修改前:
KindEditor.ready(function(K) { var editor1 = K.create('textarea[name="content"]', { height : "400px", uploadJson : './upload.jhtml', formatUploadUrl : false, items : [ 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|', 'image', 'link' ], afterCreate : function() { var self = this; K.ctrl(document, 13, function() { self.sync(); document.forms['announcement'].submit(); }); K.ctrl(self.edit.doc, 13, function() { self.sync(); document.forms['announcement'].submit(); }); } }); prettyPrint(); });
修改后:
$(function() { var editor1 = KindEditor.create('textarea[name="content"]', { height : "400px", uploadJson : './upload.jhtml', formatUploadUrl : false, items : [ 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|', 'image', 'link' ], afterCreate : function() { var self = this; KindEditor.ctrl(document, 13, function() { self.sync(); document.forms['announcement'].submit(); }); KindEditor.ctrl(self.edit.doc, 13, function() { self.sync(); document.forms['announcement'].submit(); }); } }); prettyPrint(); });