New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

suneditor

Package Overview
Dependencies
Maintainers
1
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

suneditor - npm Package Compare versions

Comparing version 1.7.0 to 1.7.2

2

bower.json
{
"name": "suneditor",
"version": "1.7.0",
"version": "1.7.2",
"description": "Pure JavaScript based WYSIWYG web editor",

@@ -5,0 +5,0 @@ "main": "src/suneditor.js",

{
"name": "suneditor",
"version": "1.7.0",
"version": "1.7.2",
"description": "Pure JavaScript based WYSIWYG web editor",

@@ -5,0 +5,0 @@ "main": "src/suneditor.js",

@@ -17,50 +17,50 @@ "undefined"===typeof window.SUNEDITOR&&(window.SUNEDITOR={},SUNEDITOR.plugin={});

"sun-editor-editable";this.contentWindow.document.body.setAttribute("contenteditable",!0);this.contentWindow.document.body.innerHTML=z(a.value)});var n=e.createElement("DIV");n.className="sun-editor-id-resizeBar";var t=e.createElement("DIV");t.className="sun-editor-id-loading";t.innerHTML='<div class="ico-loading"></div>';e=e.createElement("DIV");e.className="sun-editor-id-resize-background";f.appendChild(p);f.appendChild(u);g.appendChild(c);g.appendChild(f);g.appendChild(n);g.appendChild(e);g.appendChild(t);
b.appendChild(g);return{constructed:{_top:b,_relative:g,_toolBar:c,_editorArea:f,_resizeBar:n,_loading:t,_resizeBack:e},options:d}}SUNEDITOR.util={getXMLHttpRequest:function(){if(window.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(d){return null}}else return window.XMLHttpRequest?new XMLHttpRequest:null},getBasePath:function(){var a=SUNEDITOR.SUNEDITOR_BASEPATH||"";if(!a)for(var d=document.getElementsByTagName("script"),
e=0;e<d.length;e++){var b=d[e].src.match(/(^|.*[\\\/])suneditor(\.min)?\.js(?:\?.*|;.*)?$/i);if(b){a=b[1];break}}-1===a.indexOf(":/")&&"//"!==a.slice(0,2)&&(a=0===a.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+a:location.href.match(/^[^\?]*\/(?:)/)[0]+a);if(!a)throw'[SUNEDITOR.util.getBasePath.fail] The SUNEDITOR installation path could not be automatically detected. Please set the global variable "SUNEDITOR.SUNEDITOR_BASEPATH" before creating editor instances.';return a}(),includeFile:function(a,
d,e){var b=document.createElement("script");b.type=a;b.src=d;b.onload=e;document.getElementsByTagName("head")[0].appendChild(b)}};SUNEDITOR.dom={getArrayIndex:function(a,d){for(var e=-1,b=0,g=a.length;b<g;b++)if(a[b]===d){e=b;break}return e},nextIdx:function(a,d){var e=this.getArrayIndex(a,d);return-1===e?-1:e+1},prevIdx:function(a,d){var e=this.getArrayIndex(a,d);return-1===e?-1:e-1},isCell:function(a){return a&&/^(?:TD|TH)$/i.test(a.nodeName)},getListChildren:function(a,d){var e=[];d=d||function(){return!0};
(function c(g){a!==g&&d(g)&&e.push(g);for(var f=0,p=g.children.length;f<p;f++)c(g.children[f])})(a);return e},getListChildNodes:function(a,d){var e=[];d=d||function(){return!0};(function c(a){d(a)&&e.push(a);for(var f=0,p=a.childNodes.length;f<p;f++)c(a.childNodes[f])})(a);return e},getParentNode:function(a,d){if(/\./.test(d)){var e="className";d=d.split(".")[1]}else/#/.test(d)?(e="id",d="^"+d.split("#")[1]+"$"):/:/.test(d)?(e="name",d="^"+d.split(":")[1]+"$"):(e="tagName",d="^"+d+"$");for(var b=
new RegExp(d,"i");a&&(3===a.nodeType||!b.test(a[e]));){if(/^BODY$/i.test(a.tagName))return null;a=a.parentNode}return a},changeTxt:function(a,d){a&&d&&(a.textContent=d)},addClass:function(a,d){a&&!(new RegExp("(\\s|^)"+d+"(\\s|$)")).test(a.className)&&(a.className+=" "+d)},removeClass:function(a,d){a&&(a.className=a.className.replace(new RegExp("(\\s|^)"+d+"(\\s|$)")," ").trim())},toggleClass:function(a,d){if(a){var e=new RegExp("(\\s|^)"+d+"(\\s|$)");e.test(a.className)?a.className=a.className.replace(e,
" ").trim():a.className+=" "+d}},removeItem:function(a){try{a.remove()}catch(d){a.parentNode.removeChild(a)}}};var E=function(a,d,e){var b={context:a,loadedPlugins:{},dialogForm:null,submenu:null,submenuActiveButton:null,controllerArray:[],commandMap:{FONT:a.tool.font,B:a.tool.bold,U:a.tool.underline,I:a.tool.italic,STRIKE:a.tool.strike,SIZE:a.tool.fontSize},_variable:{selectionNode:null,wysiwygActive:!0,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,originCssText:a.element.topArea.style.cssText,
editorHeight:a.user.height,isTouchMove:!1},callModule:function(c,a,b,d){var f=e.getBasePath+"plugins/"+c;if("dialog"===c){var p=this._callBack_addModule.bind(this,"dialog","dialog",b,this.callModule.bind(this,c,a,b,d));if(!SUNEDITOR.plugin.dialog){e.includeFile("text/javascript",f+"/dialog.js",p);return}if(!this.loadedPlugins.dialog){p();return}}SUNEDITOR.plugin[a]?this.loadedPlugins[a]?"function"===typeof d&&d():this._callBack_addModule(c,a,b,d):e.includeFile("text/javascript",f+"/"+a+".js",this._callBack_addModule.bind(this,
c,a,b,d))},_callBack_addModule:function(c,a,b,d){this.context[c]||(this.context[c]={});SUNEDITOR.plugin[a].add(this,b);this.loadedPlugins[a]=!0;"function"===typeof d&&d()},submenuOn:function(c){this.submenu=c.nextElementSibling;this.submenu.style.display="block";d.addClass(c,"on");this.submenuActiveButton=c},submenuOff:function(){this.submenu&&(this.submenu.style.display="none",this.submenu=null,d.removeClass(this.submenuActiveButton,"on"),this.submenuActiveButton=null);this.controllersOff()},controllersOff:function(){var c=
this.controllerArray.length;if(0<c){for(var a=0;a<c;a++)this.controllerArray[a].style.display="none";this.controllerArray=[]}},execCommand:function(c,f,b){a.element.wysiwygWindow.document.execCommand(c,f,b)},focus:function(){var c=d.getParentNode(this._variable.selectionNode,"figcaption");c?c.focus():a.element.wysiwygWindow.document.body.focus()},_setSelectionNode:function(){var c=this.getRange();this._variable.selectionNode=c.startContainer!==c.endContainer?c.startContainer:this.getSelectionNode()},
isEdgePoint:function(c,a){return 0===a||a===c.nodeValue.length},createRange:function(){return a.element.wysiwygWindow.document.createRange()},getSelection:function(){return a.element.wysiwygWindow.getSelection()},getSelectionNode:function(){return this.getSelection().extentNode||this.getSelection().anchorNode},getRange:function(){var c=this.getSelection();if(0<c.rangeCount)var b=c.getRangeAt(0);else b=this.createRange(),(c=this._variable.selectionNode)?(b.setStart(c.anchorNode,c.anchorOffset),b.setEnd(c.focusNode,
c.focusOffset)):(c=a.element.wysiwygWindow.document.body.firstChild,b.setStart(c,0),b.setEnd(c,0));return b},setRange:function(c,a,b,d){var f=this.createRange();f.setStart(c,a);f.setEnd(b,d);c=this.getSelection();0<c.rangeCount&&c.removeAllRanges();c.addRange(f)},showLoading:function(){a.element.loading.style.display="block"},closeLoading:function(){a.element.loading.style.display="none"},getLineElement:function(c){if(c=c||this._variable.selectionNode)for(;!/^BODY$/i.test(c.parentNode.tagName);)c=
c.parentNode;else c=a.element.wysiwygWindow.document.body.firstChild;return c},appendP:function(c){var a=document.createElement("P");a.innerHTML="&#65279";c=this.getLineElement(c);c.parentNode.insertBefore(a,c.nextElementSibling);return a},insertNode:function(c,a){if(a){var b=a.parentNode;a=a.nextSibling}else{var d=this.getSelection();b=this.getRange();var f=b.startContainer,e=b.startOffset,g=b.endContainer,k=b.endOffset;b=f;3===f.nodeType&&(b=f.parentNode);if(f===g&&e===k)d.focusNode&&3===d.focusNode.nodeType?
a=d.focusNode.splitText(k):(null!==b.lastChild&&/^BR$/i.test(b.lastChild.nodeName)&&b.removeChild(b.lastChild),a=null);else if(f===g)d=f,this.isEdgePoint(g,k)||(a=g.splitText(k)),this.isEdgePoint(f,e)||(d=f.splitText(e)),b.removeChild(d);else for(d.deleteFromDocument?d.deleteFromDocument():this.removeNode(),a=g;1!==a.nodeType;)a=a.parentNode}try{b.insertBefore(c,a)}catch(l){b.appendChild(c)}},removeNode:function(){var c=this.getRange(),a=c.startContainer,b=c.startOffset,e=c.endContainer,g=c.endOffset;
c=d.getListChildNodes(c.commonAncestorContainer);var t=d.getArrayIndex(c,a),m=d.getArrayIndex(c,e);var k=t+1;for(var l=a;0<=k;k--)c[k]===l.parentNode&&c[k].firstChild===l&&0===b&&(t=k,l=l.parentNode);k=m-1;for(l=e;k>t;k--)c[k]===l.parentNode&&1===c[k].nodeType&&(c.splice(k,1),l=l.parentNode,--m);for(;t<=m;t++)k=c[t],0===k.length||3===k.nodeType&&void 0===k.data?d.removeItem(k):k===a?(k=1===a.nodeType?document.createTextNode(a.textContent):document.createTextNode(a.substringData(0,b)),0<k.length?a.data=
k.data:d.removeItem(a)):k===e?(k=1===e.nodeType?document.createTextNode(e.textContent):document.createTextNode(e.substringData(g,e.length-g)),0<k.length?e.data=k.data:d.removeItem(e)):d.removeItem(k)},wrapRangeToTag:function(c,a){var b=this.getRange(),f=b.startContainer,e=b.startOffset,g=b.endContainer,m=b.endOffset,k=b.commonAncestorContainer;b={};var l={},q;if(a){var h="(?:;|^|\\s)(?:"+a[0];for(q=1;q<a.length;q++)h+="|"+a[q];h+=")\\s*:[^;]*\\s*(?:;|$)";h=new RegExp(h,"gi")}if(f===g){q=c.cloneNode(!1);
if(e===m)q.innerHTML="&nbsp;",f.parentNode.insertBefore(q,f.nextSibling);else{g=document.createTextNode(f.substringData(0,e));var w=document.createTextNode(f.substringData(m,f.length-m));q.innerText=f.substringData(e,m-e);f.parentNode.insertBefore(q,f.nextSibling);f.data=0<g.data.length?g.data:f.substringData(0,e);0<w.data.length&&f.parentNode.insertBefore(w,q.nextSibling)}b.container=q;b.offset=0;l.container=q;l.offset=1}else if(w=function(a){if(3===a.nodeType)return!0;var b="";h&&0<a.style.cssText.length&&
(b=a.style.cssText.replace(h,"").trim());return a.nodeName!==c.nodeName||0<b.length?(0<a.style.cssText.length&&(a.style.cssText=b),!0):!1},/BODY/i.test(k.nodeName)){l=d.getListChildren(k,function(a){return/^P$/i.test(a.nodeName)});var y=d.getParentNode(f,"P");k=d.getParentNode(g,"P");b=0;for(q=l.length;b<q;b++)if(y===l[b])y=b;else if(k===l[b]){k=b;break}q=c.cloneNode(!1);b=this._wrapLineNodesStart(l[y],q,w,f,e);for(f=y+1;f<k;f++)q=c.cloneNode(!1),this._wrapLineNodes(l[f],q,w);q=c.cloneNode(!1);l=
this._wrapLineNodesEnd(l[k],q,w,g,m)}else q=c.cloneNode(!1),m=this._wrapLineNodesPart(k,q,w,f,e,g,m),b.container=m.startContainer,b.offset=m.startOffset,l.container=m.endContainer,l.offset=m.endOffset;this.setRange(b.container,b.offset,l.container,l.offset)},_wrapLineNodesPart:function(a,b,e,g,n,t,m){var c=[],f=g,p=n,h=t,u=m,y=!1,A=!1,v,r,x;(function D(g,k){for(var q=g.childNodes,m=0,t=q.length;m<t&&!A;m++){var l=q[m];if(y&&l!==h&&3===l.nodeType){r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&&
v.push(r.cloneNode(!1)),r=r.parentNode;if(0<v.length){for(x=r=v.pop();0<v.length;)r=v.pop(),x.appendChild(r);b.appendChild(x);k=r}else k=b;k.appendChild(l.cloneNode(!1));c.push(l)}if(l===f){var n=document.createTextNode(f.substringData(0,p)),w=document.createTextNode(f.substringData(p,f.length-p));0<n.length?f.data=n.data:c.push(f);r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&&v.push(r.cloneNode(!1)),r=r.parentNode;for(x=r=v.pop()||l;0<v.length;)r=v.pop(),x.appendChild(r);x!==l?(b.appendChild(x),
k=r):k=b;f=w;p=0;k.appendChild(f);y=!0}else{if(l===h){q=document.createTextNode(h.substringData(u,h.length-u));m=document.createTextNode(h.substringData(0,u));t=r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&&v.push(r.cloneNode(!1)),t=r,r=r.parentNode;for(x=r=v.pop()||l;0<v.length;)r=v.pop(),x.appendChild(r);x!==l?(b.appendChild(x),k=r):k=b;0<q.length?h.data=q.data:c.push(h);h=m;u=m.length;k.appendChild(h);for(a.insertBefore(b,t);0<c.length;){l=c.pop();for(l.data="";l.parentNode&&0===l.parentNode.innerText.length;)l=
l.parentNode;d.removeItem(l)}A=!0;break}D(l)}}})(a);return{startContainer:f,startOffset:p,endContainer:h,endOffset:u}},_wrapLineNodes:function(a,b,d){(function m(a,c){for(var b=a.childNodes,f=0,e=b.length;f<e;f++){var p=b[f],g=c;if(d(p)){var t=p.cloneNode(!1);c.appendChild(t);1===p.nodeType&&(g=t)}m(p,g)}})(a,b);a.innerHTML="";a.appendChild(b)},_wrapLineNodesStart:function(a,b,e,g,n){var c=document.createElement("P"),f=g,p=n,l=!1,q,h,u;(function r(d,g){for(var k=d.childNodes,m=0,t=k.length;m<t;m++){var n=
k[m],v=g;if(l){if(1===n.nodeType){r(n,n);continue}h=n;for(q=[];null!==h.parentNode&&h!==a&&h!==b;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;if(0<q.length){for(u=h=q.pop();0<q.length;)h=q.pop(),u.appendChild(h);b.appendChild(u);g=h}else g=b}if(l||n!==f){if(!l||e(n)){var w=n.cloneNode(!1);g.appendChild(w);1===n.nodeType&&(v=w)}r(n,v)}else{n=document.createTextNode(f.substringData(0,p));v=document.createTextNode(f.substringData(p,f.length-p));0<n.data.length&&g.appendChild(n);h=g;
for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||g;0<q.length;)h=q.pop(),u.appendChild(h);u!==g?(b.appendChild(u),g=h):g=b;c.appendChild(b);f=v;p=0;l=!0;g.appendChild(f)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:f,offset:p}},_wrapLineNodesEnd:function(a,b,e,g,n){var c=document.createElement("P"),f=g,p=n,l=!1,q,h,u;(function r(d,g){for(var k=d.childNodes,n=k.length-1;0<=n;n--){var m=k[n],t=g;if(l){if(1===m.nodeType){r(m,
m);continue}h=m;for(q=[];null!==h.parentNode&&h!==a&&h!==b;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;if(0<q.length){for(u=h=q.pop();0<q.length;)h=q.pop(),u.insertBefore(h,u.firstChild);b.insertBefore(u,b.firstChild);g=h}else g=b}if(l||m!==f){if(!l||e(m)){var v=m.cloneNode(!1);g.insertBefore(v,g.firstChild);1===m.nodeType&&(t=v)}r(m,t)}else{m=document.createTextNode(f.substringData(p,f.length-p));t=document.createTextNode(f.substringData(0,p));0<m.data.length&&g.insertBefore(m,
g.firstChild);h=g;for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||g;0<q.length;)h=q.pop(),u.insertBefore(h,u.firstChild);u!==g?(b.insertBefore(u,b.firstChild),g=h):g=b;c.insertBefore(b,c.firstChild);f=t;p=t.data.length;l=!0;g.insertBefore(f,g.firstChild)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:f,offset:p}},indent:function(a,b){var c=d.getParentNode(a,"P");if(c){var f=/\d+/.test(c.style.marginLeft)?1*c.style.marginLeft.match(/\d+/)[0]:
0;f="indent"===b?f+25:f-25;c.style.marginLeft=(0>f?0:f)+"px"}},toggleFrame:function(){if(this._variable.wysiwygActive)a.element.code.value=a.element.wysiwygWindow.document.body.innerHTML.trim().replace(/<\/p>(?=[^\n])/gi,"</p>\n"),a.element.wysiwygElement.style.display="none",a.element.code.style.display="block",this._variable.wysiwygActive=!1;else{var b={"&amp;":"&","&nbsp;":"\u00a0","&lt;":"<","&gt;":">"},d=a.element.code.value.replace(/&[a-z]+;/g,function(a){return"string"===typeof b[a]?b[a]:a});
a.element.wysiwygWindow.document.body.innerHTML=0<d.trim().length?d:"<p>&#65279</p>";a.element.wysiwygWindow.document.body.scrollTop=0;a.element.code.style.display="none";a.element.wysiwygElement.style.display="block";this._variable.wysiwygActive=!0}},toggleFullScreen:function(b){this._variable.isFullScreen?(a.element.topArea.style.cssText=this._variable.originCssText,a.element.editorArea.style.height=this._variable.editorHeight+"px",d.removeClass(b.firstElementChild,"ico_full_screen_i"),d.addClass(b.firstElementChild,
"ico_full_screen_e")):(a.element.topArea.style.position="fixed",a.element.topArea.style.top="0",a.element.topArea.style.left="0",a.element.topArea.style.width="100%",a.element.topArea.style.height="100%",this._variable.innerHeight_fullScreen=window.innerHeight-a.tool.bar.offsetHeight,a.element.editorArea.style.height=this._variable.innerHeight_fullScreen+"px",d.removeClass(b.firstElementChild,"ico_full_screen_e"),d.addClass(b.firstElementChild,"ico_full_screen_i"));this._variable.isFullScreen=!this._variable.isFullScreen},
preview:function(){var b=window.open("","_blank");b.mimeType="text/html";b.document.head.innerHTML='<meta charset="utf-8" /><title>'+SUNEDITOR.lang.toolbar.preview+'</title><link rel="stylesheet" type="text/css" href="'+e.getBasePath+'css/suneditor-contents.css">';b.document.body.className="sun-editor-editable";b.document.body.innerHTML=a.element.wysiwygWindow.document.body.innerHTML}},g={_shortcutKeyCode:{66:["bold","B"],83:["strikethrough","STRIKE"],85:["underline","U"],73:["italic","I"],89:["redo"],
90:["undo"],219:["outdent"],221:["indent"]},_directionKeyKeyCode:/^(?:8|13|32|46|33|34|35|36|37|38|39|40|98|100|102|104)$/,_findButtonEffectTag:function(){for(var c=b._variable.selectionNode,f=!0,g=!0,e=!0,n="B|U|I|STRIKE|FONT|SIZE|",t=new RegExp(n,"i"),m;!/^(?:P|BODY|HTML|DIV)$/i.test(c.nodeName);){if(3!==c.nodeType){var k=[/^STRONG$/.test(c.nodeName)?"B":/^EM/.test(c.nodeName)?"I":c.nodeName];f&&1===c.nodeType&&(0<c.style.fontFamily.length||c.face&&0<c.face.length)&&(k.push("FONT"),f=(c.style.fontFamily||
c.face||SUNEDITOR.lang.toolbar.font).replace(/["']/g,""),d.changeTxt(b.commandMap.FONT,f),f=!1,n=n.replace("FONT|",""),t=new RegExp(n,"i"));e&&/^A$/i.test(c.nodeName)&&null===c.getAttribute("data-image-link")?(a.link&&b.controllerArray[0]===a.link.linkBtn||b.callModule("dialog","link",null,function(){SUNEDITOR.plugin.link.call_controller_linkButton.call(b,c)}),e=!1):e&&a.link&&b.controllerArray[0]===a.link.linkBtn&&b.controllersOff();g&&0<c.style.fontSize.length&&(d.changeTxt(b.commandMap.SIZE,c.style.fontSize.match(/\d+/)[0]),
g=!1,n=n.replace("SIZE|",""),t=new RegExp(n,"i"));m=c.style.cssText;/:\s*bold(?:;|\s)/.test(m)&&k.push("B");/:\s*underline(?:;|\s)/.test(m)&&k.push("U");/:\s*italic(?:;|\s)/.test(m)&&k.push("I");/:\s*line-through(?:;|\s)/.test(m)&&k.push("STRIKE");for(m=0;m<k.length;m++)t.test(k[m])&&(d.addClass(b.commandMap[k[m]],"on"),n=n.replace(k[m]+"|",""),t=new RegExp(n,"i"))}c=c.parentNode}e&&b.controllersOff();n=n.split("|");g=0;for(e=n.length-1;g<e;g++)/^FONT/i.test(n[g])?d.changeTxt(b.commandMap[n[g]],SUNEDITOR.lang.toolbar.font):
/^SIZE$/i.test(n[g])?d.changeTxt(b.commandMap[n[g]],SUNEDITOR.lang.toolbar.fontSize):d.removeClass(b.commandMap[n[g]],"on")},resize_window:function(){b._variable.isFullScreen&&(b._variable.innerHeight_fullScreen+=window.innerHeight-a.tool.bar.offsetHeight-b._variable.innerHeight_fullScreen,a.element.editorArea.style.height=b._variable.innerHeight_fullScreen+"px")},touchstart_toolbar:function(){b._variable.isTouchMove=!1},touchmove_toolbar:function(){b._variable.isTouchMove=!0},onClick_toolbar:function(c){if(b._variable.isTouchMove)return!0;
for(var f=c.target,g=f.getAttribute("data-display"),e=f.getAttribute("data-command"),n=f.className;!e&&!/editor_tool/.test(n)&&!/sun-editor-id-toolbar/.test(n);)f=f.parentNode,e=f.getAttribute("data-command"),g=f.getAttribute("data-display"),n=f.className;if(!e&&!g)return!0;c.preventDefault();c.stopPropagation();b.focus();if(g)c=b.submenu,b.submenuOff(),!/submenu/.test(g)||null!==f.nextElementSibling&&f.nextElementSibling===c?/dialog/.test(g)&&b.callModule("dialog",e,null,function(){SUNEDITOR.plugin.dialog.openDialog.call(b,
e,f.getAttribute("data-option"),!1)}):b.callModule("submenu",e,f,function(){b.submenuOn(f)});else{if(e)switch(e){case "codeView":b.toggleFrame();d.toggleClass(f,"on");break;case "fullScreen":b.toggleFullScreen(f);d.toggleClass(f,"on");break;case "indent":case "outdent":b.indent(b._variable.selectionNode,e);break;case "redo":case "undo":case "removeFormat":b.execCommand(e,!1,null);break;case "preview":b.preview();break;case "print":a.element.wysiwygWindow.print();break;default:b.execCommand(e,!1,f.getAttribute("data-value")),
d.toggleClass(f,"on")}b.submenuOff()}},onMouseUp_wysiwyg:function(a){a.stopPropagation();b._setSelectionNode();var c=a.target;b.submenuOff();/^HTML$/i.test(c.nodeName)?(a.preventDefault(),b.focus()):/^IMG$/i.test(c.nodeName)?(a.preventDefault(),b.callModule("dialog","image",null,function(){SUNEDITOR.plugin.image.call_controller_imageResize.call(b,c)})):g._findButtonEffectTag()},onKeyDown_wysiwyg:function(c){b._setSelectionNode();var f=c.keyCode,e=c.shiftKey,u=c.ctrlKey||c.metaKey,n=c.altKey;c.stopPropagation();
if(u&&!/^(?:16|17|18)$/.test(f)){var t;if(t=!(e&&83!==f))(t=g._shortcutKeyCode[f])?(b.execCommand(t[0],!1,null),d.toggleClass(b.commandMap[t[1]],"on"),t=!0):t=!1;if(t){c.preventDefault();return}}switch(f){case 8:if(/^P$/i.test(b._variable.selectionNode.tagName)&&null===b._variable.selectionNode.previousSibling)return c.preventDefault(),!1;break;case 9:if(c.preventDefault(),!u&&!n){for(c=b._variable.selectionNode||b.getSelection().anchorNode;!/^TD$/i.test(c.tagName)&&!/^BODY$/i.test(c.tagName);)c=
c.parentNode;if(c&&/^TD$/i.test(c.tagName)){f=d.getParentNode(c,"table");f=d.getListChildren(f,d.isCell);c=e?d.prevIdx(f,c):d.nextIdx(f,c);c!==f.length||e||(c=0);-1===c&&e&&(c=f.length-1);c=f[c];if(!c)return!1;e=b.createRange();e.setStart(c,0);e.setEnd(c,0);c=b.getSelection();0<c.rangeCount&&c.removeAllRanges();c.addRange(e)}else e||(e=a.element.wysiwygWindow.document.createTextNode(Array(b._variable.tabSize+1).join("\u00a0")),b.insertNode(e,null),c=b.getSelection(),f=b.createRange(),f.setStart(e,
b._variable.tabSize),f.setEnd(e,b._variable.tabSize),0<c.rangeCount&&c.removeAllRanges(),c.addRange(f))}}},onKeyUp_wysiwyg:function(a){b._setSelectionNode();g._directionKeyKeyCode.test(a.keyCode)&&g._findButtonEffectTag()},onScroll_wysiwyg:function(){b.controllersOff()},onDrop_wysiwyg:function(a){var c=a.dataTransfer.files;if(0===c.length)return!0;a.stopPropagation();a.preventDefault();b.focus();b.callModule("dialog","image",null,function(){b.context.image.imgInputFile.files=c;SUNEDITOR.plugin.image.onRender_imgInput.call(b);
b.context.image.imgInputFile.files=null})},onMouseDown_resizeBar:function(c){function d(){a.element.resizeBackground.style.display="none";document.removeEventListener("mousemove",g.resize_editor);document.removeEventListener("mouseup",d)}c.stopPropagation();b._variable.resizeClientY=c.clientY;a.element.resizeBackground.style.display="block";document.addEventListener("mousemove",g.resize_editor);document.addEventListener("mouseup",d)},resize_editor:function(c){var d=c.clientY-b._variable.resizeClientY;
a.element.editorArea.style.height=a.element.editorArea.offsetHeight+d+"px";b._variable.editorHeight=a.element.editorArea.offsetHeight+d;b._variable.resizeClientY=c.clientY}};a.tool.bar.addEventListener("touchstart",g.touchstart_toolbar);a.tool.bar.addEventListener("touchmove",g.touchmove_toolbar);a.tool.bar.addEventListener("touchend",g.onClick_toolbar);a.tool.bar.addEventListener("click",g.onClick_toolbar);a.element.wysiwygWindow.addEventListener("mouseup",g.onMouseUp_wysiwyg);a.element.wysiwygWindow.addEventListener("keydown",
g.onKeyDown_wysiwyg);a.element.wysiwygWindow.addEventListener("keyup",g.onKeyUp_wysiwyg);a.element.wysiwygWindow.addEventListener("scroll",g.onScroll_wysiwyg);a.element.wysiwygWindow.addEventListener("drop",g.onDrop_wysiwyg);a.element.resizebar.addEventListener("mousedown",g.onMouseDown_resizeBar);window.addEventListener("resize",g.resize_window);return{save:function(){a.element.textElement.innerHTML=b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},getContent:function(){var c=
"";return 0===a.element.wysiwygWindow.document.body.innerText.trim().length?c:c=b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},setContent:function(c){c=z(c);b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML=c:a.element.code.value=c},appendContent:function(c){if(b._variable.wysiwygActive){var d=document.createElement("P");d.innerHTML=c;a.element.wysiwygWindow.document.body.appendChild(d)}else a.element.code.value+=c},disabled:function(){a.tool.cover.style.display=
"block";a.element.wysiwygWindow.document.body.setAttribute("contenteditable",!1)},enabled:function(){a.tool.cover.style.display="none";a.element.wysiwygWindow.document.body.setAttribute("contenteditable",!0)},show:function(){var c=a.element.topArea.style;c.cssText=b._variable.originCssText;"none"===c.display&&(c.display="block")},hide:function(){a.element.topArea.style.display="none"},destroy:function(){a.element.topArea.parentNode.removeChild(a.element.topArea);a.element.textElement.style.display=
"";this.destroy=this.hide=this.show=this.enabled=this.disabled=this.appendContent=this.setContent=this.getContent=this.save=null}}};SUNEDITOR.lang=SUNEDITOR.lang||SUNEDITOR.defaultLang;SUNEDITOR.create=function(a,d){var e=document.getElementById(a);if(null===e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+a+'")');var b=C(e,d);if(document.getElementById(b.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+
b.constructed._top.id+'")');e.style.display="none";"object"===typeof e.nextElementSibling?e.parentNode.insertBefore(b.constructed._top,e.nextElementSibling):e.parentNode.appendChild(b.constructed._top);var g=b.constructed;b=b.options;e={element:{textElement:e,topArea:g._top,relative:g._relative,resizebar:g._resizeBar,editorArea:g._editorArea,wysiwygWindow:g._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0].contentWindow,wysiwygElement:g._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0],
code:g._editorArea.getElementsByClassName("sun-editor-id-code")[0],loading:g._loading,resizeBackground:g._resizeBack},tool:{bar:g._toolBar,cover:g._toolBar.getElementsByClassName("sun-editor-id-toolbar-cover")[0],bold:g._toolBar.getElementsByClassName("sun-editor-id-bold")[0],underline:g._toolBar.getElementsByClassName("sun-editor-id-underline")[0],italic:g._toolBar.getElementsByClassName("sun-editor-id-italic")[0],strike:g._toolBar.getElementsByClassName("sun-editor-id-strike")[0],font:g._toolBar.getElementsByClassName("sun-editor-font-family")[0],
fontSize:g._toolBar.getElementsByClassName("sun-editor-font-size")[0]},user:{videoX:b.videoX,videoY:b.videoY,imageFileInput:b.imageFileInput,imageUrlInput:b.imageUrlInput,imageSize:b.imageSize,imageUploadUrl:b.imageUploadUrl,addFont:b.addFont,fontList:b.fontList,fontSizeList:b.fontSizeList,height:b.height.match(/\d+/)[0]}};return E(e,SUNEDITOR.dom,SUNEDITOR.util)};SUNEDITOR.destroy=function(a){var d=document.getElementById("suneditor_"+a);d.parentNode.removeChild(d);document.getElementById(a).style.display=
""}})();
b.appendChild(g);return{constructed:{_top:b,_relative:g,_toolBar:c,_editorArea:f,_resizeBar:n,_loading:t,_resizeBack:e},options:d}}SUNEDITOR.util={getXMLHttpRequest:function(){if(window.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(d){return null}}else return window.XMLHttpRequest?new XMLHttpRequest:null},copyObj:function(a){var d={},e;for(e in a)d[e]=a[e];return d},getBasePath:function(){var a=SUNEDITOR.SUNEDITOR_BASEPATH||
"";if(!a)for(var d=document.getElementsByTagName("script"),e=0;e<d.length;e++){var b=d[e].src.match(/(^|.*[\\\/])suneditor(\.min)?\.js(?:\?.*|;.*)?$/i);if(b){a=b[1];break}}-1===a.indexOf(":/")&&"//"!==a.slice(0,2)&&(a=0===a.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+a:location.href.match(/^[^\?]*\/(?:)/)[0]+a);if(!a)throw'[SUNEDITOR.util.getBasePath.fail] The SUNEDITOR installation path could not be automatically detected. Please set the global variable "SUNEDITOR.SUNEDITOR_BASEPATH" before creating editor instances.';
return a}(),includeFile:function(a,d,e){var b=document.createElement("script");b.type=a;b.src=d;b.onload=e;document.getElementsByTagName("head")[0].appendChild(b)}};SUNEDITOR.dom={getArrayIndex:function(a,d){for(var e=-1,b=0,g=a.length;b<g;b++)if(a[b]===d){e=b;break}return e},nextIdx:function(a,d){var e=this.getArrayIndex(a,d);return-1===e?-1:e+1},prevIdx:function(a,d){var e=this.getArrayIndex(a,d);return-1===e?-1:e-1},isCell:function(a){return a&&/^(?:TD|TH)$/i.test(a.nodeName)},getListChildren:function(a,
d){var e=[];d=d||function(){return!0};(function c(g){a!==g&&d(g)&&e.push(g);for(var f=0,p=g.children.length;f<p;f++)c(g.children[f])})(a);return e},getListChildNodes:function(a,d){var e=[];d=d||function(){return!0};(function c(a){d(a)&&e.push(a);for(var f=0,p=a.childNodes.length;f<p;f++)c(a.childNodes[f])})(a);return e},getParentNode:function(a,d){if(/\./.test(d)){var e="className";d=d.split(".")[1]}else/#/.test(d)?(e="id",d="^"+d.split("#")[1]+"$"):/:/.test(d)?(e="name",d="^"+d.split(":")[1]+"$"):
(e="tagName",d="^"+d+"$");for(var b=new RegExp(d,"i");a&&(3===a.nodeType||!b.test(a[e]));){if(/^BODY$/i.test(a.tagName))return null;a=a.parentNode}return a},changeTxt:function(a,d){a&&d&&(a.textContent=d)},addClass:function(a,d){a&&!(new RegExp("(\\s|^)"+d+"(\\s|$)")).test(a.className)&&(a.className+=" "+d)},removeClass:function(a,d){a&&(a.className=a.className.replace(new RegExp("(\\s|^)"+d+"(\\s|$)")," ").trim())},toggleClass:function(a,d){if(a){var e=new RegExp("(\\s|^)"+d+"(\\s|$)");e.test(a.className)?
a.className=a.className.replace(e," ").trim():a.className+=" "+d}},removeItem:function(a){try{a.remove()}catch(d){a.parentNode.removeChild(a)}}};var E=function(a,d,e){var b={context:a,loadedPlugins:{},dialogForm:null,submenu:null,submenuActiveButton:null,controllerArray:[],commandMap:{FONT:a.tool.font,B:a.tool.bold,U:a.tool.underline,I:a.tool.italic,STRIKE:a.tool.strike,SIZE:a.tool.fontSize},_variable:{selectionNode:null,copySelection:null,wysiwygActive:!0,isFullScreen:!1,innerHeight_fullScreen:0,
resizeClientY:0,tabSize:4,originCssText:a.element.topArea.style.cssText,editorHeight:a.user.height,isTouchMove:!1},callModule:function(c,a,b,d){var f=e.getBasePath+"plugins/"+c;if("dialog"===c){var p=this._callBack_addModule.bind(this,"dialog","dialog",b,this.callModule.bind(this,c,a,b,d));if(!SUNEDITOR.plugin.dialog){e.includeFile("text/javascript",f+"/dialog.js",p);return}if(!this.loadedPlugins.dialog){p();return}}SUNEDITOR.plugin[a]?this.loadedPlugins[a]?"function"===typeof d&&d():this._callBack_addModule(c,
a,b,d):e.includeFile("text/javascript",f+"/"+a+".js",this._callBack_addModule.bind(this,c,a,b,d))},_callBack_addModule:function(c,a,b,d){this.context[c]||(this.context[c]={});SUNEDITOR.plugin[a].add(this,b);this.loadedPlugins[a]=!0;"function"===typeof d&&d()},submenuOn:function(c){this.submenu=c.nextElementSibling;this.submenu.style.display="block";d.addClass(c,"on");this.submenuActiveButton=c},submenuOff:function(){this.submenu&&(this.submenu.style.display="none",this.submenu=null,d.removeClass(this.submenuActiveButton,
"on"),this.submenuActiveButton=null);this.controllersOff()},controllersOff:function(){var c=this.controllerArray.length;if(0<c){for(var a=0;a<c;a++)this.controllerArray[a].style.display="none";this.controllerArray=[]}},execCommand:function(c,f,b){a.element.wysiwygWindow.document.execCommand(c,f,b)},focus:function(){var c=d.getParentNode(this._variable.selectionNode,"figcaption");c?c.focus():a.element.wysiwygWindow.document.body.focus()},_setSelectionNode:function(){this._variable.copySelection=e.copyObj(this.getSelection());
var c=this.getRange();this._variable.selectionNode=c.startContainer!==c.endContainer?c.startContainer:this.getSelectionNode()},isEdgePoint:function(c,a){return 0===a||a===c.nodeValue.length},createRange:function(){return a.element.wysiwygWindow.document.createRange()},getSelection:function(){return a.element.wysiwygWindow.getSelection()},getSelectionNode:function(){return this.getSelection().extentNode||this.getSelection().anchorNode},getRange:function(){var c=this.getSelection();if(0<c.rangeCount)var b=
c.getRangeAt(0);else b=this.createRange(),(c=this._variable.copySelection)?(b.setStart(c.anchorNode,c.anchorOffset),b.setEnd(c.focusNode,c.focusOffset)):(c=a.element.wysiwygWindow.document.body.firstChild,b.setStart(c,0),b.setEnd(c,0));return b},setRange:function(c,a,b,d){var f=this.createRange();f.setStart(c,a);f.setEnd(b,d);c=this.getSelection();0<c.rangeCount&&c.removeAllRanges();c.addRange(f)},showLoading:function(){a.element.loading.style.display="block"},closeLoading:function(){a.element.loading.style.display=
"none"},getLineElement:function(c){if(c=c||this._variable.selectionNode)for(;!/^BODY$/i.test(c.parentNode.tagName);)c=c.parentNode;else c=a.element.wysiwygWindow.document.body.firstChild;return c},appendP:function(c){var a=document.createElement("P");a.innerHTML="&#65279";c=this.getLineElement(c);c.parentNode.insertBefore(a,c.nextElementSibling);return a},insertNode:function(c,a){if(a){var b=a.parentNode;a=a.nextSibling}else{var d=this.getSelection();b=this.getRange();var f=b.startContainer,e=b.startOffset,
g=b.endContainer,k=b.endOffset;b=f;3===f.nodeType&&(b=f.parentNode);if(f===g&&e===k)d.focusNode&&3===d.focusNode.nodeType?a=d.focusNode.splitText(k):(null!==b.lastChild&&/^BR$/i.test(b.lastChild.nodeName)&&b.removeChild(b.lastChild),a=null);else if(f===g)d=f,this.isEdgePoint(g,k)||(a=g.splitText(k)),this.isEdgePoint(f,e)||(d=f.splitText(e)),b.removeChild(d);else for(d.deleteFromDocument?d.deleteFromDocument():this.removeNode(),a=g;1!==a.nodeType;)a=a.parentNode}try{b.insertBefore(c,a)}catch(l){b.appendChild(c)}},
removeNode:function(){var c=this.getRange(),a=c.startContainer,b=c.startOffset,e=c.endContainer,g=c.endOffset;c=d.getListChildNodes(c.commonAncestorContainer);var t=d.getArrayIndex(c,a),m=d.getArrayIndex(c,e);var k=t+1;for(var l=a;0<=k;k--)c[k]===l.parentNode&&c[k].firstChild===l&&0===b&&(t=k,l=l.parentNode);k=m-1;for(l=e;k>t;k--)c[k]===l.parentNode&&1===c[k].nodeType&&(c.splice(k,1),l=l.parentNode,--m);for(;t<=m;t++)k=c[t],0===k.length||3===k.nodeType&&void 0===k.data?d.removeItem(k):k===a?(k=1===
a.nodeType?document.createTextNode(a.textContent):document.createTextNode(a.substringData(0,b)),0<k.length?a.data=k.data:d.removeItem(a)):k===e?(k=1===e.nodeType?document.createTextNode(e.textContent):document.createTextNode(e.substringData(g,e.length-g)),0<k.length?e.data=k.data:d.removeItem(e)):d.removeItem(k)},wrapRangeToTag:function(c,a){var b=this.getRange(),f=b.startContainer,e=b.startOffset,g=b.endContainer,m=b.endOffset,k=b.commonAncestorContainer;b={};var l={},q;if(a){var h="(?:;|^|\\s)(?:"+
a[0];for(q=1;q<a.length;q++)h+="|"+a[q];h+=")\\s*:[^;]*\\s*(?:;|$)";h=new RegExp(h,"gi")}if(f===g){q=c.cloneNode(!1);if(e===m)q.innerHTML="&nbsp;",f.parentNode.insertBefore(q,f.nextSibling);else{g=document.createTextNode(f.substringData(0,e));var w=document.createTextNode(f.substringData(m,f.length-m));q.innerText=f.substringData(e,m-e);f.parentNode.insertBefore(q,f.nextSibling);f.data=0<g.data.length?g.data:f.substringData(0,e);0<w.data.length&&f.parentNode.insertBefore(w,q.nextSibling)}b.container=
q;b.offset=0;l.container=q;l.offset=1}else if(w=function(a){if(3===a.nodeType)return!0;var b="";h&&0<a.style.cssText.length&&(b=a.style.cssText.replace(h,"").trim());return a.nodeName!==c.nodeName||0<b.length?(0<a.style.cssText.length&&(a.style.cssText=b),!0):!1},/BODY/i.test(k.nodeName)){l=d.getListChildren(k,function(a){return/^P$/i.test(a.nodeName)});var y=d.getParentNode(f,"P");k=d.getParentNode(g,"P");b=0;for(q=l.length;b<q;b++)if(y===l[b])y=b;else if(k===l[b]){k=b;break}q=c.cloneNode(!1);b=
this._wrapLineNodesStart(l[y],q,w,f,e);for(f=y+1;f<k;f++)q=c.cloneNode(!1),this._wrapLineNodes(l[f],q,w);q=c.cloneNode(!1);l=this._wrapLineNodesEnd(l[k],q,w,g,m)}else q=c.cloneNode(!1),m=this._wrapLineNodesPart(k,q,w,f,e,g,m),b.container=m.startContainer,b.offset=m.startOffset,l.container=m.endContainer,l.offset=m.endOffset;this.setRange(b.container,b.offset,l.container,l.offset)},_wrapLineNodesPart:function(a,b,e,g,n,t,m){var c=[],f=g,p=n,h=t,u=m,y=!1,A=!1,v,r,x;(function D(g,k){for(var q=g.childNodes,
m=0,t=q.length;m<t&&!A;m++){var l=q[m];if(y&&l!==h&&3===l.nodeType){r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&&v.push(r.cloneNode(!1)),r=r.parentNode;if(0<v.length){for(x=r=v.pop();0<v.length;)r=v.pop(),x.appendChild(r);b.appendChild(x);k=r}else k=b;k.appendChild(l.cloneNode(!1));c.push(l)}if(l===f){var n=document.createTextNode(f.substringData(0,p)),w=document.createTextNode(f.substringData(p,f.length-p));0<n.length?f.data=n.data:c.push(f);r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&&
v.push(r.cloneNode(!1)),r=r.parentNode;for(x=r=v.pop()||l;0<v.length;)r=v.pop(),x.appendChild(r);x!==l?(b.appendChild(x),k=r):k=b;f=w;p=0;k.appendChild(f);y=!0}else{if(l===h){q=document.createTextNode(h.substringData(u,h.length-u));m=document.createTextNode(h.substringData(0,u));t=r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&&v.push(r.cloneNode(!1)),t=r,r=r.parentNode;for(x=r=v.pop()||l;0<v.length;)r=v.pop(),x.appendChild(r);x!==l?(b.appendChild(x),k=r):k=b;0<q.length?h.data=q.data:c.push(h);
h=m;u=m.length;k.appendChild(h);for(a.insertBefore(b,t);0<c.length;){l=c.pop();for(l.data="";l.parentNode&&0===l.parentNode.innerText.length;)l=l.parentNode;d.removeItem(l)}A=!0;break}D(l)}}})(a);return{startContainer:f,startOffset:p,endContainer:h,endOffset:u}},_wrapLineNodes:function(a,b,d){(function m(a,c){for(var b=a.childNodes,f=0,e=b.length;f<e;f++){var p=b[f],g=c;if(d(p)){var t=p.cloneNode(!1);c.appendChild(t);1===p.nodeType&&(g=t)}m(p,g)}})(a,b);a.innerHTML="";a.appendChild(b)},_wrapLineNodesStart:function(a,
b,e,g,n){var c=document.createElement("P"),f=g,p=n,l=!1,q,h,u;(function r(d,g){for(var k=d.childNodes,m=0,t=k.length;m<t;m++){var n=k[m],v=g;if(l){if(1===n.nodeType){r(n,n);continue}h=n;for(q=[];null!==h.parentNode&&h!==a&&h!==b;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;if(0<q.length){for(u=h=q.pop();0<q.length;)h=q.pop(),u.appendChild(h);b.appendChild(u);g=h}else g=b}if(l||n!==f){if(!l||e(n)){var w=n.cloneNode(!1);g.appendChild(w);1===n.nodeType&&(v=w)}r(n,v)}else{n=document.createTextNode(f.substringData(0,
p));v=document.createTextNode(f.substringData(p,f.length-p));0<n.data.length&&g.appendChild(n);h=g;for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||g;0<q.length;)h=q.pop(),u.appendChild(h);u!==g?(b.appendChild(u),g=h):g=b;c.appendChild(b);f=v;p=0;l=!0;g.appendChild(f)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:f,offset:p}},_wrapLineNodesEnd:function(a,b,e,g,n){var c=document.createElement("P"),f=g,p=n,l=!1,q,h,u;
(function r(d,g){for(var k=d.childNodes,n=k.length-1;0<=n;n--){var m=k[n],t=g;if(l){if(1===m.nodeType){r(m,m);continue}h=m;for(q=[];null!==h.parentNode&&h!==a&&h!==b;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;if(0<q.length){for(u=h=q.pop();0<q.length;)h=q.pop(),u.insertBefore(h,u.firstChild);b.insertBefore(u,b.firstChild);g=h}else g=b}if(l||m!==f){if(!l||e(m)){var v=m.cloneNode(!1);g.insertBefore(v,g.firstChild);1===m.nodeType&&(t=v)}r(m,t)}else{m=document.createTextNode(f.substringData(p,
f.length-p));t=document.createTextNode(f.substringData(0,p));0<m.data.length&&g.insertBefore(m,g.firstChild);h=g;for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||g;0<q.length;)h=q.pop(),u.insertBefore(h,u.firstChild);u!==g?(b.insertBefore(u,b.firstChild),g=h):g=b;c.insertBefore(b,c.firstChild);f=t;p=t.data.length;l=!0;g.insertBefore(f,g.firstChild)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:f,offset:p}},indent:function(a,
b){var c=d.getParentNode(a,"P");if(c){var f=/\d+/.test(c.style.marginLeft)?1*c.style.marginLeft.match(/\d+/)[0]:0;f="indent"===b?f+25:f-25;c.style.marginLeft=(0>f?0:f)+"px"}},toggleFrame:function(){if(this._variable.wysiwygActive)a.element.code.value=a.element.wysiwygWindow.document.body.innerHTML.trim().replace(/<\/p>(?=[^\n])/gi,"</p>\n"),a.element.wysiwygElement.style.display="none",a.element.code.style.display="block",this._variable.wysiwygActive=!1;else{var b={"&amp;":"&","&nbsp;":"\u00a0","&lt;":"<",
"&gt;":">"},d=a.element.code.value.replace(/&[a-z]+;/g,function(a){return"string"===typeof b[a]?b[a]:a});a.element.wysiwygWindow.document.body.innerHTML=0<d.trim().length?d:"<p>&#65279</p>";a.element.wysiwygWindow.document.body.scrollTop=0;a.element.code.style.display="none";a.element.wysiwygElement.style.display="block";this._variable.wysiwygActive=!0}},toggleFullScreen:function(b){this._variable.isFullScreen?(a.element.topArea.style.cssText=this._variable.originCssText,a.element.editorArea.style.height=
this._variable.editorHeight+"px",d.removeClass(b.firstElementChild,"ico_full_screen_i"),d.addClass(b.firstElementChild,"ico_full_screen_e")):(a.element.topArea.style.position="fixed",a.element.topArea.style.top="0",a.element.topArea.style.left="0",a.element.topArea.style.width="100%",a.element.topArea.style.height="100%",this._variable.innerHeight_fullScreen=window.innerHeight-a.tool.bar.offsetHeight,a.element.editorArea.style.height=this._variable.innerHeight_fullScreen+"px",d.removeClass(b.firstElementChild,
"ico_full_screen_e"),d.addClass(b.firstElementChild,"ico_full_screen_i"));this._variable.isFullScreen=!this._variable.isFullScreen},preview:function(){var b=window.open("","_blank");b.mimeType="text/html";b.document.head.innerHTML='<meta charset="utf-8" /><title>'+SUNEDITOR.lang.toolbar.preview+'</title><link rel="stylesheet" type="text/css" href="'+e.getBasePath+'css/suneditor-contents.css">';b.document.body.className="sun-editor-editable";b.document.body.innerHTML=a.element.wysiwygWindow.document.body.innerHTML}},
g={_shortcutKeyCode:{66:["bold","B"],83:["strikethrough","STRIKE"],85:["underline","U"],73:["italic","I"],89:["redo"],90:["undo"],219:["outdent"],221:["indent"]},_directionKeyKeyCode:/^(?:8|13|32|46|33|34|35|36|37|38|39|40|98|100|102|104)$/,_findButtonEffectTag:function(){for(var c=b._variable.selectionNode,f=!0,g=!0,e=!0,n="B|U|I|STRIKE|FONT|SIZE|",t=new RegExp(n,"i"),m;!/^(?:P|BODY|HTML|DIV)$/i.test(c.nodeName);){if(3!==c.nodeType){var k=[/^STRONG$/.test(c.nodeName)?"B":/^EM/.test(c.nodeName)?"I":
c.nodeName];f&&1===c.nodeType&&(0<c.style.fontFamily.length||c.face&&0<c.face.length)&&(k.push("FONT"),f=(c.style.fontFamily||c.face||SUNEDITOR.lang.toolbar.font).replace(/["']/g,""),d.changeTxt(b.commandMap.FONT,f),f=!1,n=n.replace("FONT|",""),t=new RegExp(n,"i"));e&&/^A$/i.test(c.nodeName)&&null===c.getAttribute("data-image-link")?(a.link&&b.controllerArray[0]===a.link.linkBtn||b.callModule("dialog","link",null,function(){SUNEDITOR.plugin.link.call_controller_linkButton.call(b,c)}),e=!1):e&&a.link&&
b.controllerArray[0]===a.link.linkBtn&&b.controllersOff();g&&0<c.style.fontSize.length&&(d.changeTxt(b.commandMap.SIZE,c.style.fontSize.match(/\d+/)[0]),g=!1,n=n.replace("SIZE|",""),t=new RegExp(n,"i"));m=c.style.cssText;/:\s*bold(?:;|\s)/.test(m)&&k.push("B");/:\s*underline(?:;|\s)/.test(m)&&k.push("U");/:\s*italic(?:;|\s)/.test(m)&&k.push("I");/:\s*line-through(?:;|\s)/.test(m)&&k.push("STRIKE");for(m=0;m<k.length;m++)t.test(k[m])&&(d.addClass(b.commandMap[k[m]],"on"),n=n.replace(k[m]+"|",""),t=
new RegExp(n,"i"))}c=c.parentNode}e&&b.controllersOff();n=n.split("|");g=0;for(e=n.length-1;g<e;g++)/^FONT/i.test(n[g])?d.changeTxt(b.commandMap[n[g]],SUNEDITOR.lang.toolbar.font):/^SIZE$/i.test(n[g])?d.changeTxt(b.commandMap[n[g]],SUNEDITOR.lang.toolbar.fontSize):d.removeClass(b.commandMap[n[g]],"on")},resize_window:function(){b._variable.isFullScreen&&(b._variable.innerHeight_fullScreen+=window.innerHeight-a.tool.bar.offsetHeight-b._variable.innerHeight_fullScreen,a.element.editorArea.style.height=
b._variable.innerHeight_fullScreen+"px")},touchstart_toolbar:function(){b._variable.isTouchMove=!1},touchmove_toolbar:function(){b._variable.isTouchMove=!0},onClick_toolbar:function(c){if(b._variable.isTouchMove)return!0;for(var f=c.target,g=f.getAttribute("data-display"),e=f.getAttribute("data-command"),n=f.className;!e&&!/editor_tool/.test(n)&&!/sun-editor-id-toolbar/.test(n);)f=f.parentNode,e=f.getAttribute("data-command"),g=f.getAttribute("data-display"),n=f.className;if(!e&&!g)return!0;c.preventDefault();
c.stopPropagation();b.focus();if(g)c=b.submenu,b.submenuOff(),!/submenu/.test(g)||null!==f.nextElementSibling&&f.nextElementSibling===c?/dialog/.test(g)&&b.callModule("dialog",e,null,function(){SUNEDITOR.plugin.dialog.openDialog.call(b,e,f.getAttribute("data-option"),!1)}):b.callModule("submenu",e,f,function(){b.submenuOn(f)});else{if(e)switch(e){case "codeView":b.toggleFrame();d.toggleClass(f,"on");break;case "fullScreen":b.toggleFullScreen(f);d.toggleClass(f,"on");break;case "indent":case "outdent":b.indent(b._variable.selectionNode,
e);break;case "redo":case "undo":case "removeFormat":b.execCommand(e,!1,null);break;case "preview":b.preview();break;case "print":a.element.wysiwygWindow.print();break;default:b.execCommand(e,!1,f.getAttribute("data-value")),d.toggleClass(f,"on")}b.submenuOff()}},onMouseUp_wysiwyg:function(a){a.stopPropagation();b._setSelectionNode();var c=a.target;b.submenuOff();/^HTML$/i.test(c.nodeName)?(a.preventDefault(),b.focus()):/^IMG$/i.test(c.nodeName)?(a.preventDefault(),b.callModule("dialog","image",null,
function(){SUNEDITOR.plugin.image.call_controller_imageResize.call(b,c)})):g._findButtonEffectTag()},onKeyDown_wysiwyg:function(c){b._setSelectionNode();var f=c.keyCode,e=c.shiftKey,u=c.ctrlKey||c.metaKey,n=c.altKey;c.stopPropagation();if(u&&!/^(?:16|17|18)$/.test(f)){var t;if(t=!(e&&83!==f))(t=g._shortcutKeyCode[f])?(b.execCommand(t[0],!1,null),d.toggleClass(b.commandMap[t[1]],"on"),t=!0):t=!1;if(t){c.preventDefault();return}}switch(f){case 8:if(/^P$/i.test(b._variable.selectionNode.tagName)&&null===
b._variable.selectionNode.previousSibling)return c.preventDefault(),!1;break;case 9:if(c.preventDefault(),!u&&!n){for(c=b._variable.selectionNode||b.getSelection().anchorNode;!/^TD$/i.test(c.tagName)&&!/^BODY$/i.test(c.tagName);)c=c.parentNode;if(c&&/^TD$/i.test(c.tagName)){f=d.getParentNode(c,"table");f=d.getListChildren(f,d.isCell);c=e?d.prevIdx(f,c):d.nextIdx(f,c);c!==f.length||e||(c=0);-1===c&&e&&(c=f.length-1);c=f[c];if(!c)return!1;e=b.createRange();e.setStart(c,0);e.setEnd(c,0);c=b.getSelection();
0<c.rangeCount&&c.removeAllRanges();c.addRange(e)}else e||(e=a.element.wysiwygWindow.document.createTextNode(Array(b._variable.tabSize+1).join("\u00a0")),b.insertNode(e,null),c=b.getSelection(),f=b.createRange(),f.setStart(e,b._variable.tabSize),f.setEnd(e,b._variable.tabSize),0<c.rangeCount&&c.removeAllRanges(),c.addRange(f))}}},onKeyUp_wysiwyg:function(a){b._setSelectionNode();g._directionKeyKeyCode.test(a.keyCode)&&g._findButtonEffectTag()},onScroll_wysiwyg:function(){b.controllersOff()},onDrop_wysiwyg:function(a){var c=
a.dataTransfer.files;if(0===c.length)return!0;a.stopPropagation();a.preventDefault();b.focus();b.callModule("dialog","image",null,function(){b.context.image.imgInputFile.files=c;SUNEDITOR.plugin.image.onRender_imgInput.call(b);b.context.image.imgInputFile.files=null})},onMouseDown_resizeBar:function(c){function d(){a.element.resizeBackground.style.display="none";document.removeEventListener("mousemove",g.resize_editor);document.removeEventListener("mouseup",d)}c.stopPropagation();b._variable.resizeClientY=
c.clientY;a.element.resizeBackground.style.display="block";document.addEventListener("mousemove",g.resize_editor);document.addEventListener("mouseup",d)},resize_editor:function(c){var d=c.clientY-b._variable.resizeClientY;a.element.editorArea.style.height=a.element.editorArea.offsetHeight+d+"px";b._variable.editorHeight=a.element.editorArea.offsetHeight+d;b._variable.resizeClientY=c.clientY}};a.tool.bar.addEventListener("touchstart",g.touchstart_toolbar);a.tool.bar.addEventListener("touchmove",g.touchmove_toolbar);
a.tool.bar.addEventListener("touchend",g.onClick_toolbar);a.tool.bar.addEventListener("click",g.onClick_toolbar);a.element.wysiwygWindow.addEventListener("mouseup",g.onMouseUp_wysiwyg);a.element.wysiwygWindow.addEventListener("keydown",g.onKeyDown_wysiwyg);a.element.wysiwygWindow.addEventListener("keyup",g.onKeyUp_wysiwyg);a.element.wysiwygWindow.addEventListener("scroll",g.onScroll_wysiwyg);a.element.wysiwygWindow.addEventListener("drop",g.onDrop_wysiwyg);a.element.resizebar.addEventListener("mousedown",
g.onMouseDown_resizeBar);window.addEventListener("resize",g.resize_window);return{save:function(){a.element.textElement.innerHTML=b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},getContent:function(){var c="";return 0===a.element.wysiwygWindow.document.body.innerText.trim().length?c:c=b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},setContent:function(c){c=z(c);b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML=
c:a.element.code.value=c},appendContent:function(c){if(b._variable.wysiwygActive){var d=document.createElement("P");d.innerHTML=c;a.element.wysiwygWindow.document.body.appendChild(d)}else a.element.code.value+=c},disabled:function(){a.tool.cover.style.display="block";a.element.wysiwygWindow.document.body.setAttribute("contenteditable",!1)},enabled:function(){a.tool.cover.style.display="none";a.element.wysiwygWindow.document.body.setAttribute("contenteditable",!0)},show:function(){var c=a.element.topArea.style;
c.cssText=b._variable.originCssText;"none"===c.display&&(c.display="block")},hide:function(){a.element.topArea.style.display="none"},destroy:function(){a.element.topArea.parentNode.removeChild(a.element.topArea);a.element.textElement.style.display="";this.destroy=this.hide=this.show=this.enabled=this.disabled=this.appendContent=this.setContent=this.getContent=this.save=null}}};SUNEDITOR.lang=SUNEDITOR.lang||SUNEDITOR.defaultLang;SUNEDITOR.create=function(a,d){var e=document.getElementById(a);if(null===
e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+a+'")');var b=C(e,d);if(document.getElementById(b.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+b.constructed._top.id+'")');e.style.display="none";"object"===typeof e.nextElementSibling?e.parentNode.insertBefore(b.constructed._top,e.nextElementSibling):e.parentNode.appendChild(b.constructed._top);var g=b.constructed;b=b.options;e={element:{textElement:e,
topArea:g._top,relative:g._relative,resizebar:g._resizeBar,editorArea:g._editorArea,wysiwygWindow:g._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0].contentWindow,wysiwygElement:g._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0],code:g._editorArea.getElementsByClassName("sun-editor-id-code")[0],loading:g._loading,resizeBackground:g._resizeBack},tool:{bar:g._toolBar,cover:g._toolBar.getElementsByClassName("sun-editor-id-toolbar-cover")[0],bold:g._toolBar.getElementsByClassName("sun-editor-id-bold")[0],
underline:g._toolBar.getElementsByClassName("sun-editor-id-underline")[0],italic:g._toolBar.getElementsByClassName("sun-editor-id-italic")[0],strike:g._toolBar.getElementsByClassName("sun-editor-id-strike")[0],font:g._toolBar.getElementsByClassName("sun-editor-font-family")[0],fontSize:g._toolBar.getElementsByClassName("sun-editor-font-size")[0]},user:{videoX:b.videoX,videoY:b.videoY,imageFileInput:b.imageFileInput,imageUrlInput:b.imageUrlInput,imageSize:b.imageSize,imageUploadUrl:b.imageUploadUrl,
addFont:b.addFont,fontList:b.fontList,fontSizeList:b.fontSizeList,height:b.height.match(/\d+/)[0]}};return E(e,SUNEDITOR.dom,SUNEDITOR.util)};SUNEDITOR.destroy=function(a){var d=document.getElementById("suneditor_"+a);d.parentNode.removeChild(d);document.getElementById(a).style.display=""}})();

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc