wangEditor 自定義 菜單


https://blog.csdn.net/pan396365044/article/details/87282753?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control

 

 

1. 在組件 Myeditor 

// 配置菜單
this.editor.customConfig.menus = [
'head', // 標題
'bold', // 粗體
'fontSize', // 字號
'fontName', // 字體
'italic', // 斜體
'underline', // 下划線
'strikeThrough', // 刪除線
'foreColor', // 文字顏色
'backColor', // 背景顏色
'link', // 插入鏈接
'list', // 列表
'justify', // 對齊方式
'quote', // 引用
'emoticon', // 表情
'image', // 插入圖片
'table', // 表格
'video', // 插入視頻
'undo', // 撤銷
'redo', // 重復
'fullscreen' ,// 全屏
'hr'
]
增加 hr

 

 

2.在wangEditor.js 增加
function Hr(editor){
this.editor = editor;
this.$elem = $('<div class="w-e-menu">\n <button>插入</button>\n </div>');
this.type = 'click';
this._active = false;
}
Hr.prototype = {
constructor: Hr,

onClick:function onClick(e) {
var editor = this.editor;
editor.cmd.do('insertHtml','()');
},
}

 

 3.構造函數 增加 set 值

MenuConstructors.hr = Hr;

 

4.自定義成功

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM