hy-shop-mer/public/UEditor/ueditor.all.min.js

102 lines
429 KiB
JavaScript
Raw Permalink Normal View History

2024-03-22 15:50:26 +08:00
/*!
* UEditor
* version: ueditor
* build: Wed Dec 26 2018 17:25:05 GMT+0800 (CST)
*/
2024-05-24 11:08:29 +08:00
!function () {
function getListener(a, b, c) { var d; return b = b.toLowerCase(), (d = a.__allListeners || c && (a.__allListeners = {})) && (d[b] || c && (d[b] = [])) } function getDomNode(a, b, c, d, e, f) { var g, h = d && a[b]; for (!h && (h = a[c]); !h && (g = (g || a).parentNode);) { if ("BODY" == g.tagName || f && !f(g)) return null; h = g[c] } return h && e && !e(h) ? getDomNode(h, b, c, !1, e) : h } UEDITOR_CONFIG = window.UEDITOR_CONFIG || {}; var baidu = window.baidu || {}; window.baidu = baidu, window.UE = baidu.editor = window.UE || {}, UE.plugins = {}, UE.commands = {}, UE.instants = {}, UE.I18N = {}, UE._customizeUI = {}, UE.version = "1.4.3"; var dom = UE.dom = {}, browser = UE.browser = function () { var a = navigator.userAgent.toLowerCase(), b = window.opera, c = { ie: /(msie\s|trident.*rv:)([\w.]+)/.test(a), opera: !!b && b.version, webkit: a.indexOf(" applewebkit/") > -1, mac: a.indexOf("macintosh") > -1, quirks: "BackCompat" == document.compatMode }; c.gecko = "Gecko" == navigator.product && !c.webkit && !c.opera && !c.ie; var d = 0; if (c.ie) { var e = a.match(/(?:msie\s([\w.]+))/), f = a.match(/(?:trident.*rv:([\w.]+))/); d = e && f && e[1] && f[1] ? Math.max(1 * e[1], 1 * f[1]) : e && e[1] ? 1 * e[1] : f && f[1] ? 1 * f[1] : 0, c.ie11Compat = 11 == document.documentMode, c.ie9Compat = 9 == document.documentMode, c.ie8 = !!document.documentMode, c.ie8Compat = 8 == document.documentMode, c.ie7Compat = 7 == d && !document.documentMode || 7 == document.documentMode, c.ie6Compat = d < 7 || c.quirks, c.ie9above = d > 8, c.ie9below = d < 9, c.ie11above = d > 10, c.ie11below = d < 11 } if (c.gecko) { var g = a.match(/rv:([\d\.]+)/); g && (g = g[1].split("."), d = 1e4 * g[0] + 100 * (g[1] || 0) + 1 * (g[2] || 0)) } return /chrome\/(\d+\.\d)/i.test(a) && (c.chrome = +RegExp.$1), /(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(a) && !/chrome/i.test(a) && (c.safari = +(RegExp.$1 || RegExp.$2)), c.opera && (d = parseFloat(b.version())), c.webkit && (d = parseFloat(a.match(/ applewebkit\/(\d+)/)[1])), c.version = d, c.isCompatible = !c.mobile && (c.ie && d >= 6 || c.gecko && d >= 10801 || c.opera && d >= 9.5 || c.air && d >= 1 || c.webkit && d >= 522 || !1), c }(), ie = browser.ie, webkit = browser.webkit, gecko = browser.gecko, opera = browser.opera, utils = UE.utils = { each: function (a, b, c) { if (null != a) if (a.length === +a.length) { for (var d = 0, e = a.length; d < e; d++)if (b.call(c, a[d], d, a) === !1) return !1 } else for (var f in a) if (a.hasOwnProperty(f) && b.call(c, a[f], f, a) === !1) return !1 }, makeInstance: function (a) { var b = new Function; return b.prototype = a, a = new b, b.prototype = null, a }, extend: function (a, b, c) { if (b) for (var d in b) c && a.hasOwnProperty(d) || (a[d] = b[d]); return a }, extend2: function (a) { for (var b = arguments, c = 1; c < b.length; c++) { var d = b[c]; for (var e in d) a.hasOwnProperty(e) || (a[e] = d[e]) } return a }, inherits: function (a, b) { var c = a.prototype, d = utils.makeInstance(b.prototype); return utils.extend(d, c, !0), a.prototype = d, d.constructor = a }, bind: function (a, b) { return function () { return a.apply(b, arguments) } }, defer: function (a, b, c) { var d; return function () { c && clearTimeout(d), d = setTimeout(a, b) } }, indexOf: function (a, b, c) { var d = -1; return c = this.isNumber(c) ? c : 0, this.each(a, function (a, e) { if (e >= c && a === b) return d = e, !1 }), d }, removeItem: function (a, b) { for (var c = 0, d = a.length; c < d; c++)a[c] === b && (a.splice(c, 1), c--) }, trim: function (a) { return a.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g, "") }, listToMap: function (a) { if (!a) return {}; a = utils.isArray(a) ? a : a.split(","); for (var b, c = 0, d = {}; b = a[c++];)d[b.toUpperCase()] = d[b] = 1; return d }, unhtml: function (a, b) { return a ? a.replace(b || /[&<">'](?:(amp|lt|quot|gt|#39|nbsp|#\d+);)?/g, function (a, b) { return b ? a : { "<": "&lt;", "&": "&amp;", '"': "&quot;", ">": "&gt;", "'": "&#39;" }[a] }) : "" }, unhtmlForUrl: function (a, b) { return a ? a.replace(b || /[<">']/g, function (a)
function a(a) { a.collapsed = a.startContainer && a.endContainer && a.startContainer === a.endContainer && a.startOffset == a.endOffset } function b(a) { return !a.collapsed && 1 == a.startContainer.nodeType && a.startContainer === a.endContainer && a.endOffset - a.startOffset == 1 } function c(b, c, d, e) { return 1 == c.nodeType && (dtd.$empty[c.tagName] || dtd.$nonChild[c.tagName]) && (d = domUtils.getNodeIndex(c) + (b ? 0 : 1), c = c.parentNode), b ? (e.startContainer = c, e.startOffset = d, e.endContainer || e.collapse(!0)) : (e.endContainer = c, e.endOffset = d, e.startContainer || e.collapse(!1)), a(e), e } function d(a, b) { var c, d, e = a.startContainer, f = a.endContainer, g = a.startOffset, h = a.endOffset, i = a.document, j = i.createDocumentFragment(); if (1 == e.nodeType && (e = e.childNodes[g] || (c = e.appendChild(i.createTextNode("")))), 1 == f.nodeType && (f = f.childNodes[h] || (d = f.appendChild(i.createTextNode("")))), e === f && 3 == e.nodeType) return j.appendChild(i.createTextNode(e.substringData(g, h - g))), b && (e.deleteData(g, h - g), a.collapse(!0)), j; for (var k, l, m = j, n = domUtils.findParents(e, !0), o = domUtils.findParents(f, !0), p = 0; n[p] == o[p];)p++; for (var q, r = p; q = n[r]; r++) { for (k = q.nextSibling, q == e ? c || (3 == a.startContainer.nodeType ? (m.appendChild(i.createTextNode(e.nodeValue.slice(g))), b && e.deleteData(g, e.nodeValue.length - g)) : m.appendChild(b ? e : e.cloneNode(!0))) : (l = q.cloneNode(!1), m.appendChild(l)); k && k !== f && k !== o[r];)q = k.nextSibling, m.appendChild(b ? k : k.cloneNode(!0)), k = q; m = l } m = j, n[p] || (m.appendChild(n[p - 1].cloneNode(!1)), m = m.firstChild); for (var s, r = p; s = o[r]; r++) { if (k = s.previousSibling, s == f ? d || 3 != a.endContainer.nodeType || (m.appendChild(i.createTextNode(f.substringData(0, h))), b && f.deleteData(0, h)) : (l = s.cloneNode(!1), m.appendChild(l)), r != p || !n[p]) for (; k && k !== e;)s = k.previousSibling, m.insertBefore(b ? k : k.cloneNode(!0), m.firstChild), k = s; m = l } return b && a.setStartBefore(o[p] ? n[p] ? o[p] : n[p - 1] : o[p - 1]).collapse(!0), c && domUtils.remove(c), d && domUtils.remove(d), j } function e(a, b) {
try {
if (g && domUtils.inDoc(g, a)) if (g.nodeValue.replace(fillCharReg, "").length) g.nodeValue = g.nodeValue.replace(fillCharReg, ""); else {
var c = g.parentNode; for (domUtils.remove(g); c && domUtils.isEmptyInlineElement(c) && (browser.safari ? !(domUtils.getPosition(c, b) & domUtils.POSITION_CONTAINS) : !c.contains(b));)g = c.parentNode, domUtils.remove(c), c = g;
}
} catch (d) { }
} function f(a, b) { var c; for (a = a[b]; a && domUtils.isFillChar(a);)c = a[b], domUtils.remove(a), a = c } var g, h = 0, i = domUtils.fillChar, j = dom.Range = function (a) { var b = this; b.startContainer = b.startOffset = b.endContainer = b.endOffset = null, b.document = a, b.collapsed = !0 }; j.prototype = { cloneContents: function () { return this.collapsed ? null : d(this, 0) }, deleteContents: function () { var a; return this.collapsed || d(this, 1), browser.webkit && (a = this.startContainer, 3 != a.nodeType || a.nodeValue.length || (this.setStartBefore(a).collapse(!0), domUtils.remove(a))), this }, extractContents: function () { return this.collapsed ? null : d(this, 2) }, setStart: function (a, b) { return c(!0, a, b, this) }, setEnd: function (a, b) { return c(!1, a, b, this) }, setStartAfter: function (a) { return this.setStart(a.parentNode, domUtils.getNodeIndex(a) + 1) }, setStartBefore: function (a) { return this.setStart(a.parentNode, domUtils.getNodeIndex(a)) }, setEndAfter: function (a) { return this.setEnd(a.parentNode, domUtils.getNodeIndex(a) + 1) }, setEndBefore: function (a) { return this.setEnd(a.parentNode, domUtils.getNodeIndex(a)) }, setStartAtFirst: function (a) { return this.setStart(a, 0) }, setStartAtLast: function (a) { return this.setStart(a, 3 == a.nodeType ? a.nodeValue.length : a.childNodes.length) }, setEndAtFirst: function (a) { return this.setEnd(a, 0) }, setEndAtLast: function (a) { return this.setEnd(a, 3 == a.nodeType ? a.nodeValue.length : a.childNodes.length) }, selectNode: function (a) { return this.setStartBefore(a).setEndAfter(a) }, selectNodeContents: function (a) { return this.setStart(a, 0).setEndAtLast(a) }, cloneRange: function () { var a = this; return new j(a.document).setStart(a.startContainer, a.startOffset).setEnd(a.endContainer, a.endOffset) }, collapse: function (a) { var b = this; return a ? (b.endContainer = b.startContainer, b.endOffset = b.startOffset) : (b.startContainer = b.endContainer, b.startOffset = b.endOffset), b.collapsed = !0, b }, shrinkBoundary: function (a) { function b(a) { return 1 == a.nodeType && !domUtils.isBookmarkNode(a) && !dtd.$empty[a.tagName] && !dtd.$nonChild[a.tagName] } for (var c, d = this, e = d.collapsed; 1 == d.startContainer.nodeType && (c = d.startContainer.childNodes[d.startOffset]) && b(c);)d.setStart(c, 0); if (e) return d.collapse(!0); if (!a) for (; 1 == d.endContainer.nodeType && d.endOffset > 0 && (c = d.endContainer.childNodes[d.endOffset - 1]) && b(c);)d.setEnd(c, c.childNodes.length); return d }, getCommonAncestor: function (a, c) { var d = this, e = d.startContainer, f = d.endContainer; return e === f ? a && b(this) && (e = e.childNodes[d.startOffset], 1 == e.nodeType) ? e : c && 3 == e.nodeType ? e.parentNode : e : domUtils.getCommonAncestor(e, f) }, trimBoundary: function (a) { this.txtToElmBoundary(); var b = this.startContainer, c = this.startOffset, d = this.collapsed, e = this.endContainer; if (3 == b.nodeType) { if (0 == c) this.setStartBefore(b); else if (c >= b.nodeValue.length) this.setStartAfter(b); else { var f = domUtils.split(b, c); b === e ? this.setEnd(f, this.endOffset - c) : b.parentNode === e && (this.endOffset += 1), this.setStartBefore(f) } if (d) return this.collapse(!0) } return a || (c = this.endOffset, e = this.endContainer, 3 == e.nodeType && (0 == c ? this.setEndBefore(e) : (c < e.nodeValue.length && domUtils.split(e, c), this.setEndAfter(e)))), this }, txtToElmBoundary: function (a) { function b(a, b) { var c = a[b + "Container"], d = a[b + "Offset"]; 3 == c.nodeType && (d ? d >= c.nodeValue.length && a["set" + b.replace(/(\w)/, function (a) { return a.toUpperCase() }) + "After"](c) : a["set" + b.replace(/(\w)/, function (a) { return a.toUpperCase() }) + "Before"](c)) } return !a && this.collapsed || (b(this, "start"), b(this, "end")), this }, insertNode: function (a) { var b = a, c = 1; 11 == a.nodeType && (b = a.firstChild, c = a.childNodes.length), this.trimBoundary(!0); var d = this.startContainer, e = this.startOffset, f = d.childNodes[e]; return f ? d.insertBefore(a, f) :
}(), function () { function a(a, b) { var c = domUtils.getNodeIndex; a = a.duplicate(), a.collapse(b); var d = a.parentElement(); if (!d.hasChildNodes()) return { container: d, offset: 0 }; for (var e, f, g = d.children, h = a.duplicate(), i = 0, j = g.length - 1, k = -1; i <= j;) { k = Math.floor((i + j) / 2), e = g[k], h.moveToElementText(e); var l = h.compareEndPoints("StartToStart", a); if (l > 0) j = k - 1; else { if (!(l < 0)) return { container: d, offset: c(e) }; i = k + 1 } } if (k == -1) { if (h.moveToElementText(d), h.setEndPoint("StartToStart", a), f = h.text.replace(/(\r\n|\r)/g, "\n").length, g = d.childNodes, !f) return e = g[g.length - 1], { container: e, offset: e.nodeValue.length }; for (var m = g.length; f > 0;)f -= g[--m].nodeValue.length; return { container: g[m], offset: -f } } if (h.collapse(l > 0), h.setEndPoint(l > 0 ? "StartToStart" : "EndToStart", a), f = h.text.replace(/(\r\n|\r)/g, "\n").length, !f) return dtd.$empty[e.tagName] || dtd.$nonChild[e.tagName] ? { container: d, offset: c(e) + (l > 0 ? 0 : 1) } : { container: e, offset: l > 0 ? 0 : e.childNodes.length }; for (; f > 0;)try { var n = e; e = e[l > 0 ? "previousSibling" : "nextSibling"], f -= e.nodeValue.length } catch (o) { return { container: d, offset: c(n) } } return { container: e, offset: l > 0 ? -f : e.nodeValue.length + f } } function b(b, c) { if (b.item) c.selectNode(b.item(0)); else { var d = a(b, !0); c.setStart(d.container, d.offset), 0 != b.compareEndPoints("StartToEnd", b) && (d = a(b, !1), c.setEnd(d.container, d.offset)) } return c } function c(a) { var b; try { b = a.getNative().createRange() } catch (c) { return null } var d = b.item ? b.item(0) : b.parentElement(); return (d.ownerDocument || d) === a.document ? b : null } var d = dom.Selection = function (a) { var b, d = this; d.document = a, browser.ie9below && (b = domUtils.getWindow(a).frameElement, domUtils.on(b, "beforedeactivate", function () { d._bakIERange = d.getIERange() }), domUtils.on(b, "activate", function () { try { !c(d) && d._bakIERange && d._bakIERange.select() } catch (a) { } d._bakIERange = null })), b = a = null }; d.prototype = { rangeInBody: function (a, b) { var c = browser.ie9below || b ? a.item ? a.item() : a.parentElement() : a.startContainer; return c === this.document.body || domUtils.inDoc(c, this.document) }, getNative: function () { var a = this.document; try { return a ? browser.ie9below ? a.selection : domUtils.getWindow(a).getSelection() : null } catch (b) { return null } }, getIERange: function () { var a = c(this); return !a && this._bakIERange ? this._bakIERange : a }, cache: function () { this.clear(), this._cachedRange = this.getRange(), this._cachedStartElement = this.getStart(), this._cachedStartElementPath = this.getStartElementPath() }, getStartElementPath: function () { if (this._cachedStartElementPath) return this._cachedStartElementPath; var a = this.getStart(); return a ? domUtils.findParents(a, !0, null, !0) : [] }, clear: function () { this._cachedStartElementPath = this._cachedRange = this._cachedStartElement = null }, isFocus: function () { try { if (browser.ie9below) { var a = c(this); return !(!a || !this.rangeInBody(a)) } return !!this.getNative().rangeCount } catch (b) { return !1 } }, getRange: function () { function a(a) { for (var b = c.document.body.firstChild, d = a.collapsed; b && b.firstChild;)a.setStart(b, 0), b = b.firstChild; a.startContainer || a.setStart(c.document.body, 0), d && a.collapse(!0) } var c = this; if (null != c._cachedRange) return this._cachedRange; var d = new baidu.editor.dom.Range(c.document); if (browser.ie9below) { var e = c.getIERange(); if (e) try { b(e, d) } catch (f) { a(d) } else a(d) } else { var g = c.getNative(); if (g && g.rangeCount) { var h = g.getRangeAt(0), i = g.getRangeAt(g.rangeCount - 1); d.setStart(h.startContainer, h.startOffset).setEnd(i.endContainer, i.endOffset), d.collapsed && domUtils.isBody(d.startContainer) && !d.startOffset && a(d) } else { if (this._bakRange && domUtils.inDoc(this._bakRange.startContainer, this.document)) return this._bakRange; a(d
function a(a, b) { var c; if (b.textarea) if (utils.isString(b.textarea)) { for (var d, e = 0, f = domUtils.getElementsByTagName(a, "textarea"); d = f[e++];)if (d.id == "ueditor_textarea_" + b.options.textarea) { c = d; break } } else c = b.textarea; c || (a.appendChild(c = domUtils.createElement(document, "textarea", { name: b.options.textarea, id: "ueditor_textarea_" + b.options.textarea, style: "display:none" })), b.textarea = c), !c.getAttribute("name") && c.setAttribute("name", b.options.textarea), c.value = b.hasContents() ? b.options.allHtmlEnabled ? b.getAllHtml() : b.getContent(null, null, !0) : "" } function b(a) { for (var b in a) return b } function c(a) { a.langIsReady = !0, a.fireEvent("langReady") } var d, e = 0, f = UE.Editor = function (a) { var d = this; d.uid = e++, EventBase.call(d), d.commands = {}, d.options = utils.extend(utils.clone(a || {}), UEDITOR_CONFIG, !0), d.shortcutkeys = {}, d.inputRules = [], d.outputRules = [], d.setOpt(f.defaultOptions(d)), d.loadServerConfig(), utils.isEmptyObject(UE.I18N) ? utils.loadFile(document, { src: d.options.langPath + d.options.lang + "/" + d.options.lang + ".js", tag: "script", type: "text/javascript", defer: "defer" }, function () { UE.plugin.load(d), c(d) }) : (d.options.lang = b(UE.I18N), UE.plugin.load(d), c(d)), UE.instants["ueditorInstant" + d.uid] = d }; f.prototype = {
registerCommand: function (a, b) { this.commands[a] = b }, ready: function (a) { var b = this; a && (b.isReady ? a.apply(b) : b.addListener("ready", a)) }, setOpt: function (a, b) { var c = {}; utils.isString(a) ? c[a] = b : c = a, utils.extend(this.options, c, !0) }, getOpt: function (a) { return this.options[a] }, destroy: function () { var a = this; a.fireEvent("destroy"); var b = a.container.parentNode, c = a.textarea; c ? c.style.display = "" : (c = document.createElement("textarea"), b.parentNode.insertBefore(c, b)), c.style.width = a.iframe.offsetWidth + "px", c.style.height = a.iframe.offsetHeight + "px", c.value = a.getContent(), c.id = a.key, b.innerHTML = "", domUtils.remove(b); var d = a.key; for (var e in a) a.hasOwnProperty(e) && delete this[e]; UE.delEditor(d) }, render: function (a) { var b = this, c = b.options, d = function (b) { return parseInt(domUtils.getComputedStyle(a, b)) }; if (utils.isString(a) && (a = document.getElementById(a)), a) { c.initialFrameWidth ? c.minFrameWidth = c.initialFrameWidth : c.minFrameWidth = c.initialFrameWidth = a.offsetWidth, c.initialFrameHeight ? c.minFrameHeight = c.initialFrameHeight : c.initialFrameHeight = c.minFrameHeight = a.offsetHeight, a.style.width = /%$/.test(c.initialFrameWidth) ? "100%" : c.initialFrameWidth - d("padding-left") - d("padding-right") + "px", a.style.height = /%$/.test(c.initialFrameHeight) ? "100%" : c.initialFrameHeight - d("padding-top") - d("padding-bottom") + "px", a.style.zIndex = c.zIndex; var e = (ie && browser.version < 9 ? "" : "<!DOCTYPE html>") + "<html xmlns='http://www.w3.org/1999/xhtml' class='view' ><head><style type='text/css'>.view{padding:0;word-wrap:break-word;cursor:text;height:90%;}\nbody{margin:8px;font-family:sans-serif;font-size:16px;}p{margin:5px 0;}</style>" + (c.iframeCssUrl ? "<link rel='stylesheet' type='text/css' href='" + utils.unhtml(c.iframeCssUrl) + "'/>" : "") + (c.initialStyle ? "<style>" + c.initialStyle + "</style>" : "") + "</head><body class='view' ></body><script type='text/javascript' " + (ie ? "defer='defer'" : "") + " id='_initialScript'>setTimeout(function(){editor = window.parent.UE.instants['ueditorInstant" + b.uid + "'];editor._setup(document);},0);var _tmpScript = document.getElementById('_initialScript');_tmpScript.parentNode.removeChild(_tmpScript);</script></html>"; a.appendChild(domUtils.createElement(document, "iframe", { id: "ueditor_" + b.uid, width: "100%", height: "100%", frameborder: "0", src: "javascript:void(function(){document.open();" + (c.customDomain && document.domain != location.hostname ? 'document.domain="' + document.domain + '";' : "") + 'document.write("' + e + '");document.close();}())' })), a.style.overflow = "hidden", setTimeout(function () { /%$/.test(c.initialFrameWidth) && (c.minFrameWidth = c.initialFrameWidth = a.offsetWidth), /%$/.test(c.initialFrameHeight) && (c.minFrameHeight = c.initialFrameHeight = a.offsetHeight, a.style.height = c.initialFrameHeight + "px") }) } }, _setup: function (b) { var c = this, d = c.options; ie ? (b.body.disabled = !0, b.body.contentEditable = !0, b.body.disabled = !1) : b.body.contentEditable = !0, b.body.spellcheck = !1, c.document = b, c.window = b.defaultView || b.parentWindow, c.iframe = c.window.frameElement, c.body = b.body, c.selection = new dom.Selection(b); var e; browser.gecko && (e = this.selection.getNative()) && e.removeAllRanges(), this._initEvents(); for (var f = this.iframe.parentNode; !domUtils.isBody(f); f = f.parentNode)if ("FORM" == f.tagName) { c.form = f, c.options.autoSyncData ? domUtils.on(c.window, "blur", function () { a(f, c) }) : domUtils.on(f, "submit", function () { a(this, c) }); break } if (d.initialContent) if (d.autoClearinitialContent) { var g = c.execCommand; c.execCommand = function () { return c.fireEvent("firstBeforeExecCommand"), g.apply(c, arguments) }, this._setDefaultContent(d.initialContent) } else this.setContent(d.initialContent, !1, !0); domUtils.isEmptyNode(c.body) && (c.body.innerHTML = "<p>" + (browser.ie ? "" : "<br/>") + "</p>"), d.focus && setTimeout(function () { c
return this.setShow();
}, setHide: function () { var a = this; a.lastBk || (a.lastBk = a.selection.getRange().createBookmark(!0)), a.container.style.display = "none" }, hide: function () { return this.setHide() }, getLang: function (a) { if (!this.options) return ""; var b = UE.I18N[this.options.lang]; if (!b) throw Error("not import language file"); a = (a || "").split("."); for (var c, d = 0; (c = a[d++]) && (b = b[c], b);); return b }, getContentLength: function (a, b) { var c = this.getContent(!1, !1, !0).length; if (a) { b = (b || []).concat(["hr", "img", "iframe"]), c = this.getContentTxt().replace(/[\t\r\n]+/g, "").length; for (var d, e = 0; d = b[e++];)c += this.document.getElementsByTagName(d).length } return c }, addInputRule: function (a) { this.inputRules.push(a) }, filterInputRule: function (a) { for (var b, c = 0; b = this.inputRules[c++];)b.call(this, a) }, addOutputRule: function (a) { this.outputRules.push(a) }, filterOutputRule: function (a) { for (var b, c = 0; b = this.outputRules[c++];)b.call(this, a) }, getActionUrl: function (a) { var b = this.getOpt(a) || a, c = this.getOpt("imageUrl"), d = this.getOpt("serverUrl"); return !d && c && (d = c.replace(/^(.*[\/]).+([\.].+)$/, "$1controller$2")), d ? (d = d + (d.indexOf("?") == -1 ? "?" : "&") + "action=" + (b || ""), utils.formatUrl(d)) : "" }
}, utils.inherits(f, EventBase)
}(), UE.Editor.defaultOptions = function (a) { var b = a.options.UEDITOR_HOME_URL; return { isShow: !0, initialContent: "", initialStyle: "", autoClearinitialContent: !1, iframeCssUrl: b + "themes/iframe.css", textarea: "editorValue", focus: !1, focusInEnd: !0, autoClearEmptyNode: !0, fullscreen: !1, readonly: !1, zIndex: 999, imagePopup: !0, enterTag: "p", customDomain: !1, lang: "zh-cn", langPath: b + "lang/", theme: "default", themePath: b + "themes/", allHtmlEnabled: !1, scaleEnabled: !1, tableNativeEditInFF: !1, autoSyncData: !0, fileNameFormat: "{time}{rand:6}" } }, function () { UE.Editor.prototype.loadServerConfig = function () { function showErrorMsg(a) { console && console.error(a) } var me = this; setTimeout(function () { try { me.options.imageUrl && me.setOpt("serverUrl", me.options.imageUrl.replace(/^(.*[\/]).+([\.].+)$/, "$1controller$2")); var configUrl = me.getActionUrl("config"), isJsonp = utils.isCrossDomainUrl(configUrl); me._serverConfigLoaded = !1, configUrl && UE.ajax.request(configUrl, { method: "GET", dataType: isJsonp ? "jsonp" : "", onsuccess: function (r) { try { var config = isJsonp ? r : eval("(" + r.responseText + ")"); utils.extend(me.options, config), me.fireEvent("serverConfigLoaded"), me._serverConfigLoaded = !0 } catch (e) { showErrorMsg(me.getLang("loadconfigFormatError")) } }, onerror: function () { showErrorMsg(me.getLang("loadconfigHttpError")) } }) } catch (e) { showErrorMsg(me.getLang("loadconfigError")) } }) }, UE.Editor.prototype.isServerConfigLoaded = function () { var a = this; return a._serverConfigLoaded || !1 }, UE.Editor.prototype.afterConfigReady = function (a) { if (a && utils.isFunction(a)) { var b = this, c = function () { a.apply(b, arguments), b.removeListener("serverConfigLoaded", c) }; b.isServerConfigLoaded() ? a.call(b, "serverConfigLoaded") : b.addListener("serverConfigLoaded", c) } } }(), UE.ajax = function () { function a(a) { var b = []; for (var c in a) if ("method" != c && "timeout" != c && "async" != c && "dataType" != c && "callback" != c && void 0 != a[c] && null != a[c]) if ("function" != (typeof a[c]).toLowerCase() && "object" != (typeof a[c]).toLowerCase()) b.push(encodeURIComponent(c) + "=" + encodeURIComponent(a[c])); else if (utils.isArray(a[c])) for (var d = 0; d < a[c].length; d++)b.push(encodeURIComponent(c) + "[]=" + encodeURIComponent(a[c][d])); return b.join("&") } function b(b, c) { var d = f(), e = !1, g = { method: "POST", timeout: 5e3, async: !0, data: {}, onsuccess: function () { }, onerror: function () { } }; if ("object" == typeof b && (c = b, b = c.url), d && b) { var h = c ? utils.extend(g, c) : g, i = a(h); utils.isEmptyObject(h.data) || (i += (i ? "&" : "") + a(h.data)); var j = setTimeout(function () { 4 != d.readyState && (e = !0, d.abort(), clearTimeout(j)) }, h.timeout), k = h.method.toUpperCase(), l = b + (b.indexOf("?") == -1 ? "?" : "&") + ("POST" == k ? "" : i + "&noCache=" + +new Date); d.open(k, l, h.async), d.onreadystatechange = function () { 4 == d.readyState && (e || 200 != d.status ? h.onerror(d) : h.onsuccess(d)) }, "POST" == k ? (d.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), d.send(i)) : d.send(null) } } function c(b, c) { function d(a, b, c) { a.setAttribute("type", "text/javascript"), a.setAttribute("defer", "defer"), c && a.setAttribute("charset", c), a.setAttribute("src", b), document.getElementsByTagName("head")[0].appendChild(a) } function e(a) { return function () { try { if (a) k.onerror && k.onerror(); else try { clearTimeout(g), i.apply(window, arguments) } catch (b) { } } catch (c) { k.onerror && k.onerror.call(window, c) } finally { k.oncomplete && k.oncomplete.apply(window, arguments), j.parentNode && j.parentNode.removeChild(j), window[f] = null; try { delete window[f] } catch (b) { } } } } var f, g, h, i = c.onsuccess || function () { }, j = document.createElement("SCRIPT"), k = c || {}, l = k.charset, m = k.jsonp || "callback", n = k.timeOut || 0, o = new RegExp("(\\?|&)" + m + "=([^&]*)"); utils.isFunction(i) ? (f = "bd__editor__" + Math.floor(2147483648 * Math.rando
function a(a) { var b = {}, c = a.split(";"); return utils.each(c, function (a) { var c = a.indexOf(":"), d = utils.trim(a.substr(0, c)).toLowerCase(); d && (b[d] = utils.trim(a.substr(c + 1) || "")) }), b } function b(a) { if (a) { var b = []; for (var c in a) a.hasOwnProperty(c) && b.push(c + ":" + a[c] + "; "); utils.cssRule(e, b.length ? "body{" + b.join("") + "}" : "", d.document) } else utils.cssRule(e, "", d.document) } var c, d = this, e = "editor_background", f = new RegExp("body[\\s]*\\{(.+)\\}", "i"), g = d.hasContents; return d.hasContents = function () { return !!d.queryCommandValue("background") || g.apply(d, arguments) }, {
bindEvents: {
getAllHtml: function (a, b) { var c = this.body, e = domUtils.getComputedStyle(c, "background-image"), f = ""; f = e.indexOf(d.options.imagePath) > 0 ? e.substring(e.indexOf(d.options.imagePath), e.length - 1).replace(/"|\(|\)/gi, "") : "none" != e ? e.replace(/url\("?|"?\)/gi, "") : ""; var g = '<style type="text/css">body{', h = { "background-color": domUtils.getComputedStyle(c, "background-color") || "#ffffff", "background-image": f ? "url(" + f + ")" : "", "background-repeat": domUtils.getComputedStyle(c, "background-repeat") || "", "background-position": browser.ie ? domUtils.getComputedStyle(c, "background-position-x") + " " + domUtils.getComputedStyle(c, "background-position-y") : domUtils.getComputedStyle(c, "background-position"), height: domUtils.getComputedStyle(c, "height") }; for (var i in h) h.hasOwnProperty(i) && (g += i + ":" + h[i] + "; "); g += "}</style> ", b.push(g) }, aftersetcontent: function () { 0 == c && b() }
}, inputRule: function (d) { c = !1, utils.each(d.getNodesByTagName("p"), function (d) { var e = d.getAttr("data-background"); e && (c = !0, b(a(e)), d.parentNode.removeChild(d)) }) }, outputRule: function (a) { var b = this, c = (utils.cssRule(e, b.document) || "").replace(/[\n\r]+/g, "").match(f); c && a.appendChild(UE.uNode.createElement('<p style="display:none;" data-background="' + utils.trim(c[1].replace(/"/g, "").replace(/[\s]+/g, " ")) + '"><br/></p>')) }, commands: { background: { execCommand: function (a, c) { b(c) }, queryCommandValue: function () { var b = this, c = (utils.cssRule(e, b.document) || "").replace(/[\n\r]+/g, "").match(f); return c ? a(c[1]) : null }, notNeedUndo: !0 } }
}
}), UE.commands.imagefloat = { execCommand: function (a, b) { var c = this, d = c.selection.getRange(); if (!d.collapsed) { var e = d.getClosedNode(); if (e && "IMG" == e.tagName) switch (b) { case "left": case "right": case "none": for (var f, g, h, i = e.parentNode; dtd.$inline[i.tagName] || "A" == i.tagName;)i = i.parentNode; if (f = i, "P" == f.tagName && "center" == domUtils.getStyle(f, "text-align")) { if (!domUtils.isBody(f) && 1 == domUtils.getChildCount(f, function (a) { return !domUtils.isBr(a) && !domUtils.isWhitespace(a) })) if (g = f.previousSibling, h = f.nextSibling, g && h && 1 == g.nodeType && 1 == h.nodeType && g.tagName == h.tagName && domUtils.isBlockElm(g)) { for (g.appendChild(f.firstChild); h.firstChild;)g.appendChild(h.firstChild); domUtils.remove(f), domUtils.remove(h) } else domUtils.setStyle(f, "text-align", ""); d.selectNode(e).select() } domUtils.setStyle(e, "float", "none" == b ? "" : b), "none" == b && domUtils.removeAttributes(e, "align"); break; case "center": if ("center" != c.queryCommandValue("imagefloat")) { for (i = e.parentNode, domUtils.setStyle(e, "float", ""), domUtils.removeAttributes(e, "align"), f = e; i && 1 == domUtils.getChildCount(i, function (a) { return !domUtils.isBr(a) && !domUtils.isWhitespace(a) }) && (dtd.$inline[i.tagName] || "A" == i.tagName);)f = i, i = i.parentNode; d.setStartBefore(f).setCursor(!1), i = c.document.createElement("div"), i.appendChild(f), domUtils.setStyle(f, "float", ""), c.execCommand("insertHtml", '<p id="_img_parent_tmp" style="text-align:center">' + i.innerHTML + "</p>"), f = c.document.getElementById("_img_parent_tmp"), f.removeAttribute("id"), f = f.firstChild, d.selectNode(f).select(), h = f.parentNode.nextSibling, h && domUtils.isEmptyNode(h) && domUtils.remove(h) } } } }, queryCommandValue: function () { var a, b, c = this.selection.getRange(); return c.collapsed ? "none" : (a = c.getClosedNode(), a && 1 == a.nodeType && "IMG" == a.tagName ? (b = domUtils.getComputedStyle(a, "float") || a.getAttribute("align"), "none" == b && (b = "center" == domUtils.getComputedStyle(a.parentNode, "text-align") ? "center" : b), { left: 1, right: 1, center: 1 }[b] ? b : "none") : "none") }, queryCommandState: function () { var a, b = this.selection.getRange(); return b.collapsed ? -1 : (a = b.getClosedNode(), a && 1 == a.nodeType && "IMG" == a.tagName ? 0 : -1) } }, UE.commands.insertimage = { execCommand: function (a, b) { function c(a) { utils.each("width,height,border,hspace,vspace".split(","), function (b) { a[b] && (a[b] = parseInt(a[b], 10) || 0) }), utils.each("src,_src".split(","), function (b) { a[b] && (a[b] = utils.unhtmlForUrl(a[b])) }), utils.each("title,alt".split(","), function (b) { a[b] && (a[b] = utils.unhtml(a[b])) }) } if (b = utils.isArray(b) ? b : [b], b.length) { var d = this, e = d.selection.getRange(), f = e.getClosedNode(); if (d.fireEvent("beforeinsertimage", b) !== !0) { if (!f || !/img/i.test(f.tagName) || "edui-faked-video" == f.className && f.className.indexOf("edui-upload-video") == -1 || f.getAttribute("word_img")) { var g, h = [], i = ""; if (g = b[0], 1 == b.length) c(g), i = '<img src="' + g.src + '" ' + (g._src ? ' _src="' + g._src + '" ' : "") + (g.width ? 'width="' + g.width + '" ' : "") + (g.height ? ' height="' + g.height + '" ' : "") + ("left" == g.floatStyle || "right" == g.floatStyle ? ' style="float:' + g.floatStyle + ';"' : "") + (g.title && "" != g.title ? ' title="' + g.title + '"' : "") + (g.border && "0" != g.border ? ' border="' + g.border + '"' : "") + (g.alt && "" != g.alt ? ' alt="' + g.alt + '"' : "") + (g.hspace && "0" != g.hspace ? ' hspace = "' + g.hspace + '"' : "") + (g.vspace && "0" != g.vspace ? ' vspace = "' + g.vspace + '"' : "") + "/>", "center" == g.floatStyle && (i = '<p style="text-align: center">' + i + "</p>"), h.push(i); else for (var j = 0; g = b[j++];)c(g), i = "<p " + ("center" == g.floatStyle ? 'style="text-align: center" ' : "") + '><img src="' + g.src + '" ' + (g.width ? 'width="' + g.width + '" ' : "") + (g._src ? ' _src="' + g._src + '" ' : "") + (g.height ? ' height="'
var a = this; a.ready(function () { utils.cssRule("pre", "pre{margin:.5em 0;padding:.4em .6em;border-radius:8px;background:#f8f8f8;}", a.document) }), a.setOpt("insertcode", { as3: "ActionScript3", bash: "Bash/Shell", cpp: "C/C++", css: "Css", cf: "CodeFunction", "c#": "C#", delphi: "Delphi", diff: "Diff", erlang: "Erlang", groovy: "Groovy", html: "Html", java: "Java", jfx: "JavaFx", js: "Javascript", pl: "Perl", php: "Php", plain: "Plain Text", ps: "PowerShell", python: "Python", ruby: "Ruby", scala: "Scala", sql: "Sql", vb: "Vb", xml: "Xml" }), a.commands.insertcode = { execCommand: function (a, b) { var c = this, d = c.selection.getRange(), e = domUtils.findParentByTagName(d.startContainer, "pre", !0); if (e) e.className = "brush:" + b + ";toolbar:false;"; else { var f = ""; if (d.collapsed) f = browser.ie && browser.ie11below ? browser.version <= 8 ? "&nbsp;" : "" : "<br/>"; else { var g = d.extractContents(), h = c.document.createElement("div"); h.appendChild(g), utils.each(UE.filterNode(UE.htmlparser(h.innerHTML.replace(/[\r\t]/g, "")), c.options.filterTxtRules).children, function (a) { if (browser.ie && browser.ie11below && browser.version > 8) "element" == a.type ? "br" == a.tagName ? f += "\n" : dtd.$empty[a.tagName] || (utils.each(a.children, function (b) { "element" == b.type ? "br" == b.tagName ? f += "\n" : dtd.$empty[a.tagName] || (f += b.innerText()) : f += b.data }), /\n$/.test(f) || (f += "\n")) : f += a.data + "\n", !a.nextSibling() && /\n$/.test(f) && (f = f.replace(/\n$/, "")); else if (browser.ie && browser.ie11below) "element" == a.type ? "br" == a.tagName ? f += "<br>" : dtd.$empty[a.tagName] || (utils.each(a.children, function (b) { "element" == b.type ? "br" == b.tagName ? f += "<br>" : dtd.$empty[a.tagName] || (f += b.innerText()) : f += b.data }), /br>$/.test(f) || (f += "<br>")) : f += a.data + "<br>", !a.nextSibling() && /<br>$/.test(f) && (f = f.replace(/<br>$/, "")); else if (f += "element" == a.type ? dtd.$empty[a.tagName] ? "" : a.innerText() : a.data, !/br\/?\s*>$/.test(f)) { if (!a.nextSibling()) return; f += "<br>" } }) } c.execCommand("inserthtml", '<pre id="coder"class="brush:' + b + ';toolbar:false">' + f + "</pre>", !0), e = c.document.getElementById("coder"), domUtils.removeAttributes(e, "id"); var i = e.previousSibling; i && (3 == i.nodeType && 1 == i.nodeValue.length && browser.ie && 6 == browser.version || domUtils.isEmptyBlock(i)) && domUtils.remove(i); var d = c.selection.getRange(); domUtils.isEmptyBlock(e) ? d.setStart(e, 0).setCursor(!1, !0) : d.selectNodeContents(e).select() } }, queryCommandValue: function () { var a = this.selection.getStartElementPath(), b = ""; return utils.each(a, function (a) { if ("PRE" == a.nodeName) { var c = a.className.match(/brush:([^;]+)/); return b = c && c[1] ? c[1] : "", !1 } }), b } }, a.addInputRule(function (a) { utils.each(a.getNodesByTagName("pre"), function (a) { var b = a.getNodesByTagName("br"); if (b.length) return void (browser.ie && browser.ie11below && browser.version > 8 && utils.each(b, function (a) { var b = UE.uNode.createText("\n"); a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a) })); if (!(browser.ie && browser.ie11below && browser.version > 8)) { var c = a.innerText().split(/\n/); a.innerHTML(""), utils.each(c, function (b) { b.length && a.appendChild(UE.uNode.createText(b)), a.appendChild(UE.uNode.createElement("br")) }) } }) }), a.addOutputRule(function (a) { utils.each(a.getNodesByTagName("pre"), function (a) { var b = ""; utils.each(a.children, function (a) { b += "text" == a.type ? a.data.replace(/[ ]/g, "&nbsp;").replace(/\n$/, "") : "br" == a.tagName ? "\n" : dtd.$empty[a.tagName] ? a.innerText() : "" }), a.innerText(b.replace(/(&nbsp;|\n)+$/, "")) }) }), a.notNeedCodeQuery = { help: 1, undo: 1, redo: 1, source: 1, print: 1, searchreplace: 1, fullscreen: 1, preview: 1, insertparagraph: 1, elementpath: 1, insertcode: 1, inserthtml: 1, selectall: 1 }; a.queryCommandState; a.queryCommandState = function (a) { var b = this; return !b.notNeedCodeQuery[a.toLowerCase()] && b.selection && b.queryComm
var b = a.selection.getRange(), c = domUtils.findParentByTagName(b.startContainer, "pre", !0); if (c) {
if (a.fireEvent("saveScene"), b.collapsed || b.deleteContents(), !browser.ie || browser.ie9above) {
var c, d = a.document.createElement("br"); b.insertNode(d).setStartAfter(d).collapse(!0);
var e = d.nextSibling; e || browser.ie && !(browser.version > 10) ? b.setStartAfter(d) : b.insertNode(d.cloneNode(!1)), c = d.previousSibling; for (var f; c;)if (f = c, c = c.previousSibling, !c || "BR" == c.nodeName) { c = f; break } if (c) { for (var g = ""; c && "BR" != c.nodeName && new RegExp("^[\\s" + domUtils.fillChar + "]*$").test(c.nodeValue);)g += c.nodeValue, c = c.nextSibling; if ("BR" != c.nodeName) { var h = c.nodeValue.match(new RegExp("^([\\s" + domUtils.fillChar + "]+)")); h && h[1] && (g += h[1]) } g && (g = a.document.createTextNode(g), b.insertNode(g).setStartAfter(g)) } b.collapse(!0).select(!0)
} else if (browser.version > 8) { var i = a.document.createTextNode("\n"), j = b.startContainer; if (0 == b.startOffset) { var k = j.previousSibling; if (k) { b.insertNode(i); var l = a.document.createTextNode(" "); b.setStartAfter(i).insertNode(l).setStart(l, 0).collapse(!0).select(!0) } } else { b.insertNode(i).setStartAfter(i); var l = a.document.createTextNode(" "); j = b.startContainer.childNodes[b.startOffset], j && !/^\n/.test(j.nodeValue) && b.setStartBefore(i), b.insertNode(l).setStart(l, 0).collapse(!0).select(!0) } } else { var d = a.document.createElement("br"); b.insertNode(d), b.insertNode(a.document.createTextNode(domUtils.fillChar)), b.setStartAfter(d), c = d.previousSibling; for (var f; c;)if (f = c, c = c.previousSibling, !c || "BR" == c.nodeName) { c = f; break } if (c) { for (var g = ""; c && "BR" != c.nodeName && new RegExp("^[ " + domUtils.fillChar + "]*$").test(c.nodeValue);)g += c.nodeValue, c = c.nextSibling; if ("BR" != c.nodeName) { var h = c.nodeValue.match(new RegExp("^([ " + domUtils.fillChar + "]+)")); h && h[1] && (g += h[1]) } g = a.document.createTextNode(g), b.insertNode(g).setStartAfter(g) } b.collapse(!0).select() } return a.fireEvent("saveScene"), !0
}
}), a.addListener("tabkeydown", function (b, c) { var d = a.selection.getRange(), e = domUtils.findParentByTagName(d.startContainer, "pre", !0); if (e) { if (a.fireEvent("saveScene"), c.shiftKey); else if (d.collapsed) { var f = a.document.createTextNode(" "); d.insertNode(f).setStartAfter(f).collapse(!0).select(!0) } else { for (var g = d.createBookmark(), h = g.start.previousSibling; h;) { if (e.firstChild === h && !domUtils.isBr(h)) { e.insertBefore(a.document.createTextNode(" "), h); break } if (domUtils.isBr(h)) { e.insertBefore(a.document.createTextNode(" "), h.nextSibling); break } h = h.previousSibling } var i = g.end; for (h = g.start.nextSibling, e.firstChild === g.start && e.insertBefore(a.document.createTextNode(" "), h.nextSibling); h && h !== i;) { if (domUtils.isBr(h) && h.nextSibling) { if (h.nextSibling === i) break; e.insertBefore(a.document.createTextNode(" "), h.nextSibling) } h = h.nextSibling } d.moveToBookmark(g).select() } return a.fireEvent("saveScene"), !0 } }), a.addListener("beforeinserthtml", function (a, b) { var c = this, d = c.selection.getRange(), e = domUtils.findParentByTagName(d.startContainer, "pre", !0); if (e) { d.collapsed || d.deleteContents(); var f = ""; if (browser.ie && browser.version > 8) { utils.each(UE.filterNode(UE.htmlparser(b), c.options.filterTxtRules).children, function (a) { "element" == a.type ? "br" == a.tagName ? f += "\n" : dtd.$empty[a.tagName] || (utils.each(a.children, function (b) { "element" == b.type ? "br" == b.tagName ? f += "\n" : dtd.$empty[a.tagName] || (f += b.innerText()) : f += b.data }), /\n$/.test(f) || (f += "\n")) : f += a.data + "\n", !a.nextSibling() && /\n$/.test(f) && (f = f.replace(/\n$/, "")) }); var g = c.document.createTextNode(utils.html(f.replace(/&nbsp;/g, " "))); d.insertNode(g).selectNode(g).select() } else { var h = c.document.createDocumentFragment(); utils.each(UE.filterNode(UE.htmlparser(b), c.options.filterTxtRules).children, function (a) { "element" == a.type ? "br" == a.tagName ? h.appendChild(c.document.createElement("br")) : dtd.$empty[a.tagName] || (utils.each(a.children, function (b) { "element" == b.type ? "br" == b.tagName ? h.appendChild(c.document.createElement("br")) : dtd.$empty[a.tagName] || h.appendChild(c.document.createTextNode(utils.html(b.innerText().replace(/&nbsp;/g, " ")))) : h.appendChild(c.document.createTextNode(utils.html(b.data.replace(/&nbsp;/g, " ")))) }), "BR" != h.lastChild.nodeName && h.appendChild(c.document.createElement("br"))) : h.appendChild(c.document.createTextNode(utils.html(a.data.replace(/&nbsp;/g, " ")))), a.nextSibling() || "BR" != h.lastChild.nodeName || h.removeChild(h.lastChild) }), d.insertNode(h).select() } return !0 } }), a.addListener("keydown", function (a, b) { var c = this, d = b.keyCode || b.which; if (40 == d) { var e, f = c.selection.getRange(), g = f.startContainer; if (f.collapsed && (e = domUtils.findParentByTagName(f.startContainer, "pre", !0)) && !e.nextSibling) { for (var h = e.lastChild; h && "BR" == h.nodeName;)h = h.previousSibling; (h === g || f.startContainer === e && f.startOffset == e.childNodes.length) && (c.execCommand("insertparagraph"), domUtils.preventDefault(b)) } } }), a.addListener("delkeydown", function (b, c) { var d = this.selection.getRange(); d.txtToElmBoundary(!0); var e = d.startContainer; if (domUtils.isTagNode(e, "pre") && d.collapsed && domUtils.isStartInblock(d)) { var f = a.document.createElement("p"); return domUtils.fillNode(a.document, f), e.parentNode.insertBefore(f, e), domUtils.remove(e), d.setStart(f, 0).setCursor(!1, !0), domUtils.preventDefault(c), !0 } })
}, UE.commands.cleardoc = { execCommand: function (a) { var b = this, c = b.options.enterTag, d = b.selection.getRange(); "br" == c ? (b.body.innerHTML = "<br/>", d.setStart(b.body, 0).setCursor()) : (b.body.innerHTML = "<p>" + (ie ? "" : "<br/>") + "</p>", d.setStart(b.body.firstChild, 0).setCursor(!1, !0)), setTimeout(function () { b.fireEvent("clearDoc") }, 0) } }, UE.plugin.register("anchor", function () { return { bindEvents: { ready: function () { utils.cssRule("anchor", ".anchorclass{background: url('" + this.options.themePath + this.options.theme + "/images/anchor.gif') no-repeat scroll left center transparent;cursor: auto;display: inline-block;height: 16px;width: 15px;}", this.document) } }, outputRule: function (a) { utils.each(a.getNodesByTagName("img"), function (a) { var b; (b = a.getAttr("anchorname")) && (a.tagName = "a", a.setAttr({ anchorname: "", name: b, "class": "" })) }) }, inputRule: function (a) { utils.each(a.getNodesByTagName("a"), function (a) { var b; (b = a.getAttr("name")) && !a.getAttr("href") && (a.tagName = "img", a.setAttr({ anchorname: a.getAttr("name"), "class": "anchorclass" }), a.setAttr("name")) }) }, commands: { anchor: { execCommand: function (a, b) { var c = this.selection.getRange(), d = c.getClosedNode(); if (d && d.getAttribute("anchorname")) b ? d.setAttribute("anchorname", b) : (c.setStartBefore(d).setCursor(), domUtils.remove(d)); else if (b) { var e = this.document.createElement("img"); c.collapse(!0), domUtils.setAttributes(e, { anchorname: b, "class": "anchorclass" }), c.insertNode(e).setStartAfter(e).setCursor(!1, !0) } } } } } }), UE.plugins.wordcount = function () { var a = this; a.setOpt("wordCount", !0), a.addListener("contentchange", function () { a.fireEvent("wordcount") }); var b; a.addListener("ready", function () { var a = this; domUtils.on(a.body, "keyup", function (c) { var d = c.keyCode || c.which, e = { 16: 1, 18: 1, 20: 1, 37: 1, 38: 1, 39: 1, 40: 1 }; d in e || (clearTimeout(b), b = setTimeout(function () { a.fireEvent("wordcount") }, 200)) }) }) }, UE.plugins.pagebreak = function () { function a(a) { if (domUtils.isEmptyBlock(a)) { for (var b, d = a.firstChild; d && 1 == d.nodeType && domUtils.isEmptyBlock(d);)b = d, d = d.firstChild; !b && (b = a), domUtils.fillNode(c.document, b) } } function b(a) { return a && 1 == a.nodeType && "HR" == a.tagName && "pagebreak" == a.className } var c = this, d = ["td"]; c.setOpt("pageBreakTag", "_ueditor_page_break_tag_"), c.ready(function () { utils.cssRule("pagebreak", ".pagebreak{display:block;clear:both !important;cursor:default !important;width: 100% !important;margin:0;}", c.document) }), c.addInputRule(function (a) { a.traversal(function (a) { if ("text" == a.type && a.data == c.options.pageBreakTag) { var b = UE.uNode.createElement('<hr class="pagebreak" noshade="noshade" size="5" style="-webkit-user-select: none;">'); a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a) } }) }), c.addOutputRule(function (a) { utils.each(a.getNodesByTagName("hr"), function (a) { if ("pagebreak" == a.getAttr("class")) { var b = UE.uNode.createText(c.options.pageBreakTag); a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a) } }) }), c.commands.pagebreak = { execCommand: function () { var e = c.selection.getRange(), f = c.document.createElement("hr"); domUtils.setAttributes(f, { "class": "pagebreak", noshade: "noshade", size: "5" }), domUtils.unSelectable(f); var g, h = domUtils.findParentByTagName(e.startContainer, d, !0), i = []; if (h) switch (h.tagName) { case "TD": if (g = h.parentNode, g.previousSibling) g.parentNode.insertBefore(f, g), i = domUtils.findParents(f); else { var j = domUtils.findParentByTagName(g, "table"); j.parentNode.insertBefore(f, j), i = domUtils.findParents(f, !0) } g = i[1], f !== g && domUtils.breakParent(f, g), c.fireEvent("afteradjusttable", c.document) } else { if (!e.collapsed) { e.deleteContents(); for (var k = e.startContainer; !domUtils.isBody(k) && domUtils.isBlockElm(k) && domUtils.isEmptyNode(k);)e.setStartBefore(k).collapse(!0), domUtils.remove(k), k = e.startContainer
function a(a) { var b = []; for (var c in a) b.push(c); return b } function b(a) { var b = a.className; return domUtils.hasClass(a, /custom_/) ? b.match(/custom_(\w+)/)[1] : domUtils.getStyle(a, "list-style-type") } function c(a, c) { utils.each(domUtils.getElementsByTagName(a, "ol ul"), function (f) { if (domUtils.inDoc(f, a)) { var g = f.parentNode; if (g.tagName == f.tagName) { var h = b(f) || ("OL" == f.tagName ? "decimal" : "disc"), i = b(g) || ("OL" == g.tagName ? "decimal" : "disc"); if (h == i) { var l = utils.indexOf(k[f.tagName], h); l = l + 1 == k[f.tagName].length ? 0 : l + 1, e(f, k[f.tagName][l]) } } var m = 0, n = 2; domUtils.hasClass(f, /custom_/) ? /[ou]l/i.test(g.tagName) && domUtils.hasClass(g, /custom_/) || (n = 1) : /[ou]l/i.test(g.tagName) && domUtils.hasClass(g, /custom_/) && (n = 3); var o = domUtils.getStyle(f, "list-style-type"); o && (f.style.cssText = "list-style-type:" + o), f.className = utils.trim(f.className.replace(/list-paddingleft-\w+/, "")) + " list-paddingleft-" + n, utils.each(domUtils.getElementsByTagName(f, "li"), function (a) { if (a.style.cssText && (a.style.cssText = ""), !a.firstChild) return void domUtils.remove(a); if (a.parentNode === f) { if (m++, domUtils.hasClass(f, /custom_/)) { var c = 1, d = b(f); if ("OL" == f.tagName) { if (d) switch (d) { case "cn": case "cn1": case "cn2": m > 10 && (m % 10 == 0 || m > 10 && m < 20) ? c = 2 : m > 20 && (c = 3); break; case "num2": m > 9 && (c = 2) }a.className = "list-" + j[d] + m + " list-" + d + "-paddingleft-" + c } else a.className = "list-" + j[d] + " list-" + d + "-paddingleft" } else a.className = a.className.replace(/list-[\w\-]+/gi, ""); var e = a.getAttribute("class"); null === e || e.replace(/\s/g, "") || domUtils.removeAttributes(a, "class") } }), !c && d(f, f.tagName.toLowerCase(), b(f) || domUtils.getStyle(f, "list-style-type"), !0) } }) } function d(a, d, e, f) { var g = a.nextSibling; g && 1 == g.nodeType && g.tagName.toLowerCase() == d && (b(g) || domUtils.getStyle(g, "list-style-type") || ("ol" == d ? "decimal" : "disc")) == e && (domUtils.moveChild(g, a), 0 == g.childNodes.length && domUtils.remove(g)), g && domUtils.isFillChar(g) && domUtils.remove(g); var h = a.previousSibling; h && 1 == h.nodeType && h.tagName.toLowerCase() == d && (b(h) || domUtils.getStyle(h, "list-style-type") || ("ol" == d ? "decimal" : "disc")) == e && domUtils.moveChild(a, h), h && domUtils.isFillChar(h) && domUtils.remove(h), !f && domUtils.isEmptyBlock(a) && domUtils.remove(a), b(a) && c(a.ownerDocument, !0) } function e(a, b) { j[b] && (a.className = "custom_" + b); try { domUtils.setStyle(a, "list-style-type", b) } catch (c) { } } function f(a) { var b = a.previousSibling; b && domUtils.isEmptyBlock(b) && domUtils.remove(b), b = a.nextSibling, b && domUtils.isEmptyBlock(b) && domUtils.remove(b) } function g(a) { for (; a && !domUtils.isBody(a);) { if ("TABLE" == a.nodeName) return null; if ("LI" == a.nodeName) return a; a = a.parentNode } } var h = this, i = { TD: 1, PRE: 1, BLOCKQUOTE: 1 }, j = { cn: "cn-1-", cn1: "cn-2-", cn2: "cn-3-", num: "num-1-", num1: "num-2-", num2: "num-3-", dash: "dash", dot: "dot" }; h.setOpt({ autoTransWordToList: !1, insertorderedlist: { num: "", num1: "", num2: "", cn: "", cn1: "", cn2: "", decimal: "", "lower-alpha": "", "lower-roman": "", "upper-alpha": "", "upper-roman": "" }, insertunorderedlist: { circle: "", disc: "", square: "", dash: "", dot: "" }, listDefaultPaddingLeft: "30", listiconpath: "http://bs.baidu.com/listicon/", maxListLevel: -1, disablePInList: !1 }); var k = { OL: a(h.options.insertorderedlist), UL: a(h.options.insertunorderedlist) }, l = h.options.listiconpath; for (var m in j) h.options.insertorderedlist.hasOwnProperty(m) || h.options.insertunorderedlist.hasOwnProperty(m) || delete j[m]; h.ready(function () { var a = []; for (var b in j) { if ("dash" == b || "dot" == b) a.push("li.list-" + j[b] + "{background-image:url(" + l + j[b] + ".gif)}"), a.push("ul.custom_" + b + "{list-style:none;}ul.custom_" + b + " li{background-position:0 3px;background-repeat:no-repeat}"); els
function c() { b.preventDefault ? b.preventDefault() : b.returnValue = !1, h.fireEvent("contentchange"), h.undoManger && h.undoManger.save() } function d(a, b) { for (; a && !domUtils.isBody(a);) { if (b(a)) return null; if (1 == a.nodeType && /[ou]l/i.test(a.tagName)) return a; a = a.parentNode } return null } var e = b.keyCode || b.which; if (13 == e && !b.shiftKey) {
var g = h.selection.getRange(), i = domUtils.findParent(g.startContainer, function (a) { return domUtils.isBlockElm(a) }, !0), j = domUtils.findParentByTagName(g.startContainer, "li", !0); if (i && "PRE" != i.tagName && !j) { var k = i.innerHTML.replace(new RegExp(domUtils.fillChar, "g"), ""); /^\s*1\s*\.[^\d]/.test(k) && (i.innerHTML = k.replace(/^\s*1\s*\./, ""), g.setStartAtLast(i).collapse(!0).select(), h.__hasEnterExecCommand = !0, h.execCommand("insertorderedlist"), h.__hasEnterExecCommand = !1) } var l = h.selection.getRange(), m = d(l.startContainer, function (a) { return "TABLE" == a.tagName }), n = l.collapsed ? m : d(l.endContainer, function (a) { return "TABLE" == a.tagName }); if (m && n && m === n) {
if (!l.collapsed) {
if (m = domUtils.findParentByTagName(l.startContainer, "li", !0), n = domUtils.findParentByTagName(l.endContainer, "li", !0), !m || !n || m !== n) { var o = l.cloneRange(), p = o.collapse(!1).createBookmark(); l.deleteContents(), o.moveToBookmark(p); var j = domUtils.findParentByTagName(o.startContainer, "li", !0); return f(j), o.select(), void c() } if (l.deleteContents(), j = domUtils.findParentByTagName(l.startContainer, "li", !0), j && domUtils.isEmptyBlock(j)) return v = j.previousSibling, next = j.nextSibling, s = h.document.createElement("p"), domUtils.fillNode(h.document, s), q = j.parentNode, v && next ? (l.setStart(next, 0).collapse(!0).select(!0), domUtils.remove(j)) : ((v || next) && v ? j.parentNode.parentNode.insertBefore(s, q.nextSibling) : q.parentNode.insertBefore(s, q), domUtils.remove(j), q.firstChild || domUtils.remove(q),
l.setStart(s, 0).setCursor()), void c()
} if (j = domUtils.findParentByTagName(l.startContainer, "li", !0)) { if (domUtils.isEmptyBlock(j)) { p = l.createBookmark(); var q = j.parentNode; if (j !== q.lastChild ? (domUtils.breakParent(j, q), f(j)) : (q.parentNode.insertBefore(j, q.nextSibling), domUtils.isEmptyNode(q) && domUtils.remove(q)), !dtd.$list[j.parentNode.tagName]) if (domUtils.isBlockElm(j.firstChild)) domUtils.remove(j, !0); else { for (s = h.document.createElement("p"), j.parentNode.insertBefore(s, j); j.firstChild;)s.appendChild(j.firstChild); domUtils.remove(j) } l.moveToBookmark(p).select() } else { var r = j.firstChild; if (!r || !domUtils.isBlockElm(r)) { var s = h.document.createElement("p"); for (!j.firstChild && domUtils.fillNode(h.document, s); j.firstChild;)s.appendChild(j.firstChild); j.appendChild(s), r = s } var t = h.document.createElement("span"); l.insertNode(t), domUtils.breakParent(t, j); var u = t.nextSibling; r = u.firstChild, r || (s = h.document.createElement("p"), domUtils.fillNode(h.document, s), u.appendChild(s), r = s), domUtils.isEmptyNode(r) && (r.innerHTML = "", domUtils.fillNode(h.document, r)), l.setStart(r, 0).collapse(!0).shrinkBoundary().select(), domUtils.remove(t); var v = u.previousSibling; v && domUtils.isEmptyBlock(v) && (v.innerHTML = "<p></p>", domUtils.fillNode(h.document, v.firstChild)) } c() }
}
} if (8 == e && (l = h.selection.getRange(), l.collapsed && domUtils.isStartInblock(l) && (o = l.cloneRange().trimBoundary(), j = domUtils.findParentByTagName(l.startContainer, "li", !0), j && domUtils.isStartInblock(o)))) { if (m = domUtils.findParentByTagName(l.startContainer, "p", !0), m && m !== j.firstChild) { var q = domUtils.findParentByTagName(m, ["ol", "ul"]); return domUtils.breakParent(m, q), f(m), h.fireEvent("contentchange"), l.setStart(m, 0).setCursor(!1, !0), h.fireEvent("saveScene"), void domUtils.preventDefault(b) } if (j && (v = j.previousSibling)) { if (46 == e && j.childNodes.length) return; if (dtd.$list[v.tagName] && (v = v.lastChild), h.undoManger && h.undoManger.save(), r = j.firstChild, domUtils.isBlockElm(r)) if (domUtils.isEmptyNode(r)) for (v.appendChild(r), l.setStart(r, 0).setCursor(!1, !0); j.firstChild;)v.appendChild(j.firstChild); else t = h.document.createElement("span"), l.insertNode(t), domUtils.isEmptyBlock(v) && (v.innerHTML = ""), domUtils.moveChild(j, v), l.setStartBefore(t).collapse(!0).select(!0), domUtils.remove(t); else if (domUtils.isEmptyNode(j)) { var s = h.document.createElement("p"); v.appendChild(s), l.setStart(s, 0).setCursor() } else for (l.setEnd(v, v.childNodes.length).collapse().select(!0); j.firstChild;)v.appendChild(j.firstChild); return domUtils.remove(j), h.fireEvent("contentchange"), h.fireEvent("saveScene"), void domUtils.preventDefault(b) } if (j && !j.previousSibling) { var q = j.parentNode, p = l.createBookmark(); if (domUtils.isTagNode(q.parentNode, "ol ul")) q.parentNode.insertBefore(j, q), domUtils.isEmptyNode(q) && domUtils.remove(q); else { for (; j.firstChild;)q.parentNode.insertBefore(j.firstChild, q); domUtils.remove(j), domUtils.isEmptyNode(q) && domUtils.remove(q) } return l.moveToBookmark(p).setCursor(!1, !0), h.fireEvent("contentchange"), h.fireEvent("saveScene"), void domUtils.preventDefault(b) } }
}), h.addListener("keyup", function (a, c) { var e = c.keyCode || c.which; if (8 == e) { var f, g = h.selection.getRange(); (f = domUtils.findParentByTagName(g.startContainer, ["ol", "ul"], !0)) && d(f, f.tagName.toLowerCase(), b(f) || domUtils.getComputedStyle(f, "list-style-type"), !0) } }), h.addListener("tabkeydown", function () { function a(a) { if (h.options.maxListLevel != -1) { for (var b = a.parentNode, c = 0; /[ou]l/i.test(b.tagName);)c++, b = b.parentNode; if (c >= h.options.maxListLevel) return !0 } } var c = h.selection.getRange(), f = domUtils.findParentByTagName(c.startContainer, "li", !0); if (f) { var g; if (!c.collapsed) { h.fireEvent("saveScene"), g = c.createBookmark(); for (var i, j, l = 0, m = domUtils.findParents(f); j = m[l++];)if (domUtils.isTagNode(j, "ol ul")) { i = j; break } var n = f; if (g.end) for (; n && !(domUtils.getPosition(n, g.end) & domUtils.POSITION_FOLLOWING);)if (a(n)) n = domUtils.getNextDomNode(n, !1, null, function (a) { return a !== i }); else { var o = n.parentNode, p = h.document.createElement(o.tagName), q = utils.indexOf(k[p.tagName], b(o) || domUtils.getComputedStyle(o, "list-style-type")), r = q + 1 == k[p.tagName].length ? 0 : q + 1, s = k[p.tagName][r]; for (e(p, s), o.insertBefore(p, n); n && !(domUtils.getPosition(n, g.end) & domUtils.POSITION_FOLLOWING);) { if (f = n.nextSibling, p.appendChild(n), !f || domUtils.isTagNode(f, "ol ul")) { if (f) for (; (f = f.firstChild) && "LI" != f.tagName;); else f = domUtils.getNextDomNode(n, !1, null, function (a) { return a !== i }); break } n = f } d(p, p.tagName.toLowerCase(), s), n = f } return h.fireEvent("contentchange"), c.moveToBookmark(g).select(), !0 } if (a(f)) return !0; var o = f.parentNode, p = h.document.createElement(o.tagName), q = utils.indexOf(k[p.tagName], b(o) || domUtils.getComputedStyle(o, "list-style-type")); q = q + 1 == k[p.tagName].length ? 0 : q + 1; var s = k[p.tagName][q]; if (e(p, s), domUtils.isStartInblock(c)) return h.fireEvent("saveScene"), g = c.createBookmark(), o.insertBefore(p, f), p.appendChild(f), d(p, p.tagName.toLowerCase(), s), h.fireEvent("contentchange"), c.moveToBookmark(g).select(!0), !0 } }), h.commands.insertorderedlist = h.commands.insertunorderedlist = { execCommand: function (a, c) { c || (c = "insertorderedlist" == a.toLowerCase() ? "decimal" : "disc"); var f = this, h = this.selection.getRange(), j = function (a) { return 1 == a.nodeType ? "br" != a.tagName.toLowerCase() : !domUtils.isWhitespace(a) }, k = "insertorderedlist" == a.toLowerCase() ? "ol" : "ul", l = f.document.createDocumentFragment(); h.adjustmentBoundary().shrinkBoundary(); var m, n, o, p, q = h.createBookmark(!0), r = g(f.document.getElementById(q.start)), s = 0, t = g(f.document.getElementById(q.end)), u = 0; if (r || t) { if (r && (m = r.parentNode), q.end || (t = r), t && (n = t.parentNode), m === n) { for (; r !== t;) { if (p = r, r = r.nextSibling, !domUtils.isBlockElm(p.firstChild)) { for (var v = f.document.createElement("p"); p.firstChild;)v.appendChild(p.firstChild); p.appendChild(v) } l.appendChild(p) } if (p = f.document.createElement("span"), m.insertBefore(p, t), !domUtils.isBlockElm(t.firstChild)) { for (v = f.document.createElement("p"); t.firstChild;)v.appendChild(t.firstChild); t.appendChild(v) } l.appendChild(t), domUtils.breakParent(p, m), domUtils.isEmptyNode(p.previousSibling) && domUtils.remove(p.previousSibling), domUtils.isEmptyNode(p.nextSibling) && domUtils.remove(p.nextSibling); var w = b(m) || domUtils.getComputedStyle(m, "list-style-type") || ("insertorderedlist" == a.toLowerCase() ? "decimal" : "disc"); if (m.tagName.toLowerCase() == k && w == c) { for (var x, y = 0, z = f.document.createDocumentFragment(); x = l.firstChild;)if (domUtils.isTagNode(x, "ol ul")) z.appendChild(x); else for (; x.firstChild;)z.appendChild(x.firstChild), domUtils.remove(x); p.parentNode.insertBefore(z, p) } else o = f.document.createElement(k), e(o, c), o.appendChild(l), p.parentNode.insertBefore(o, p); return domUtils.remove(p), o && d(o, k, c), void h.moveToBookmark(q).select() } if (r) { fo
}, function () { var a = { textarea: function (a, b) { var c = b.ownerDocument.createElement("textarea"); return c.style.cssText = "position:absolute;resize:none;width:100%;height:100%;border:0;padding:0;margin:0;overflow-y:auto;", browser.ie && browser.version < 8 && (c.style.width = b.offsetWidth + "px", c.style.height = b.offsetHeight + "px", b.onresize = function () { c.style.width = b.offsetWidth + "px", c.style.height = b.offsetHeight + "px" }), b.appendChild(c), { setContent: function (a) { c.value = a }, getContent: function () { return c.value }, select: function () { var a; browser.ie ? (a = c.createTextRange(), a.collapse(!0), a.select()) : (c.setSelectionRange(0, 0), c.focus()) }, dispose: function () { b.removeChild(c), b.onresize = null, c = null, b = null } } }, codemirror: function (a, b) { var c = window.CodeMirror(b, { mode: "text/html", tabMode: "indent", lineNumbers: !0, lineWrapping: !0 }), d = c.getWrapperElement(); return d.style.cssText = 'position:absolute;left:0;top:0;width:100%;height:100%;font-family:consolas,"Courier new",monospace;font-size:13px;', c.getScrollerElement().style.cssText = "position:absolute;left:0;top:0;width:100%;height:100%;", c.refresh(), { getCodeMirror: function () { return c }, setContent: function (a) { c.setValue(a) }, getContent: function () { return c.getValue() }, select: function () { c.focus() }, dispose: function () { b.removeChild(d), d = null, c = null } } } }; UE.plugins.source = function () { function b(b) { return a["codemirror" == f.sourceEditor && window.CodeMirror ? "codemirror" : "textarea"](e, b) } var c, d, e = this, f = this.options, g = !1; f.sourceEditor = browser.ie ? "textarea" : f.sourceEditor || "codemirror", e.setOpt({ sourceEditorFirst: !1 }); var h, i, j; e.commands.source = { execCommand: function () { if (g = !g) { j = e.selection.getRange().createAddress(!1, !0), e.undoManger && e.undoManger.save(!0), browser.gecko && (e.body.contentEditable = !1), h = e.iframe.style.cssText, e.iframe.style.cssText += "position:absolute;left:-32768px;top:-32768px;", e.fireEvent("beforegetcontent"); var a = UE.htmlparser(e.body.innerHTML); e.filterOutputRule(a), a.traversal(function (a) { if ("element" == a.type) switch (a.tagName) { case "td": case "th": case "caption": a.children && 1 == a.children.length && "br" == a.firstChild().tagName && a.removeChild(a.firstChild()); break; case "pre": a.innerText(a.innerText().replace(/&nbsp;/g, " ")) } }), e.fireEvent("aftergetcontent"); var f = a.toHtml(!0); c = b(e.iframe.parentNode), c.setContent(f), d = e.setContent, e.setContent = function (a) { var b = UE.htmlparser(a); e.filterInputRule(b), a = b.toHtml(), c.setContent(a) }, setTimeout(function () { c.select(), e.addListener("fullscreenchanged", function () { try { c.getCodeMirror().refresh() } catch (a) { } }) }), i = e.getContent, e.getContent = function () { return c.getContent() || "<p>" + (browser.ie ? "" : "<br/>") + "</p>" } } else { e.iframe.style.cssText = h; var k = c.getContent() || "<p>" + (browser.ie ? "" : "<br/>") + "</p>"; k = k.replace(new RegExp("[\\r\\t\\n ]*</?(\\w+)\\s*(?:[^>]*)>", "g"), function (a, b) { return b && !dtd.$inlineWithA[b.toLowerCase()] ? a.replace(/(^[\n\r\t ]*)|([\n\r\t ]*$)/g, "") : a.replace(/(^[\n\r\t]*)|([\n\r\t]*$)/g, "") }), e.setContent = d, e.setContent(k), c.dispose(), c = null, e.getContent = i; var l = e.body.firstChild; if (l || (e.body.innerHTML = "<p>" + (browser.ie ? "" : "<br/>") + "</p>", l = e.body.firstChild), e.undoManger && e.undoManger.save(!0), browser.gecko) { var m = document.createElement("input"); m.style.cssText = "position:absolute;left:0;top:-32768px", document.body.appendChild(m), e.body.contentEditable = !1, setTimeout(function () { domUtils.setViewportOffset(m, { left: -32768, top: 0 }), m.focus(), setTimeout(function () { e.body.contentEditable = !0, e.selection.getRange().moveToAddress(j).select(!0), domUtils.remove(m) }) }) } else try { e.selection.getRange().moveToAddress(j).select(!0) } catch (n) { } } this.fireEvent("sourcemodechanged", g) }, queryCommandState: function () { re
function a() { var a = this; clearTimeout(e), f || (!a.queryCommandState || a.queryCommandState && 1 != a.queryCommandState("source")) && (e = setTimeout(function () { for (var b = a.body.lastChild; b && 1 != b.nodeType;)b = b.previousSibling; b && 1 == b.nodeType && (b.style.clear = "both", d = Math.max(domUtils.getXY(b).y + b.offsetHeight + 25, Math.max(h.minFrameHeight, h.initialFrameHeight)), d != g && (d !== parseInt(a.iframe.parentNode.style.height) && (a.iframe.parentNode.style.height = d + "px"), a.body.style.height = d + "px", g = d), domUtils.removeStyle(b, "clear")) }, 50)) } var b = this; if (b.autoHeightEnabled = b.options.autoHeightEnabled !== !1, b.autoHeightEnabled) {
var c, d, e, f, g = 0, h = b.options; b.addListener("fullscreenchanged", function (a, b) { f = b }), b.addListener("destroy", function () { b.removeListener("contentchange afterinserthtml keyup mouseup", a) }), b.enableAutoHeight = function () { var b = this; if (b.autoHeightEnabled) { var d = b.document; b.autoHeightEnabled = !0, c = d.body.style.overflowY, d.body.style.overflowY = "hidden", b.addListener("contentchange afterinserthtml keyup mouseup", a), setTimeout(function () { a.call(b) }, browser.gecko ? 100 : 0), b.fireEvent("autoheightchanged", b.autoHeightEnabled) } }, b.disableAutoHeight = function () { b.body.style.overflowY = c || "", b.removeListener("contentchange", a), b.removeListener("keyup", a), b.removeListener("mouseup", a), b.autoHeightEnabled = !1, b.fireEvent("autoheightchanged", b.autoHeightEnabled) }, b.on("setHeight", function () { b.disableAutoHeight() }), b.addListener("ready", function () {
b.enableAutoHeight(); var c; domUtils.on(browser.ie ? b.body : b.document, browser.webkit ? "dragover" : "drop", function () {
clearTimeout(c), c = setTimeout(function () { a.call(b) }, 100)
}); var d; window.onscroll = function () { null === d ? d = this.scrollY : 0 == this.scrollY && 0 != d && (b.window.scrollTo(0, 0), d = null) }
})
}
}, UE.plugins.autofloat = function () { function a() { return UE.ui ? 1 : (alert(g.autofloatMsg), 0) } function b() { var a = document.body.style; a.backgroundImage = 'url("about:blank")', a.backgroundAttachment = "fixed" } function c() { var a = domUtils.getXY(k), b = domUtils.getComputedStyle(k, "position"), c = domUtils.getComputedStyle(k, "left"); k.style.width = k.offsetWidth + "px", k.style.zIndex = 1 * f.options.zIndex + 1, k.parentNode.insertBefore(q, k), o || p && browser.ie ? ("absolute" != k.style.position && (k.style.position = "absolute"), k.style.top = (document.body.scrollTop || document.documentElement.scrollTop) - l + i + "px") : (browser.ie7Compat && r && (r = !1, k.style.left = domUtils.getXY(k).x - document.documentElement.getBoundingClientRect().left + 2 + "px"), "fixed" != k.style.position && (k.style.position = "fixed", k.style.top = i + "px", ("absolute" == b || "relative" == b) && parseFloat(c) && (k.style.left = a.x + "px"))) } function d() { r = !0, q.parentNode && q.parentNode.removeChild(q), k.style.cssText = j } function e() { var a = m(f.container), b = f.options.toolbarTopOffset || 0; a.top < 0 && a.bottom - k.offsetHeight > b ? c() : d() } var f = this, g = f.getLang(); f.setOpt({ topOffset: 0 }); var h = f.options.autoFloatEnabled !== !1, i = f.options.topOffset; if (h) { var j, k, l, m, n = UE.ui.uiUtils, o = browser.ie && browser.version <= 6, p = browser.quirks, q = document.createElement("div"), r = !0, s = utils.defer(function () { e() }, browser.ie ? 200 : 100, !0); f.addListener("destroy", function () { domUtils.un(window, ["scroll", "resize"], e), f.removeListener("keydown", s) }), f.addListener("ready", function () { if (a(f)) { if (!f.ui) return; m = n.getClientRect, k = f.ui.getDom("toolbarbox"), l = m(k).top, j = k.style.cssText, q.style.height = k.offsetHeight + "px", o && b(), domUtils.on(window, ["scroll", "resize"], e), f.addListener("keydown", s), f.addListener("beforefullscreenchange", function (a, b) { b && d() }), f.addListener("fullscreenchanged", function (a, b) { b || e() }), f.addListener("sourcemodechanged", function (a, b) { setTimeout(function () { e() }, 0) }), f.addListener("clearDoc", function () { setTimeout(function () { e() }, 0) }) } }) } }, UE.plugins.video = function () { function a(a, b, d, e, f, g, h) { a = utils.unhtmlForUrl(a), f = utils.unhtml(f), g = utils.unhtml(g).trim(), b = parseInt(b, 10) || 0, d = parseInt(d, 10) || 0; var i; switch (h) { case "image": i = "<img " + (e ? 'id="' + e + '"' : "") + ' width="' + b + '" height="' + d + '" _url="' + a + '" class="' + g.replace(/\bvideo-js\b/, "") + '" src="' + c.options.UEDITOR_HOME_URL + 'themes/default/images/spacer.gif" style="background:url(' + c.options.UEDITOR_HOME_URL + "themes/default/images/videologo.gif) no-repeat center center; border:1px solid gray;" + (f ? "float:" + f + ";" : "") + '" />'; break; case "embed": i = '<embed type="application/x-shockwave-flash" class="' + g + '" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' + utils.html(a) + '" width="' + b + '" height="' + d + '"' + (f ? ' style="float:' + f + '"' : "") + ' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >'; break; case "video": var j = a.substr(a.lastIndexOf(".") + 1); "ogv" == j && (j = "ogg"), i = "<video" + (e ? ' id="' + e + '"' : "") + ' class="' + g + ' video-js" ' + (f ? ' style="float:' + f + '"' : "") + ' controls preload="none" width="' + b + '" height="' + d + '" src="' + a + '" data-setup="{}"><source src="' + a + '" type="video/' + j + '" /></video>' }return i } function b(b, c) { utils.each(b.getNodesByTagName(c ? "img" : "embed video"), function (b) { var d = b.getAttr("class"); if (d && d.indexOf("edui-faked-video") != -1) { var e = a(c ? b.getAttr("_url") : b.getAttr("src"), b.getAttr("width"), b.getAttr("height"), null, b.getStyle("float") || "", d, c ? "embed" : "image"); b.parentNode.replaceChild(UE.uNode.createElement(e), b) } if (d && d.indexOf("edui-upload-video") != -1) { var e = a(c ? b.getAttr("_url") : b.getA
function a(a, c) { var d = domUtils.getElementsByTagName(a, "td th"); utils.each(d, function (a) { a.removeAttribute("width") }), a.setAttribute("width", b(c, !0, g(c, a))); var e = []; setTimeout(function () { utils.each(d, function (a) { 1 == a.colSpan && e.push(a.offsetWidth) }), utils.each(d, function (a, b) { 1 == a.colSpan && a.setAttribute("width", e[b] + "") }) }, 0) } function b(a, b, c) { var d = a.body; return d.offsetWidth - (b ? 2 * parseInt(domUtils.getComputedStyle(d, "margin-left"), 10) : 0) - 2 * c.tableBorder - (a.options.offsetWidth || 0) } function c(a) { var b = e(a).cell; if (b) { var c = h(b); return c.selectedTds.length ? c.selectedTds : [b] } return [] } var d = UE.UETable, e = function (a) { return d.getTableItemsByRange(a) }, f = function (a) { return d.getUETableBySelected(a) }, g = function (a, b) { return d.getDefaultValue(a, b) }, h = function (a) { return d.getUETable(a) }; UE.commands.inserttable = { queryCommandState: function () { return e(this).table ? -1 : 0 }, execCommand: function (a, b) { function c(a, b) { for (var c = [], d = a.numRows, e = a.numCols, f = 0; f < d; f++) { c.push("<tr" + (0 == f ? ' class="firstRow"' : "") + ">"); for (var g = 0; g < e; g++)c.push('<td width="' + b + '" vAlign="' + a.tdvalign + '" >' + (browser.ie && browser.version < 11 ? domUtils.fillChar : "<br/>") + "</td>"); c.push("</tr>") } return "<table><tbody>" + c.join("") + "</tbody></table>" } b || (b = utils.extend({}, { numCols: this.options.defaultCols, numRows: this.options.defaultRows, tdvalign: this.options.tdvalign })); var d = this, e = this.selection.getRange(), f = e.startContainer, h = domUtils.findParent(f, function (a) { return domUtils.isBlockElm(a) }, !0) || d.body, i = g(d), j = h.offsetWidth, k = Math.floor(j / b.numCols - 2 * i.tdPadding - i.tdBorder); !b.tdvalign && (b.tdvalign = d.options.tdvalign), d.execCommand("inserthtml", c(b, k)) } }, UE.commands.insertparagraphbeforetable = { queryCommandState: function () { return e(this).cell ? 0 : -1 }, execCommand: function () { var a = e(this).table; if (a) { var b = this.document.createElement("p"); b.innerHTML = browser.ie ? "&nbsp;" : "<br />", a.parentNode.insertBefore(b, a), this.selection.getRange().setStart(b, 0).setCursor() } } }, UE.commands.deletetable = { queryCommandState: function () { var a = this.selection.getRange(); return domUtils.findParentByTagName(a.startContainer, "table", !0) ? 0 : -1 }, execCommand: function (a, b) { var c = this.selection.getRange(); if (b = b || domUtils.findParentByTagName(c.startContainer, "table", !0)) { var d = b.nextSibling; d || (d = domUtils.createElement(this.document, "p", { innerHTML: browser.ie ? domUtils.fillChar : "<br/>" }), b.parentNode.insertBefore(d, b)), domUtils.remove(b), c = this.selection.getRange(), 3 == d.nodeType ? c.setStartBefore(d) : c.setStart(d, 0), c.setCursor(!1, !0), this.fireEvent("tablehasdeleted") } } }, UE.commands.cellalign = { queryCommandState: function () { return c(this).length ? 0 : -1 }, execCommand: function (a, b) { var d = c(this); if (d.length) for (var e, f = 0; e = d[f++];)e.setAttribute("align", b) } }, UE.commands.cellvalign = { queryCommandState: function () { return c(this).length ? 0 : -1 }, execCommand: function (a, b) { var d = c(this); if (d.length) for (var e, f = 0; e = d[f++];)e.setAttribute("vAlign", b) } }, UE.commands.insertcaption = { queryCommandState: function () { var a = e(this).table; return a && 0 == a.getElementsByTagName("caption").length ? 1 : -1 }, execCommand: function () { var a = e(this).table; if (a) { var b = this.document.createElement("caption"); b.innerHTML = browser.ie ? domUtils.fillChar : "<br/>", a.insertBefore(b, a.firstChild); var c = this.selection.getRange(); c.setStart(b, 0).setCursor() } } }, UE.commands.deletecaption = { queryCommandState: function () { var a = this.selection.getRange(), b = domUtils.findParentByTagName(a.startContainer, "table"); return b ? 0 == b.getElementsByTagName("caption").length ? -1 : 1 : -1 }, execCommand: function () { var a = this.selection.getRange(), b = domUtil
queryCommandState: function () {
var a = e(this), b = a.cell; return b && h(a.table).colsNum < this.options.maxColNum ? 0 : -1;
}, execCommand: function () { var a = this.selection.getRange(), b = a.createBookmark(!0), c = e(this).cell, d = h(c), f = d.getCellInfo(c); if (d.selectedTds.length) for (var g = d.cellsRange, i = 0, j = g.endColIndex - g.beginColIndex + 1; i < j; i++)d.insertCol(g.endColIndex + 1, c); else d.insertCol(f.colIndex + f.colSpan, c); a.moveToBookmark(b).select() }
}, UE.commands.deletecol = { queryCommandState: function () { var a = e(this); return a.cell ? 0 : -1 }, execCommand: function () { var a = e(this).cell, b = h(a), c = b.cellsRange, d = b.getCellInfo(a), f = b.getHSideCell(a), g = b.getHSideCell(a, !0); if (utils.isEmptyObject(c)) b.deleteCol(d.colIndex); else for (var i = c.beginColIndex; i < c.endColIndex + 1; i++)b.deleteCol(c.beginColIndex); var j = b.table, k = this.selection.getRange(); if (j.getElementsByTagName("td").length) domUtils.inDoc(a, this.document) ? k.setStart(a, 0).setCursor(!1, !0) : g && domUtils.inDoc(g, this.document) ? k.selectNodeContents(g).setCursor(!1, !0) : f && domUtils.inDoc(f, this.document) && k.selectNodeContents(f).setCursor(!0, !0); else { var l = j.nextSibling; domUtils.remove(j), l && k.setStart(l, 0).setCursor(!1, !0) } } }, UE.commands.splittocells = { queryCommandState: function () { var a = e(this), b = a.cell; if (!b) return -1; var c = h(a.table); return c.selectedTds.length > 0 ? -1 : b && (b.colSpan > 1 || b.rowSpan > 1) ? 0 : -1 }, execCommand: function () { var a = this.selection.getRange(), b = a.createBookmark(!0), c = e(this).cell, d = h(c); d.splitToCells(c), a.moveToBookmark(b).select() } }, UE.commands.splittorows = { queryCommandState: function () { var a = e(this), b = a.cell; if (!b) return -1; var c = h(a.table); return c.selectedTds.length > 0 ? -1 : b && b.rowSpan > 1 ? 0 : -1 }, execCommand: function () { var a = this.selection.getRange(), b = a.createBookmark(!0), c = e(this).cell, d = h(c); d.splitToRows(c), a.moveToBookmark(b).select() } }, UE.commands.splittocols = { queryCommandState: function () { var a = e(this), b = a.cell; if (!b) return -1; var c = h(a.table); return c.selectedTds.length > 0 ? -1 : b && b.colSpan > 1 ? 0 : -1 }, execCommand: function () { var a = this.selection.getRange(), b = a.createBookmark(!0), c = e(this).cell, d = h(c); d.splitToCols(c), a.moveToBookmark(b).select() } }, UE.commands.adaptbytext = UE.commands.adaptbywindow = { queryCommandState: function () { return e(this).table ? 0 : -1 }, execCommand: function (b) { var c = e(this), d = c.table; if (d) if ("adaptbywindow" == b) a(d, this); else { var f = domUtils.getElementsByTagName(d, "td th"); utils.each(f, function (a) { a.removeAttribute("width") }), d.removeAttribute("width") } } }, UE.commands.averagedistributecol = { queryCommandState: function () { var a = f(this); return a && (a.isFullRow() || a.isFullCol()) ? 0 : -1 }, execCommand: function (a) { function b() { var a, b = e.table, c = 0, f = 0, h = g(d, b); if (e.isFullRow()) c = b.offsetWidth, f = e.colsNum; else for (var i, j = e.cellsRange.beginColIndex, k = e.cellsRange.endColIndex, l = j; l <= k;)i = e.selectedTds[l], c += i.offsetWidth, l += i.colSpan, f += 1; return a = Math.ceil(c / f) - 2 * h.tdBorder - 2 * h.tdPadding } function c(a) { utils.each(domUtils.getElementsByTagName(e.table, "th"), function (a) { a.setAttribute("width", "") }); var b = e.isFullRow() ? domUtils.getElementsByTagName(e.table, "td") : e.selectedTds; utils.each(b, function (b) { 1 == b.colSpan && b.setAttribute("width", a) }) } var d = this, e = f(d); e && e.selectedTds.length && c(b()) } }, UE.commands.averagedistributerow = { queryCommandState: function () { var a = f(this); return a ? a.selectedTds && /th/gi.test(a.selectedTds[0].tagName) ? -1 : a.isFullRow() || a.isFullCol() ? 0 : -1 : -1 }, execCommand: function (a) { function b() { var a, b, c = 0, f = e.table, h = g(d, f), i = parseInt(domUtils.getComputedStyle(f.getElementsByTagName("td")[0], "padding-top")); if (e.isFullCol()) { var j, k, l = domUtils.getElementsByTagName(f, "caption"), m = domUtils.getElementsByTagName(f, "th"); l.length > 0 && (j = l[0].offsetHeight), m.length > 0 && (k = m[0].offsetHeight), c = f.offsetHeight - (j || 0) - (k || 0), b = 0 == m.length ? e.rowsNum : e.rowsNum - 1 } else { for (var n = e.cellsRange.beginRowIndex, o = e.cellsRange.endRowIndex, p = 0, q = domUtils.getElementsByTagName(f, "tr"), r = n; r <= o; r++)c += q[r].offsetHeight, p += 1; b = p } return a = browser.ie && browser.v
}(), UE.plugins.table = function () { function a(a) { } function b(a, b) { c(a, "width", !0), c(a, "height", !0) } function c(a, b, c) { a.style[b] && (c && a.setAttribute(b, parseInt(a.style[b], 10)), a.style[b] = "") } function d(a) { if ("TD" == a.tagName || "TH" == a.tagName) return a; var b; return (b = domUtils.findParentByTagName(a, "td", !0) || domUtils.findParentByTagName(a, "th", !0)) ? b : null } function e(a) { var b = new RegExp(domUtils.fillChar, "g"); if (a[browser.ie ? "innerText" : "textContent"].replace(/^\s*$/, "").replace(b, "").length > 0) return 0; for (var c in dtd.$isNotEmpty) if (a.getElementsByTagName(c).length) return 0; return 1 } function f(a) { return a.pageX || a.pageY ? { x: a.pageX, y: a.pageY } : { x: a.clientX + N.document.body.scrollLeft - N.document.body.clientLeft, y: a.clientY + N.document.body.scrollTop - N.document.body.clientTop } } function g(b) { if (!A()) try { var c, e = d(b.target || b.srcElement); if (R && (N.body.style.webkitUserSelect = "none", (Math.abs(V.x - b.clientX) > T || Math.abs(V.y - b.clientY) > T) && (t(), R = !1, U = 0, v(b))), ca && ha) return U = 0, N.body.style.webkitUserSelect = "none", N.selection.getNative()[browser.ie9below ? "empty" : "removeAllRanges"](), c = f(b), m(N, !0, ca, c, e), void ("h" == ca ? ga.style.left = k(ha, b) + "px" : "v" == ca && (ga.style.top = l(ha, b) + "px")); if (e) { if (N.fireEvent("excludetable", e) === !0) return; c = f(b); var g = n(e, c), i = domUtils.findParentByTagName(e, "table", !0); if (j(i, e, b, !0)) { if (N.fireEvent("excludetable", i) === !0) return; N.body.style.cursor = "url(" + N.options.cursorpath + "h.png),pointer" } else if (j(i, e, b)) { if (N.fireEvent("excludetable", i) === !0) return; N.body.style.cursor = "url(" + N.options.cursorpath + "v.png),pointer" } else { N.body.style.cursor = "text"; /\d/.test(g) && (g = g.replace(/\d/, ""), e = Y(e).getPreviewCell(e, "v" == g)), m(N, !!e && !!g, e ? g : "", c, e) } } else h(!1, i, N) } catch (o) { a(o) } } function h(a, b, c) { if (a) i(b, c); else { if (fa) return; la = setTimeout(function () { !fa && ea && ea.parentNode && ea.parentNode.removeChild(ea) }, 2e3) } } function i(a, b) { function c(c, d) { clearTimeout(g), g = setTimeout(function () { b.fireEvent("tableClicked", a, d) }, 300) } function d(c) { clearTimeout(g); var d = Y(a), e = a.rows[0].cells[0], f = d.getLastCell(), h = d.getCellsRange(e, f); b.selection.getRange().setStart(e, 0).setCursor(!1, !0), d.setSelected(h) } var e = domUtils.getXY(a), f = a.ownerDocument; if (ea && ea.parentNode) return ea; ea = f.createElement("div"), ea.contentEditable = !1, ea.innerHTML = "", ea.style.cssText = "width:15px;height:15px;background-image:url(" + b.options.UEDITOR_HOME_URL + "dialogs/table/dragicon.png);position: absolute;cursor:move;top:" + (e.y - 15) + "px;left:" + e.x + "px;", domUtils.unSelectable(ea), ea.onmouseover = function (a) { fa = !0 }, ea.onmouseout = function (a) { fa = !1 }, domUtils.on(ea, "click", function (a, b) { c(b, this) }), domUtils.on(ea, "dblclick", function (a, b) { d(b) }), domUtils.on(ea, "dragstart", function (a, b) { domUtils.preventDefault(b) }); var g; f.body.appendChild(ea) } function j(a, b, c, d) { var e = f(c), g = n(b, e); if (d) { var h = a.getElementsByTagName("caption")[0], i = h ? h.offsetHeight : 0; return "v1" == g && e.y - domUtils.getXY(a).y - i < 8 } return "h1" == g && e.x - domUtils.getXY(a).x < 8 } function k(a, b) { var c = Y(a); if (c) { var d = c.getSameEndPosCells(a, "x")[0], e = c.getSameStartPosXCells(a)[0], g = f(b).x, h = (d ? domUtils.getXY(d).x : domUtils.getXY(c.table).x) + 20, i = e ? domUtils.getXY(e).x + e.offsetWidth - 20 : N.body.offsetWidth + 5 || parseInt(domUtils.getComputedStyle(N.body, "width"), 10); return h += Q, i -= Q, g < h ? h : g > i ? i : g } } function l(b, c) { try { var d = domUtils.getXY(b).y, e = f(c).y; return e < d ? d : e } catch (g) { a(g) } } function m(b, c, d, e, f) { try { b.body.style.cursor = "h" == d ? "col-resize" : "v" == d ? "row-resize" : "text", browser.ie && (!d || ia || Z(b) ? I(b) : (H(b, b.documen
var c = this.table, d = c.rows, e = [], f = "TH" === d[0].cells[0].tagName, g = 0; if (this.selectedTds.length) {
for (var h = this.cellsRange, i = h.endRowIndex + 1, j = h.beginRowIndex; j < i; j++)e[j] = d[j];
e.splice(0, h.beginRowIndex), g = h.endRowIndex + 1 === this.rowsNum ? 0 : h.endRowIndex + 1
} else for (var j = 0, i = d.length; j < i; j++)e[j] = d[j]; var k = { reversecurrent: function (a, b) { return 1 }, orderbyasc: function (a, b) { var c = a.innerText || a.textContent, d = b.innerText || b.textContent; return c.localeCompare(d) }, reversebyasc: function (a, b) { var c = a.innerHTML, d = b.innerHTML; return d.localeCompare(c) }, orderbynum: function (a, b) { var c = a[browser.ie ? "innerText" : "textContent"].match(/\d+/), d = b[browser.ie ? "innerText" : "textContent"].match(/\d+/); return c && (c = +c[0]), d && (d = +d[0]), (c || 0) - (d || 0) }, reversebynum: function (a, b) { var c = a[browser.ie ? "innerText" : "textContent"].match(/\d+/), d = b[browser.ie ? "innerText" : "textContent"].match(/\d+/); return c && (c = +c[0]), d && (d = +d[0]), (d || 0) - (c || 0) } }; c.setAttribute("data-sort-type", b && "string" == typeof b && k[b] ? b : ""), f && e.splice(0, 1), e = utils.sort(e, function (c, d) { var e; return e = b && "function" == typeof b ? b.call(this, c.cells[a], d.cells[a]) : b && "number" == typeof b ? 1 : b && "string" == typeof b && k[b] ? k[b].call(this, c.cells[a], d.cells[a]) : k.orderbyasc.call(this, c.cells[a], d.cells[a]) }); for (var l = c.ownerDocument.createDocumentFragment(), m = 0, i = e.length; m < i; m++)l.appendChild(e[m]); var n = c.getElementsByTagName("tbody")[0]; g ? n.insertBefore(l, d[g - h.endRowIndex + h.beginRowIndex - 1]) : n.appendChild(l)
}, UE.plugins.tablesort = function () { var a = this, b = UE.UETable, c = function (a) { return b.getUETable(a) }, d = function (a) { return b.getTableItemsByRange(a) }; a.ready(function () { utils.cssRule("tablesort", "table.sortEnabled tr.firstRow th,table.sortEnabled tr.firstRow td{padding-right:20px;background-repeat: no-repeat;background-position: center right; background-image:url(" + a.options.themePath + a.options.theme + "/images/sortable.png);}", a.document), a.addListener("afterexeccommand", function (a, b) { "mergeright" != b && "mergedown" != b && "mergecells" != b || this.execCommand("disablesort") }) }), UE.commands.sorttable = { queryCommandState: function () { var a = this, b = d(a); if (!b.cell) return -1; for (var c, e = b.table, f = e.getElementsByTagName("td"), g = 0; c = f[g++];)if (1 != c.rowSpan || 1 != c.colSpan) return -1; return 0 }, execCommand: function (a, b) { var e = this, f = e.selection.getRange(), g = f.createBookmark(!0), h = d(e), i = h.cell, j = c(h.table), k = j.getCellInfo(i); j.sortTable(k.cellIndex, b), f.moveToBookmark(g); try { f.select() } catch (l) { } } }, UE.commands.enablesort = UE.commands.disablesort = { queryCommandState: function (a) { var b = d(this).table; if (b && "enablesort" == a) for (var c = domUtils.getElementsByTagName(b, "th td"), e = 0; e < c.length; e++)if (c[e].getAttribute("colspan") > 1 || c[e].getAttribute("rowspan") > 1) return -1; return b ? "enablesort" == a ^ "sortEnabled" != b.getAttribute("data-sort") ? -1 : 0 : -1 }, execCommand: function (a) { var b = d(this).table; b.setAttribute("data-sort", "enablesort" == a ? "sortEnabled" : "sortDisabled"), "enablesort" == a ? domUtils.addClass(b, "sortEnabled") : domUtils.removeClasses(b, "sortEnabled") } } }, UE.plugins.contextmenu = function () { var a = this; if (a.setOpt("enableContextMenu", !0), a.getOpt("enableContextMenu") !== !1) { var b, c = a.getLang("contextMenu"), d = a.options.contextMenu || [{ label: c.selectall, cmdName: "selectall" }, { label: c.cleardoc, cmdName: "cleardoc", exec: function () { confirm(c.confirmclear) && this.execCommand("cleardoc") } }, "-", { label: c.unlink, cmdName: "unlink" }, "-", { group: c.paragraph, icon: "justifyjustify", subMenu: [{ label: c.justifyleft, cmdName: "justify", value: "left" }, { label: c.justifyright, cmdName: "justify", value: "right" }, { label: c.justifycenter, cmdName: "justify", value: "center" }, { label: c.justifyjustify, cmdName: "justify", value: "justify" }] }, "-", { group: c.table, icon: "table", subMenu: [{ label: c.inserttable, cmdName: "inserttable" }, { label: c.deletetable, cmdName: "deletetable" }, "-", { label: c.deleterow, cmdName: "deleterow" }, { label: c.deletecol, cmdName: "deletecol" }, { label: c.insertcol, cmdName: "insertcol" }, { label: c.insertcolnext, cmdName: "insertcolnext" }, { label: c.insertrow, cmdName: "insertrow" }, { label: c.insertrownext, cmdName: "insertrownext" }, "-", { label: c.insertcaption, cmdName: "insertcaption" }, { label: c.deletecaption, cmdName: "deletecaption" }, { label: c.inserttitle, cmdName: "inserttitle" }, { label: c.deletetitle, cmdName: "deletetitle" }, { label: c.inserttitlecol, cmdName: "inserttitlecol" }, { label: c.deletetitlecol, cmdName: "deletetitlecol" }, "-", { label: c.mergecells, cmdName: "mergecells" }, { label: c.mergeright, cmdName: "mergeright" }, { label: c.mergedown, cmdName: "mergedown" }, "-", { label: c.splittorows, cmdName: "splittorows" }, { label: c.splittocols, cmdName: "splittocols" }, { label: c.splittocells, cmdName: "splittocells" }, "-", { label: c.averageDiseRow, cmdName: "averagedistributerow" }, { label: c.averageDisCol, cmdName: "averagedistributecol" }, "-", { label: c.edittd, cmdName: "edittd", exec: function () { UE.ui.edittd && new UE.ui.edittd(this), this.getDialog("edittd").open() } }, { label: c.edittable, cmdName: "edittable", exec: function () { UE.ui.edittable && new UE.ui.edittable(this), this.getDialog("edittable").open() } }, { label: c.setbordervisible, cmdName: "setbordervisible" }] }, { group: c.tablesort, icon: "tablesort", subMe
function a(a) { var b = null, c = 0; if (a.rows.length < 2) return !1; if (a.rows[0].cells.length < 2) return !1; b = a.rows[0].cells, c = b.length; for (var d, e = 0; d = b[e]; e++)if ("th" !== d.tagName.toLowerCase()) return !1; for (var f, e = 1; f = a.rows[e]; e++) { if (f.cells.length != c) return !1; if ("th" !== f.cells[0].tagName.toLowerCase()) return !1; for (var d, g = 1; d = f.cells[g]; g++) { var h = utils.trim(d.innerText || d.textContent || ""); if (h = h.replace(new RegExp(UE.dom.domUtils.fillChar, "g"), "").replace(/^\s+|\s+$/g, ""), !/^\d*\.?\d+$/.test(h)) return !1 } } return !0 } var b = this; return {
bindEvents: { chartserror: function () { } }, commands: {
charts: {
execCommand: function (c, d) {
var e = domUtils.findParentByTagName(this.selection.getRange().startContainer, "table", !0), f = [], g = {}; if (!e) return !1; if (!a(e)) return b.fireEvent("chartserror"), !1; g.title = d.title || "", g.subTitle = d.subTitle || "", g.xTitle = d.xTitle || "", g.yTitle = d.yTitle || "", g.suffix = d.suffix || "", g.tip = d.tip || "", g.dataFormat = d.tableDataFormat || "", g.chartType = d.chartType || 0; for (var h in g) g.hasOwnProperty(h) && f.push(h + ":" + g[h]);
e.setAttribute("data-chart", f.join(";")), domUtils.addClass(e, "edui-charts-table")
}, queryCommandState: function (b, c) { var d = domUtils.findParentByTagName(this.selection.getRange().startContainer, "table", !0); return d && a(d) ? 0 : -1 }
}
}, inputRule: function (a) { utils.each(a.getNodesByTagName("table"), function (a) { void 0 !== a.getAttr("data-chart") && a.setAttr("style") }) }, outputRule: function (a) { utils.each(a.getNodesByTagName("table"), function (a) { void 0 !== a.getAttr("data-chart") && a.setAttr("style", "display: none;") }) }
}
}), UE.plugin.register("section", function () { function a(a) { this.tag = "", this.level = -1, this.dom = null, this.nextSection = null, this.previousSection = null, this.parentSection = null, this.startAddress = [], this.endAddress = [], this.children = [] } function b(b) { var c = new a; return utils.extend(c, b) } function c(a, b) { for (var c = b, d = 0; d < a.length; d++) { if (!c.childNodes) return null; c = c.childNodes[a[d]] } return c } var d = this; return { bindMultiEvents: { type: "aftersetcontent afterscencerestore", handler: function () { d.fireEvent("updateSections") } }, bindEvents: { ready: function () { d.fireEvent("updateSections"), domUtils.on(d.body, "drop paste", function () { d.fireEvent("updateSections") }) }, afterexeccommand: function (a, b) { "paragraph" == b && d.fireEvent("updateSections") }, keyup: function (a, b) { var c = this, d = c.selection.getRange(); if (1 != d.collapsed) c.fireEvent("updateSections"); else { var e = b.keyCode || b.which; 13 != e && 8 != e && 46 != e || c.fireEvent("updateSections") } } }, commands: { getsections: { execCommand: function (a, c) { function d(a) { for (var b = 0; b < f.length; b++)if (f[b](a)) return b; return -1 } function e(a, c) { for (var f, g, i, k = null, l = a.childNodes, m = 0, n = l.length; m < n; m++)if (i = l[m], f = d(i), f >= 0) { var o = h.selection.getRange().selectNode(i).createAddress(!0).startAddress, p = b({ tag: i.tagName, title: i.innerText || i.textContent || "", level: f, dom: i, startAddress: utils.clone(o, []), endAddress: utils.clone(o, []), children: [] }); for (j.nextSection = p, p.previousSection = j, g = j; f <= g.level;)g = g.parentSection; p.parentSection = g, g.children.push(p), k = j = p } else 1 === i.nodeType && e(i, c), k && k.endAddress[k.endAddress.length - 1]++ } for (var f = c || ["h1", "h2", "h3", "h4", "h5", "h6"], g = 0; g < f.length; g++)"string" == typeof f[g] ? f[g] = function (a) { return function (b) { return b.tagName == a.toUpperCase() } }(f[g]) : "function" != typeof f[g] && (f[g] = function (a) { return null }); var h = this, i = b({ level: -1, title: "root" }), j = i; return e(h.body, i), i }, notNeedUndo: !0 }, movesection: { execCommand: function (a, b, d, e) { function f(a, b, c) { for (var d = !1, e = !1, f = 0; f < a.length && !(f >= c.length); f++) { if (c[f] > a[f]) { d = !0; break } if (c[f] < a[f]) break } for (var f = 0; f < b.length && !(f >= c.length); f++) { if (c[f] < a[f]) { e = !0; break } if (c[f] > a[f]) break } return d && e } var g, h, i = this; if (b && d && d.level != -1 && (g = e ? d.endAddress : d.startAddress, h = c(g, i.body), g && h && !f(b.startAddress, b.endAddress, g))) { var j, k, l = c(b.startAddress, i.body), m = c(b.endAddress, i.body); if (e) for (j = m; j && !(domUtils.getPosition(l, j) & domUtils.POSITION_FOLLOWING) && (k = j.previousSibling, domUtils.insertAfter(h, j), j != l);)j = k; else for (j = l; j && !(domUtils.getPosition(j, m) & domUtils.POSITION_FOLLOWING) && (k = j.nextSibling, h.parentNode.insertBefore(j, h), j != m);)j = k; i.fireEvent("updateSections") } } }, deletesection: { execCommand: function (a, b, c) { function d(a) { for (var b = e.body, c = 0; c < a.length; c++) { if (!b.childNodes) return null; b = b.childNodes[a[c]] } return b } var e = this; if (b) { var f, g = d(b.startAddress), h = d(b.endAddress), i = g; if (c) domUtils.remove(i); else for (; i && domUtils.inDoc(h, e.document) && !(domUtils.getPosition(i, h) & domUtils.POSITION_FOLLOWING);)f = i.nextSibling, domUtils.remove(i), i = f; e.fireEvent("updateSections") } } }, selectsection: { execCommand: function (a, b) { if (!b && !b.dom) return !1; var c = this, d = c.selection.getRange(), e = { startAddress: utils.clone(b.startAddress, []), endAddress: utils.clone(b.endAddress, []) }; return e.endAddress[e.endAddress.length - 1]++, d.moveToAddress(e).select().scrollToView(), !0 }, notNeedUndo: !0 }, scrolltosection: { execCommand: function (a, b) { if (!b && !b.dom) return !1; var c = this, d = c.selection.getRange(), e = { startAddress: b.startAddress, endAddress: b.endAddress };
var a = baidu.editor.utils, b = baidu.editor.ui.Popup, c = baidu.editor.ui.TablePicker, d = baidu.editor.ui.SplitButton, e = baidu.editor.ui.TableButton = function (a) { this.initOptions(a), this.initTableButton() }; e.prototype = {
initTableButton: function () {
var a = this; this.popup = new b({
content: new c({
editor: a.editor, onpicktable: function (b, c, d) {
a._onPickTable(c, d)
}
}), editor: a.editor
}), this.initSplitButton()
}, _onPickTable: function (a, b) { this.fireEvent("picktable", a, b) !== !1 && this.popup.hide() }
}, a.inherits(e, d)
}(), function () { var a = baidu.editor.utils, b = baidu.editor.ui.UIBase, c = baidu.editor.ui.AutoTypeSetPicker = function (a) { this.initOptions(a), this.initAutoTypeSetPicker() }; c.prototype = { initAutoTypeSetPicker: function () { this.initUIBase() }, getHtmlTpl: function () { var a = this.editor, b = a.options.autotypeset, c = a.getLang("autoTypeSet"), d = "textAlignValue" + a.uid, e = "imageBlockLineValue" + a.uid, f = "symbolConverValue" + a.uid; return '<div id="##" class="edui-autotypesetpicker %%"><div class="edui-autotypesetpicker-body"><table ><tr><td nowrap><input type="checkbox" name="mergeEmptyline" ' + (b.mergeEmptyline ? "checked" : "") + ">" + c.mergeLine + '</td><td colspan="2"><input type="checkbox" name="removeEmptyline" ' + (b.removeEmptyline ? "checked" : "") + ">" + c.delLine + '</td></tr><tr><td nowrap><input type="checkbox" name="removeClass" ' + (b.removeClass ? "checked" : "") + ">" + c.removeFormat + '</td><td colspan="2"><input type="checkbox" name="indent" ' + (b.indent ? "checked" : "") + ">" + c.indent + '</td></tr><tr><td nowrap><input type="checkbox" name="textAlign" ' + (b.textAlign ? "checked" : "") + ">" + c.alignment + '</td><td colspan="2" id="' + d + '"><input type="radio" name="' + d + '" value="left" ' + (b.textAlign && "left" == b.textAlign ? "checked" : "") + ">" + a.getLang("justifyleft") + '<input type="radio" name="' + d + '" value="center" ' + (b.textAlign && "center" == b.textAlign ? "checked" : "") + ">" + a.getLang("justifycenter") + '<input type="radio" name="' + d + '" value="right" ' + (b.textAlign && "right" == b.textAlign ? "checked" : "") + ">" + a.getLang("justifyright") + '</td></tr><tr><td nowrap><input type="checkbox" name="imageBlockLine" ' + (b.imageBlockLine ? "checked" : "") + ">" + c.imageFloat + '</td><td nowrap id="' + e + '"><input type="radio" name="' + e + '" value="none" ' + (b.imageBlockLine && "none" == b.imageBlockLine ? "checked" : "") + ">" + a.getLang("default") + '<input type="radio" name="' + e + '" value="left" ' + (b.imageBlockLine && "left" == b.imageBlockLine ? "checked" : "") + ">" + a.getLang("justifyleft") + '<input type="radio" name="' + e + '" value="center" ' + (b.imageBlockLine && "center" == b.imageBlockLine ? "checked" : "") + ">" + a.getLang("justifycenter") + '<input type="radio" name="' + e + '" value="right" ' + (b.imageBlockLine && "right" == b.imageBlockLine ? "checked" : "") + ">" + a.getLang("justifyright") + '</td></tr><tr><td nowrap><input type="checkbox" name="clearFontSize" ' + (b.clearFontSize ? "checked" : "") + ">" + c.removeFontsize + '</td><td colspan="2"><input type="checkbox" name="clearFontFamily" ' + (b.clearFontFamily ? "checked" : "") + ">" + c.removeFontFamily + '</td></tr><tr><td nowrap colspan="3"><input type="checkbox" name="removeEmptyNode" ' + (b.removeEmptyNode ? "checked" : "") + ">" + c.removeHtml + '</td></tr><tr><td nowrap colspan="3"><input type="checkbox" name="pasteFilter" ' + (b.pasteFilter ? "checked" : "") + ">" + c.pasteFilter + '</td></tr><tr><td nowrap><input type="checkbox" name="symbolConver" ' + (b.bdc2sb || b.tobdc ? "checked" : "") + ">" + c.symbol + '</td><td id="' + f + '"><input type="radio" name="bdc" value="bdc2sb" ' + (b.bdc2sb ? "checked" : "") + ">" + c.bdc2sb + '<input type="radio" name="bdc" value="tobdc" ' + (b.tobdc ? "checked" : "") + ">" + c.tobdc + '</td><td nowrap align="right"><button >' + c.run + "</button></td></tr></table></div></div>" }, _UIBase_render: b.prototype.render }, a.inherits(c, b) }(), function () { function a(a) { for (var c, d = {}, e = a.getDom(), f = a.editor.uid, g = null, h = null, i = domUtils.getElementsByTagName(e, "input"), j = i.length - 1; c = i[j--];)if (g = c.getAttribute("type"), "checkbox" == g) if (h = c.getAttribute("name"), d[h] && delete d[h], c.checked) { var k = document.getElementById(h + "Value" + f); if (k) { if (/input/gi.test(k.tagName)) d[h] = k.value; else for (var l, m = k.getElementsByTagName("input"), n = m.length - 1; l = m[n--];)if (l.checked) { d[h] = l.value; break } } else d[h] = !0 } else d[h] = !1; else d[
var a = baidu.editor.utils, b = baidu.editor.ui, c = b.Dialog; b.buttons = {}, b.Dialog = function (a) { var b = new c(a); return b.addListener("hide", function () { if (b.editor) { var a = b.editor; try { if (browser.gecko) { var c = a.window.scrollY, d = a.window.scrollX; a.body.focus(), a.window.scrollTo(d, c) } else a.focus() } catch (e) { } } }), b }; for (var d, e = { anchor: "~/dialogs/anchor/anchor.html", insertimage: "~/dialogs/image/image.html", link: "~/dialogs/link/link.html", spechars: "~/dialogs/spechars/spechars.html", searchreplace: "~/dialogs/searchreplace/searchreplace.html", map: "~/dialogs/map/map.html", gmap: "~/dialogs/gmap/gmap.html", insertvideo: "~/dialogs/video/video.html", help: "~/dialogs/help/help.html", preview: "~/dialogs/preview/preview.html", emotion: "~/dialogs/emotion/emotion.html", wordimage: "~/dialogs/wordimage/wordimage.html", attachment: "~/dialogs/attachment/attachment.html", insertframe: "~/dialogs/insertframe/insertframe.html", edittip: "~/dialogs/table/edittip.html", edittable: "~/dialogs/table/edittable.html", edittd: "~/dialogs/table/edittd.html", webapp: "~/dialogs/webapp/webapp.html", snapscreen: "~/dialogs/snapscreen/snapscreen.html", scrawl: "~/dialogs/scrawl/scrawl.html", music: "~/dialogs/music/music.html", template: "~/dialogs/template/template.html", background: "~/dialogs/background/background.html", charts: "~/dialogs/charts/charts.html" }, f = ["undo", "redo", "formatmatch", "bold", "italic", "underline", "fontborder", "touppercase", "tolowercase", "strikethrough", "subscript", "superscript", "source", "indent", "outdent", "blockquote", "pasteplain", "pagebreak", "selectall", "print", "horizontal", "removeformat", "time", "date", "unlink", "insertparagraphbeforetable", "insertrow", "insertcol", "mergeright", "mergedown", "deleterow", "deletecol", "splittorows", "splittocols", "splittocells", "mergecells", "deletetable", "drafts"], g = 0; d = f[g++];)d = d.toLowerCase(), b[d] = function (a) { return function (c) { var d = new b.Button({ className: "edui-for-" + a, title: c.options.labelMap[a] || c.getLang("labelMap." + a) || "", onclick: function () { c.execCommand(a) }, theme: c.options.theme, showText: !1 }); return b.buttons[a] = d, c.addListener("selectionchange", function (b, e, f) { var g = c.queryCommandState(a); g == -1 ? (d.setDisabled(!0), d.setChecked(!1)) : f || (d.setDisabled(!1), d.setChecked(g)) }), d } }(d); b.cleardoc = function (a) { var c = new b.Button({ className: "edui-for-cleardoc", title: a.options.labelMap.cleardoc || a.getLang("labelMap.cleardoc") || "", theme: a.options.theme, onclick: function () { confirm(a.getLang("confirmClear")) && a.execCommand("cleardoc") } }); return b.buttons.cleardoc = c, a.addListener("selectionchange", function () { c.setDisabled(a.queryCommandState("cleardoc") == -1) }), c }; var h = { justify: ["left", "right", "center", "justify"], imagefloat: ["none", "left", "center", "right"], directionality: ["ltr", "rtl"] }; for (var i in h) !function (a, c) { for (var d, e = 0; d = c[e++];)!function (c) { b[a.replace("float", "") + c] = function (d) { var e = new b.Button({ className: "edui-for-" + a.replace("float", "") + c, title: d.options.labelMap[a.replace("float", "") + c] || d.getLang("labelMap." + a.replace("float", "") + c) || "", theme: d.options.theme, onclick: function () { d.execCommand(a, c) } }); return b.buttons[a] = e, d.addListener("selectionchange", function (b, f, g) { e.setDisabled(d.queryCommandState(a) == -1), e.setChecked(d.queryCommandValue(a) == c && !g) }), e } }(d) }(i, h[i]); for (var d, g = 0; d = ["backcolor", "forecolor"][g++];)b[d] = function (a) {
return function (c) {
var d = new b.ColorButton({
className: "edui-for-" + a, color: "default", title: c.options.labelMap[a] || c.getLang("labelMap." + a) || "", editor: c, onpickcolor: function (b, d) {
c.execCommand(a, d)
}, onpicknocolor: function () { c.execCommand(a, "default"), this.setColor("transparent"), this.color = "default" }, onbuttonclick: function () { c.execCommand(a, this.color) }
}); return b.buttons[a] = d, c.addListener("selectionchange", function () { d.setDisabled(c.queryCommandState(a) == -1) }), d
}
}(d); var j = { noOk: ["searchreplace", "help", "spechars", "webapp", "preview"], ok: ["attachment", "anchor", "link", "insertimage", "map", "gmap", "insertframe", "wordimage", "insertvideo", "insertframe", "edittip", "edittable", "edittd", "scrawl", "template", "music", "background", "charts"] }; for (var i in j) !function (c, d) { for (var f, g = 0; f = d[g++];)browser.opera && "searchreplace" === f || !function (d) { b[d] = function (f, g, h) { g = g || (f.options.iframeUrlMap || {})[d] || e[d], h = f.options.labelMap[d] || f.getLang("labelMap." + d) || ""; var i; g && (i = new b.Dialog(a.extend({ iframeUrl: f.ui.mapUrl(g), editor: f, className: "edui-for-" + d, title: h, holdScroll: "insertimage" === d, fullscreen: /charts|preview/.test(d), closeDialog: f.getLang("closeDialog") }, "ok" == c ? { buttons: [{ className: "edui-okbutton", label: f.getLang("ok"), editor: f, onclick: function () { i.close(!0) } }, { className: "edui-cancelbutton", label: f.getLang("cancel"), editor: f, onclick: function () { i.close(!1) } }] } : {})), f.ui._dialogs[d + "Dialog"] = i); var j = new b.Button({ className: "edui-for-" + d, title: h, onclick: function () { if (i) switch (d) { case "wordimage": var a = f.execCommand("wordimage"); a && a.length && (i.render(), i.open()); break; case "scrawl": f.queryCommandState("scrawl") != -1 && (i.render(), i.open()); break; default: i.render(), i.open() } }, theme: f.options.theme, disabled: "scrawl" == d && f.queryCommandState("scrawl") == -1 || "charts" == d }); return b.buttons[d] = j, f.addListener("selectionchange", function () { var a = { edittable: 1 }; if (!(d in a)) { var b = f.queryCommandState(d); j.getDom() && (j.setDisabled(b == -1), j.setChecked(b)) } }), j } }(f.toLowerCase()) }(i, j[i]); b.snapscreen = function (a, c, d) { d = a.options.labelMap.snapscreen || a.getLang("labelMap.snapscreen") || ""; var f = new b.Button({ className: "edui-for-snapscreen", title: d, onclick: function () { a.execCommand("snapscreen") }, theme: a.options.theme }); if (b.buttons.snapscreen = f, c = c || (a.options.iframeUrlMap || {}).snapscreen || e.snapscreen) { var g = new b.Dialog({ iframeUrl: a.ui.mapUrl(c), editor: a, className: "edui-for-snapscreen", title: d, buttons: [{ className: "edui-okbutton", label: a.getLang("ok"), editor: a, onclick: function () { g.close(!0) } }, { className: "edui-cancelbutton", label: a.getLang("cancel"), editor: a, onclick: function () { g.close(!1) } }] }); g.render(), a.ui._dialogs.snapscreenDialog = g } return a.addListener("selectionchange", function () { f.setDisabled(a.queryCommandState("snapscreen") == -1) }), f }, b.insertcode = function (c, d, e) { d = c.options.insertcode || [], e = c.options.labelMap.insertcode || c.getLang("labelMap.insertcode") || ""; var f = []; a.each(d, function (a, b) { f.push({ label: a, value: b, theme: c.options.theme, renderLabelHtml: function () { return '<div class="edui-label %%-label" >' + (this.label || "") + "</div>" } }) }); var g = new b.Combox({ editor: c, items: f, onselect: function (a, b) { c.execCommand("insertcode", this.items[b].value) }, onbuttonclick: function () { this.showPopup() }, title: e, initValue: e, className: "edui-for-insertcode", indexByValue: function (a) { if (a) for (var b, c = 0; b = this.items[c]; c++)if (b.value.indexOf(a) != -1) return c; return -1 } }); return b.buttons.insertcode = g, c.addListener("selectionchange", function (a, b, d) { if (!d) { var f = c.queryCommandState("insertcode"); if (f == -1) g.setDisabled(!0); else { g.setDisabled(!1); var h = c.queryCommandValue("insertcode"); if (!h) return void g.setValue(e); h && (h = h.replace(/['"]/g, "").split(",")[0]), g.setValue(h) } } }), g }, b.fontfamily = function (c, d, e) { if (d = c.options.fontfamily || [], e = c.options.labelMap.fontfamily || c.getLang("labelMap.fontfamily") || "", d.length) { for (var f, g = 0, h = []; f = d[g]; g++) { var i = c.getLang("fontfamily")[f.name] || ""; !function (b, d) { h.push({ label: b, value: d, theme: c.options.theme, renderLabelHtml: function () { return '<div class="edui-label %%-la
}(), function () { function a(a) { this.initOptions(a), this.initEditorUI() } var b = baidu.editor.utils, c = baidu.editor.ui.uiUtils, d = baidu.editor.ui.UIBase, e = baidu.editor.dom.domUtils, f = []; a.prototype = { uiName: "editor", initEditorUI: function () { function a(a, b) { a.setOpt({ wordCount: !0, maximumWords: 1e4, wordCountMsg: a.options.wordCountMsg || a.getLang("wordCountMsg"), wordOverFlowMsg: a.options.wordOverFlowMsg || a.getLang("wordOverFlowMsg") }); var c = a.options, d = c.maximumWords, e = c.wordCountMsg, f = c.wordOverFlowMsg, g = b.getDom("wordcount"); if (c.wordCount) { var h = a.getContentLength(!0); h > d ? (g.innerHTML = f, a.fireEvent("wordcountoverflow")) : g.innerHTML = e.replace("{#leave}", d - h).replace("{#count}", h) } } this.editor.ui = this, this._dialogs = {}, this.initUIBase(), this._initToolbars(); var b = this.editor, c = this; b.addListener("ready", function () { function d() { a(b, c), e.un(b.document, "click", arguments.callee) } b.getDialog = function (a) { return b.ui._dialogs[a + "Dialog"] }, e.on(b.window, "scroll", function (a) { baidu.editor.ui.Popup.postHide(a) }), b.ui._actualFrameWidth = b.options.initialFrameWidth, UE.browser.ie && 6 === UE.browser.version && b.container.ownerDocument.execCommand("BackgroundImageCache", !1, !0), b.options.elementPathEnabled && (b.ui.getDom("elementpath").innerHTML = '<div class="edui-editor-breadcrumb">' + b.getLang("elementPathTip") + ":</div>"), b.options.wordCount && (e.on(b.document, "click", d), b.ui.getDom("wordcount").innerHTML = b.getLang("wordCountTip")), b.ui._scale(), b.options.scaleEnabled ? (b.autoHeightEnabled && b.disableAutoHeight(), c.enableScale()) : c.disableScale(), b.options.elementPathEnabled || b.options.wordCount || b.options.scaleEnabled || (b.ui.getDom("elementpath").style.display = "none", b.ui.getDom("wordcount").style.display = "none", b.ui.getDom("scale").style.display = "none"), b.selection.isFocus() && b.fireEvent("selectionchange", !1, !0) }), b.addListener("mousedown", function (a, b) { var c = b.target || b.srcElement; baidu.editor.ui.Popup.postHide(b, c), baidu.editor.ui.ShortCutMenu.postHide(b) }), b.addListener("delcells", function () { UE.ui.edittip && new UE.ui.edittip(b), b.getDialog("edittip").open() }); var d, f, g = !1; b.addListener("afterpaste", function () { b.queryCommandState("pasteplain") || (baidu.editor.ui.PastePicker && (d = new baidu.editor.ui.Popup({ content: new baidu.editor.ui.PastePicker({ editor: b }), editor: b, className: "edui-wordpastepop" }), d.render()), g = !0) }), b.addListener("afterinserthtml", function () { clearTimeout(f), f = setTimeout(function () { if (d && (g || b.ui._isTransfer)) { if (d.isHidden()) { var a = e.createElement(b.document, "span", { style: "line-height:0px;", innerHTML: "\ufeff" }), c = b.selection.getRange(); c.insertNode(a); var f = getDomNode(a, "firstChild", "previousSibling"); f && d.showAnchor(3 == f.nodeType ? f.parentNode : f), e.remove(a) } else d.show(); delete b.ui._isTransfer, g = !1 } }, 200) }), b.addListener("contextmenu", function (a, b) { baidu.editor.ui.Popup.postHide(b) }), b.addListener("keydown", function (a, b) { d && d.dispose(b); var c = b.keyCode || b.which; b.altKey && 90 == c && UE.ui.buttons.fullscreen.onclick() }), b.addListener("wordcount", function (b) { a(this, c) }), b.addListener("selectionchange", function () { b.options.elementPathEnabled && c[(b.queryCommandState("elementpath") == -1 ? "dis" : "en") + "ableElementPath"](), b.options.scaleEnabled && c[(b.queryCommandState("scale") == -1 ? "dis" : "en") + "ableScale"]() }); var h = new baidu.editor.ui.Popup({ editor: b, content: "", className: "edui-bubble", _onEditButtonClick: function () { this.hide(), b.ui._dialogs.linkDialog.open() }, _onImgEditButtonClick: function (a) { this.hide(), b.ui._dialogs[a] && b.ui._dialogs[a].open() }, _onImgSetFloat: function (a) { this.hide(), b.execCommand("imagefloat", a) }, _setIframeAlign: function (a) { var b = h.anchorEl, c = b.cloneNode(!0); switch (a) { case -2: c.setAttribute("align", ""); break; case -1: c.setAtt
}();