{"version":3,"sources":["wangEditor.js"],"names":["global","factory","exports","module","define","amd","wangEditor","this","createElemByHTML","html","div","document","createElement","innerHTML","children","isDOMList","selector","HTMLCollection","NodeList","querySelectorAll","result","DomElement","nodeType","selectorResult","Array","replace","trim","indexOf","length","i","$","objForEach","obj","fn","key","hasOwnProperty","call","arrForEach","fakeArr","item","getRandom","prefix","Math","random","toString","slice","replaceHtmlSymbol","isFunction","Bold","editor","$elem","type","_active","DropList","menu","opt","_this","$container","$title","titleHtml","replaceLang","addClass","append","list","onClick","_emptyFn","$list","forEach","elemHtml","value","$li","on","e","hideTimeoutId","setTimeout","hide","_rendered","_show","Head","droplist","width","_command","FontSize","FontName","config","fontNames","map","fontName","Panel","Link","Italic","Redo","StrikeThrough","Underline","Undo","List","Justify","ForeColor","colors","color","BackColor","Quote","Code","Emoticon","Table","Video","Image","imgMenuId","Menus","menus","getPasteText","clipboardData","originalEvent","pasteText","window","getData","getPasteHtml","filterStyle","ignoreImg","pasteHtml","docSplitHtml","split","getPasteImgs","items","test","push","getAsFile","getChildrenJSON","childNodes","curElem","elemResult","textContent","tag","nodeName","toLowerCase","attrData","attrList","attributes","attrListLength","attr","name","attrs","Text","Command","API","_currentRange","Progress","_time","_isShow","_isRender","_timeoutId","$textContainer","$textContainerElem","$bar","UploadImg","Editor","toolbarSelector","textSelector","Error","id","editorId","customConfig","eventList","prototype","constructor","elem","clone","deep","cloneList","cloneNode","get","index","first","last","types","addEventListener","target","matches","off","removeEventListener","val","getAttribute","setAttribute","className","arr","filter","join","removeClass","css","currentStyle","style","styleArr","resultArr","show","$children","child","appendChild","remove","parent","parentElement","removeChild","isContain","$child","contains","getSizeData","getBoundingClientRect","getNodeName","find","text","focus","parentUntil","_currentElem","results","equal","insertBefore","$referenceNode","referenceNode","parentNode","insertAfter","lastChild","nextSibling","offAll","emotions","title","content","alt","src","zIndex","debug","linkCheck","link","linkImgCheck","pasteFilterStyle","pasteIgnoreImg","pasteTextHandle","showLinkImg","linkImgCallback","url","uploadImgMaxSize","uploadImgShowBase64","uploadFileName","uploadImgParams","uploadImgHeaders","withCredentials","uploadImgTimeout","uploadImgHooks","before","xhr","files","success","fail","error","timeout","qiniu","UA","_ua","navigator","userAgent","isWebkit","isIE","isSeleEmpty","selection","isSelectionEmpty","createEmptyRange","cmd","do","collapseRange","restoreSelection","tryChangeActive","queryCommandState","str","langArgs","reg","clearTimeout","$menuELem","menuHeight","height","showTimeoutId","$selectionElem","getSelectionContainerElem","$textElem","cmdValue","queryCommandValue","emptyFn","_isCreatedPanelMenus","$body","$closeBtn","$tabTitleContainer","$tabContentContainer","tabs","tabTitleArr","tabContentArr","tab","tabIndex","tpl","$content","_index","stopPropagation","events","event","$inputs","_hideOtherPanels","panel","$linkelem","createRangeByElem","_createPanel","getSelectionText","inputLinkId","inputTextId","btnOkId","btnDelId","delBtnDisplay","$link","$text","_insertLink","_delLink","selectionText","checkResult","alert","$selectionELem","$parent","$targetELem","$startElem","getSelectionStartElem","$endElem","getSelectionEndElem","$code","textId","btnId","_insertCode","_updateCode","$parentElem","tabConfig","emotData","emotType","faceHtml","$target","insertHtml","_insert","emotHtml","_createEditPanel","_createInsertPanel","btnInsertId","textRowNum","textColNum","rowNum","parseInt","colNum","r","c","_this2","addRowBtnId","addColBtnId","delRowBtnId","delColBtnId","delTableBtnId","_addRow","_addCol","_delRow","_delCol","_delTable","_getLocationData","$tr","$tds","tdLength","td","$tbody","$trs","trLength","tr","locationData","trData","$currentTr","tdData","newTr","tdIndex","$currentTd","$table","textValId","width30","width50","width100","delBtn","tabsConfig","$img","_selectedImg","uploadImg","upTriggerId","upFileId","linkUrlId","linkBtnId","$file","fileElem","click","fileList","$linkUrl","insertLinkImg","tabsConfigResult","uploadImgServer","customUploadImg","FileReader","MenuConstructors","bold","head","fontSize","italic","redo","strikeThrough","underline","undo","justify","foreColor","backColor","quote","code","emoticon","table","video","image","init","menuKey","MenuConstructor","_addToToolbar","_bindEvent","$toolbarElem","getRange","changeActive","clear","initSelection","getJSON","_saveRangeRealTime","_enterKeyHandle","_clearHandle","_pasteHandle","_tabHandle","_imgHandle","_dragHandle","saveRange","insertEmptyP","$p","pHandle","codeHandle","selectionNodeName","parentNodeName","queryCommandSupported","_willBreakCode","preventDefault","_startOffset","startOffset","codeLength","keyCode","txtHtml","canDo","now","Date","flag","pasteTime","resetTime","ex","pasteFiles","img","dataTransfer","_useStyleWithCSS","execCommand","_name","_execCommand","change","_insertHTML","range","insertNode","deleteContents","pasteHTML","_insertElem","_range","getSelection","rangeCount","getRangeAt","$containerElem","toStart","collapse","commonAncestorContainer","startContainer","endContainer","endOffset","removeAllRanges","addRange","setEnd","isContent","createRange","selectNodeContents","selectNode","progress","timeoutId","_hide","_typeof","Symbol","iterator","_alert","alertInfo","debugInfo","customAlert","onload","callback","onerror","onabort","_this3","maxSize","maxSizeM","maxLength","uploadImgMaxLength","uploadImgParamsWithUrl","hooks","resultFiles","errInfo","file","size","bind","formdata","FormData","uploadImgServerArr","uploadImgServerHash","XMLHttpRequest","open","ontimeout","upload","onprogress","percent","progressBar","lengthComputable","loaded","total","onreadystatechange","readyState","status","responseText","JSON","parse","customInsert","errno","data","beforeResult","prevent","msg","setRequestHeader","send","reader","readAsDataURL","_initConfig","Object","assign","langConfig","lang","RegExp","_initDom","$toolbarSelector","config$$1","toolbarElemId","textElemId","compositionEnd","onfocus","onblur","isFocus","isChild","isToolbar","isMenu","_initCommand","_initSelectionAPI","_initUploadImg","_initMenus","_initText","txt","newLine","$last","onChangeTimeoutId","beforeChangeHtml","onchangeTimeout","onchange","currentHtml","create","_offAllEvent","varArgs","TypeError","to","arguments","nextSource","nextKey","Element","matchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","s","ownerDocument","getElementsByTagName"],"mappings":"CAAC,SAAUA,EAAQC,GACC,gBAAZC,UAA0C,mBAAXC,QAAyBA,OAAOD,QAAUD,IAC9D,kBAAXG,SAAyBA,OAAOC,IAAMD,OAAOH,GACnDD,EAAOM,W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I,KAAO,WACb2I,EAAMjL,UALU;y9gBAMhBF,SAASukB,qBAAqB,QAAQ3iB,KAAK,GAAG6J,YAAYN,GAG9C5E,OAAO5G,YAAcqJ","file":"wangEditor.min.js","sourcesContent":["(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.wangEditor = factory());\n}(this, (function () { 'use strict';\n\n/*\n poly-fill\n*/\n\nvar polyfill = function () {\n\n // Object.assign\n if (typeof Object.assign != 'function') {\n Object.assign = function (target, varArgs) {\n // .length of function is 2\n if (target == null) {\n // TypeError if undefined or null\n throw new TypeError('Cannot convert undefined or null to object');\n }\n\n var to = Object(target);\n\n for (var index = 1; index < arguments.length; index++) {\n var nextSource = arguments[index];\n\n if (nextSource != null) {\n // Skip over if undefined or null\n for (var nextKey in nextSource) {\n // Avoid bugs when hasOwnProperty is shadowed\n if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {\n to[nextKey] = nextSource[nextKey];\n }\n }\n }\n }\n return to;\n };\n }\n\n // IE 中兼容 Element.prototype.matches\n if (!Element.prototype.matches) {\n Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) {\n var matches = (this.document || this.ownerDocument).querySelectorAll(s),\n i = matches.length;\n while (--i >= 0 && matches.item(i) !== this) {}\n return i > -1;\n };\n }\n};\n\n/*\n DOM 操作 API\n*/\n\n// 根据 html 代码片段创建 dom 对象\nfunction createElemByHTML(html) {\n var div = void 0;\n div = document.createElement('div');\n div.innerHTML = html;\n return div.children;\n}\n\n// 是否是 DOM List\nfunction isDOMList(selector) {\n if (!selector) {\n return false;\n }\n if (selector instanceof HTMLCollection || selector instanceof NodeList) {\n return true;\n }\n return false;\n}\n\n// 封装 document.querySelectorAll\nfunction querySelectorAll(selector) {\n var result = document.querySelectorAll(selector);\n if (isDOMList(result)) {\n return result;\n } else {\n return [result];\n }\n}\n\n// 记录所有的事件绑定\nvar eventList = [];\n\n// 创建构造函数\nfunction DomElement(selector) {\n if (!selector) {\n return;\n }\n\n // selector 本来就是 DomElement 对象,直接返回\n if (selector instanceof DomElement) {\n return selector;\n }\n\n this.selector = selector;\n var nodeType = selector.nodeType;\n\n // 根据 selector 得出的结果(如 DOM,DOM List)\n var selectorResult = [];\n if (nodeType === 9) {\n // document 节点\n selectorResult = [selector];\n } else if (nodeType === 1) {\n // 单个 DOM 节点\n selectorResult = [selector];\n } else if (isDOMList(selector) || selector instanceof Array) {\n // DOM List 或者数组\n selectorResult = selector;\n } else if (typeof selector === 'string') {\n // 字符串\n selector = selector.replace('/\\n/mg', '').trim();\n if (selector.indexOf('<') === 0) {\n // 如
设置标题
'),\n type: 'list', // droplist 以列表形式展示\n list: [{ $elem: $('正文
'), value: '' }],\n onClick: function onClick(value) {\n // 注意 this 是指向当前的 Head 对象\n _this._command(value);\n }\n });\n}\n\n// 原型\nHead.prototype = {\n constructor: Head,\n\n // 执行命令\n _command: function _command(value) {\n var editor = this.editor;\n\n var $selectionElem = editor.selection.getSelectionContainerElem();\n if (editor.$textElem.equal($selectionElem)) {\n // 不能选中多行来设置标题,否则会出现问题\n // 例如选中的是
xxx
yyy
来设置标题,设置之后会成为字号
'),\n type: 'list', // droplist 以列表形式展示\n list: [{ $elem: $('x-small'), value: '1' }, { $elem: $('small'), value: '2' }, { $elem: $('normal'), value: '3' }, { $elem: $('large'), value: '4' }, { $elem: $('x-large'), value: '5' }, { $elem: $('xx-large'), value: '6' }],\n onClick: function onClick(value) {\n // 注意 this 是指向当前的 FontSize 对象\n _this._command(value);\n }\n });\n}\n\n// 原型\nFontSize.prototype = {\n constructor: FontSize,\n\n // 执行命令\n _command: function _command(value) {\n var editor = this.editor;\n editor.cmd.do('fontSize', value);\n }\n};\n\n/*\n menu - fontName\n*/\n\n// 构造函数\nfunction FontName(editor) {\n var _this = this;\n\n this.editor = editor;\n this.$elem = $(' ');\n this.type = 'droplist';\n\n // 当前是否 active 状态\n this._active = false;\n\n // 获取配置的字体\n var config = editor.config;\n var fontNames = config.fontNames || [];\n\n // 初始化 droplist\n this.droplist = new DropList(this, {\n width: 100,\n $title: $('字体
'),\n type: 'list', // droplist 以列表形式展示\n list: fontNames.map(function (fontName) {\n return { $elem: $('' + fontName + ''), value: fontName };\n }),\n onClick: function onClick(value) {\n // 注意 this 是指向当前的 FontName 对象\n _this._command(value);\n }\n });\n}\n\n// 原型\nFontName.prototype = {\n constructor: FontName,\n\n _command: function _command(value) {\n var editor = this.editor;\n editor.cmd.do('fontName', value);\n }\n};\n\n/*\n panel\n*/\n\nvar emptyFn = function emptyFn() {};\n\n// 记录已经显示 panel 的菜单\nvar _isCreatedPanelMenus = [];\n\n// 构造函数\nfunction Panel(menu, opt) {\n this.menu = menu;\n this.opt = opt;\n}\n\n// 原型\nPanel.prototype = {\n constructor: Panel,\n\n // 显示(插入DOM)\n show: function show() {\n var _this = this;\n\n var menu = this.menu;\n if (_isCreatedPanelMenus.indexOf(menu) >= 0) {\n // 该菜单已经创建了 panel 不能再创建\n return;\n }\n\n var editor = menu.editor;\n var $body = $('body');\n var $textContainerElem = editor.$textContainerElem;\n var opt = this.opt;\n\n // panel 的容器\n var $container = $('');\n var width = opt.width || 300; // 默认 300px\n $container.css('width', width + 'px').css('margin-left', (0 - width) / 2 + 'px');\n\n // 添加关闭按钮\n var $closeBtn = $('');\n $container.append($closeBtn);\n $closeBtn.on('click', function () {\n _this.hide();\n });\n\n // 准备 tabs 容器\n var $tabTitleContainer = $('设置列表
'),\n type: 'list', // droplist 以列表形式展示\n list: [{ $elem: $(' 有序列表'), value: 'insertOrderedList' }, { $elem: $(' 无序列表'), value: 'insertUnorderedList' }],\n onClick: function onClick(value) {\n // 注意 this 是指向当前的 List 对象\n _this._command(value);\n }\n });\n}\n\n// 原型\nList.prototype = {\n constructor: List,\n\n // 执行命令\n _command: function _command(value) {\n var editor = this.editor;\n var $textElem = editor.$textElem;\n editor.selection.restoreSelection();\n if (editor.cmd.queryCommandState(value)) {\n return;\n }\n editor.cmd.do(value);\n\n // 验证列表是否被包裹在之内\n var $selectionElem = editor.selection.getSelectionContainerElem();\n if ($selectionElem.getNodeName() === 'LI') {\n $selectionElem = $selectionElem.parent();\n }\n if (/^ol|ul$/i.test($selectionElem.getNodeName()) === false) {\n return;\n }\n if ($selectionElem.equal($textElem)) {\n // 证明是顶级标签,没有被
包裹\n return;\n }\n var $parent = $selectionElem.parent();\n if ($parent.equal($textElem)) {\n // $parent 是顶级标签,不能删除\n return;\n }\n\n $selectionElem.insertAfter($parent);\n $parent.remove();\n },\n\n // 试图改变 active 状态\n tryChangeActive: function tryChangeActive(e) {\n var editor = this.editor;\n var $elem = this.$elem;\n if (editor.cmd.queryCommandState('insertUnOrderedList') || editor.cmd.queryCommandState('insertOrderedList')) {\n this._active = true;\n $elem.addClass('w-e-active');\n } else {\n this._active = false;\n $elem.removeClass('w-e-active');\n }\n }\n};\n\n/*\n menu - justify\n*/\n// 构造函数\nfunction Justify(editor) {\n var _this = this;\n\n this.editor = editor;\n this.$elem = $('
');\n this.type = 'droplist';\n\n // 当前是否 active 状态\n this._active = false;\n\n // 初始化 droplist\n this.droplist = new DropList(this, {\n width: 100,\n $title: $('对齐方式
'),\n type: 'list', // droplist 以列表形式展示\n list: [{ $elem: $(' 靠左'), value: 'justifyLeft' }, { $elem: $(' 居中'), value: 'justifyCenter' }, { $elem: $(' 靠右'), value: 'justifyRight' }],\n onClick: function onClick(value) {\n // 注意 this 是指向当前的 List 对象\n _this._command(value);\n }\n });\n}\n\n// 原型\nJustify.prototype = {\n constructor: Justify,\n\n // 执行命令\n _command: function _command(value) {\n var editor = this.editor;\n editor.cmd.do(value);\n }\n};\n\n/*\n menu - Forecolor\n*/\n// 构造函数\nfunction ForeColor(editor) {\n var _this = this;\n\n this.editor = editor;\n this.$elem = $(' ');\n this.type = 'droplist';\n\n // 获取配置的颜色\n var config = editor.config;\n var colors = config.colors || [];\n\n // 当前是否 active 状态\n this._active = false;\n\n // 初始化 droplist\n this.droplist = new DropList(this, {\n width: 120,\n $title: $('文字颜色
'),\n type: 'inline-block', // droplist 内容以 block 形式展示\n list: colors.map(function (color) {\n return { $elem: $(''), value: color };\n }),\n onClick: function onClick(value) {\n // 注意 this 是指向当前的 ForeColor 对象\n _this._command(value);\n }\n });\n}\n\n// 原型\nForeColor.prototype = {\n constructor: ForeColor,\n\n // 执行命令\n _command: function _command(value) {\n var editor = this.editor;\n editor.cmd.do('foreColor', value);\n }\n};\n\n/*\n menu - BackColor\n*/\n// 构造函数\nfunction BackColor(editor) {\n var _this = this;\n\n this.editor = editor;\n this.$elem = $(' ');\n this.type = 'droplist';\n\n // 获取配置的颜色\n var config = editor.config;\n var colors = config.colors || [];\n\n // 当前是否 active 状态\n this._active = false;\n\n // 初始化 droplist\n this.droplist = new DropList(this, {\n width: 120,\n $title: $('背景色
'),\n type: 'inline-block', // droplist 内容以 block 形式展示\n list: colors.map(function (color) {\n return { $elem: $(''), value: color };\n }),\n onClick: function onClick(value) {\n // 注意 this 是指向当前的 BackColor 对象\n _this._command(value);\n }\n });\n}\n\n// 原型\nBackColor.prototype = {\n constructor: BackColor,\n\n // 执行命令\n _command: function _command(value) {\n var editor = this.editor;\n editor.cmd.do('backColor', value);\n }\n};\n\n/*\n menu - quote\n*/\n// 构造函数\nfunction Quote(editor) {\n this.editor = editor;\n this.$elem = $(' ');\n this.type = 'click';\n\n // 当前是否 active 状态\n this._active = false;\n}\n\n// 原型\nQuote.prototype = {\n constructor: Quote,\n\n onClick: function onClick(e) {\n var editor = this.editor;\n var $selectionElem = editor.selection.getSelectionContainerElem();\n var nodeName = $selectionElem.getNodeName();\n\n if (!UA.isIE()) {\n if (nodeName === 'BLOCKQUOTE') {\n // 撤销 quote\n editor.cmd.do('formatBlock', '');\n } else {\n // 转换为 quote\n editor.cmd.do('formatBlock', '
');\n }\n return;\n }\n\n // IE 中不支持 formatBlock,要用其他方式兼容\n var content = void 0,\n $targetELem = void 0;\n if (nodeName === 'P') {\n // 将 P 转换为 quote\n content = $selectionElem.text();\n $targetELem = $('' + content + '');\n $targetELem.insertAfter($selectionElem);\n $selectionElem.remove();\n return;\n }\n if (nodeName === 'BLOCKQUOTE') {\n // 撤销 quote\n content = $selectionElem.text();\n $targetELem = $('' + content + '
');\n $targetELem.insertAfter($selectionElem);\n $selectionElem.remove();\n }\n },\n\n tryChangeActive: function tryChangeActive(e) {\n var editor = this.editor;\n var $elem = this.$elem;\n var reg = /^BLOCKQUOTE$/i;\n var cmdValue = editor.cmd.queryCommandValue('formatBlock');\n if (reg.test(cmdValue)) {\n this._active = true;\n $elem.addClass('w-e-active');\n } else {\n this._active = false;\n $elem.removeClass('w-e-active');\n }\n }\n};\n\n/*\n menu - code\n*/\n// 构造函数\nfunction Code(editor) {\n this.editor = editor;\n this.$elem = $(' ');\n this.type = 'panel';\n\n // 当前是否 active 状态\n this._active = false;\n}\n\n// 原型\nCode.prototype = {\n constructor: Code,\n\n onClick: function onClick(e) {\n var editor = this.editor;\n var $startElem = editor.selection.getSelectionStartElem();\n var $endElem = editor.selection.getSelectionEndElem();\n var isSeleEmpty = editor.selection.isSelectionEmpty();\n var selectionText = editor.selection.getSelectionText();\n var $code = void 0;\n\n if (!$startElem.equal($endElem)) {\n // 跨元素选择,不做处理\n editor.selection.restoreSelection();\n return;\n }\n if (!isSeleEmpty) {\n // 选取不是空,用包裹即可\n $code = $('
' + selectionText + '
');\n editor.cmd.do('insertElem', $code);\n editor.selection.createRangeByElem($code, false);\n editor.selection.restoreSelection();\n return;\n }\n\n // 选取是空,且没有夸元素选择,则插入\n if (this._active) {\n // 选中状态,将编辑内容\n this._createPanel($startElem.html());\n } else {\n // 未选中状态,将创建内容\n this._createPanel();\n }\n },\n\n _createPanel: function _createPanel(value) {\n var _this = this;\n\n // value - 要编辑的内容\n value = value || '';\n var type = !value ? 'new' : 'edit';\n var textId = getRandom('texxt');\n var btnId = getRandom('btn');\n\n var panel = new Panel(this, {\n width: 500,\n // 一个 Panel 包含多个 tab\n tabs: [{\n // 标题\n title: '插入代码',\n // 模板\n tpl: '
\\n \\n\\n',\n // 事件绑定\n events: [\n // 插入代码\n {\n selector: '#' + btnId,\n type: 'click',\n fn: function fn() {\n var $text = $('#' + textId);\n var text = $text.val() || $text.html();\n text = replaceHtmlSymbol(text);\n if (type === 'new') {\n // 新插入\n _this._insertCode(text);\n } else {\n // 编辑更新\n _this._updateCode(text);\n }\n\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }]\n } // first tab end\n ] // tabs end\n }); // new Panel end\n\n // 显示 panel\n panel.show();\n\n // 记录属性\n this.panel = panel;\n },\n\n // 插入代码\n _insertCode: function _insertCode(value) {\n var editor = this.editor;\n editor.cmd.do('insertHTML', '' + value + '
');\n },\n\n // 更新代码\n _updateCode: function _updateCode(value) {\n var editor = this.editor;\n var $selectionELem = editor.selection.getSelectionContainerElem();\n if (!$selectionELem) {\n return;\n }\n $selectionELem.html(value);\n editor.selection.restoreSelection();\n },\n\n // 试图改变 active 状态\n tryChangeActive: function tryChangeActive(e) {\n var editor = this.editor;\n var $elem = this.$elem;\n var $selectionELem = editor.selection.getSelectionContainerElem();\n if (!$selectionELem) {\n return;\n }\n var $parentElem = $selectionELem.parent();\n if ($selectionELem.getNodeName() === 'CODE' && $parentElem.getNodeName() === 'PRE') {\n this._active = true;\n $elem.addClass('w-e-active');\n } else {\n this._active = false;\n $elem.removeClass('w-e-active');\n }\n }\n};\n\n/*\n menu - emoticon\n*/\n// 构造函数\nfunction Emoticon(editor) {\n this.editor = editor;\n this.$elem = $(' ');\n this.type = 'panel';\n\n // 当前是否 active 状态\n this._active = false;\n}\n\n// 原型\nEmoticon.prototype = {\n constructor: Emoticon,\n\n onClick: function onClick() {\n this._createPanel();\n },\n\n _createPanel: function _createPanel() {\n var _this = this;\n\n var editor = this.editor;\n var config = editor.config;\n // 获取表情配置\n var emotions = config.emotions || [];\n\n // 创建表情 dropPanel 的配置\n var tabConfig = [];\n emotions.forEach(function (emotData) {\n var emotType = emotData.type;\n var content = emotData.content || [];\n\n // 这一组表情最终拼接出来的 html\n var faceHtml = '';\n\n // emoji 表情\n if (emotType === 'emoji') {\n content.forEach(function (item) {\n if (item) {\n faceHtml += '' + item + '';\n }\n });\n }\n // 图片表情\n if (emotType === 'image') {\n content.forEach(function (item) {\n var src = item.src;\n var alt = item.alt;\n if (src) {\n // 加一个 data-w-e 属性,点击图片的时候不再提示编辑图片\n faceHtml += '';\n }\n });\n }\n\n tabConfig.push({\n title: emotData.title,\n tpl: '
' + faceHtml + '',\n events: [{\n selector: 'span.w-e-item',\n type: 'click',\n fn: function fn(e) {\n var target = e.target;\n var $target = $(target);\n var nodeName = $target.getNodeName();\n\n var insertHtml = void 0;\n if (nodeName === 'IMG') {\n // 插入图片\n insertHtml = $target.parent().html();\n } else {\n // 插入 emoji\n insertHtml = '' + $target.html() + '';\n }\n\n _this._insert(insertHtml);\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }]\n });\n });\n\n var panel = new Panel(this, {\n width: 300,\n height: 200,\n // 一个 Panel 包含多个 tab\n tabs: tabConfig\n });\n\n // 显示 panel\n panel.show();\n\n // 记录属性\n this.panel = panel;\n },\n\n // 插入表情\n _insert: function _insert(emotHtml) {\n var editor = this.editor;\n editor.cmd.do('insertHTML', emotHtml);\n }\n};\n\n/*\n menu - table\n*/\n// 构造函数\nfunction Table(editor) {\n this.editor = editor;\n this.$elem = $(' ');\n this.type = 'panel';\n\n // 当前是否 active 状态\n this._active = false;\n}\n\n// 原型\nTable.prototype = {\n constructor: Table,\n\n onClick: function onClick() {\n if (this._active) {\n // 编辑现有表格\n this._createEditPanel();\n } else {\n // 插入新表格\n this._createInsertPanel();\n }\n },\n\n // 创建插入新表格的 panel\n _createInsertPanel: function _createInsertPanel() {\n var _this = this;\n\n // 用到的 id\n var btnInsertId = getRandom('btn');\n var textRowNum = getRandom('row');\n var textColNum = getRandom('col');\n\n var panel = new Panel(this, {\n width: 250,\n // panel 包含多个 tab\n tabs: [{\n // 标题\n title: '插入表格',\n // 模板\n tpl: '\\n',\n // 事件绑定\n events: [{\n // 点击按钮,插入表格\n selector: '#' + btnInsertId,\n type: 'click',\n fn: function fn() {\n var rowNum = parseInt($('#' + textRowNum).val());\n var colNum = parseInt($('#' + textColNum).val());\n\n if (rowNum && colNum && rowNum > 0 && colNum > 0) {\n // form 数据有效\n _this._insert(rowNum, colNum);\n }\n\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }]\n } // first tab end\n ] // tabs end\n }); // panel end\n\n // 展示 panel\n panel.show();\n\n // 记录属性\n this.panel = panel;\n },\n\n // 插入表格\n _insert: function _insert(rowNum, colNum) {\n // 拼接 table 模板\n var r = void 0,\n c = void 0;\n var html = '\\n \\u521B\\u5EFA\\n \\n \\u884C\\n \\n \\u5217\\u7684\\u8868\\u683C\\n
\\n \\n';\n for (r = 0; r < rowNum; r++) {\n html += '
';\n if (r === 0) {\n for (c = 0; c < colNum; c++) {\n html += ' ';\n }\n html += '';\n }\n } else {\n for (c = 0; c < colNum; c++) {\n html += ' ';\n }\n }\n html += ' ';\n\n // 执行命令\n var editor = this.editor;\n editor.cmd.do('insertHTML', html);\n\n // 防止 firefox 下出现 resize 的控制点\n editor.cmd.do('enableObjectResizing', false);\n editor.cmd.do('enableInlineTableEditing', false);\n },\n\n // 创建编辑表格的 panel\n _createEditPanel: function _createEditPanel() {\n var _this2 = this;\n\n // 可用的 id\n var addRowBtnId = getRandom('add-row');\n var addColBtnId = getRandom('add-col');\n var delRowBtnId = getRandom('del-row');\n var delColBtnId = getRandom('del-col');\n var delTableBtnId = getRandom('del-table');\n\n // 创建 panel 对象\n var panel = new Panel(this, {\n width: 320,\n // panel 包含多个 tab\n tabs: [{\n // 标题\n title: '编辑表格',\n // 模板\n tpl: '
\\n\\n ',\n // 事件绑定\n events: [{\n // 增加行\n selector: '#' + addRowBtnId,\n type: 'click',\n fn: function fn() {\n _this2._addRow();\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }, {\n // 增加列\n selector: '#' + addColBtnId,\n type: 'click',\n fn: function fn() {\n _this2._addCol();\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }, {\n // 删除行\n selector: '#' + delRowBtnId,\n type: 'click',\n fn: function fn() {\n _this2._delRow();\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }, {\n // 删除列\n selector: '#' + delColBtnId,\n type: 'click',\n fn: function fn() {\n _this2._delCol();\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }, {\n // 删除表格\n selector: '#' + delTableBtnId,\n type: 'click',\n fn: function fn() {\n _this2._delTable();\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }]\n }]\n });\n // 显示 panel\n panel.show();\n },\n\n // 获取选中的单元格的位置信息\n _getLocationData: function _getLocationData() {\n var result = {};\n var editor = this.editor;\n var $selectionELem = editor.selection.getSelectionContainerElem();\n if (!$selectionELem) {\n return;\n }\n var nodeName = $selectionELem.getNodeName();\n if (nodeName !== 'TD' && nodeName !== 'TH') {\n return;\n }\n\n // 获取 td index\n var $tr = $selectionELem.parent();\n var $tds = $tr.children();\n var tdLength = $tds.length;\n $tds.forEach(function (td, index) {\n if (td === $selectionELem[0]) {\n // 记录并跳出循环\n result.td = {\n index: index,\n elem: td,\n length: tdLength\n };\n return false;\n }\n });\n\n // 获取 tr index\n var $tbody = $tr.parent();\n var $trs = $tbody.children();\n var trLength = $trs.length;\n $trs.forEach(function (tr, index) {\n if (tr === $tr[0]) {\n // 记录并跳出循环\n result.tr = {\n index: index,\n elem: tr,\n length: trLength\n };\n return false;\n }\n });\n\n // 返回结果\n return result;\n },\n\n // 增加行\n _addRow: function _addRow() {\n // 获取当前单元格的位置信息\n var locationData = this._getLocationData();\n if (!locationData) {\n return;\n }\n var trData = locationData.tr;\n var $currentTr = $(trData.elem);\n var tdData = locationData.td;\n var tdLength = tdData.length;\n\n // 拼接即将插入的字符串\n var newTr = document.createElement('tr');\n var tpl = '',\n i = void 0;\n for (i = 0; i < tdLength; i++) {\n tpl += '';\n }\n newTr.innerHTML = tpl;\n // 插入\n $(newTr).insertAfter($currentTr);\n },\n\n // 增加列\n _addCol: function _addCol() {\n // 获取当前单元格的位置信息\n var locationData = this._getLocationData();\n if (!locationData) {\n return;\n }\n var trData = locationData.tr;\n var tdData = locationData.td;\n var tdIndex = tdData.index;\n var $currentTr = $(trData.elem);\n var $trParent = $currentTr.parent();\n var $trs = $trParent.children();\n\n // 遍历所有行\n $trs.forEach(function (tr) {\n var $tr = $(tr);\n var $tds = $tr.children();\n var $currentTd = $tds.get(tdIndex);\n var name = $currentTd.getNodeName().toLowerCase();\n\n // new 一个 td,并插入\n var newTd = document.createElement(name);\n $(newTd).insertAfter($currentTd);\n });\n },\n\n // 删除行\n _delRow: function _delRow() {\n // 获取当前单元格的位置信息\n var locationData = this._getLocationData();\n if (!locationData) {\n return;\n }\n var trData = locationData.tr;\n var $currentTr = $(trData.elem);\n $currentTr.remove();\n },\n\n // 删除列\n _delCol: function _delCol() {\n // 获取当前单元格的位置信息\n var locationData = this._getLocationData();\n if (!locationData) {\n return;\n }\n var trData = locationData.tr;\n var tdData = locationData.td;\n var tdIndex = tdData.index;\n var $currentTr = $(trData.elem);\n var $trParent = $currentTr.parent();\n var $trs = $trParent.children();\n\n // 遍历所有行\n $trs.forEach(function (tr) {\n var $tr = $(tr);\n var $tds = $tr.children();\n var $currentTd = $tds.get(tdIndex);\n // 删除\n $currentTd.remove();\n });\n },\n\n // 删除表格\n _delTable: function _delTable() {\n var editor = this.editor;\n var $selectionELem = editor.selection.getSelectionContainerElem();\n if (!$selectionELem) {\n return;\n }\n var $table = $selectionELem.parentUntil('table');\n if (!$table) {\n return;\n }\n $table.remove();\n },\n\n // 试图改变 active 状态\n tryChangeActive: function tryChangeActive(e) {\n var editor = this.editor;\n var $elem = this.$elem;\n var $selectionELem = editor.selection.getSelectionContainerElem();\n if (!$selectionELem) {\n return;\n }\n var nodeName = $selectionELem.getNodeName();\n if (nodeName === 'TD' || nodeName === 'TH') {\n this._active = true;\n $elem.addClass('w-e-active');\n } else {\n this._active = false;\n $elem.removeClass('w-e-active');\n }\n }\n};\n\n/*\n menu - video\n*/\n// 构造函数\nfunction Video(editor) {\n this.editor = editor;\n this.$elem = $(' ');\n this.type = 'panel';\n\n // 当前是否 active 状态\n this._active = false;\n}\n\n// 原型\nVideo.prototype = {\n constructor: Video,\n\n onClick: function onClick() {\n this._createPanel();\n },\n\n _createPanel: function _createPanel() {\n var _this = this;\n\n // 创建 id\n var textValId = getRandom('text-val');\n var btnId = getRandom('btn');\n\n // 创建 panel\n var panel = new Panel(this, {\n width: 350,\n // 一个 panel 多个 tab\n tabs: [{\n // 标题\n title: '插入视频',\n // 模板\n tpl: ' \\n \"/>\\n',\n // 事件绑定\n events: [{\n selector: '#' + btnId,\n type: 'click',\n fn: function fn() {\n var $text = $('#' + textValId);\n var val = $text.val().trim();\n\n // 测试用视频地址\n // \n\n if (val) {\n // 插入视频\n _this._insert(val);\n }\n\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }]\n } // first tab end\n ] // tabs end\n }); // panel end\n\n // 显示 panel\n panel.show();\n\n // 记录属性\n this.panel = panel;\n },\n\n // 插入视频\n _insert: function _insert(val) {\n var editor = this.editor;\n editor.cmd.do('insertHTML', val + ' \\n');\n }\n};\n\n/*\n menu - img\n*/\n// 构造函数\nfunction Image(editor) {\n this.editor = editor;\n var imgMenuId = getRandom('w-e-img');\n this.$elem = $(' ');\n editor.imgMenuId = imgMenuId;\n this.type = 'panel';\n\n // 当前是否 active 状态\n this._active = false;\n}\n\n// 原型\nImage.prototype = {\n constructor: Image,\n\n onClick: function onClick() {\n var editor = this.editor;\n var config = editor.config;\n if (config.qiniu) {\n return;\n }\n if (this._active) {\n this._createEditPanel();\n } else {\n this._createInsertPanel();\n }\n },\n\n _createEditPanel: function _createEditPanel() {\n var editor = this.editor;\n\n // id\n var width30 = getRandom('width-30');\n var width50 = getRandom('width-50');\n var width100 = getRandom('width-100');\n var delBtn = getRandom('del-btn');\n\n // tab 配置\n var tabsConfig = [{\n title: '编辑图片',\n tpl: '
\\n\\n ',\n events: [{\n selector: '#' + width30,\n type: 'click',\n fn: function fn() {\n var $img = editor._selectedImg;\n if ($img) {\n $img.css('max-width', '30%');\n }\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }, {\n selector: '#' + width50,\n type: 'click',\n fn: function fn() {\n var $img = editor._selectedImg;\n if ($img) {\n $img.css('max-width', '50%');\n }\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }, {\n selector: '#' + width100,\n type: 'click',\n fn: function fn() {\n var $img = editor._selectedImg;\n if ($img) {\n $img.css('max-width', '100%');\n }\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }, {\n selector: '#' + delBtn,\n type: 'click',\n fn: function fn() {\n var $img = editor._selectedImg;\n if ($img) {\n $img.remove();\n }\n // 返回 true,表示该事件执行完之后,panel 要关闭。否则 panel 不会关闭\n return true;\n }\n }]\n }];\n\n // 创建 panel 并显示\n var panel = new Panel(this, {\n width: 300,\n tabs: tabsConfig\n });\n panel.show();\n\n // 记录属性\n this.panel = panel;\n },\n\n _createInsertPanel: function _createInsertPanel() {\n var editor = this.editor;\n var uploadImg = editor.uploadImg;\n var config = editor.config;\n\n // id\n var upTriggerId = getRandom('up-trigger');\n var upFileId = getRandom('up-file');\n var linkUrlId = getRandom('link-url');\n var linkBtnId = getRandom('link-btn');\n\n // tabs 的配置\n var tabsConfig = [{\n title: '上传图片',\n tpl: '\\n',\n events: [{\n // 触发选择图片\n selector: '#' + upTriggerId,\n type: 'click',\n fn: function fn() {\n var $file = $('#' + upFileId);\n var fileElem = $file[0];\n if (fileElem) {\n fileElem.click();\n } else {\n // 返回 true 可关闭 panel\n return true;\n }\n }\n }, {\n // 选择图片完毕\n selector: '#' + upFileId,\n type: 'change',\n fn: function fn() {\n var $file = $('#' + upFileId);\n var fileElem = $file[0];\n if (!fileElem) {\n // 返回 true 可关闭 panel\n return true;\n }\n\n // 获取选中的 file 对象列表\n var fileList = fileElem.files;\n if (fileList.length) {\n uploadImg.uploadImg(fileList);\n }\n\n // 返回 true 可关闭 panel\n return true;\n }\n }]\n }, // first tab end\n {\n title: '网络图片',\n tpl: '\\n \\n\\n \\n\\n \\n',\n events: [{\n selector: '#' + linkBtnId,\n type: 'click',\n fn: function fn() {\n var $linkUrl = $('#' + linkUrlId);\n var url = $linkUrl.val().trim();\n\n if (url) {\n uploadImg.insertLinkImg(url);\n }\n\n // 返回 true 表示函数执行结束之后关闭 panel\n return true;\n }\n }]\n } // second tab end\n ]; // tabs end\n\n // 判断 tabs 的显示\n var tabsConfigResult = [];\n if ((config.uploadImgShowBase64 || config.uploadImgServer || config.customUploadImg) && window.FileReader) {\n // 显示“上传图片”\n tabsConfigResult.push(tabsConfig[0]);\n }\n if (config.showLinkImg) {\n // 显示“网络图片”\n tabsConfigResult.push(tabsConfig[1]);\n }\n\n // 创建 panel 并显示\n var panel = new Panel(this, {\n width: 300,\n tabs: tabsConfigResult\n });\n panel.show();\n\n // 记录属性\n this.panel = panel;\n },\n\n // 试图改变 active 状态\n tryChangeActive: function tryChangeActive(e) {\n var editor = this.editor;\n var $elem = this.$elem;\n if (editor._selectedImg) {\n this._active = true;\n $elem.addClass('w-e-active');\n } else {\n this._active = false;\n $elem.removeClass('w-e-active');\n }\n }\n};\n\n/*\n 所有菜单的汇总\n*/\n\n// 存储菜单的构造函数\nvar MenuConstructors = {};\n\nMenuConstructors.bold = Bold;\n\nMenuConstructors.head = Head;\n\nMenuConstructors.fontSize = FontSize;\n\nMenuConstructors.fontName = FontName;\n\nMenuConstructors.link = Link;\n\nMenuConstructors.italic = Italic;\n\nMenuConstructors.redo = Redo;\n\nMenuConstructors.strikeThrough = StrikeThrough;\n\nMenuConstructors.underline = Underline;\n\nMenuConstructors.undo = Undo;\n\nMenuConstructors.list = List;\n\nMenuConstructors.justify = Justify;\n\nMenuConstructors.foreColor = ForeColor;\n\nMenuConstructors.backColor = BackColor;\n\nMenuConstructors.quote = Quote;\n\nMenuConstructors.code = Code;\n\nMenuConstructors.emoticon = Emoticon;\n\nMenuConstructors.table = Table;\n\nMenuConstructors.video = Video;\n\nMenuConstructors.image = Image;\n\n/*\n 菜单集合\n*/\n// 构造函数\nfunction Menus(editor) {\n this.editor = editor;\n this.menus = {};\n}\n\n// 修改原型\nMenus.prototype = {\n constructor: Menus,\n\n // 初始化菜单\n init: function init() {\n var _this = this;\n\n var editor = this.editor;\n var config = editor.config || {};\n var configMenus = config.menus || []; // 获取配置中的菜单\n\n // 根据配置信息,创建菜单\n configMenus.forEach(function (menuKey) {\n var MenuConstructor = MenuConstructors[menuKey];\n if (MenuConstructor && typeof MenuConstructor === 'function') {\n // 创建单个菜单\n _this.menus[menuKey] = new MenuConstructor(editor);\n }\n });\n\n // 添加到菜单栏\n this._addToToolbar();\n\n // 绑定事件\n this._bindEvent();\n },\n\n // 添加到菜单栏\n _addToToolbar: function _addToToolbar() {\n var editor = this.editor;\n var $toolbarElem = editor.$toolbarElem;\n var menus = this.menus;\n var config = editor.config;\n // config.zIndex 是配置的编辑区域的 z-index,菜单的 z-index 得在其基础上 +1\n var zIndex = config.zIndex + 1;\n objForEach(menus, function (key, menu) {\n var $elem = menu.$elem;\n if ($elem) {\n // 设置 z-index\n $elem.css('z-index', zIndex);\n $toolbarElem.append($elem);\n }\n });\n },\n\n // 绑定菜单 click mouseenter 事件\n _bindEvent: function _bindEvent() {\n var menus = this.menus;\n var editor = this.editor;\n objForEach(menus, function (key, menu) {\n var type = menu.type;\n if (!type) {\n return;\n }\n var $elem = menu.$elem;\n var droplist = menu.droplist;\n var panel = menu.panel;\n\n // 点击类型,例如 bold\n if (type === 'click' && menu.onClick) {\n $elem.on('click', function (e) {\n if (editor.selection.getRange() == null) {\n return;\n }\n menu.onClick(e);\n });\n }\n\n // 下拉框,例如 head\n if (type === 'droplist' && droplist) {\n $elem.on('mouseenter', function (e) {\n if (editor.selection.getRange() == null) {\n return;\n }\n // 显示\n droplist.showTimeoutId = setTimeout(function () {\n droplist.show();\n }, 200);\n }).on('mouseleave', function (e) {\n // 隐藏\n droplist.hideTimeoutId = setTimeout(function () {\n droplist.hide();\n }, 0);\n });\n }\n\n // 弹框类型,例如 link\n if (type === 'panel' && menu.onClick) {\n $elem.on('click', function (e) {\n e.stopPropagation();\n if (editor.selection.getRange() == null) {\n return;\n }\n // 在自定义事件中显示 panel\n menu.onClick(e);\n });\n }\n });\n },\n\n // 尝试修改菜单状态\n changeActive: function changeActive() {\n var menus = this.menus;\n objForEach(menus, function (key, menu) {\n if (menu.tryChangeActive) {\n setTimeout(function () {\n menu.tryChangeActive();\n }, 100);\n }\n });\n }\n};\n\n/*\n 粘贴信息的处理\n*/\n\n// 获取粘贴的纯文本\nfunction getPasteText(e) {\n var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData;\n var pasteText = void 0;\n if (clipboardData == null) {\n pasteText = window.clipboardData && window.clipboardData.getData('text');\n } else {\n pasteText = clipboardData.getData('text/plain');\n }\n\n return replaceHtmlSymbol(pasteText);\n}\n\n// 获取粘贴的html\nfunction getPasteHtml(e, filterStyle, ignoreImg) {\n var clipboardData = e.clipboardData || e.originalEvent && e.originalEvent.clipboardData;\n var pasteText = void 0,\n pasteHtml = void 0;\n if (clipboardData == null) {\n pasteText = window.clipboardData && window.clipboardData.getData('text');\n } else {\n pasteText = clipboardData.getData('text/plain');\n pasteHtml = clipboardData.getData('text/html');\n }\n if (!pasteHtml && pasteText) {\n pasteHtml = ' \\n' + replaceHtmlSymbol(pasteText) + '
';\n }\n if (!pasteHtml) {\n return;\n }\n\n // 过滤word中状态过来的无用字符\n var docSplitHtml = pasteHtml.split('