diff --git a/bower.json b/bower.json index 722018bad..83a3da704 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "suneditor", - "version": "2.9.1", + "version": "2.9.2", "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 8391a6d5b..0f19f958c 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";var _lib_util__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("8e1d"),_modules_colorPicker__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("EjF6");__webpack_exports__.a={name:"fontColor",add:function(core,targetElement){core.addModule([_modules_colorPicker__WEBPACK_IMPORTED_MODULE_1__.a]);const context=core.context;context.fontColor={previewEl:null,colorInput:null};let listDiv=eval(this.setSubmenu(context.colorPicker.colorListHTML));context.fontColor.colorInput=listDiv.getElementsByClassName("sun-editor-id-submenu-color-input")[0],context.fontColor.colorInput.addEventListener("keyup",this.onChangeInput.bind(core)),listDiv.getElementsByClassName("sun-editor-id-submenu-color-submit")[0].addEventListener("click",this.submit.bind(core)),listDiv.getElementsByTagName("UL")[0].addEventListener("click",this.pickup.bind(core)),targetElement.parentNode.appendChild(listDiv),listDiv=null},setSubmenu:function(e){const t=_lib_util__WEBPACK_IMPORTED_MODULE_0__.a.createElement("DIV");return t.className="layer_editor",t.style.display="none",t.innerHTML=e,t},on:function(){const e=this.context.colorPicker;e._colorInput=this.context.fontColor.colorInput,e._defaultColor="#000000",e._styleProperty="color",this.plugins.colorPicker.init.call(this,this.getSelectionNode(),null)},onChangeInput:function(e){this.plugins.colorPicker.setCurrentColor.call(this,"#"+e.target.value)},submit:function(){this.plugins.fontColor.applyColor.call(this,this.context.colorPicker._currentColor)},pickup:function(e){if(e.preventDefault(),e.stopPropagation(),!/^BUTTON$/i.test(e.target.tagName))return!1;this.plugins.fontColor.applyColor.call(this,e.target.getAttribute("data-value"))},applyColor:function(e){const t=_lib_util__WEBPACK_IMPORTED_MODULE_0__.a.createElement("SPAN");t.style.color=e,this.nodeChange(t,["color"]),this.submenuOff(),this.focus()}}},"1kvd":function(e,t,i){"use strict";var n=i("8e1d");t.a={name:"dialog",add:function(e){const t=e.context;t.dialog={};let i=n.a.createElement("DIV");i.className="sun-editor-id-dialogBox sun-editor-common";let o=n.a.createElement("DIV");o.className="modal-dialog-background sun-editor-id-dialog-back",o.style.display="none";let l=n.a.createElement("DIV");l.className="modal-dialog sun-editor-id-dialog-modal",l.style.display="none",i.appendChild(o),i.appendChild(l),t.dialog.modalArea=i,t.dialog.back=o,t.dialog.modal=l,t.dialog.modal.addEventListener("click",this.onClick_dialog.bind(e)),t.element.relative.appendChild(i),i=null,o=null,l=null},onClick_dialog:function(e){e.stopPropagation(),(/modal-dialog/.test(e.target.className)||/close/.test(e.target.getAttribute("data-command")))&&this.plugins.dialog.close.call(this)},open:function(e,t){if(this.modalForm)return!1;this.context.dialog.updateModal=t,"full"===this.context.option.popupDisplay?this.context.dialog.modalArea.style.position="fixed":this.context.dialog.modalArea.style.position="absolute",this.context.dialog.kind=e,this.modalForm=this.context[e].modal;const i=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",i&&i.focus()},close: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)}}},"3FqI":function(e,t,i){},"50IV":function(module,__webpack_exports__,__webpack_require__){"use strict";var _lib_util__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("8e1d");__webpack_exports__.a={name:"font",add:function(core,targetElement){let listDiv=eval(this.setSubmenu(core.context.option));listDiv.getElementsByClassName("list_family")[0].addEventListener("click",this.pickup.bind(core)),targetElement.parentNode.appendChild(listDiv),listDiv=null},setSubmenu:function(e){const t=_lib_util__WEBPACK_IMPORTED_MODULE_0__.a.createElement("DIV");let i,n,o,l;t.className="layer_editor",t.style.display="none";let a=e.font?e.font:["Arial","Comic Sans MS","Courier New,Courier","Impact,Charcoal,sans-serif","Georgia","tahoma","Trebuchet MS,Helvetica","Verdana"],s='
"+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:this.zeroWidthSpace)+"
"),n},convertHTMLForCodeView:function(e){return e.replace(/\s*<(?:li|td)\s*(?:[a-z\-]+)?\s*(?:="?[^>]*"?)?\s*>/gi,this._insertIndent).replace(/<\/?(?:blockquote|hr|ol|ul|table|tbody|thead|th|tr)\s*(?:[a-z\-]+)?\s*(?:="?[^>]*"?)?\s*>(?=[^\n])/gi,this._insertLineBreak).replace(/<\/(?:p|div|h[1-6]|li|td|pre)>(?=[^\n])/gi,this._insertLineBreak)},_insertIndent:function(e){return" "+e.trim()},_insertLineBreak:function(e){return 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|CODE)$/i.test(e.nodeName)||/sun-editor-id-comp/.test(e.className))},isRangeFormatElement:function(e){return!(!e||1!==e.nodeType||!/^(?:BLOCKQUOTE|TABLE|THEAD|TBODY|TH|TR|TD|OL|UL|PRE|FIGCAPTION)$/i.test(e.nodeName))},getFormatElement:function(e){if(!e)return null;for(;!this.isFormatElement(e)&&!this.isWysiwygDiv(e.parentNode);)e=e.parentNode;if(this.isWysiwygDiv(e)||this.isRangeFormatElement(e)){return this.getListChildren(e,function(e){return this.isFormatElement(e)}.bind(this))[0]}return e},getRangeFormatElement:function(e){if(!e)return null;for(;!this.isRangeFormatElement(e)&&!this.isWysiwygDiv(e);)e=e.parentNode;return this.isWysiwygDiv(e)?null:e},getArrayIndex:function(e,t){let i=-1;for(let n=0,o=e.length;n"+p.a.zeroWidthSpace+"
",e.element.wysiwyg.scrollTop=0,e.element.code.style.display="none",e.element.wysiwyg.style.display="block","auto"===e.option.height&&(e.element.code.style.height="0px"),this._variable.wysiwygActive=!0,this.focus()}},toggleFullScreen:function(t){this._variable.isFullScreen?(this._variable.isFullScreen=!1,e.element.code.style.cssText=this._variable._codeOriginCssText,e.element.wysiwyg.style.cssText=this._variable._wysiwygOriginCssText,e.element.toolbar.style.cssText="",e.element.editorArea.style.cssText=this._variable._editorAreaOriginCssText,e.element.topArea.style.cssText=this._variable._originCssText,n.body.style.overflow=this._variable._bodyOverflow,e.option.stickyToolbar>-1&&(p.a.removeClass(e.element.toolbar,"sun-editor-sticky"),a.onScroll_window()),p.a.removeClass(t.firstElementChild,"icon-reduction"),p.a.addClass(t.firstElementChild,"icon-expansion")):(this._variable.isFullScreen=!0,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._bodyOverflow=n.body.style.overflow,n.body.style.overflow="hidden",this._variable._editorAreaOriginCssText=e.element.editorArea.style.cssText,this._variable._wysiwygOriginCssText=e.element.wysiwyg.style.cssText,this._variable._codeOriginCssText=e.element.code.style.cssText,e.element.editorArea.style.cssText=e.element.toolbar.style.cssText=e.element.wysiwyg.style.cssText=e.element.code.style.cssText="",e.element.toolbar.style.width=e.element.wysiwyg.style.height=e.element.code.style.height="100%",e.element.toolbar.style.position="relative",this._variable.innerHeight_fullScreen=o.innerHeight-e.element.toolbar.offsetHeight,e.element.editorArea.style.height=this._variable.innerHeight_fullScreen+"px",p.a.removeClass(t.firstElementChild,"icon-expansion"),p.a.addClass(t.firstElementChild,"icon-reduction"))},openWindowContents:function(t){const n="print"===t,l=o.open("","_blank");l.mimeType="text/html",l.document.write('' + _util__WEBPACK_IMPORTED_MODULE_0__[\"default\"].zeroWidthSpace + '
';\n context.element.wysiwyg.scrollTop = 0;\n context.element.code.style.display = 'none';\n context.element.wysiwyg.style.display = 'block';\n if (context.option.height === 'auto') context.element.code.style.height = '0px';\n this._variable.wysiwygActive = true;\n this.focus();\n } else {\n context.element.code.value = _util__WEBPACK_IMPORTED_MODULE_0__[\"default\"].convertHTMLForCodeView(context.element.wysiwyg.innerHTML.trim());\n context.element.wysiwyg.style.display = 'none';\n context.element.code.style.display = 'block';\n if (context.option.height === 'auto') context.element.code.style.height = context.element.code.scrollHeight > 0 ? context.element.code.scrollHeight + 'px' : 'auto';\n this._variable.wysiwygActive = false;\n context.element.code.focus();\n }\n },\n\n /**\r\n * @description Changes to full screen or default screen\r\n * @param {Element} element - full screen button\r\n */\n toggleFullScreen: function (element) {\n if (!this._variable.isFullScreen) {\n this._variable.isFullScreen = true;\n context.element.topArea.style.position = 'fixed';\n context.element.topArea.style.top = '0';\n context.element.topArea.style.left = '0';\n context.element.topArea.style.width = '100%';\n context.element.topArea.style.height = '100%';\n context.element.topArea.style.zIndex = '2147483647';\n this._variable._bodyOverflow = _d.body.style.overflow;\n _d.body.style.overflow = 'hidden';\n this._variable._editorAreaOriginCssText = context.element.editorArea.style.cssText;\n this._variable._wysiwygOriginCssText = context.element.wysiwyg.style.cssText;\n this._variable._codeOriginCssText = context.element.code.style.cssText;\n context.element.editorArea.style.cssText = context.element.toolbar.style.cssText = context.element.wysiwyg.style.cssText = context.element.code.style.cssText = '';\n context.element.toolbar.style.width = context.element.wysiwyg.style.height = context.element.code.style.height = '100%';\n context.element.toolbar.style.position = 'relative';\n this._variable.innerHeight_fullScreen = _w.innerHeight - context.element.toolbar.offsetHeight;\n context.element.editorArea.style.height = this._variable.innerHeight_fullScreen + 'px';\n _util__WEBPACK_IMPORTED_MODULE_0__[\"default\"].removeClass(element.firstElementChild, 'icon-expansion');\n _util__WEBPACK_IMPORTED_MODULE_0__[\"default\"].addClass(element.firstElementChild, 'icon-reduction');\n } else {\n this._variable.isFullScreen = false;\n context.element.code.style.cssText = this._variable._codeOriginCssText;\n context.element.wysiwyg.style.cssText = this._variable._wysiwygOriginCssText;\n context.element.toolbar.style.cssText = '';\n context.element.editorArea.style.cssText = this._variable._editorAreaOriginCssText;\n context.element.topArea.style.cssText = this._variable._originCssText;\n _d.body.style.overflow = this._variable._bodyOverflow;\n\n if (context.option.stickyToolbar > -1) {\n _util__WEBPACK_IMPORTED_MODULE_0__[\"default\"].removeClass(context.element.toolbar, 'sun-editor-sticky');\n event.onScroll_window();\n }\n\n _util__WEBPACK_IMPORTED_MODULE_0__[\"default\"].removeClass(element.firstElementChild, 'icon-reduction');\n _util__WEBPACK_IMPORTED_MODULE_0__[\"default\"].addClass(element.firstElementChild, 'icon-expansion');\n }\n },\n\n /**\r\n * @description Open the preview window or open the print window\r\n * @param {String} mode - 'preview' or 'print'\r\n */\n openWindowContents: function (mode) {\n const isPrint = mode === 'print';\n\n const windowObject = _w.open('', '_blank');\n\n windowObject.mimeType = 'text/html';\n windowObject.document.write('' + '' + '' + '' + '' + '