=n+o?(u._sticky||h._onStickyToolbar(),t.toolbar.style.top=n+o+l.stickyToolbar-i-u._variable.minResizingSize+"px"):i>=o&&h._onStickyToolbar()},_getEditorOffsets:function(t){let n=t||e.element.topArea,i=0,l=0,o=0;for(;n;)i+=n.offsetTop,l+=n.offsetLeft,o+=n.scrollTop,n=n.offsetParent;return{top:i,left:l,scroll:o}},_getPageBottomSpace:function(){return a.documentElement.scrollHeight-(h._getEditorOffsets(null).top+e.element.topArea.offsetHeight)},_onStickyToolbar:function(){const t=e.element;u._isInline||l.toolbarContainer||(t._stickyDummy.style.height=t.toolbar.offsetHeight+"px",t._stickyDummy.style.display="block"),t.toolbar.style.top=l.stickyToolbar+"px",t.toolbar.style.width=u._isInline?u._inlineToolbarAttr.width:t.toolbar.offsetWidth+"px",c.addClass(t.toolbar,"se-toolbar-sticky"),u._sticky=!0},_offStickyToolbar:function(){const t=e.element;t._stickyDummy.style.display="none",t.toolbar.style.top=u._isInline?u._inlineToolbarAttr.top:"",t.toolbar.style.width=u._isInline?u._inlineToolbarAttr.width:"",t.editorArea.style.marginTop="",c.removeClass(t.toolbar,"se-toolbar-sticky"),u._sticky=!1},_codeViewAutoHeight:function(){e.element.code.style.height=e.element.code.scrollHeight+"px"},_hardDelete:function(){const e=u.getRange(),t=e.startContainer,n=e.endContainer,i=c.getRangeFormatElement(t),l=c.getRangeFormatElement(n),o=c.isCell(i),s=c.isCell(l);if((o&&!i.previousElementSibling&&!i.parentElement.previousElementSibling||s&&!l.nextElementSibling&&!l.parentElement.nextElementSibling)&&i!==l)if(o){if(s)return c.removeItem(c.getParentElement(i,c.isComponent)),u.nativeFocus(),!0;c.removeItem(c.getParentElement(i,c.isComponent))}else c.removeItem(c.getParentElement(l,c.isComponent));const a=1===t.nodeType?c.getParentElement(t,".se-component"):null,r=1===n.nodeType?c.getParentElement(n,".se-component"):null;return a&&c.removeItem(a),r&&c.removeItem(r),!1},onCut_wysiwyg:function(){r.setTimeout((function(){u.history.push(!1)}))},onPaste_wysiwyg:function(e){const t=c.isIE?r.clipboardData:e.clipboardData;return!t||h._dataTransferAction("paste",e,t)},onDrop_wysiwyg:function(e){const t=e.dataTransfer;return!t||(c.isIE?(e.preventDefault(),e.stopPropagation(),!1):(u.removeNode(),h._setDropLocationSelection(e),h._dataTransferAction("drop",e,t)))},_setDropLocationSelection:function(e){if(e.rangeParent)u.setRange(e.rangeParent,e.rangeOffset,e.rangeParent,e.rangeOffset);else if(u._wd.caretRangeFromPoint){const t=u._wd.caretRangeFromPoint(e.clientX,e.clientY);u.setRange(t.startContainer,t.startOffset,t.endContainer,t.endOffset)}else{const e=u.getRange();u.setRange(e.startContainer,e.startOffset,e.endContainer,e.endOffset)}},_dataTransferAction:function(t,n,i){let l,o;if(c.isIE){l=i.getData("Text");const s=u.getRange(),a=c.createElement("DIV"),d={sc:s.startContainer,so:s.startOffset,ec:s.endContainer,eo:s.endOffset};return a.setAttribute("contenteditable",!0),a.style.cssText="position:absolute; top:0; left:0; width:1px; height:1px; overflow:hidden;",e.element.relative.appendChild(a),a.focus(),r.setTimeout((function(){o=a.innerHTML,c.removeItem(a),u.setRange(d.sc,d.so,d.ec,d.eo),h._setClipboardData(t,n,l,o,i)})),!0}if(l=i.getData("text/plain"),o=i.getData("text/html"),!1===h._setClipboardData(t,n,l,o,i))return n.preventDefault(),n.stopPropagation(),!1},_setClipboardData:function(e,t,n,i,l){/class=["']*Mso(Normal|List)/i.test(i)||/content=["']*Word.Document/i.test(i)||/content=["']*OneNote.File/i.test(i)?(i=i.replace(/\n/g," "),n=n.replace(/\n/g," ")):n=n.replace(/\n/g,""),i=u.cleanHTML(i,u.pasteTagsWhitelistRegExp);const o=u._charCount(u._charTypeHTML?i:n);if("paste"===e&&"function"==typeof g.onPaste&&!g.onPaste(t,i,o,u))return!1;if("drop"===e&&"function"==typeof g.onDrop&&!g.onDrop(t,l,u))return!1;const s=l.files;return s.length>0?(/^image/.test(s[0].type)&&u.plugins.image&&g.insertImage(s),!1):!!o&&(i?(g.insertHTML(i,!0,!1),!1):void 0)},onMouseMove_wysiwyg:function(t){if(u.isDisabled)return;const n=c.getParentElement(t.target,c.isComponent),i=u._lineBreaker.style;if(n&&!u.currentControllerName){let o=0,s=e.element.wysiwyg;do{o+=s.scrollTop,s=s.parentElement}while(s&&!/^(BODY|HTML)$/i.test(s.nodeName));const a=e.element.wysiwyg.scrollTop,r=h._getEditorOffsets(null),d=c.getOffset(n,e.element.wysiwygFrame).top+a,g=t.pageY+o+(l.iframe&&!l.toolbarContainer?e.element.toolbar.offsetHeight:0),p=d+(l.iframe?o:r.top),m=c.isListCell(n.parentNode);let f="",_="";if((m?!n.previousSibling:!c.isFormatElement(n.previousElementSibling))&&gp+n.offsetHeight-20))return void(i.display="none");_=d+n.offsetHeight,f="b"}u._variable._lineBreakComp=n,u._variable._lineBreakDir=f,i.top=_-a+"px",u._lineBreakerButton.style.left=c.getOffset(n).left+n.offsetWidth/2-15+"px",i.display="block"}else"none"!==i.display&&(i.display="none")},_onMouseDown_lineBreak:function(e){e.preventDefault()},_onLineBreak:function(e){e.preventDefault();const t=u._variable._lineBreakComp,n=this?this:u._variable._lineBreakDir,i=c.isListCell(t.parentNode),l=c.createElement(i?"BR":c.isCell(t.parentNode)?"DIV":"P");if(i||(l.innerHTML="
"),u._charTypeHTML&&!u.checkCharCount(l.outerHTML,"byte-html"))return;t.parentNode.insertBefore(l,"t"===n?t:t.nextSibling),u._lineBreaker.style.display="none",u._variable._lineBreakComp=null;const o=i?l:l.firstChild;u.setRange(o,1,o,1),u.history.push(!1)},_addEvent:function(){const t=l.iframe?u._ww:e.element.wysiwyg;e.element.toolbar.addEventListener("mousedown",h._buttonsEventHandler,!1),e.element._menuTray.addEventListener("mousedown",h._buttonsEventHandler,!1),e.element.toolbar.addEventListener("click",h.onClick_toolbar,!1),t.addEventListener("mousedown",h.onMouseDown_wysiwyg,!1),t.addEventListener("click",h.onClick_wysiwyg,!1),t.addEventListener(c.isIE?"textinput":"input",h.onInput_wysiwyg,!1),t.addEventListener("keydown",h.onKeyDown_wysiwyg,!1),t.addEventListener("keyup",h.onKeyUp_wysiwyg,!1),t.addEventListener("paste",h.onPaste_wysiwyg,!1),t.addEventListener("cut",h.onCut_wysiwyg,!1),t.addEventListener("drop",h.onDrop_wysiwyg,!1),t.addEventListener("scroll",h.onScroll_wysiwyg,!1),t.addEventListener("focus",h.onFocus_wysiwyg,!1),t.addEventListener("blur",h.onBlur_wysiwyg,!1),h._lineBreakerBind={a:h._onLineBreak.bind(""),t:h._onLineBreak.bind("t"),b:h._onLineBreak.bind("b")},t.addEventListener("mousemove",h.onMouseMove_wysiwyg,!1),u._lineBreakerButton.addEventListener("mousedown",h._onMouseDown_lineBreak,!1),u._lineBreakerButton.addEventListener("click",h._lineBreakerBind.a,!1),e.element.lineBreaker_t.addEventListener("mousedown",h._lineBreakerBind.t,!1),e.element.lineBreaker_b.addEventListener("mousedown",h._lineBreakerBind.b,!1),u.plugins.table&&t.addEventListener("touchstart",h.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),"auto"!==l.height||l.codeMirrorEditor||(e.element.code.addEventListener("keydown",h._codeViewAutoHeight,!1),e.element.code.addEventListener("keyup",h._codeViewAutoHeight,!1),e.element.code.addEventListener("paste",h._codeViewAutoHeight,!1)),e.element.resizingBar&&(/\d+/.test(l.height)?e.element.resizingBar.addEventListener("mousedown",h.onMouseDown_resizingBar,!1):c.addClass(e.element.resizingBar,"se-resizing-none")),h._setResponsiveToolbar(),r.removeEventListener("resize",h.onResize_window),r.removeEventListener("scroll",h.onScroll_window),r.addEventListener("resize",h.onResize_window,!1),l.stickyToolbar>-1&&r.addEventListener("scroll",h.onScroll_window,!1)},_removeEvent:function(){const t=l.iframe?u._ww:e.element.wysiwyg;e.element.toolbar.removeEventListener("mousedown",h._buttonsEventHandler),e.element._menuTray.removeEventListener("mousedown",h._buttonsEventHandler),e.element.toolbar.removeEventListener("click",h.onClick_toolbar),t.removeEventListener("mousedown",h.onMouseDown_wysiwyg),t.removeEventListener("click",h.onClick_wysiwyg),t.removeEventListener(c.isIE?"textinput":"input",h.onInput_wysiwyg),t.removeEventListener("keydown",h.onKeyDown_wysiwyg),t.removeEventListener("keyup",h.onKeyUp_wysiwyg),t.removeEventListener("paste",h.onPaste_wysiwyg),t.removeEventListener("cut",h.onCut_wysiwyg),t.removeEventListener("drop",h.onDrop_wysiwyg),t.removeEventListener("scroll",h.onScroll_wysiwyg),t.removeEventListener("mousemove",h.onMouseMove_wysiwyg),u._lineBreakerButton.removeEventListener("mousedown",h._onMouseDown_lineBreak),u._lineBreakerButton.removeEventListener("click",h._lineBreakerBind.a),e.element.lineBreaker_t.removeEventListener("mousedown",h._lineBreakerBind.t),e.element.lineBreaker_b.removeEventListener("mousedown",h._lineBreakerBind.b),h._lineBreakerBind=null,t.removeEventListener("touchstart",h.onMouseDown_wysiwyg,{passive:!0,useCapture:!1}),t.removeEventListener("focus",h.onFocus_wysiwyg),t.removeEventListener("blur",h.onBlur_wysiwyg),e.element.code.removeEventListener("keydown",h._codeViewAutoHeight),e.element.code.removeEventListener("keyup",h._codeViewAutoHeight),e.element.code.removeEventListener("paste",h._codeViewAutoHeight),e.element.resizingBar&&e.element.resizingBar.removeEventListener("mousedown",h.onMouseDown_resizingBar),r.removeEventListener("resize",h.onResize_window),r.removeEventListener("scroll",h.onScroll_window)},_setResponsiveToolbar:function(){if(0===s.length)return void(s=null);const e=h._responsiveButtonSize=["default"],t=h._responsiveButtons={default:s[0]};for(let n,i,l=1,o=s.length;l"+this.lang.dialogBox.caption+"",e}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"component",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},ee5k:function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"resizing",add:function(e){const t=e.icons,n=e.context;n.resizing={_resizeClientX:0,_resizeClientY:0,_resize_plugin:"",_resize_w:0,_resize_h:0,_origin_w:0,_origin_h:0,_rotateVertical:!1,_resize_direction:"",_move_path:null,_isChange:!1,alignIcons:{basic:t.align_justify,left:t.align_left,right:t.align_right,center:t.align_center}};let i=this.setController_resize.call(e);n.resizing.resizeContainer=i,n.resizing.resizeDiv=i.querySelector(".se-modal-resize"),n.resizing.resizeDot=i.querySelector(".se-resize-dot"),n.resizing.resizeDisplay=i.querySelector(".se-resize-display");let l=this.setController_button.call(e);n.resizing.resizeButton=l;let o=n.resizing.resizeHandles=n.resizing.resizeDot.querySelectorAll("span");n.resizing.resizeButtonGroup=l.querySelector("._se_resizing_btn_group"),n.resizing.rotationButtons=l.querySelectorAll("._se_resizing_btn_group ._se_rotation"),n.resizing.percentageButtons=l.querySelectorAll("._se_resizing_btn_group ._se_percentage"),n.resizing.alignMenu=l.querySelector(".se-resizing-align-list"),n.resizing.alignMenuList=n.resizing.alignMenu.querySelectorAll("button"),n.resizing.alignButton=l.querySelector("._se_resizing_align_button"),n.resizing.autoSizeButton=l.querySelector("._se_resizing_btn_group ._se_auto_size"),n.resizing.captionButton=l.querySelector("._se_resizing_caption_button"),i.addEventListener("mousedown",(function(e){e.preventDefault()})),l.addEventListener("mousedown",e.eventStop),o[0].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[1].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[2].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[3].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[4].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[5].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[6].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),o[7].addEventListener("mousedown",this.onMouseDown_resize_handle.bind(e)),l.addEventListener("click",this.onClick_resizeButton.bind(e)),n.element.relative.appendChild(i),n.element.relative.appendChild(l),i=null,l=null,o=null},setController_resize:function(){const e=this.util.createElement("DIV");return e.className="se-controller se-resizing-container",e.style.display="none",e.innerHTML='',e},setController_button:function(){const e=this.lang,t=this.icons,n=this.util.createElement("DIV");return n.className="se-controller se-controller-resizing",n.innerHTML='
",n},_module_getSizeX:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),t?/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.width,2)||100)+"%":t.style.width:""},_module_getSizeY:function(e,t,n,i){return t||(t=e._element),n||(n=e._cover),i||(i=e._container),i&&n?this.util.getNumber(n.style.paddingBottom,0)>0&&!this.context.resizing._rotateVertical?n.style.height:/%$/.test(t.style.height)&&/%$/.test(t.style.width)?(i&&this.util.getNumber(i.style.height,2)||100)+"%":t.style.height:t&&t.style.height||""},_module_setModifyInputSize:function(e,t){const n=e._onlyPercentage&&this.context.resizing._rotateVertical;e.proportion.checked=e._proportionChecked="false"!==e._element.getAttribute("data-proportion");let i=n?"":this.plugins.resizing._module_getSizeX.call(this,e);if(i===e._defaultSizeX&&(i=""),e._onlyPercentage&&(i=this.util.getNumber(i,2)),e.inputX.value=i,t.setInputSize.call(this,"x"),!e._onlyPercentage){let t=n?"":this.plugins.resizing._module_getSizeY.call(this,e);t===e._defaultSizeY&&(t=""),e._onlyPercentage&&(t=this.util.getNumber(t,2)),e.inputY.value=t}e.inputX.disabled=!!n,e.inputY.disabled=!!n,e.proportion.disabled=!!n,t.setRatio.call(this)},_module_setInputSize:function(e,t){if(e._onlyPercentage)"x"===t&&e.inputX.value>100&&(e.inputX.value=100);else if(e.proportion.checked&&e._ratio&&/\d/.test(e.inputX.value)&&/\d/.test(e.inputY.value)){const n=e.inputX.value.replace(/\d+|\./g,"")||e.sizeUnit,i=e.inputY.value.replace(/\d+|\./g,"")||e.sizeUnit;if(n!==i)return;const l="%"===n?2:0;"x"===t?e.inputY.value=this.util.getNumber(e._ratioY*this.util.getNumber(e.inputX.value,l),l)+i:e.inputX.value=this.util.getNumber(e._ratioX*this.util.getNumber(e.inputY.value,l),l)+n}},_module_setRatio:function(e){const t=e.inputX.value,n=e.inputY.value;if(e.proportion.checked&&/\d+/.test(t)&&/\d+/.test(n)){if((t.replace(/\d+|\./g,"")||e.sizeUnit)!==(n.replace(/\d+|\./g,"")||e.sizeUnit))e._ratio=!1;else if(!e._ratio){const i=this.util.getNumber(t,0),l=this.util.getNumber(n,0);e._ratio=!0,e._ratioX=i/l,e._ratioY=l/i}}else e._ratio=!1},_module_sizeRevert:function(e){e._onlyPercentage?e.inputX.value=e._origin_w>100?100:e._origin_w:(e.inputX.value=e._origin_w,e.inputY.value=e._origin_h)},_module_saveCurrentSize:function(e){const t=this.plugins.resizing._module_getSizeX.call(this,e),n=this.plugins.resizing._module_getSizeY.call(this,e);e._element.setAttribute("data-size",t+","+n),e._videoRatio&&(e._videoRatio=n)},call_controller_resize:function(e,t){const n=this.context.resizing,i=this.context[t];n._resize_plugin=t;const l=n.resizeContainer,o=n.resizeDiv,s=this.util.getOffset(e,this.context.element.wysiwygFrame),a=n._rotateVertical=/^(90|270)$/.test(Math.abs(e.getAttribute("data-rotate")).toString()),r=a?e.offsetHeight:e.offsetWidth,c=a?e.offsetWidth:e.offsetHeight,d=s.top,u=s.left-this.context.element.wysiwygFrame.scrollLeft;l.style.top=d+"px",l.style.left=u+"px",l.style.width=r+"px",l.style.height=c+"px",o.style.top="0px",o.style.left="0px",o.style.width=r+"px",o.style.height=c+"px";let h=e.getAttribute("data-align")||"basic";h="none"===h?"basic":h;const g=this.util.getParentElement(e,this.util.isComponent),p=this.util.getParentElement(e,"FIGURE"),m=this.plugins.resizing._module_getSizeX.call(this,i,e,p,g)||"auto",f=i._onlyPercentage&&"image"===t?"":", "+(this.plugins.resizing._module_getSizeY.call(this,i,e,p,g)||"auto");this.util.changeTxt(n.resizeDisplay,this.lang.dialogBox[h]+" ("+m+f+")"),n.resizeButtonGroup.style.display=i._resizing?"":"none";const _=!i._resizing||i._resizeDotHide||i._onlyPercentage?"none":"flex",b=n.resizeHandles;for(let e=0,t=b.length;e=360?0:d;s.setAttribute("data-rotate",u),c._rotateVertical=/^(90|270)$/.test(this._w.Math.abs(u).toString()),this.plugins.resizing.setTransformSize.call(this,s,null,null),this.selectComponent(s,l);break;case"onalign":return void this.plugins.resizing.openAlignMenu.call(this);case"align":const h="basic"===i?"none":i;a.setAlign.call(this,h,null,null,null),this.selectComponent(s,l);break;case"caption":const g=!o._captionChecked;if(a.openModify.call(this,!0),o._captionChecked=o.captionCheckEl.checked=g,a.update_image.call(this,!1,!1,!1),g){const e=this.util.getChildElement(o._caption,(function(e){return 3===e.nodeType}));e?this.setRange(e,0,e,e.textContent.length):o._caption.focus(),this.controllersOff()}else this.selectComponent(s,l),a.openModify.call(this,!0);break;case"revert":a.setOriginSize.call(this),this.selectComponent(s,l);break;case"update":a.openModify.call(this),this.controllersOff();break;case"delete":a.destroy.call(this)}this.history.push(!1)}},resetTransform:function(e){const t=(e.getAttribute("data-size")||e.getAttribute("data-origin")||"").split(",");this.context.resizing._rotateVertical=!1,e.style.maxWidth="",e.style.transform="",e.style.transformOrigin="",e.setAttribute("data-rotate",""),e.setAttribute("data-rotateX",""),e.setAttribute("data-rotateY",""),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,t[0]?t[0]:"auto",t[1]?t[1]:"",!0)},setTransformSize:function(e,t,n){let i=e.getAttribute("data-percentage");const l=this.context.resizing._rotateVertical,o=1*e.getAttribute("data-rotate");let s="";if(i&&!l)i=i.split(","),"auto"===i[0]&&"auto"===i[1]?this.plugins[this.context.resizing._resize_plugin].setAutoSize.call(this):this.plugins[this.context.resizing._resize_plugin].setPercentSize.call(this,i[0],i[1]);else{const i=this.util.getParentElement(e,"FIGURE"),a=t||e.offsetWidth,r=n||e.offsetHeight,c=(l?r:a)+"px",d=(l?a:r)+"px";if(this.plugins[this.context.resizing._resize_plugin].cancelPercentAttr.call(this),this.plugins[this.context.resizing._resize_plugin].setSize.call(this,a+"px",r+"px",!0),i.style.width=c,i.style.height=this.context[this.context.resizing._resize_plugin]._caption?"":d,l){let e=a/2+"px "+a/2+"px 0",t=r/2+"px "+r/2+"px 0";s=90===o||-270===o?t:e}}e.style.transformOrigin=s,this.plugins.resizing._setTransForm(e,o.toString(),e.getAttribute("data-rotateX")||"",e.getAttribute("data-rotateY")||""),e.style.maxWidth=l?"none":"",this.plugins.resizing.setCaptionPosition.call(this,e)},_setTransForm:function(e,t,n,i){let l=(e.offsetWidth-e.offsetHeight)*(/-/.test(t)?1:-1),o="";if(/[1-9]/.test(t)&&(n||i))switch(o=n?"Y":"X",t){case"90":o=n&&i?"X":i?o:"";break;case"270":l*=-1,o=n&&i?"Y":n?o:"";break;case"-90":o=n&&i?"Y":n?o:"";break;case"-270":l*=-1,o=n&&i?"X":i?o:"";break;default:o=""}t%180==0&&(e.style.maxWidth=""),e.style.transform="rotate("+t+"deg)"+(n?" rotateX("+n+"deg)":"")+(i?" rotateY("+i+"deg)":"")+(o?" translate"+o+"("+l+"px)":"")},setCaptionPosition:function(e){const t=this.util.getChildElement(this.util.getParentElement(e,"FIGURE"),"FIGCAPTION");t&&(t.style.marginTop=(this.context.resizing._rotateVertical?e.offsetWidth-e.offsetHeight:0)+"px")},onMouseDown_resize_handle:function(e){e.stopPropagation(),e.preventDefault();const t=this.context.resizing,n=t._resize_direction=e.target.classList[0];t._resizeClientX=e.clientX,t._resizeClientY=e.clientY,this.context.element.resizeBackground.style.display="block",t.resizeButton.style.display="none",t.resizeDiv.style.float=/l/.test(n)?"right":/r/.test(n)?"left":"none";const i=function(e){if("keydown"===e.type&&27!==e.keyCode)return;const o=t._isChange;t._isChange=!1,this.removeDocEvent("mousemove",l),this.removeDocEvent("mouseup",i),this.removeDocEvent("keydown",i),"keydown"===e.type?(this.controllersOff(),this.context.element.resizeBackground.style.display="none",this.plugins[this.context.resizing._resize_plugin].init.call(this)):(this.plugins.resizing.cancel_controller_resize.call(this,n),o&&this.history.push(!1))}.bind(this),l=this.plugins.resizing.resizing_element.bind(this,t,n,this.context[t._resize_plugin]);this.addDocEvent("mousemove",l),this.addDocEvent("mouseup",i),this.addDocEvent("keydown",i)},resizing_element:function(e,t,n,i){const l=i.clientX,o=i.clientY;let s=n._element_w,a=n._element_h;const r=n._element_w+(/r/.test(t)?l-e._resizeClientX:e._resizeClientX-l),c=n._element_h+(/b/.test(t)?o-e._resizeClientY:e._resizeClientY-o),d=n._element_h/n._element_w*r;/t/.test(t)&&(e.resizeDiv.style.top=n._element_h-(/h/.test(t)?c:d)+"px"),/l/.test(t)&&(e.resizeDiv.style.left=n._element_w-r+"px"),/r|l/.test(t)&&(e.resizeDiv.style.width=r+"px",s=r),/^(t|b)[^h]$/.test(t)?(e.resizeDiv.style.height=d+"px",a=d):/^(t|b)h$/.test(t)&&(e.resizeDiv.style.height=c+"px",a=c),e._resize_w=s,e._resize_h=a,this.util.changeTxt(e.resizeDisplay,this._w.Math.round(s)+" x "+this._w.Math.round(a)),e._isChange=!0},cancel_controller_resize:function(e){const t=this.context.resizing._rotateVertical;this.controllersOff(),this.context.element.resizeBackground.style.display="none";let n=this._w.Math.round(t?this.context.resizing._resize_h:this.context.resizing._resize_w),i=this._w.Math.round(t?this.context.resizing._resize_w:this.context.resizing._resize_h);if(!t&&!/%$/.test(n)){const e=16,t=this.context.element.wysiwygFrame.clientWidth-2*e-2;this.util.getNumber(n,0)>t&&(i=this._w.Math.round(i/n*t),n=t)}const l=this.context.resizing._resize_plugin;this.plugins[l].setSize.call(this,n,i,!1,e),this.selectComponent(this.context[l]._element,l)}};return void 0===t&&(e.SUNEDITOR_MODULES||Object.defineProperty(e,"SUNEDITOR_MODULES",{enumerable:!0,writable:!1,configurable:!1,value:{}}),Object.defineProperty(e.SUNEDITOR_MODULES,"resizing",{enumerable:!0,writable:!1,configurable:!1,value:n})),n},"object"==typeof e.exports?e.exports=i.document?l(i,!0):function(e){if(!e.document)throw new Error("SUNEDITOR_MODULES a window with a document");return l(e)}:l(i)},"gjS+":function(e,t,n){"use strict";var i,l;i="undefined"!=typeof window?window:this,l=function(e,t){const n={name:"fileManager",_xmlHttp:null,upload:function(e,t,n,i,l){this.showLoading();const o=this.plugins.fileManager,s=o._xmlHttp=this.util.getXMLHttpRequest();if(s.onreadystatechange=o._callBackUpload.bind(this,s,i,l),s.open("post",e,!0),null!==t&&"object"==typeof t&&this._w.Object.keys(t).length>0)for(let e in t)s.setRequestHeader(e,t[e]);s.send(n)},_callBackUpload:function(e,t,n){if(4===e.readyState)if(200===e.status)try{t(e)}catch(e){throw Error('[SUNEDITOR.fileManager.upload.callBack.fail] cause : "'+e.message+'"')}finally{this.closeLoading()}else{this.closeLoading();const t=e.responseText?JSON.parse(e.responseText):e;if("function"!=typeof n||n("",t,this)){const n="[SUNEDITOR.fileManager.upload.serverException] status: "+e.status+", response: "+(t.errorMessage||e.responseText);throw this.functions.noticeOpen(n),Error(n)}}},checkInfo:function(e,t,n,i,l){let o=[];for(let e in t)o=o.concat([].slice.call(this.context.element.wysiwyg.getElementsByTagName(t[e])));const s=this.context[e],a=s._infoList,r=this.plugins.fileManager.setInfo.bind(this);if(o.length===a.length){if(this._componentsInfoReset){for(let t=0,i=o.length;t-1||(a.splice(t,1),"function"==typeof n&&n(null,e,"delete",null,0,this),t--);l&&(this.context.resizing._resize_plugin=c)},setInfo:function(e,t,n,i,l){const o=l?this.context.resizing._resize_plugin:"";l&&(this.context.resizing._resize_plugin=e);const s=this.plugins[e],a=this.context[e],r=a._infoList;let c=t.getAttribute("data-index"),d=null,u="";if(i||(i={name:t.getAttribute("data-file-name")||("string"==typeof t.src?t.src.split("/").pop():""),size:t.getAttribute("data-file-size")||0}),!c||this._componentsInfoInit)u="create",c=a._infoIndex++,t.setAttribute("data-index",c),t.setAttribute("data-file-name",i.name),t.setAttribute("data-file-size",i.size),d={src:t.src,index:1*c,name:i.name,size:i.size},r.push(d);else{u="update",c*=1;for(let e=0,t=r.length;e=0){const i=this.context[e]._infoList;for(let e=0,l=i.length;e
+
--Value
+
+
+
--Whitelist
@@ -439,6 +443,7 @@
Applied options
imageTable.innerHTML = '';
var options = {
+ value: document.getElementById('editor_value').checked ? document.getElementById('editor_value_value').value : undefined,
addTagsWhitelist: document.getElementById('addTagsWhitelist').checked ? document.getElementById('addTagsWhitelist_value').value : undefined,
pasteTagsWhitelist: document.getElementById('pasteTagsWhitelist').checked ? document.getElementById('pasteTagsWhitelist_value').value : undefined,
attributesWhitelist: !document.getElementById('attributesWhitelist').checked ? undefined : {
diff --git a/src/lib/constructor.js b/src/lib/constructor.js
index 10a7db255..be43f28c1 100755
--- a/src/lib/constructor.js
+++ b/src/lib/constructor.js
@@ -375,8 +375,9 @@ export default {
* @private
*/
_initOptions: function (element, options) {
- /** user options */
+ /** Values */
options.lang = options.lang || _defaultLang;
+ options.value = typeof options.value === 'string' ? options.value : null;
/** Whitelist */
options._defaultTagsWhitelist = typeof options._defaultTagsWhitelist === 'string' ? options._defaultTagsWhitelist : 'br|p|div|pre|blockquote|h[1-6]|ol|ul|li|hr|figure|figcaption|img|iframe|audio|video|source|table|thead|tbody|tr|th|td|a|b|strong|var|i|em|u|ins|s|span|strike|del|sub|sup';
options._editorTagsWhitelist = options._defaultTagsWhitelist + (typeof options.addTagsWhitelist === 'string' && options.addTagsWhitelist.length > 0 ? '|' + options.addTagsWhitelist : '');
diff --git a/src/lib/core.js b/src/lib/core.js
index 2d90d4730..394593684 100755
--- a/src/lib/core.js
+++ b/src/lib/core.js
@@ -387,6 +387,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
* @property {Element} fullScreen fullScreen button element
* @property {Element} showBlocks showBlocks button element
* @property {Element} codeView codeView button element
+ * @private
*/
_styleCommandMap: null,
@@ -761,6 +762,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
const format = util.createElement('P');
const br = util.createElement('BR');
format.appendChild(br);
+ context.element.wysiwyg.appendChild(format);
this.setRange(br, 0, br, 0);
} else {
this.setRange(range.startContainer, range.startOffset, range.endContainer, range.endOffset);
@@ -790,7 +792,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
if (!focusEl) this.nativeFocus();
else this.setRange(focusEl, focusEl.textContent.length, focusEl, focusEl.textContent.length);
} else {
- this.nativeFocus();
+ this.focus();
}
},
@@ -812,7 +814,9 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
range.setStart(startCon, startOff);
range.setEnd(endCon, endOff);
} catch (error) {
+ console.warn('[SUNEDITOR.core.focus.error] ' + error);
this.nativeFocus();
+ return;
}
const selection = this.getSelection();
@@ -934,12 +938,19 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
* @private
*/
_createDefaultRange: function () {
- context.element.wysiwyg.focus();
+ const wysiwyg = context.element.wysiwyg;
+ wysiwyg.focus();
const range = this._wd.createRange();
- if (!context.element.wysiwyg.firstChild) this.execCommand('formatBlock', false, 'P');
- range.setStart(context.element.wysiwyg.firstChild, 0);
- range.setEnd(context.element.wysiwyg.firstChild, 0);
+ let focusEl = wysiwyg.firstElementChild;
+ if (!focusEl) {
+ focusEl = util.createElement('P');
+ focusEl.innerHTML = '
';
+ wysiwyg.appendChild(focusEl);
+ }
+
+ range.setStart(focusEl, 0);
+ range.setEnd(focusEl, 0);
return range;
},
@@ -4572,7 +4583,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
/**
* @description Initializ core variable
* @param {Boolean} reload Is relooad?
- * @param {String} _initHTML initial html string when "reload" is true
+ * @param {String} _initHTML initial html string
* @private
*/
_init: function (reload, _initHTML) {
@@ -4685,24 +4696,14 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
this.addModule([_notice]);
// Init, validate
- _w.setTimeout(function () {
- if (options.iframe) {
- this._wd = context.element.wysiwygFrame.contentDocument;
- context.element.wysiwyg = this._wd.body;
- if (options._editorStyles.editor) context.element.wysiwyg.style.cssText = options._editorStyles.editor;
- if (options.height === 'auto') this._iframeAuto = this._wd.body;
- }
- this._initWysiwygArea(reload, _initHTML);
-
- this._checkComponents();
- this._componentsInfoInit = false;
- this._componentsInfoReset = false;
-
- this.history.reset(true);
- this._resourcesStateChange();
-
- if (typeof functions.onload === 'function') return functions.onload(this, reload);
- }.bind(this));
+ if (options.iframe) {
+ this._wd = context.element.wysiwygFrame.contentDocument;
+ context.element.wysiwyg = this._wd.body;
+ if (options._editorStyles.editor) context.element.wysiwyg.style.cssText = options._editorStyles.editor;
+ if (options.height === 'auto') this._iframeAuto = this._wd.body;
+ }
+
+ this._initWysiwygArea(reload, _initHTML);
},
/**
@@ -4731,17 +4732,13 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
},
/**
- * @description Initializ wysiwyg area (Only called from core._init())
+ * @description Initializ wysiwyg area (Only called from core._init)
* @param {Boolean} reload Is relooad?
- * @param {String} _initHTML initial html string when "reload" is true
+ * @param {String} _initHTML initial html string
* @private
*/
_initWysiwygArea: function (reload, _initHTML) {
- if (!reload) {
- context.element.wysiwyg.innerHTML = this.convertContentsForEditor(context.element.originElement.value);
- } else if (_initHTML) {
- context.element.wysiwyg.innerHTML = _initHTML;
- }
+ context.element.wysiwyg.innerHTML = reload ? _initHTML : this.convertContentsForEditor(typeof _initHTML === 'string' ? _initHTML : context.element.originElement.value);
},
/**
@@ -4795,7 +4792,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
/**
* @description If there is no default format, add a format and move "selection".
- * Alternative code for - execCommand('formatBlock');
* @param {String|null} formatName Format tag name (default: 'P')
* @private
*/
@@ -4882,7 +4878,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
/**
* @description Initializ editor
* @param {Boolean} reload Is relooad?
- * @param {String} _initHTML initial html string when "reload" is true
+ * @param {String} _initHTML initial html string
* @private
*/
_editorInit: function (reload, _initHTML) {
@@ -4895,6 +4891,15 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
// toolbar visibility
context.element.toolbar.style.visibility = '';
+
+ this._checkComponents();
+ this._componentsInfoInit = false;
+ this._componentsInfoReset = false;
+
+ this.history.reset(true);
+ this._resourcesStateChange();
+
+ if (typeof functions.onload === 'function') return functions.onload(this, reload);
},
/**
@@ -7280,7 +7285,8 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
if (options.iframe) {
contextEl.wysiwygFrame.addEventListener('load', function () {
util._setIframeDocument(this, options);
- core._editorInit(false, null);
+ core._editorInit(false, options.value);
+ options.value = null;
});
}
@@ -7296,7 +7302,8 @@ export default function (context, pluginCallButtons, plugins, lang, options, _ic
// init
if (!options.iframe) {
- core._editorInit(false, null);
+ core._editorInit(false, options.value);
+ options.value = null;
}
return functions;
diff --git a/src/options.d.ts b/src/options.d.ts
index a19c4674d..67152801f 100644
--- a/src/options.d.ts
+++ b/src/options.d.ts
@@ -3,6 +3,23 @@ import { Plugin } from './plugins/Plugin';
export interface SunEditorOptions {
plugins: Plugin[] | Record
;
+ /**
+ * Values
+ * ======
+ */
+ /**
+ * language object
+ */
+ lang?: Lang;
+ /**
+ * Initial value(html string) of the edit area.
+ * If not, the value of the "target textarea".
+ */
+ value?: string;
+ /**
+ * Whitelist
+ * ======
+ */
/**
* Add tags to the default tags whitelist of editor.
*/
@@ -19,10 +36,6 @@ export interface SunEditorOptions {
* Layout
* ======
*/
- /**
- * language object
- */
- lang?: Lang;
/**
* The mode of the editor (classic, inline, balloon, balloon-always)
*/
diff --git a/src/plugins/dialog/image.js b/src/plugins/dialog/image.js
index f401f6c09..107a09635 100644
--- a/src/plugins/dialog/image.js
+++ b/src/plugins/dialog/image.js
@@ -509,9 +509,10 @@ export default {
setup_reader: function (files, imgLinkValue, newWindowCheck, width, height, align, filesLen, isUpdate) {
try {
- const reader = new FileReader();
+ const wFileReader = this._w.FileReader;
- for (let i = 0, file; i <= filesLen; i++) {
+ for (let i = 0, reader, file; i <= filesLen; i++) {
+ reader = new wFileReader();
file = files[i];
if (isUpdate) {
diff --git a/src/plugins/fileBrowser/imageGallery.js b/src/plugins/fileBrowser/imageGallery.js
index 7cf7477d2..da3e80712 100644
--- a/src/plugins/fileBrowser/imageGallery.js
+++ b/src/plugins/fileBrowser/imageGallery.js
@@ -50,14 +50,15 @@ export default {
const srcName = item.src.split('/').pop();
return '' +
'
' +
- '
' + (item.name || srcName) + '
' +
+ '
' + (item.name || srcName) + '
' +
'
';
},
setImage: function (target) {
this.callPlugin('image', function () {
+ const file = {name: target.parentNode.querySelector('.__se__img_name').textContent, size: 0};
this.context.image._altText = target.alt;
- this.plugins.image.create_image.call(this, target.src, '', false, this.context.image._origin_w, this.context.image._origin_h, 'none', null);
+ this.plugins.image.create_image.call(this, target.src, '', false, this.context.image._origin_w, this.context.image._origin_h, 'none', file);
}.bind(this), null);
}
};
\ No newline at end of file
diff --git a/src/plugins/modules/fileManager.js b/src/plugins/modules/fileManager.js
index 812997519..c1943d843 100644
--- a/src/plugins/modules/fileManager.js
+++ b/src/plugins/modules/fileManager.js
@@ -46,7 +46,7 @@
xmlHttp.setRequestHeader(key, uploadHeader[key]);
}
}
- xmlHttp.send(formData);
+ xmlHttp.send(formData);
},
_callBackUpload: function (xmlHttp, callBack, errorCallBack) {
diff --git a/src/plugins/submenu/table.js b/src/plugins/submenu/table.js
index d82fde300..8f97e55d0 100644
--- a/src/plugins/submenu/table.js
+++ b/src/plugins/submenu/table.js
@@ -1437,10 +1437,9 @@ export default {
this.controllersOff();
if (emptyDiv !== this.context.element.wysiwyg) this.util.removeItemAllParents(emptyDiv, function (current) { return current.childNodes.length === 0; }, null);
+ this.focus();
}
- this.focus();
-
// history stack
this.history.push(false);
}
diff --git a/test/dev/suneditor_build_test.js b/test/dev/suneditor_build_test.js
index d25c6544e..0b8fdb7ea 100644
--- a/test/dev/suneditor_build_test.js
+++ b/test/dev/suneditor_build_test.js
@@ -132,71 +132,14 @@ suneditor.create('scrolleditor', {
let s1 = suneditor.create('editor', {
plugins: plugins,
- // mode: 'balloon-always',
- katex: Katex,
- linkProtocol: 'http://',
- fontSize: fs,
- resizingBar: true,
- height: '500px',
- // shortcutsDisable: ['bold'],
- // attributesWhitelist: 'style',
- buttonList: [
- ['undo', 'redo',
- 'font', 'fontSize', 'formatBlock',
- 'blockquote', 'paragraphStyle',
- 'bold', 'underline', 'italic', 'strike', 'subscript', 'superscript',
- 'fontColor', 'hiliteColor', 'textStyle',
- 'removeFormat',
- 'outdent', 'indent',
- 'list',
- 'align', 'horizontalRule', 'lineHeight',
- 'table', 'link', 'image', 'video', 'math',
- 'fullScreen', 'showBlocks', 'codeView',
- 'preview', 'print', 'save', 'template'],
- ['%510', [
- ['fullScreen', 'codeView'],
- [':moreText-More Text-default.more_horizontal', 'undo', 'redo', 'image'],
- [':command2-title2-text.Insert', 'codeView', 'preview'],
- ['outdent', 'indent'],
- ]]
- ],
- imageFileInput: false,
- icons: {
- undo: 'U',
- bold: 'B'
- },
- width: '100%',
- defaultStyle: 'font-size: 10px;',
- // fullPage: true,
- // pasteTagsWhitelist: 'p|h[1-6]',
- // attributesWhitelist: {
- // table: "style",
- // tbody: "style",
- // thead: "style",
- // tr: "style",
- // td: "style"
- // },
- addTagsWhitelist: '//',
- // addTagsWhitelist: '//',
- formats: [
- {
- tag: 'div', // Tag name
- name: 'NORMAL', // default: tag name
- command: 'free', // default: "replace"
- class: '__se__format__free_NORMAL', // Class names must always begin with "__se__format__"
- },
- {
- tag: 'div', // Tag name
- name: 'CODE', // default: tag name
- command: 'replace', // default: "replace"
- class: '__se__format__replace_CODE', // Class names must always begin with "__se__format__"
- },
- 'pre',
- 'blockquote'
- ],
- charCounterType: 'byte-html',
- charCounterLabel: 'HTML BYTE : ',
- maxCharCount: 650
+ mode: "balloon-always",
+ value: '',
+ resizingBar: false,
+ showPathLabel: false,
+ display: "inline",
+ tabDisable: false,
+ placeholder: "Enter the question image here",
+ buttonList: [["table","removeFormat"]],
})
// s1.core._charCount = function (nextCharCount, blink) {
@@ -318,6 +261,7 @@ let ss = window.ss = suneditor.create(document.getElementById('editor1'), {
lang: lang.ko,
plugins: plugins,
katex: Katex,
+ value: '',
codeMirror: CodeMirror,
display: 'block',
width: '100%',
@@ -328,12 +272,15 @@ let ss = window.ss = suneditor.create(document.getElementById('editor1'), {
charCounter: true,
charCounterType: 'byte-html',
charCounterLabel: 'Characters :',
+ imageMultipleFile: true,
+ videoMultipleFile: true,
+ audioMultipleFile: true,
+ // imageUploadUrl: 'http://localhost:3000/editor/upload',
+ // videoUploadUrl: 'http://localhost:3000/editor/upload',
+ // audioUploadUrl: 'http://localhost:3000/editor/upload',
iframe: true,
videoFileInput: true,
audioFileInput: true,
- imageUploadUrl: 'http://localhost:3000/editor/upload',
- videoUploadUrl: 'http://localhost:3000/editor/upload',
- audioUploadUrl: 'http://localhost:3000/editor/upload',
placeholder: 'Start typing something...',
templates: [
{
@@ -556,18 +503,18 @@ function ResizeImage (files, uploadHandler) {
reader.readAsDataURL(uploadFile);
}
-ss.onImageUploadBefore = function (files, info, core, uploadHandler) {
- // ResizeImage(files, uploadHandler)
+// ss.onImageUploadBefore = function (files, info, core, uploadHandler) {
+// // ResizeImage(files, uploadHandler)
- const response = { // Same format as "videoUploadUrl" response
- "result": [ { "url": "http://suneditor.com/docs/cat.jpg", "name": "test", "size": "0" }, ]
- };
- core.plugins.image.register.call(core, info, response);
-}
+// const response = { // Same format as "videoUploadUrl" response
+// "result": [ { "url": "http://suneditor.com/docs/cat.jpg", "name": "test", "size": "0" }, ]
+// };
+// core.plugins.image.register.call(core, info, response);
+// }
-ss.onImageUpload = function (targetElement, index, state, info, core) {
- console.log('imageInfo-----', info);
-}
+// ss.onImageUpload = function (targetElement, index, state, info, core) {
+// console.log('imageInfo-----', info);
+// }
ss.showInline = function (toolbar, context) {