nicEditors使用方法

//声明初始化富文本框到context中

<div> <textarea id="context" name="context" style="height:100%; overflow: auto;border: 1px solid #ccc; min-height: 600px;"></textarea></div>

myNicEditor = new nicEditor({ buttonList: ['bold', 'italic', 'underline', 'strikethrough', 'left', 'center', 'right', 'justify', 'ol', 'ul',
'subscript', 'superscript', 'fontSize', 'fontFamily', 'fontFormat', 'indent', 'outdent', 'forecolor', 'removeformat', 'save'] }).panelInstance('context'); //文本框赋初始值
myNicEditorOldValue
= (baseInfo.Contents.length > 0 ? base64decodeCN(baseInfo.Contents) : baseInfo.Contents)
nicEditors.findEditor(
'context').setContent(myNicEditorOldValue);
//失去焦点事件 ,判断内容是否变化,变了则保存调用(
editBaseInfo())方法)

myNicEditor.addEvent('blur', function () {
//获取文本框内的值
var clause = nicEditors.findEditor('context').getContent();
                    if (myNicEditorOldValue != clause) {
                        myNicEditorOldValue = clause
                        clause = base64encodeCN(clause);
                        editBaseInfo("Contents", clause);
                    }
                    return;
                });

相关js下载地址:http://nicedit.com/demos.php

原文地址:https://www.cnblogs.com/Godlovezk/p/8269611.html