diff --git a/README.md b/README.md
index d31643ea2..906e0bfba 100644
--- a/README.md
+++ b/README.md
@@ -91,7 +91,7 @@ suneditor.create('sample', {
});
```
-### 2. Load plugins
+### 2. Load only what you want
```javascript
import 'suneditor/dist/css/suneditor.min.css'
import suneditor from 'suneditor'
@@ -131,7 +131,7 @@ import suneditor from 'suneditor'
import plugins from 'suneditor/src/plugins'
suneditor.create('sample', {
- modules: plugins,
+ plugins: plugins,
buttonList: [
['undo', 'redo'],
['font', 'fontSize', 'formatBlock'],
@@ -146,6 +146,20 @@ suneditor.create('sample', {
['preview', 'print']
]
})
+
+// You can also load what you want
+suneditor.create('sample', {
+ plugins: [
+ plugins.font
+ plugins.fontSize,
+ plugins.formatBlock
+ ],
+ buttonList: [
+ ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
+ ['font', 'fontSize', 'formatBlock'],
+ ['removeFormat']
+ ]
+})
```
### 4. Plugins can be used directly in the button list
diff --git a/bower.json b/bower.json
index 48dbb0296..e71f7588f 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "suneditor",
- "version": "2.0.10",
+ "version": "2.0.11",
"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 a9c7eb32e..61e9bb669 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(_this,targetElement){let listDiv=eval(this.setSubmenu());listDiv.getElementsByTagName("UL")[0].addEventListener("click",this.pickUp.bind(_this)),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='
';for(let e=0,n=t.length;e '}return 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()}}},"1kvd":function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"dialog",add:function(_this){const context=_this.context;context.dialog={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_resize_direction:""};let dialog_div=document.createElement("DIV");dialog_div.className="sun-editor-id-dialogBox sun-editor-common";let dialog_back=document.createElement("DIV");dialog_back.className="modal-dialog-background sun-editor-id-dialog-back",dialog_back.style.display="none";let dialog_area=document.createElement("DIV");dialog_area.className="modal-dialog sun-editor-id-dialog-modal",dialog_area.style.display="none",dialog_div.appendChild(dialog_back),dialog_div.appendChild(dialog_area),context.dialog.modalArea=dialog_div,context.dialog.back=dialog_back,context.dialog.modal=dialog_area;let resize_div_container=eval(this.setController_resize());context.dialog.resizeContainer=resize_div_container,context.dialog.resizeDiv=resize_div_container.getElementsByClassName("modal-resize")[0],context.dialog.resizeDot=resize_div_container.getElementsByClassName("resize-dot")[0],context.dialog.resizeDisplay=resize_div_container.getElementsByClassName("resize-display")[0];let resize_button=eval(this.setController_button(_this.lang));context.dialog.resizeButton=resize_button;let resize_handles=resize_div_container.getElementsByClassName("sun-editor-name-resize-handle");context.dialog.modal.addEventListener("click",this.onClick_dialog.bind(_this)),context.element.topArea.getElementsByClassName("sun-editor-container")[0].appendChild(dialog_div),resize_handles[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(_this)),resize_handles[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(_this)),resize_handles[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(_this)),resize_handles[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(_this)),resize_handles[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(_this)),resize_handles[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(_this)),resize_handles[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(_this)),resize_handles[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(_this)),resize_button.addEventListener("click",this.onClick_resizeButton.bind(_this)),context.element.relative.appendChild(resize_div_container),context.element.relative.appendChild(resize_button),dialog_div=null,dialog_back=null,dialog_area=null,resize_div_container=null,resize_button=null,resize_handles=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)},setController_resize:function(){const e=document.createElement("DIV");return e.className="modal-resize-container",e.style.display="none",e.innerHTML='',e},setController_button:function(e){const t=document.createElement("DIV");return t.className="resize-btn",t.style.display="none",t.innerHTML='',t},call_controller_resize:function(e,t){this.context.dialog._resize_plugin=t,e.setAttribute("unselectable","on"),e.contentEditable=!1;const i=this.context.dialog.resizeContainer,n=this.context.dialog.resizeDiv,o=e.offsetWidth,l=e.offsetHeight,s=e.offsetTop-this.context.element.wysiwyg.scrollTop,a=e.offsetLeft;return i.style.top=s+"px",i.style.left=a+"px",i.style.width=o+"px",i.style.height=l+"px",n.style.top="0px",n.style.left="0px",n.style.width=o+"px",n.style.height=l+"px",this.context.dialog.resizeButton.style.top=l+s+"px",this.context.dialog.resizeButton.style.left=a+"px",this.util.changeTxt(this.context.dialog.resizeDisplay,o+" x "+l),this.context.dialog.resizeContainer.style.display="block",this.context.dialog.resizeButton.style.display="block",this.context.dialog.resizeDot.style.display="block",this.context.dialog._resize_w=o,this.context.dialog._resize_h=l,this.controllerArray=[this.context.dialog.resizeContainer,this.context.dialog.resizeButton],{w:o,h:l,t:s,l:a}},cancel_controller_resize:function(){this.context[this.context.dialog._resize_plugin]._resize_element.style.width=this.context.dialog._resize_w+"px",this.context[this.context.dialog._resize_plugin]._resize_element.style.height=this.context.dialog._resize_h+"px",this.context.element.resizeBackground.style.display="none",this.context.dialog.resizeContainer.style.display="none",this.context.dialog.resizeButton.style.display="none",this.plugins[this.context.dialog._resize_plugin].init.call(this)},onClick_resizeButton:function(e){e.stopPropagation();const t=e.target.getAttribute("data-command")||e.target.parentNode.getAttribute("data-command");t&&(e.preventDefault(),/^\d+$/.test(t)?this.plugins[this.context.dialog._resize_plugin].setSize.call(this,t+"%",""):/update/.test(t)?this.plugins[this.context.dialog._resize_plugin].openModify.call(this):/delete/.test(t)&&this.plugins[this.context.dialog._resize_plugin].destroy.call(this),this.submenuOff(),this.focus())},onMouseDown_resize_handle:function(e){const t=this.context.dialog._resize_direction=e.target.classList[0];e.stopPropagation(),e.preventDefault(),this.context.dialog.resizeDot.style.display="none",this.context.dialog._resizeClientX=e.clientX,this.context.dialog._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",this.context.dialog.resizeButton.style.display="none",this.context.dialog.resizeDiv.style.float=/l/.test(t)?"right":/r/.test(t)?"left":"none";const i=this.plugins.dialog.resizing_element.bind(this),n=function(){this.plugins.dialog.cancel_controller_resize.call(this),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",n)}.bind(this);document.addEventListener("mousemove",i),document.addEventListener("mouseup",n)},resizing_element:function(e){const t=this.context.dialog._resize_direction,i=e.clientX,n=e.clientY,o=this.context[this.context.dialog._resize_plugin];let l=o._element_w,s=o._element_h;const a=o._element_w+(/r/.test(t)?i-this.context.dialog._resizeClientX:this.context.dialog._resizeClientX-i),r=o._element_h+(/b/.test(t)?n-this.context.dialog._resizeClientY:this.context.dialog._resizeClientY-n),d=o._element_h/o._element_w*a;/t/.test(t)&&(this.context.dialog.resizeDiv.style.top=o._element_h-(/h/.test(t)?r:d)+"px"),/l/.test(t)&&(this.context.dialog.resizeDiv.style.left=o._element_w-a+"px"),/r|l/.test(t)&&(this.context.dialog.resizeDiv.style.width=a+"px",l=a),/^(?:t|b)[^h]$/.test(t)?(this.context.dialog.resizeDiv.style.height=d+"px",s=d):/^(?:t|b)h$/.test(t)&&(this.context.dialog.resizeDiv.style.height=r+"px",s=r),this.context.dialog._resize_w=l,this.context.dialog._resize_h=s,this.util.changeTxt(this.context.dialog.resizeDisplay,Math.round(l)+" x "+Math.round(s))}}},"3FqI":function(e,t,i){},"50IV":function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"font",add:function(_this,targetElement){let listDiv=eval(this.setSubmenu(_this.context.user));listDiv.getElementsByClassName("list_family")[0].addEventListener("click",this.pickup.bind(_this)),targetElement.parentNode.appendChild(listDiv),listDiv=null},setSubmenu:function(e){const t=document.createElement("DIV");let i,n,o,l;t.className="layer_editor",t.style.display="none";let s=e.font?e.font:["Arial","Comic Sans MS","Courier New,Courier","Georgia","tahoma","Trebuchet MS,Helvetica","Verdana"],a=' ';for(o=0,l=s.length;o";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()}}},KKur:function(module,__webpack_exports__,__webpack_require__){"use strict";var _modules_dialog__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("1kvd");__webpack_exports__.a={name:"image",add:function(_this){_this._addModule(_modules_dialog__WEBPACK_IMPORTED_MODULE_0__.a);const context=_this.context;context.image={_linkElement:null,_element:null,_resize_element:null,_element_w:1,_element_h:1,_element_l:0,_element_t:0,_origin_w:context.user.imageSize,_origin_h:0,_altText:"",_imageCaption:null,_linkValue:"",_align:"none",_captionChecked:!1,_proportionChecked:!0,_onCaption:!1,_floatClassRegExp:"float\\-[a-z]+"};let image_dialog=eval(this.setDialog(_this.context.user,_this.lang));context.image.modal=image_dialog,context.image.imgUrlFile=image_dialog.getElementsByClassName("sun-editor-id-image-url")[0],context.image.imgInputFile=context.image.focusElement=image_dialog.getElementsByClassName("sun-editor-id-image-file")[0],context.image.altText=image_dialog.getElementsByClassName("sun-editor-id-image-alt")[0],context.image.imgLink=image_dialog.getElementsByClassName("sun-editor-id-image-link")[0],context.image.imgLinkNewWindowCheck=image_dialog.getElementsByClassName("sun-editor-id-linkCheck")[0],context.image.caption=image_dialog.querySelector("#suneditor_image_check_caption"),context.image.proportion=image_dialog.querySelector("#suneditor_image_check_proportion"),context.image.imageX=image_dialog.getElementsByClassName("sun-editor-id-image-x")[0],context.image.imageY=image_dialog.getElementsByClassName("sun-editor-id-image-y")[0],context.image.imageX.value=_this.context.user.imageSize,context.image.modal.getElementsByClassName("sun-editor-tab-button")[0].addEventListener("click",this.openTab.bind(_this)),context.image.modal.getElementsByClassName("btn-primary")[0].addEventListener("click",this.submit.bind(_this)),context.image.imageX.addEventListener("change",this.setInputSize.bind(_this,"x")),context.image.imageY.addEventListener("change",this.setInputSize.bind(_this,"y")),image_dialog.getElementsByClassName("sun-editor-id-image-revert-button")[0].addEventListener("click",this.sizeRevert.bind(_this)),context.dialog.modal.appendChild(image_dialog),image_dialog=null},setDialog:function(e,t){const i=document.createElement("DIV");i.className="modal-content sun-editor-id-dialog-image",i.style.display="none";let n='
",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!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-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(){this.context.image.imgInputFile.value="",this.context.image.imgUrlFile.value="",this.context.image.altText.value="",this.context.image.imgLink.value="",this.context.image.imgLinkNewWindowCheck.checked=!1,this.context.image.modal.querySelector("#suneditor_image_radio_none").checked=!0,this.context.image.caption.checked=!1,this.context.image.proportion.checked=!1,this.context.image.imageX.value=this.context.user.imageSize,this.context.image.imageY.value="",this.context.image.imageY.disabled=!0,this.context.image.proportion.disabled=!0,this.context.image._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(_this,targetElement){let listDiv=eval(this.setSubmenu(_this.context.user));listDiv.getElementsByTagName("UL")[0].addEventListener("click",this.pickup.bind(_this)),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()}}},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(_this){_this._addModule(_modules_dialog__WEBPACK_IMPORTED_MODULE_0__.a);const context=_this.context;context.link={};let link_dialog=eval(this.setDialog(_this.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_LinkBtn(_this.lang));context.link.linkBtn=link_button,context.link._linkAnchor=null,link_dialog.getElementsByClassName("btn-primary")[0].addEventListener("click",this.submit.bind(_this)),link_button.addEventListener("click",this.onClick_linkBtn.bind(_this)),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_LinkBtn: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,t.style.left=e.offsetLeft+"px",t.style.top=e.offsetTop+e.offsetHeight-this.context.element.wysiwyg.scrollTop+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.context.link.linkBtn.style.display="none")},init:function(){this.context.link.linkBtn.style.display="none",this.context.link._linkAnchor=null,this.context.link.focusElement.value="",this.context.link.linkAnchorText.value="",this.context.link.linkNewWindowCheck.checked=!1}}},VquE:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"table",add:function(_this,targetElement){const context=_this.context;let listDiv=eval(this.setSubmenu()),tablePicker=listDiv.getElementsByClassName("sun-editor-id-table-picker")[0];context.submenu.tableHighlight=listDiv.getElementsByClassName("sun-editor-id-table-highlighted")[0],context.submenu.tableUnHighlight=listDiv.getElementsByClassName("sun-editor-id-table-unhighlighted")[0],context.submenu.tableDisplay=listDiv.getElementsByClassName("sun-editor-table-display")[0],context.submenu._tableXY=[],tablePicker.addEventListener("mousemove",this.onMouseMove_tablePicker.bind(_this)),tablePicker.addEventListener("click",this.appendTable.bind(_this)),targetElement.parentNode.appendChild(listDiv),listDiv=null,tablePicker=null},setSubmenu:function(){const e=document.createElement("DIV");return e.className="table-content",e.style.display="none",e.innerHTML='1 x 1
',e},appendTable:function(){const e=document.createElement("TABLE");let t=this.context.submenu._tableXY[0],i=this.context.submenu._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.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.submenu.tableHighlight.style.width=t+"em",this.context.submenu.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.submenu.tableUnHighlight.style.width=n+"em",this.context.submenu.tableUnHighlight.style.height=o+"em",this.util.changeTxt(this.context.submenu.tableDisplay,t+" x "+i),this.context.submenu._tableXY=[t,i]},reset_table_picker:function(){if(!this.context.submenu.tableHighlight)return;const e=this.context.submenu.tableHighlight.style,t=this.context.submenu.tableUnHighlight.style;e.width="1em",e.height="1em",t.width="5em",t.height="5em",this.util.changeTxt(this.context.submenu.tableDisplay,"1 x 1"),this.submenuOff()}}},WRt5:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"align",add:function(_this,targetElement){let listDiv=eval(this.setSubmenu(_this.lang));listDiv.getElementsByTagName("UL")[0].addEventListener("click",this.pickup.bind(_this)),targetElement.parentNode.appendChild(listDiv),listDiv=null},setSubmenu:function(e){const t=document.createElement("DIV");return t.className="layer_editor layer_align",t.style.display="none",t.innerHTML='
",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),this.submenuOff()}}},WUQj:function(e,t,i){},WzUB:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_exports__.a={name:"formatBlock",add:function(_this,targetElement){let listDiv=eval(this.setSubmenu(_this.lang));listDiv.getElementsByTagName("UL")[0].addEventListener("click",this.pickUp.bind(_this)),targetElement.parentNode.appendChild(listDiv),listDiv=null},setSubmenu:function(e){const t=document.createElement("DIV");return t.className="layer_editor layer_size",t.style.display="none",t.innerHTML='",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-value"),t=t.parentNode;this.focus(),this.util.changeTxt(this.commandMap.FORMAT,i),this.execCommand("formatBlock",!1,i),this.submenuOff()}}},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;t"+i+"";return 0===n.length&&(n="
"),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\\d)$/i.test(e.tagName))},getFormatElement:function(e){if(!e)return null;if(!e||this.isWysiwygDiv(e))e=context.element.wysiwyg.firstChild;else for(;!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?e.getRangeAt(0):this._createDefaultRange(),this._variable.range=t,t.collapsed?this._variable.selectionNode=t.commonAncestorContainer:this._variable.selectionNode=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()},getSelectionNode:function(){return this._variable.selectionNode?this._variable.selectionNode:e.element.wysiwyg.firstChild},isEdgePoint:function(e,t){return 0===t||t===e.nodeValue.length},showLoading:function(){e.element.loading.style.display="block"},closeLoading:function(){e.element.loading.style.display="none"},appendP:function(e){const i=document.createElement("P");return i.innerHTML="",(e=t.getFormatElement(e)).parentNode.insertBefore(i,e.nextElementSibling),i},insertNode:function(e,t){const i=this.getRange();let n=null;if(t)n=t.parentNode,t=t.nextSibling;else{const e=i.startContainer,o=i.startOffset,l=i.endContainer,s=i.endOffset,a=i.commonAncestorContainer;if(n=e,3===e.nodeType&&(n=e.parentNode),i.collapsed)3===a.nodeType?t=a.splitText(s):(null!==n.lastChild&&/^BR$/i.test(n.lastChild.nodeName)&&n.removeChild(n.lastChild),t=null);else if(e===l){let i=e;this.isEdgePoint(l,s)||(t=l.splitText(s)),this.isEdgePoint(e,o)||(i=e.splitText(o)),n.removeChild(i)}else for(this.removeNode(),t=l;1!==t.nodeType;)t=t.parentNode}try{n.insertBefore(e,t)}catch(t){n.appendChild(e)}},removeNode:function(){const e=this.getRange();if(e.deleteContents)return void e.deleteContents();const i=e.startContainer,n=e.startOffset,o=e.endContainer,l=e.endOffset,s=e.commonAncestorContainer;let a=null,r=null;const d=t.getListChildNodes(s);let c=t.getArrayIndex(d,i),u=t.getArrayIndex(d,o);for(let e=c+1,t=i;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)}},wrapRangeToTag:function(e,i){const n=this.getRange(),o=n.startContainer,l=n.startOffset,s=n.endContainer,a=n.endOffset,r=n.commonAncestorContainer;let d,c,u={},m={};if(i){c="(?:;|^|\\s)(?:"+i[0];for(let e=1;e0?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.hasClass(r,"sun-editor-id-wysiwyg")){const n=t.getListChildren(r,function(e){return t.isFormatElement(e)});let c=t.getParentElement(o,"P"),g=t.getParentElement(s,"P");for(let e=0,t=n.length;e0){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)){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=document.createElement("P");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){if(1===h.nodeType){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)){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.getParentElement(e,"P");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(){if(this._variable.wysiwygActive)e.element.code.value=e.element.wysiwyg.innerHTML.trim().replace(/<\/p>(?=[^\n])/gi,"\n"),e.element.wysiwyg.style.display="none",e.element.code.style.display="block",this._variable.wysiwygActive=!1;else{const t={"&":"&"," ":" ",""":"'","<":"<",">":">"},i=e.element.code.value.replace(/&[a-z]+;/g,function(e){return"string"==typeof t[e]?t[e]:e});e.element.wysiwyg.innerHTML=i.trim().length>0?i:"
",e.element.wysiwyg.scrollTop=0,e.element.code.style.display="none",e.element.wysiwyg.style.display="block",this._variable.wysiwygActive=!0}},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 n="print"===i,l=window.open("","_blank");l.mimeType="text/html",l.document.write(''+(n?o.toolbar.print:o.toolbar.preview)+''+e.element.wysiwyg.innerHTML+""+(n?"' : '') + '