///import core ///import uicore (function () { var utils = baidu.editor.utils, domUtils = baidu.editor.dom.domUtils, UIBase = baidu.editor.ui.UIBase, Message = baidu.editor.ui.Message = function (options){ this.initOptions(options); this.initMessage(); }; Message.prototype = { initMessage: function (){ this.initUIBase(); }, getHtmlTpl: function (){ return '
'; }, reset: function(opt){ var me = this; if (!opt.keepshow) { clearTimeout(this.timer); me.timer = setTimeout(function(){ me.hide(); }, opt.timeout || 4000); } opt.content !== undefined && me.setContent(opt.content); opt.type !== undefined && me.setType(opt.type); me.show(); }, postRender: function(){ var me = this, closer = this.getDom('closer'); closer && domUtils.on(closer, 'click', function(){ me.hide(); }); }, setContent: function(content){ this.getDom('content').innerHTML = content; }, setType: function(type){ type = type || 'info'; var body = this.getDom('body'); body.className = body.className.replace(/edui-message-type-[\w-]+/, 'edui-message-type-' + type); }, getContent: function(){ return this.getDom('content').innerHTML; }, getType: function(){ var arr = this.getDom('body').match(/edui-message-type-([\w-]+)/); return arr ? arr[1]:''; }, show: function (){ this.getDom().style.display = 'block'; }, hide: function (){ var dom = this.getDom(); if (dom) { dom.style.display = 'none'; dom.parentNode && dom.parentNode.removeChild(dom); } } }; utils.inherits(Message, UIBase); })();