代码拉取完成,页面将自动刷新
///import core
///import uicore
///import ui/stateful.js
;(function() {
var utils = baidu.editor.utils,
UIBase = baidu.editor.ui.UIBase,
Stateful = baidu.editor.ui.Stateful,
Button = (baidu.editor.ui.Button = function(options) {
if (options.name) {
var btnName = options.name;
var cssRules = options.cssRules;
if (!options.className) {
options.className = "edui-for-" + btnName;
}
options.cssRules =
".edui-" +
(options.theme || "default") +
" .edui-toolbar .edui-button.edui-for-" +
btnName +
" .edui-icon {" +
cssRules +
"}";
}
this.initOptions(options);
this.initButton();
});
Button.prototype = {
uiName: "button",
label: "",
title: "",
showIcon: true,
showText: true,
cssRules: "",
initButton: function() {
this.initUIBase();
this.Stateful_init();
if (this.cssRules) {
utils.cssRule("edui-customize-" + this.name + "-style", this.cssRules);
}
},
getHtmlTpl: function() {
return (
'<div id="##" class="edui-box %%">' +
'<div id="##_state" stateful>' +
'<div class="%%-wrap"><div id="##_body" unselectable="on" ' +
(this.title ? 'title="' + this.title + '"' : "") +
' class="%%-body" onmousedown="return $$._onMouseDown(event, this);" onclick="return $$._onClick(event, this);">' +
(this.showIcon ? '<div class="edui-box edui-icon"><svg class="edui-iconfont"><use xlink:href="#' + this.className + '"></use></svg></div>' : "") +
(this.showText
? '<div class="edui-box edui-label">' + this.label + "</div>"
: "") +
"</div>" +
"</div>" +
"</div></div>"
);
},
postRender: function() {
this.Stateful_postRender();
this.setDisabled(this.disabled);
},
_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;
}
},
_onClick: function() {
if (!this.isDisabled()) {
this.fireEvent("click");
}
},
setTitle: function(text) {
var label = this.getDom("label");
label.innerHTML = text;
}
};
utils.inherits(Button, UIBase);
utils.extend(Button.prototype, Stateful);
})();
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。