在網站項目中新建一個目錄ueditor1,把editor_all.js、editor_all_min.js、editor_config.js文件和net、dialogs、themes、third-party、_src目錄放到ueditor1目錄中。
注:最開始用的目錄名是ueditor,在上傳圖片時出現問題,所以目錄命名時要注意。
修改editor_config.js文件,
URL = "/ueditor1/"; //就是自己建的目錄名稱;
<textarea id="myEditor" cols="20" rows="2" style="width:800px;" runat="server"> <p>ueditor Demo</p> </textarea> <script type="text/javascript"> // 自定義的編輯器配置項,此處定義的配置項將覆蓋editor_config.js中的同名配置 var editorOption = { //這里可以選擇自己需要的工具按鈕名稱,此處僅選擇如下五個 //toolbars: [['FullScreen', 'Source', 'Undo', 'Redo', 'Bold']], //focus時自動清空初始化時的內容 //autoClearinitialContent: true, //關閉字數統計 wordCount: true, //關閉elementPath elementPathEnabled: false //更多其他參數,請參考editor_config.js中的配置項 }; var editor_a = new baidu.editor.ui.Editor(editorOption); editor_a.render('myEditor'); </script>
下載的代碼中net目錄中的web.config被我刪除掉了,要不然項目編譯不能通過
toolbars:可以自定義ueditor的按鈕和功能。
可以在editor_config.js文件中看到每個按鈕的功能說明,其實就是鼠標指向按鈕的說明文字。
'anchor': '錨點', 'undo': '撤銷', 'redo': '重做', 'bold': '加粗', 'indent': '首行縮進', 'snapscreen': '截圖', 'italic': '斜體', 'underline': '下划線', 'strikethrough': '刪除線', 'subscript': '下標', 'superscript': '上標', 'formatmatch': '格式刷', 'source': '源代碼', 'blockquote': '引用', 'pasteplain': '純文本粘貼模式', 'selectall': '全選', 'print': '打印', 'preview': '預覽', 'horizontal': '分隔線', 'removeformat': '清除格式', 'time': '時間', 'date': '日期', 'unlink': '取消鏈接', 'insertrow': '前插入行', 'insertcol': '前插入列', 'mergeright': '右合並單元格', 'mergedown': '下合並單元格', 'deleterow': '刪除行', 'deletecol': '刪除列', 'splittorows': '拆分成行', 'splittocols': '拆分成列', 'splittocells': '完全拆分單元格', 'mergecells': '合並多個單元格', 'deletetable': '刪除表格', 'insertparagraphbeforetable': '表格前插行', 'cleardoc': '清空文檔', 'fontfamily': '字體', 'fontsize': '字號', 'paragraph': '段落格式', 'insertimage': '圖片', 'inserttable': '表格', 'link': '超鏈接', 'emotion': '表情', 'spechars': '特殊字符', 'searchreplace': '查詢替換', 'map': 'Baidu地圖', 'gmap': 'Google地圖', 'insertvideo': '視頻', 'help': '幫助', 'justifyleft': '居左對齊', 'justifyright': '居右對齊', 'justifycenter': '居中對齊', 'justifyjustify': '兩端對齊', 'forecolor': '字體顏色', 'backcolor': '背景色', 'insertorderedlist': '有序列表', 'insertunorderedlist': '無序列表', 'fullscreen': '全屏', 'directionalityltr': '從左向右輸入', 'directionalityrtl': '從右向左輸入', 'RowSpacingTop': '段前距', 'RowSpacingBottom': '段后距', 'highlightcode': '插入代碼', 'pagebreak': '分頁', 'insertframe': '插入Iframe', 'imagenone': '默認', 'imageleft': '左浮動', 'imageright': '右浮動', 'attachment': '附件', 'imagecenter': '居中', 'wordimage': '圖片轉存', 'lineheight': '行間距', 'customstyle': '自定義標題', 'autotypeset': '自動排版', 'webapp': '百度應用'
相關文章:百度文本編輯器ueditor v1.2.3.0使用方法及配置