305 Star 1.5K Fork 291

GVPNotadd/Neditor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
toolbar.js 1.45 KB
一键复制 编辑 原始数据 按行查看 历史
;(function() {
var utils = baidu.editor.utils,
uiUtils = baidu.editor.ui.uiUtils,
UIBase = baidu.editor.ui.UIBase,
Toolbar = (baidu.editor.ui.Toolbar = function(options) {
this.initOptions(options);
this.initToolbar();
});
Toolbar.prototype = {
items: null,
initToolbar: function() {
this.items = this.items || [];
this.initUIBase();
},
add: function(item, index) {
if (index === undefined) {
this.items.push(item);
} else {
this.items.splice(index, 0, item);
}
},
getHtmlTpl: function() {
var buff = [];
for (var i = 0; i < this.items.length; i++) {
buff[i] = this.items[i].renderHtml();
}
return (
'<div id="##" class="edui-toolbar %%" onselectstart="return false;" onmousedown="return $$._onMouseDown(event, this);">' +
buff.join("") +
"</div>"
);
},
postRender: function() {
var box = this.getDom();
for (var i = 0; i < this.items.length; i++) {
this.items[i].postRender();
}
uiUtils.makeUnselectable(box);
},
_onMouseDown: function(e) {
var target = e.target || e.srcElement,
tagName = target && target.tagName && target.tagName.toLowerCase();
if (tagName == "input" || tagName == "object" || tagName == "object") {
return false;
}
}
};
utils.inherits(Toolbar, UIBase);
})();
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/notadd/neditor.git
git@gitee.com:notadd/neditor.git
notadd
neditor
Neditor
master

搜索帮助