diff --git a/bower.json b/bower.json index 4093b4056..f02dea58e 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "suneditor", - "version": "2.2.3", + "version": "2.2.4", "description": "Pure JavaScript based WYSIWYG web editor", "main": "src/suneditor.js", "keywords": [ diff --git a/dist/suneditor.min.js b/dist/suneditor.min.js index 5f8f12c81..42c969e7a 100644 --- a/dist/suneditor.min.js +++ b/dist/suneditor.min.js @@ -1 +1 @@ -!function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s="XJR1")}({"0A7J":function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"fontColor",add:function(core,targetElement){let listDiv=eval(this.setSubmenu());listDiv.getElementsByTagName("UL")[0].addEventListener("click",this.pickUp.bind(core)),targetElement.parentNode.appendChild(listDiv),listDiv=null},setSubmenu:function(){const e=document.createElement("DIV");e.className="layer_editor",e.style.display="none";const t=["#ff0000","#ff5e00","#ffe400","#abf200","#00d8ff","#0055ff","#6600ff","#ff00dd","#000000","#ffd8d8","#fae0d4","#faf4c0","#e4f7ba","#d4f4fa","#d9e5ff","#e8d9ff","#ffd9fa","#ffffff","#ffa7a7","#ffc19e","#faed7d","#cef279","#b2ebf4","#b2ccff","#d1b2ff","#ffb2f5","#bdbdbd","#f15f5f","#f29661","#e5d85c","#bce55c","#5cd1e5","#6699ff","#a366ff","#f261df","#8c8c8c","#980000","#993800","#998a00","#6b9900","#008299","#003399","#3d0099","#990085","#353535","#670000","#662500","#665c00","#476600","#005766","#002266","#290066","#660058","#222222"];let i='
",e.innerHTML=i,e},pickUp:function(e){if(e.preventDefault(),e.stopPropagation(),!/^BUTTON$/i.test(e.target.tagName))return!1;this.focus();const t=document.createElement("SPAN");t.style.color=e.target.getAttribute("data-value"),this.wrapRangeToTag(t,["color"]),this.submenuOff(),this.focus()}}},"1kvd":function(e,t,i){"use strict";t.a={name:"dialog",add:function(e){const t=e.context;t.dialog={};let i=document.createElement("DIV");i.className="sun-editor-id-dialogBox sun-editor-common";let n=document.createElement("DIV");n.className="modal-dialog-background sun-editor-id-dialog-back",n.style.display="none";let o=document.createElement("DIV");o.className="modal-dialog sun-editor-id-dialog-modal",o.style.display="none",i.appendChild(n),i.appendChild(o),t.dialog.modalArea=i,t.dialog.back=n,t.dialog.modal=o,t.dialog.modal.addEventListener("click",this.onClick_dialog.bind(e)),t.element.topArea.getElementsByClassName("sun-editor-container")[0].appendChild(i),i=null,n=null,o=null},onClick_dialog:function(e){e.stopPropagation(),(/modal-dialog/.test(e.target.className)||/close/.test(e.target.getAttribute("data-command")))&&this.plugins.dialog.closeDialog.call(this)},openDialog:function(e,t,i){if(this.modalForm)return!1;this.context.dialog.updateModal=i,this.context.dialog.modalArea.style.position="full"===t?"fixed":"absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const n=this.context[e].focusElement;this.context.dialog.modalArea.style.display="block",this.context.dialog.back.style.display="block",this.context.dialog.modal.style.display="block",this.modalForm.style.display="block",n&&n.focus()},closeDialog:function(){this.modalForm.style.display="none",this.context.dialog.back.style.display="none",this.context.dialog.modalArea.style.display="none",this.modalForm=null,this.context.dialog.updateModal=!1,this.plugins[this.context.dialog.kind].init.call(this)}}},"33yf":function(e,t,i){(function(e){function i(e,t){for(var i=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),i++):i&&(e.splice(n,1),i--)}if(t)for(;i--;i)e.unshift("..");return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,o=function(e){return n.exec(e).slice(1)};function l(e,t){if(e.filter)return e.filter(t);for(var i=[],n=0;n=-1&&!n;o--){var s=o>=0?arguments[o]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(t=s+"/"+t,n="/"===s.charAt(0))}return t=i(l(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),o="/"===s(e,-1);return(e=i(l(e.split("/"),function(e){return!!e}),!n).join("/"))||n||(e="."),e&&o&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(l(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,i){function n(e){for(var t=0;t=0&&""===e[i];i--);return t>i?[]:e.slice(t,i-t+1)}e=t.resolve(e).substr(1),i=t.resolve(i).substr(1);for(var o=n(e.split("/")),l=n(i.split("/")),s=Math.min(o.length,l.length),a=s,r=0;r";return a+=" ",a+="",t.innerHTML=a,t},pickup:function(e){if(!/^BUTTON$/i.test(e.target.tagName))return!1;e.preventDefault(),e.stopPropagation();const t=e.target;this.focus(),this.util.changeTxt(this.context.tool.font,t.getAttribute("data-txt"));const i=document.createElement("SPAN");i.style.fontFamily=t.getAttribute("data-value"),this.wrapRangeToTag(i,["font-family"]),this.submenuOff(),this.focus()}}},"8oxB":function(e,t){var i,n,o=e.exports={};function l(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(i===setTimeout)return setTimeout(e,0);if((i===l||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:l}catch(e){i=l}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var r,d=[],c=!1,u=-1;function m(){c&&r&&(c=!1,r.length?d=r.concat(d):u=-1,d.length&&g())}function g(){if(!c){var e=a(m);c=!0;for(var t=d.length;t;){for(r=d,d=[];++u1)for(var i=1;i
",i.innerHTML=n,i},openTab:function(e){const t="init"===e?document.getElementsByClassName("sun-editor-id-tab-link")[0]:e.target;if(!/^BUTTON$/i.test(t.tagName))return!1;const i=t.getAttribute("data-tab-link");let n,o,l;for(o=document.getElementsByClassName("sun-editor-id-tab-content"),n=0;n0){const t=this.context.user.imageUploadUrl,i=this.context.dialog.updateModal?1:e.length;if(null!==t&&t.length>0){const n=new FormData;for(let t=0;t0?1:result.length;e0){const n=document.createElement("A");return n.href=/^https?:\/\//.test(t)?t:"http://"+t,n.target=i?"_blank":"",n.setAttribute("data-image-link","image"),n.addEventListener("click",function(e){e.preventDefault()}),e.setAttribute("data-image-link",t),n.appendChild(e),n}return e},setInputSize:function(e){this.context.dialog.updateModal&&this.context.image.proportion.checked&&("x"===e?this.context.image.imageY.value=Math.round(this.context.image._element_h/this.context.image._element_w*this.context.image.imageX.value):this.context.image.imageX.value=Math.round(this.context.image._element_w/this.context.image._element_h*this.context.image.imageY.value))},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation(),this.context.image._linkValue=this.context.image.imgLink.value,this.context.image._altText=this.context.image.altText.value,this.context.image._align=this.context.image.modal.querySelector('input[name="suneditor_image_radio"]:checked').value,this.context.image._captionChecked=this.context.image.caption.checked,this.context.image._proportionChecked=this.context.image.proportion.checked;try{this.context.dialog.updateModal?this.plugins.image.update_image.call(this):(this.plugins.image.onRender_imgInput.call(this),this.plugins.image.onRender_imgUrl.call(this))}finally{this.plugins.dialog.closeDialog.call(this),this.closeLoading()}return this.focus(),!1},create_caption:function(){const e=document.createElement("FIGCAPTION");return e.innerHTML="

"+this.lang.dialogBox.imageBox.caption+"

",e.addEventListener("click",this.plugins.image.toggle_caption_contenteditable.bind(this,!0)),e},set_cover:function(e){const t=document.createElement("FIGURE");return t.className="sun-editor-image-cover",t.appendChild(e),t},set_container:function(e){const t=document.createElement("DIV");return t.className="sun-editor-id-media-container sun-editor-id-image-container",t.setAttribute("contenteditable",!1),t.appendChild(e),t},create_image:function(e,t,i,n,o,l){if(l)return void(this.context.image._element.src=e);let s=document.createElement("IMG");s.src=e,s.style.width=n,s.setAttribute("data-align",o),s.setAttribute("data-proportion",this.context.image._proportionChecked),s.alt=this.context.image._altText,s=this.plugins.image.onRender_link(s,t,i);const a=this.plugins.image.set_cover.call(this,s),r=this.plugins.image.set_container.call(this,a);this.context.image._captionChecked&&(this.context.image._imageCaption=this.plugins.image.create_caption.call(this),this.context.image._imageCaption.setAttribute("contenteditable",!1),a.appendChild(this.context.image._imageCaption)),"center"!==o&&(r.style.display="inline-block",this.util.removeClass(r,this.context.image._floatClassRegExp),this.util.addClass(r,"float-"+o)),this.insertNode(r,this.util.getFormatElement(this.getSelectionNode())),this.appendP(r)},update_image:function(){const e=this.context.image,t=e._linkValue;let i=this.util.getParentElement(e._element,".sun-editor-image-cover"),n=this.util.getParentElement(e._element,".sun-editor-id-image-container"),o=!1;if(null===i&&(o=!0,i=this.plugins.image.set_cover.call(this,e._element.cloneNode(!0))),null===n?(o=!0,n=this.plugins.image.set_container.call(this,i.cloneNode(!0))):o&&(n.innerHTML="",n.appendChild(i)),this.plugins.image.onRender_imgInput.call(this),e._element.src=e.imgUrlFile.value,e._element.alt=e._altText,e._element.setAttribute("data-proportion",e._proportionChecked),e._element.style.width=e.imageX.value+"px",e._element.style.height=e.imageY.value+"px",e._captionChecked?null===e._imageCaption&&(e._imageCaption=this.plugins.image.create_caption.call(this),i.appendChild(e._imageCaption)):e._imageCaption&&this.util.removeItem(e._imageCaption),"center"!==e._align?(n.style.display="inline-block",this.util.removeClass(n,this.context.image._floatClassRegExp),this.util.addClass(n,"float-"+e._align)):(n.style.display="",this.util.removeClass(n,this.context.image._floatClassRegExp),this.util.addClass(n,"float-none")),e._element.setAttribute("data-align",e._align),t.trim().length>0)if(null!==e._linkElement)e._linkElement.href=t,e._linkElement.target=e.imgLinkNewWindowCheck.checked?"_blank":"",e._element.setAttribute("data-image-link",t);else{let n=this.plugins.image.onRender_link(e._element.cloneNode(!0),t,this.context.image.imgLinkNewWindowCheck.checked);i.removeChild(e._element),i.insertBefore(n,e._imageCaption)}else if(null!==e._linkElement){const t=e._element;t.setAttribute("data-image-link","");let n=t.cloneNode(!0);i.removeChild(e._linkElement),i.insertBefore(n,e._imageCaption)}if(o){const t=this.util.getFormatElement(e._element);t.parentNode.insertBefore(n,t),this.util.removeItem(t)}},toggle_caption_contenteditable:function(e,t){this.context.image._onCaption=e,this.context.image._imageCaption.setAttribute("contenteditable",e),this.context.image._imageCaption.focus()},sizeRevert:function(){const e=this.context.image;e._origin_w&&(e.imageX.value=e._element_w=e._origin_w,e.imageY.value=e._element_h=e._origin_h)},onModifyMode:function(e,t){const i=this.context.image;i._linkElement=/^A$/i.test(e.parentNode.nodeName)?e.parentNode:null,i._element=i._resize_element=e,i._imageCaption=i._linkElement?i._linkElement.nextSibling:e.nextSibling,i._element_w=t.w,i._element_h=t.h,i._element_t=t.t,i._element_l=t.l;let n=i._element.getAttribute("data-origin");n?(n=n.split(","),i._origin_w=1*n[0],i._origin_h=1*n[1]):(i._origin_w=t.w,i._origin_h=t.h,i._element.setAttribute("data-origin",t.w+","+t.h))},openModify:function(){const e=this.context.image;e.imgUrlFile.value=e._element.src,e.altText.value=e._element.alt,e.imgLink.value=null===e._linkElement?"":e._linkElement.href,e.imgLinkNewWindowCheck.checked=e._linkElement&&"_blank"===e._linkElement.target,e.modal.querySelector("#suneditor_image_radio_"+(e._element.getAttribute("data-align")||"none")).checked=!0,e._captionChecked=e.caption.checked=!!e._imageCaption,e.proportion.checked=e._proportionChecked="true"===e._element.getAttribute("data-proportion"),e.imageX.value=e._element.offsetWidth,e.imageY.value=e._element.offsetHeight,e.imageY.disabled=!1,e.proportion.disabled=!1,this.plugins.dialog.openDialog.call(this,"image",null,!0)},setSize:function(e,t){this.context.image._resize_element.style.width=e,this.context.image._resize_element.style.height=t},destroy:function(){const e=this.util.getParentElement(this.context.image._element,".sun-editor-id-image-container")||this.context.image._element;this.util.removeItem(e),this.plugins.image.init.call(this)},init:function(){const e=this.context.image;e.imgInputFile.value="",e.imgUrlFile.value="",e.altText.value="",e.imgLink.value="",e.imgLinkNewWindowCheck.checked=!1,e.modal.querySelector("#suneditor_image_radio_none").checked=!0,e.caption.checked=!1,e.proportion.checked=!1,e.imageX.value=this.context.user.imageSize,e.imageY.value="",e.imageY.disabled=!0,e.proportion.disabled=!0,e._element=null,this.plugins.image.openTab.call(this,"init")}}},MIhV:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"fontSize",add:function(core,targetElement){let listDiv=eval(this.setSubmenu(core.context.user));listDiv.getElementsByTagName("UL")[0].addEventListener("click",this.pickup.bind(core)),targetElement.parentNode.appendChild(listDiv),listDiv=null},setSubmenu:function(e){const t=document.createElement("DIV");t.className="layer_editor layer_size",t.style.display="none";const i=e.fontSize?e.fontSize:[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72];let n='
    ';for(let e=0,t=i.length;e"}return n+="
",t.innerHTML=n,t},pickup:function(e){if(e.preventDefault(),e.stopPropagation(),!/^BUTTON$/i.test(e.target.tagName))return!1;this.focus(),this.util.changeTxt(this.context.tool.fontSize,e.target.getAttribute("data-value"));const t=document.createElement("SPAN");t.style.fontSize=e.target.getAttribute("data-value")+"px",this.wrapRangeToTag(t,["font-size"]),this.submenuOff(),this.focus()}}},Rp48:function(module,__webpack_exports__,__webpack_require__){"use strict";var _modules_dialog__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("1kvd");__webpack_exports__.a={name:"link",add:function(core){core.addModule([_modules_dialog__WEBPACK_IMPORTED_MODULE_0__.a]);const context=core.context;context.link={};let link_dialog=eval(this.setDialog(core.lang));context.link.modal=link_dialog,context.link.focusElement=link_dialog.getElementsByClassName("sun-editor-id-link-url")[0],context.link.linkAnchorText=link_dialog.getElementsByClassName("sun-editor-id-link-text")[0],context.link.linkNewWindowCheck=link_dialog.getElementsByClassName("sun-editor-id-link-check")[0];let link_button=eval(this.setController_LinkButton(core.lang));context.link.linkBtn=link_button,context.link._linkAnchor=null,link_dialog.getElementsByClassName("btn-primary")[0].addEventListener("click",this.submit.bind(core)),link_button.addEventListener("click",this.onClick_linkBtn.bind(core)),context.dialog.modal.appendChild(link_dialog),context.element.relative.appendChild(link_button),link_dialog=null,link_button=null},setDialog:function(e){const t=document.createElement("DIV");return t.className="modal-content sun-editor-id-dialog-link",t.style.display="none",t.innerHTML='",t},setController_LinkButton:function(e){const t=document.createElement("DIV");return t.className="sun-editor-id-link-btn",t.style.display="none",t.innerHTML='
',t},submit:function(e){this.showLoading(),e.preventDefault(),e.stopPropagation();try{(function(){if(0===this.context.link.focusElement.value.trim().length)return!1;const e=/^https?:\/\//.test(this.context.link.focusElement.value)?this.context.link.focusElement.value:"http://"+this.context.link.focusElement.value,t=this.context.link.linkAnchorText||this.context.dialog.document.getElementById("linkAnchorText"),i=0===t.value.length?e:t.value;if(this.context.dialog.updateModal)this.context.link._linkAnchor.href=e,this.context.link._linkAnchor.textContent=i,this.context.link._linkAnchor.target=this.context.link.linkNewWindowCheck.checked?"_blank":"",this.setRange(this.context.link._linkAnchor.childNodes[0],0,this.context.link._linkAnchor.childNodes[0],this.context.link._linkAnchor.textContent.length);else{const t=document.createElement("A");t.href=e,t.textContent=i,t.target=this.context.link.linkNewWindowCheck.checked?"_blank":"",this.insertNode(t),this.setRange(t.childNodes[0],0,t.childNodes[0],t.textContent.length)}this.context.link.focusElement.value="",this.context.link.linkAnchorText.value=""}).call(this)}finally{this.plugins.dialog.closeDialog.call(this),this.closeLoading(),this.focus()}return!1},call_controller_linkButton:function(e){this.editLink=this.context.link._linkAnchor=e;const t=this.context.link.linkBtn;t.getElementsByTagName("A")[0].href=e.href,t.getElementsByTagName("A")[0].textContent=e.textContent;const i=this.util.getOffset(e);t.style.left=i.left+"px",t.style.top=i.top+e.offsetHeight+10+"px",t.style.display="block",this.controllerArray=[t]},onClick_linkBtn:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/update/.test(t)?(this.context.link.focusElement.value=this.context.link._linkAnchor.href,this.context.link.linkAnchorText.value=this.context.link._linkAnchor.textContent,this.context.link.linkNewWindowCheck.checked=!!/_blank/i.test(this.context.link._linkAnchor.target),this.plugins.dialog.openDialog.call(this,"link",null,!0)):(this.util.removeItem(this.context.link._linkAnchor),this.context.link._linkAnchor=null,this.focus()),this.controllersOff())},init:function(){const e=this.context.link;e.linkBtn.style.display="none",e._linkAnchor=null,e.focusElement.value="",e.linkAnchorText.value="",e.linkNewWindowCheck.checked=!1}}},VquE:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"table",add:function(core,targetElement){const context=core.context;context.table={_element:null,_tdElement:null,_trElement:null,_trElements:null,_tdIndex:0,_trIndex:0,_tdCnt:0,_trCnt:0,_tableXY:[]};let listDiv=eval(this.setSubmenu()),tablePicker=listDiv.getElementsByClassName("sun-editor-id-table-picker")[0];context.table.tableHighlight=listDiv.getElementsByClassName("sun-editor-id-table-highlighted")[0],context.table.tableUnHighlight=listDiv.getElementsByClassName("sun-editor-id-table-unhighlighted")[0],context.table.tableDisplay=listDiv.getElementsByClassName("sun-editor-table-display")[0];let resizeDiv=eval(this.setController_tableEditor(core.lang));context.table.resizeDiv=resizeDiv,tablePicker.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(core)),tablePicker.addEventListener("click",this.appendTable.bind(core)),resizeDiv.addEventListener("click",this.onClick_resizeDiv.bind(core)),targetElement.parentNode.appendChild(listDiv),context.element.relative.appendChild(resizeDiv),listDiv=null,tablePicker=null,resizeDiv=null},setSubmenu:function(){const e=document.createElement("DIV");return e.className="table-content",e.style.display="none",e.innerHTML='
1 x 1
',e},setController_tableEditor:function(e){const t=document.createElement("DIV");return t.className="sun-editor-id-table-edit",t.style.display="none",t.innerHTML='
',t},appendTable:function(){const e=document.createElement("TABLE");let t=this.context.table._tableXY[0],i=this.context.table._tableXY[1],n="";for(;i>0;){n+="";let e=t;for(;e>0;)n+="

",--e;n+="",--i}n+="",e.innerHTML=n,this.insertNode(e,this.util.getFormatElement(this.getSelectionNode())),this.appendP(e),this.focus(),this.plugins.table.reset_table_picker.call(this)},onMouseMove_tablePicker:function(e){e.stopPropagation();let t=Math.ceil(e.offsetX/18),i=Math.ceil(e.offsetY/18);t=t<1?1:t,i=i<1?1:i,this.context.table.tableHighlight.style.width=t+"em",this.context.table.tableHighlight.style.height=i+"em";let n=t<5?5:t>9?10:t+1,o=i<5?5:i>9?10:i+1;this.context.table.tableUnHighlight.style.width=n+"em",this.context.table.tableUnHighlight.style.height=o+"em",this.util.changeTxt(this.context.table.tableDisplay,t+" x "+i),this.context.table._tableXY=[t,i]},reset_table_picker:function(){if(!this.context.table.tableHighlight)return;const e=this.context.table.tableHighlight.style,t=this.context.table.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="5em",t.height="5em",this.util.changeTxt(this.context.table.tableDisplay,"1 x 1"),this.submenuOff()},init:function(){const e=this.context.table;e._tdElement&&this.util.removeClass(e._tdElement,"sun-editor-selected-cell"),e._element=null,e._tdElement=null,e._trElement=null,e._trElements=0,e._tdIndex=0,e._trIndex=0,e._trCnt=0,e._tdCnt=0,e._tableXY=[],e._resizeBars=[]},call_controller_tableEdit:function(e){const t=this.context.table.resizeDiv;this.plugins.table.setPositionControllerDiv.call(this,e,!1),t.style.display="block",this.controllerArray=[t],this.controllerFunction=[this.plugins.table.init.bind(this)]},setPositionControllerDiv:function(e,t){const i=this.context.table,n=i.resizeDiv;let o=i._element;if(!o){for(o=e;!/^TABLE$/i.test(o.nodeName);)o=o.parentNode;i._element=o}i._tdElement!==e&&(i._tdElement&&this.util.removeClass(i._tdElement,"sun-editor-selected-cell"),this.util.addClass(e,"sun-editor-selected-cell"),i._tdElement=e,i._trElement=e.parentNode),(t||0===i._trCnt)&&(i._trElements=o.rows,i._tdIndex=e.cellIndex,i._trIndex=i._trElement.rowIndex,i._trCnt=o.rows.length,i._tdCnt=i._trElement.cells.length);const l=this.util.getOffset(e);n.style.left=l.left+"px",n.style.top=l.top+e.offsetHeight+10+"px"},insertRowCell:function(e,t){const i=this.context.table;if("row"===e){const e="up"===t?i._trIndex:i._trIndex+1;let n="";for(let e=0,t=i._tdCnt;e

";i._element.insertRow(e).innerHTML=n}else{const e=i._trElements,n="left"===t?i._tdIndex:i._tdIndex+1;let o=null;for(let t=0,l=i._trCnt;t"}this.plugins.table.setPositionControllerDiv.call(this,i._tdElement,!0)},deleteRowCell:function(e){const t=this.context.table;if("row"===e)t._element.deleteRow(t._trIndex);else{const e=t._trElements,i=t._tdIndex;for(let n=0,o=t._trCnt;n'+e.toolbar.alignLeft+'
  • ",t},pickup:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,i=null;for(;!i&&!/UL/i.test(t.tagName);)i=t.getAttribute("data-command"),t=t.parentNode;this.focus(),this.execCommand(i,!1,null),this.submenuOff()}}},WUQj:function(e,t,i){},WzUB:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"formatBlock",add:function(core,targetElement){let listDiv=eval(this.setSubmenu(core.lang));listDiv.getElementsByTagName("UL")[0].addEventListener("click",this.pickUp.bind(core)),targetElement.parentNode.appendChild(listDiv),listDiv=null},setSubmenu:function(e){const t=document.createElement("DIV");return t.className="layer_editor layer_block",t.style.display="none",t.innerHTML='
    ",t},pickUp:function(e){e.preventDefault(),e.stopPropagation();let t=e.target,i=null,n=null;for(;!i&&!/UL/i.test(t.tagName);)i=t.getAttribute("data-command"),n=t.getAttribute("data-value"),t=t.parentNode;if(this.focus(),"range"===i){const e=document.createElement(n);this.wrapToTags(e),this.setRange(e.firstChild,0,e.firstChild,0),this.appendP(e)}else this.execCommand("formatBlock",!1,n),this.util.changeTxt(this.commandMap.FORMAT,n);this.submenuOff(),this.focus()}}},XJR1:function(e,t,i){"use strict";i.r(t);i("3FqI"),i("WUQj");var n=i("WRt5"),o=i("50IV"),l=i("MIhV"),s=i("0A7J"),a=i("s0fJ"),r=i("g4XY"),d=i("gMuy"),c=i("VquE"),u=i("WzUB"),m=i("Rp48"),g=i("KKur"),h=i("hlhS"),p={align:n.a,font:o.a,fontSize:l.a,fontColor:s.a,hiliteColor:a.a,horizontalRule:r.a,list:d.a,table:c.a,formatBlock:u.a,link:m.a,image:g.a,video:h.a};var _={util:{getXMLHttpRequest:function(){if(!window.ActiveXObject)return window.XMLHttpRequest?new XMLHttpRequest:null;try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return null}}},copyObj:function(e){const t={};for(let i in e)t[i]=e[i];return t},getIncludePath:function(e,t){let i="";const n="js"===t?"script":"link",o="js"===t?"src":"href";let l="(?:";for(let t=0,i=e.length;t0&&(n+="

    "+t+"

    ")}else n+=i;const o={"&":"&"," ":" ","'":""","<":"<",">":">"};return e=e.replace(/&|\u00A0|'|\<|\>/g,function(e){return"string"==typeof o[e]?o[e]:e}),0===n.length&&(n="

    "+(e.length>0?e:"")+"

    "),n},isWysiwygDiv:function(e){return!(!e||1!==e.nodeType||!this.hasClass(e,"sun-editor-id-wysiwyg"))},isFormatElement:function(e){return!(!e||1!==e.nodeType||!/^(?:P|DIV|H[1-6]|LI)$/i.test(e.nodeName)||/sun-editor-id-media-container/.test(e.className))},isRangeFormatElement:function(e){return!(!e||1!==e.nodeType||!/^BLOCKQUOTE|TABLE|TD|TR|OL|UL$/i.test(e.nodeName))},getFormatElement:function(e){if(!e)return null;if(this.isWysiwygDiv(e)){return this.getListChildren(e,function(e){return this.isFormatElement(e)}.bind(this))[0]}for(;!this.isFormatElement(e)&&!this.isWysiwygDiv(e.parentNode);)e=e.parentNode;return e},getArrayIndex:function(e,t){let i=-1;for(let n=0,o=e.length;n0){for(let t=0;t0){for(let e=0;e":null)},focus:function(){if("none"===e.element.wysiwyg.style.display)return;const i=t.getParentElement(this.getSelectionNode(),"figcaption");i?i.focus():e.element.wysiwyg.focus(),this._setEditorRange(),l._findButtonEffectTag()},_setEditorRange:function(){const e=window.getSelection();let t=null;t=e.rangeCount>0?e.getRangeAt(0):this._createDefaultRange(),this._variable.range=t,t.collapsed?this.setSelectionNode(t.commonAncestorContainer):this.setSelectionNode(e.extentNode||e.anchorNode)},_createDefaultRange:function(){const t=document.createRange();return t.setStart(e.element.wysiwyg.firstChild,0),t.setEnd(e.element.wysiwyg.firstChild,0),t},setRange:function(e,t,i,n){const o=document.createRange();o.setStart(e,t),o.setEnd(i,n);const l=window.getSelection();l.rangeCount>0&&l.removeAllRanges(),this._variable.range=o,l.addRange(o)},getRange:function(){return this._variable.range||this._createDefaultRange()},setSelectionNode:function(e){this._variable.selectionNode=e},getSelectionNode:function(){return this._variable.selectionNode?this._variable.selectionNode:e.element.wysiwyg.firstChild},getRangeSelectedFormatElement:function(){const e=this.getRange(),i=e.startContainer,n=e.endContainer,o=e.commonAncestorContainer,l=[];if(!t.isWysiwygDiv(o)&&!t.isRangeFormatElement(o))return l;const s=t.getListChildren(o,function(e){return t.isFormatElement(e)});if(i===n)return s[0];let a=t.getFormatElement(i),r=t.getFormatElement(n);for(let e=0,t=s.length;e=0;e--)d[e]===t.parentNode&&d[e].firstChild===t&&0===n&&(c=e,t=t.parentNode);for(let e=u-1,t=o;e>c;e--)d[e]===t.parentNode&&1===d[e].nodeType&&(d.splice(e,1),t=t.parentNode,--u);for(let e=c;e<=u;e++){const s=d[e];0===s.length||3===s.nodeType&&void 0===s.data?t.removeItem(s):s!==i?s!==o?t.removeItem(s):(r=1===o.nodeType?document.createTextNode(o.textContent):document.createTextNode(o.substringData(l,o.length-l))).length>0?o.data=r.data:t.removeItem(o):(a=1===i.nodeType?document.createTextNode(i.textContent):document.createTextNode(i.substringData(0,n))).length>0?i.data=a.data:t.removeItem(i)}},wrapToTags:function(e){const i=this.getRange().commonAncestorContainer,n=[];if(this.util.isWysiwygDiv(i)||this.util.isRangeFormatElement(i)){const e=this.getRangeSelectedFormatElement();for(let t=0,i=e.length;t0?o.data=e.data:o.data=o.substringData(0,l),t.data.length>0&&o.parentNode.insertBefore(t,d.nextSibling)}u.container=d,u.offset=1,m.container=d,m.offset=1}else{const i=function(t){if(3===t.nodeType)return!0;let i="";return c&&t.style.cssText.length>0&&(i=t.style.cssText.replace(c,"").trim()),(t.nodeName!==e.nodeName||i.length>0)&&(t.style.cssText.length>0&&(t.style.cssText=i),!0)};if(t.isWysiwygDiv(r)||t.isRangeFormatElement(r)){const t=this.getRangeSelectedFormatElement(),n=t.length-1;d=e.cloneNode(!1),u=this._wrapLineNodesStart(t[0],d,i,o,l);for(let o=1;o0||/^BR$/i.test(s.nodeName))){let e;s===r?(s=document.createTextNode(r.substringData(d,r.length-d)),r=e=s.cloneNode(!0),d=0,m=!0):s===c?(s=document.createTextNode(c.substringData(0,u)),c=e=s.cloneNode(!0),u=s.textContent.length,i.appendChild(e),g=!0):e=s.cloneNode(!1),(m||1===s.nodeType)&&o.appendChild(e),1===s.nodeType&&(a=e)}e(s,a)}}(e,i),this.removeNode();let h=s;for(;h.parentNode!==e;)h=h.parentNode;return e.insertBefore(i,h),0===s.textContent.length&&t.removeItem(s),0===o.textContent.length&&t.removeItem(o),{startContainer:r,startOffset:d,endContainer:c,endOffset:u}},_wrapLineNodes:function(e,t,i){!function e(t,n){const o=t.childNodes;for(let t=0,l=o.length;t0||/^BR$/i.test(l.nodeName))){let e=l.cloneNode(!1);n.appendChild(e),1===l.nodeType&&(s=e)}e(l,s)}}(e,t),e.innerHTML="",e.appendChild(t)},_wrapLineNodesStart:function(e,i,n,o,l){const s=e,a=e.cloneNode(!1);let r,d,c,u=o,m=l,g=!1;return function e(t,o){const l=t.childNodes;for(let t=0,h=l.length;t0){for(c=d=r.pop();r.length>0;)d=r.pop(),c.appendChild(d);i.appendChild(c),o=d}else o=i}if(g||h!==u){if((!g||n(h))&&(h.textContent.length>0||/^BR$/i.test(h.nodeName))){const e=h.cloneNode(!1);o.appendChild(e),1===h.nodeType&&(p=e)}e(h,p)}else{const e=document.createTextNode(u.substringData(0,m)),t=document.createTextNode(u.substringData(m,u.length-m));for(e.data.length>0&&o.appendChild(e),d=o,r=[];d!==a&&null!==d;)n(d)&&1===d.nodeType&&r.push(d.cloneNode(!1)),d=d.parentNode;for(c=d=r.pop()||o;r.length>0;)d=r.pop(),c.appendChild(d);c!==o?(i.appendChild(c),o=d):o=i,a.appendChild(i),u=t,m=0,g=!0,o.appendChild(u)}}}(e,a),e.parentNode.insertBefore(a,e),t.removeItem(e),{container:u,offset:m}},_wrapLineNodesEnd:function(e,i,n,o,l){const s=e,a=e.cloneNode(!1);let r,d,c,u=o,m=l,g=!1;return function e(t,o){const l=t.childNodes;for(let t=l.length-1;0<=t;t--){const h=l[t];let p=o;if(g&&!/^BR$/i.test(h.nodeName)){if(1===h.nodeType&&!/^BR$/i.test(h.nodeName)){e(h,h);continue}for(d=h,r=[];null!==d.parentNode&&d!==s&&d!==i;)n(d)&&1===d.nodeType&&r.push(d.cloneNode(!1)),d=d.parentNode;if(r.length>0){for(c=d=r.pop();r.length>0;)d=r.pop(),c.insertBefore(d,c.firstChild);i.insertBefore(c,i.firstChild),o=d}else o=i}if(g||h!==u){if((!g||n(h))&&(h.textContent.length>0||/^BR$/i.test(h.nodeName))){const e=h.cloneNode(!1);o.insertBefore(e,o.firstChild),1===h.nodeType&&(p=e)}e(h,p)}else{const e=document.createTextNode(u.substringData(m,u.length-m)),t=document.createTextNode(u.substringData(0,m));for(e.data.length>0&&o.insertBefore(e,o.firstChild),d=o,r=[];d!==a&&null!==d;)n(d)&&1===d.nodeType&&r.push(d.cloneNode(!1)),d=d.parentNode;for(c=d=r.pop()||o;r.length>0;)d=r.pop(),c.insertBefore(d,c.firstChild);c!==o?(i.insertBefore(c,i.firstChild),o=d):o=i,a.insertBefore(i,a.firstChild),u=t,m=t.data.length,g=!0,o.insertBefore(u,o.firstChild)}}}(e,a),e.parentNode.insertBefore(a,e),t.removeItem(e),{container:u,offset:m}},indent:function(e,i){const n=t.getFormatElement(e);if(!n)return;let o=/\d+/.test(n.style.marginLeft)?1*n.style.marginLeft.match(/\d+/)[0]:0;"indent"===i?o+=25:o-=25,n.style.marginLeft=(o<0?0:o)+"px"},toggleDisplayBlocks:function(){t.toggleClass(e.element.wysiwyg,"sun-editor-show-block")},toggleCodeView:function(){const i=this._variable.wysiwygActive,n=this.codeViewDisabledButtons;for(let e=0,t=n.length;e(?=[^\n])/gi,"

    \n"),e.element.wysiwyg.style.display="none",e.element.code.style.display="block",this._variable.wysiwygActive=!1,e.element.code.focus();else{const i=e.element.code.value.trim();e.element.wysiwyg.innerHTML=i.length>0?t.convertContentsForEditor(i):"

    

    ",e.element.wysiwyg.scrollTop=0,e.element.code.style.display="none",e.element.wysiwyg.style.display="block",this._variable.wysiwygActive=!0,this.focus()}},toggleFullScreen:function(i){this._variable.isFullScreen?(e.element.topArea.style.cssText=this._variable.originCssText,e.element.editorArea.style.height=this._variable.editorHeight+"px",t.removeClass(i.firstElementChild,"icon-reduction"),t.addClass(i.firstElementChild,"icon-expansion")):(e.element.topArea.style.position="fixed",e.element.topArea.style.top="0",e.element.topArea.style.left="0",e.element.topArea.style.width="100%",e.element.topArea.style.height="100%",e.element.topArea.style.zIndex="2147483647",this._variable.innerHeight_fullScreen=window.innerHeight-e.tool.bar.offsetHeight,e.element.editorArea.style.height=this._variable.innerHeight_fullScreen+"px",t.removeClass(i.firstElementChild,"icon-expansion"),t.addClass(i.firstElementChild,"icon-reduction")),this._variable.isFullScreen=!this._variable.isFullScreen},openWindowContents:function(i){const o="print"===i,l=window.open("","_blank");l.mimeType="text/html",l.document.write(''+(o?n.toolbar.print:n.toolbar.preview)+''+e.element.wysiwyg.innerHTML+""+(o?"