Current Path : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/fileman/html_editor/ |
Current File : /var/www/www-root/data/www/www.monolith-realty.ru/bitrix/js/fileman/html_editor/html-actions.min.js |
(function(){function e(e){this.editor=e;this.document=e.sandbox.GetDocument();BX.addCustomEvent(this.editor,"OnIframeReInit",BX.proxy((function(){this.document=this.editor.sandbox.GetDocument()}),this));this.actions=this.GetActionList();this.contentActionIndex={removeFormat:1,bold:1,italic:1,underline:1,strikeout:1,fontSize:1,foreColor:1,backgroundColor:1,formatInline:1,formatBlock:1,createLink:1,insertHTML:1,insertImage:1,insertLineBreak:1,removeLink:1,insertOrderedList:1,insertUnorderedList:1,align:1,indent:1,outdent:1,formatStyle:1,fontFamily:1,universalFormatStyle:1,quote:1,code:1,sub:1,sup:1,insertSmile:1}}e.prototype={IsSupportedByBrowser:function(e){var t=BX.browser.IsIE()||BX.browser.IsIE10()||BX.browser.IsIE11(),r={indent:t,outdent:t,formatBlock:t,insertUnorderedList:BX.browser.IsIE()||BX.browser.IsOpera(),insertOrderedList:BX.browser.IsIE()||BX.browser.IsOpera()},n={insertHTML:BX.browser.IsFirefox()};if(!r[e]){try{return this.document.queryCommandSupported(e)}catch(e){}try{return this.document.queryCommandEnabled(e)}catch(t){return!!n[e]}}return false},IsSupported:function(e){return!!this.actions[e]},IsContentAction:function(e){return this.contentActionIndex[e]},Exec:function(e,t,r){var n=this,i=this.actions[e],o=i&&i.exec,a=this.IsContentAction(e),l=null;if(!r){this.editor.On("OnBeforeCommandExec",[a,e,i,t])}if(a){this.editor.Focus(false)}if(o){l=o.apply(i,arguments)}else{try{l=this.document.execCommand(e,false,t)}catch(e){}}if(a){setTimeout((function(){n.editor.Focus(false)}),1)}if(!r){this.editor.On("OnAfterCommandExec",[a,e])}return l},CheckState:function(e,t){var r=this.actions[e],n=null;if(r&&r.state){n=r.state.apply(r,arguments)}else{try{n=this.document.queryCommandState(e)}catch(e){n=false}}return n},GetValue:function(e){var t=this.commands[e],r=t&&t.value;if(r){return r.call(t,this.composer,e)}else{try{return this.document.queryCommandValue(e)}catch(e){return null}}},GetActionList:function(){this.actions={changeView:this.GetChangeView(),splitMode:this.GetChangeSplitMode(),fullscreen:this.GetFullscreen(),changeTemplate:this.GetChangeTemplate(),removeFormat:this.GetRemoveFormat(),bold:this.GetBold(),italic:this.GetItalic(),underline:this.GetUnderline(),strikeout:this.GetStrikeout(),fontSize:this.GetFontSize(),foreColor:this.GetForeColor(),backgroundColor:this.GetBackgroundColor(),formatInline:this.GetFormatInline(),formatBlock:this.GetFormatBlock(),createLink:this.GetCreateLink(),insertHTML:this.GetInsertHTML(),insertImage:this.GetInsertImage(),insertLineBreak:this.GetInsertLineBreak(),insertTable:this.GetInsertTable(),removeLink:this.GetRemoveLink(),insertHr:this.GetInsertHr(),insertOrderedList:this.GetInsertList({bOrdered:true}),insertUnorderedList:this.GetInsertList({bOrdered:false}),align:this.GetAlign(),indent:this.GetIndent(),outdent:this.GetOutdent(),formatStyle:this.GetFormatStyle(),fontFamily:this.GetFontFamily(),universalFormatStyle:this.GetUniversalFormatStyle(),selectNode:this.GetSelectNode(),doUndo:this.GetUndoRedo(true),doRedo:this.GetUndoRedo(false),sub:this.GetSubSup("sub"),sup:this.GetSubSup("sup"),quote:this.GetQuote(),code:this.GetCode(),insertSmile:this.GetInsertSmile(),tableOperation:this.GetTableOperation(),formatBbCode:this.GetFormatBbCode()};this.editor.On("OnGetActionsList");return this.actions},GetChangeView:function(){var e=this;return{exec:function(){var t=arguments[1];if({code:1,wysiwyg:1,split:1}[t])e.editor.SetView(t)},state:function(){return false},value:function(){}}},GetChangeSplitMode:function(){var e=this;return{exec:function(){e.editor.SetSplitMode(arguments[1]==1)},state:function(){return e.editor.GetSplitMode()},value:function(){}}},GetFullscreen:function(){var e=this;return{exec:function(){e.editor.Expand()},state:function(){return e.editor.IsExpanded()},value:function(){}}},GetFormatInline:function(){var e=this,t={strong:"b",em:"i",b:"strong",i:"em"},r={};function n(e,t,r){var n=e+":";if(r)n+=r;if(t){for(var i in t)if(t.hasOwnProperty(i))n+=i+"="+t[i]+";"}return n}function i(i,o,a){var l=n(i,o,a);if(!r[l]){var s=t[i];var d=s?[i.toLowerCase(),s.toLowerCase()]:[i.toLowerCase()];r[l]=new e.editor.HTMLStyler(e.editor,d,o,a,true)}return r[l]}return{exec:function(t,r,n,o,a,l){l=!l||typeof l!="object"?{}:l;e.editor.iframeView.Focus();var s=e.editor.selection.GetRange();if(!s){return false}var d=i(n,o,a);if(l.bClear){s=d.UndoToRange(s,false)}else{s=d.ToggleRange(s)}setTimeout((function(){e.editor.selection.SetSelection(s);var t,r,n,i,o,a=[],l=[],d=s.getNodes([1]);for(r=0;r<d.length;r++){if(BX.util.in_array(d[r].nodeName,["TD","TR","TH"])){t=BX.findParent(d[r],(function(e){return e.nodeName=="TABLE"}),e.editor.GetIframeDoc().body);if(t&&!BX.util.in_array(t,a)){a.push(t)}}}for(r=0;r<a.length;r++){t=a[r];for(n=0;n<t.rows.length;n++){for(i=0;i<t.rows[n].childNodes.length;i++){o=t.rows[n].childNodes[i];if(o&&o.nodeType==1&&!BX.util.in_array(o.nodeName,e.editor.TABLE_TAGS)){l.push(o)}}}}for(r=0;r<l.length;r++){BX.cleanNode(l[r],true)}var f=e.editor.selection.GetSelectedNode();if(f&&f.nodeType==1){e.editor.lastCreatedId=Math.round(Math.random()*1e6);f.setAttribute("data-bx-last-created-id",e.editor.lastCreatedId)}}),10)},state:function(r,n,o,a,l){var s=e.editor.GetIframeDoc(),d=t[o]||o;if(!e.editor.util.DocumentHasTag(s,o)&&(o!=d&&!e.editor.util.DocumentHasTag(s,d))){return false}var f=e.editor.selection.GetRange();if(!f){return false}var c=i(o,a,l);return c.IsAppliedToRange(f,false)},value:BX.DoNothing}},GetFormatBlock:function(){var e=this,t="DIV",r=e.editor.GetBlockTags(),n=e.editor.NESTED_BLOCK_TAGS;function i(e,t,r){if(e.className){o(e,r);e.className+=" "+t}else{e.className=t}}function o(e,t){e.className=e.className.replace(t,"")}function a(t){var r=e.editor.util.GetNextNotEmptySibling(t),n=e.editor.util.GetPreviousNotEmptySibling(t);if(r&&!d(r)){t.parentNode.insertBefore(e.document.createElement("BR"),r)}if(n&&!d(n)){t.parentNode.insertBefore(e.document.createElement("BR"),t)}}function l(t){var r=e.editor.util.GetNextNotEmptySibling(t),n=e.editor.util.GetPreviousNotEmptySibling(t);if(r&&r.nodeName==="BR"){r.parentNode.removeChild(r)}if(n&&n.nodeName==="BR"){n.parentNode.removeChild(n)}}function s(e){var t=e.lastChild;if(t&&t.nodeName==="BR"){t.parentNode.removeChild(t)}}function d(t){return t.nodeName==="BR"||e.editor.util.IsBlockElement(t)}function f(t,r,n,i){if(n||i){}e.document.execCommand(t,false,r)}function c(e){return!e.className||BX.util.trim(e.className)===""}function u(t,r,n,i){if(r){if(t.nodeName!==r){t=e.editor.util.RenameNode(t,r)}if(n){t.className=n}if(i&&i.length>0){e.editor.util.SetCss(t,i)}}else{a(t);e.editor.util.ReplaceWithOwnChildren(t)}}return{exec:function(i,o,d,f,c){c=c||{};o=typeof o==="string"?o.toUpperCase():o;var m,h,g,N=c.range||e.editor.selection.GetRange(),p=o?e.actions.formatBlock.state(i,o,d,f):false,v;if(c.range)e.editor.selection.RestoreBookmark();if(p){var B=N.startContainer==p.firstChild&&N.endContainer==p.lastChild;if(o&&BX.util.in_array(o,n)&&c.nestedBlocks!==false){p=e.document.createElement(o||t);if(d){p.className=d}e.editor.selection.Surround(p);e.editor.selection.SelectNode(p);e.editor.util.SetCss(p,f);var b=e.editor.util.GetNextNotEmptySibling(p);if(b&&b.nodeName=="BR")BX.remove(b);setTimeout((function(){if(p){e.editor.selection.SelectNode(p)}}),50)}else if(c&&c.splitBlock&&!B){var C=e.document.createElement(o||t);e.editor.selection.Surround(C);e.editor.selection.SelectNode(C);if(d)C.className=d;e.editor.util.SetCss(C,f);if(p&&p.lastChild){var x=N.cloneRange();x.setStartAfter(C);x.setEndAfter(p.lastChild);var I=p.cloneNode(false);e.editor.selection.SetSelection(x);e.editor.selection.Surround(I);var S=e.editor.selection._GetNonTextFirstChild(I);if(S&&S.nodeName=="BR")BX.remove(S)}e.editor.selection.SetSelection(N);setTimeout((function(){if(C){e.editor.selection.SelectNode(C)}}),50)}else{e.editor.util.SetCss(p,f);if(d){p.className=d;if(BX.browser.IsFirefox()){var y="bx-editor-temp-"+Math.round(Math.random()*1e6);p.id=y;p.parentNode.innerHTML=p.parentNode.innerHTML;p=e.editor.GetIframeElement(y);if(p)p.removeAttribute("id")}}setTimeout((function(){if(p){e.editor.selection.SelectNode(p)}}),50)}}else{if(o===null||BX.util.in_array(o,r)){p=false;v=e.editor.selection.GetSelectedNode();if(v){if(v.nodeType==1&&BX.util.in_array(v.nodeName,r)){p=v}else{p=BX.findParent(v,(function(e){return BX.util.in_array(e.nodeName,r)}),e.document.body)}}else{var T=e.editor.selection.GetCommonAncestorForRange(N);if(T&&T.nodeName!=="BODY"&&BX.util.in_array(T.nodeName,r)){p=T}}if(p&&!e.actions.quote.checkNode(p)){e.editor.selection.ExecuteAndRestoreSimple((function(){u(p,o,d,f)}));return true}}p=BX.create(o||t,{},e.document);if(d){p.className=d}e.editor.util.SetCss(p,f);if(N.collapsed||v&&v.nodeType==3){e.editor.selection.SelectNode(v)}else if(N.collapsed){e.editor.selection.SelectLine()}e.editor.selection.Surround(p,N);l(p);s(p);if(c.leaveChilds){return p}if(o&&!BX.util.in_array(o,n)){N=e.editor.selection.GetRange();g=N.getNodes([1]);if(o=="P"){m=p.getElementsByTagName(o);for(h=0;h<g.length;h++){if(f&&e.editor.util.CheckCss(g[h],f,false)&&e.editor.util.IsEmptyNode(g[h],true,true)){BX.remove(g[h])}}while(m[0]){a(m[0]);e.editor.util.ReplaceWithOwnChildren(m[0])}}else if(o.substr(0,1)=="H"){for(h=0;h<g.length;h++){if(g[h].nodeName!==o&&e.editor.util.IsEmptyNode(g[h],true,true)){BX.remove(g[h])}}var A=BX.findChild(p,(function(e){return BX.util.in_array(e.nodeName,r)&&e.nodeName.substr(0,1)=="H"}),true,true);for(h=0;h<A.length;h++){a(A[h]);e.editor.util.ReplaceWithOwnChildren(A[h])}}}if(p&&c.bxTagParams&&typeof c.bxTagParams=="object"){e.editor.SetBxTag(p,c.bxTagParams)}if(p&&p.parentNode){var w=p.parentNode;if(w.nodeName=="UL"||w.nodeName=="OL"){var G=e.editor.util.GetPreviousNotEmptySibling(p);if(e.editor.util.IsEmptyLi(G)){BX.remove(G)}G=e.editor.util.GetNextNotEmptySibling(p);if(e.editor.util.IsEmptyLi(G)){BX.remove(G)}if(!e.editor.util.GetPreviousNotEmptySibling(p)&&!e.editor.util.GetNextNotEmptySibling(p)){var E=p.cloneNode(false);w.parentNode.insertBefore(E,w);e.editor.util.ReplaceWithOwnChildren(p);E.appendChild(w)}}if(p.firstChild&&p.firstChild.nodeName=="BLOCKQUOTE"){var X=e.editor.util.GetPreviousNotEmptySibling(p);if(X&&X.nodeName=="BLOCKQUOTE"&&e.editor.util.IsEmptyNode(X)){BX.remove(X)}}if((p.nodeName=="BLOCKQUOTE"||p.nodeName=="PRE")&&e.editor.util.IsEmptyNode(p)){p.innerHTML="";var L=e.document.createElement("br");p.appendChild(L);e.editor.selection.SetAfter(L)}}setTimeout((function(){if(p){e.editor.selection.SelectNode(p)}}),10);return true}},state:function(t,r,n,i){r=typeof r==="string"?r.toUpperCase():r;var o=false,a=e.editor.selection.GetSelectedNode();if(a&&a.nodeName){if(a.nodeName!=r){a=BX.findParent(a,(function(e){return e.nodeName==r}),e.document.body)}o=a&&a.tagName==r?a:false}else{var l=e.editor.selection.GetRange(),s=e.editor.selection.GetCommonAncestorForRange(l);if(s.nodeName==r){o=s}}return o},value:BX.DoNothing,removeBrBeforeAndAfter:l,addBrBeforeAndAfter:a}},GetRemoveFormat:function(){var e={B:1,STRONG:1,I:1,EM:1,U:1,DEL:1,S:1,STRIKE:1,A:1,SPAN:1,CODE:1,NOBR:1,Q:1,FONT:1,CENTER:1,CITE:1},t={H1:1,H2:1,H3:1,H4:1,H5:1,H6:1,DIV:1,P:1,LI:1,UL:1,OL:1,MENU:1,BLOCKQUOTE:1,PRE:1},r=this;function n(n,i){if(!n)return;var o=n.nodeName;if(e[o]){r.editor.util.ReplaceWithOwnChildren(n)}else if(t[o]){r.actions.formatBlock.addBrBeforeAndAfter(n);r.editor.util.ReplaceWithOwnChildren(n)}else{n.removeAttribute("style");n.removeAttribute("class");n.removeAttribute("align");if(r.editor.bbCode&&n.nodeName=="TABLE"){n.removeAttribute("align")}}}function i(e){return BX.findParent(e,(function(e){return e.nodeName=="TABLE"}),r.editor.GetIframeDoc().body)}function o(e){var t,n,i=e.parentNode;while(i&&i.nodeName!=="BODY"){t=i.previousSibling&&!r.editor.util.IsEmptyNode(i.previousSibling);n=i.nextSibling&&!r.editor.util.IsEmptyNode(i.nextSibling);if(t||n||i.parentNode.nodeName=="BODY"){break}i=i.parentNode}return i}function a(e){var t=r.editor.GetIframeDoc(),n=BX.findParent(e,(function(e){return e.nodeName=="UL"||e.nodeName=="OL"||e.nodeName=="MENU"}),t.body);if(n){var i,o,a=n.cloneNode(false),l=n.cloneNode(false),s=true;BX.cleanNode(a);BX.cleanNode(l);for(i=0;i<n.childNodes.length;i++){o=n.childNodes[i];if(o==e){s=false}if(o.nodeName=="LI"){if(!r.editor.util.IsEmptyNode(o,true,true)){(s?a:l).appendChild(o.cloneNode(true))}}}if(a.childNodes.length>0){n.parentNode.insertBefore(a,n)}n.parentNode.insertBefore(e,n);if(l.childNodes.length>0){n.parentNode.insertBefore(l,n)}BX.remove(n);return true}return false}function l(e,t){if(e&&e.length>0){var i,o,a=[];for(i=0,o=e.length;i<o;i++){if(!r.editor.util.CheckSurrogateNode(e[i])){a.push({node:e[i],nesting:r.editor.util.GetNodeDomOffset(e[i])})}}a=a.sort((function(e,t){return t.nesting-e.nesting}));for(i=0,o=a.length;i<o;i++){n(a[i].node,t)}}}function s(e){var t,n=false,i=r.editor.selection.SelectNode(e),o=i.getNodes([1]);if(e.nodeType==1){for(t=0;t<o.length;t++){if(o[t]==e){n=true;break}}if(!n){o=[e].concat(o)}}if(!o||typeof o!="object"||o.length==0){o=[e]}return o}function d(e,t){var r=[];if(e&&(!t||e==t)){r.push(e)}else if(!e&&t){r.push(t)}return r}return{exec:function(e,t){var n=r.editor.selection.GetRange();if(!n||r.editor.iframeView.IsEmpty())return;var d=true,f,c,u,m,h,g=n.getNodes([1]),N=r.editor.GetIframeDoc();if(g.length==0){c=n.getNodes([3]);if(c&&c.length==1){u=c[0]}if(!u&&n.startContainer==n.endContainer){if(n.startContainer.nodeType==3){u=n.startContainer}else{d=false;g=s(n.startContainer)}}if(u&&g.length==0){m=o(u);if(m&&(m.nodeName!="BODY"||n.collapsed)){d=false;g=s(m)}}}else{var p=false,v=[],B=i(n.startContainer),b=i(n.endContainer);if(B){v.push({startContainer:n.startContainer,startOffset:n.startOffset,end:B});n.setStartAfter(B);p=true}if(b){p=true;v.push({start:b,endContainer:n.endContainer,endOffset:n.endOffset});n.setEndBefore(b)}var C=r.editor.util.FindParentEx(n.startContainer,(function(e){return e.nodeName=="UL"||e.nodeName=="OL"||e.nodeName=="MENU"}),N.body),x=r.editor.util.FindParentEx(n.endContainer,(function(e){return e.nodeName=="UL"||e.nodeName=="OL"||e.nodeName=="MENU"}),N.body);if(C){n.setStartBefore(C);if(!x)n.setEndAfter(C);p=true}if(x){p=true;n.setEndAfter(x);if(!C)n.setStartBefore(x)}if(p){r.editor.selection.SetSelection(n);g=n.getNodes([1])}}if(d){h=N.createElement("span");r.editor.selection.Surround(h,n);g=s(h)}if(g&&g.length>0){r.editor.selection.ExecuteAndRestoreSimple((function(){l(g,N)}))}if(v&&v.length>0){var I=n.cloneRange();for(f=0;f<v.length;f++){if(v[f].start){I.setStartBefore(v[f].start)}else{I.setStart(v[f].startContainer,v[f].startOffset)}if(v[f].end){I.setEndAfter(v[f].end)}else{I.setEnd(v[f].endContainer,v[f].endOffset)}r.editor.selection.SetSelection(I);l(I.getNodes([1]),N)}r.editor.selection.SetSelection(n)}if(d&&h&&h.parentNode){if(a(h)){r.editor.selection.SelectNode(h)}r.editor.selection.ExecuteAndRestoreSimple((function(){r.editor.util.ReplaceWithOwnChildren(h)}))}if(!r.editor.iframeView.IsEmpty(true)){r.actions.formatBlock.exec("formatBlock",null)}},state:BX.DoNothing,value:BX.DoNothing}},GetBold:function(){var e=this;return{exec:function(t,r){if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){return e.actions.formatInline.exec(t,r,"b")}else{return e.actions.formatBbCode.exec(t,{tag:"B"})}},state:function(t,r){return e.actions.formatInline.state(t,r,"b")},value:BX.DoNothing}},GetItalic:function(){var e=this;return{exec:function(t,r){if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){return e.actions.formatInline.exec(t,r,"i")}else{return e.actions.formatBbCode.exec(t,{tag:"I"})}},state:function(t,r){return e.actions.formatInline.state(t,r,"i")},value:BX.DoNothing}},GetUnderline:function(){var e=this;return{exec:function(t,r){if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){return e.actions.formatInline.exec(t,r,"u")}else{return e.actions.formatBbCode.exec(t,{tag:"U"})}},state:function(t,r){return e.actions.formatInline.state(t,r,"u")},value:BX.DoNothing}},GetStrikeout:function(){var e=this;return{exec:function(t,r){if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){return e.actions.formatInline.exec(t,r,"del")}else{return e.actions.formatBbCode.exec(t,{tag:"S"})}},state:function(t,r){return e.actions.formatInline.state(t,r,"del")},value:BX.DoNothing}},GetFontSize:function(){var e=this;return{exec:function(t,r){var n;if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){if(r>0)n=e.actions.formatInline.exec(t,r,"span",{fontSize:r+"pt"});else n=e.actions.formatInline.exec(t,r,"span",{fontSize:null},null,{bClear:true})}else{n=e.actions.formatBbCode.exec(t,{tag:"SIZE",value:r+"pt"})}return n},state:function(t,r){return e.actions.formatInline.state(t,r,"span",{fontSize:r+"pt"})},value:BX.DoNothing}},GetForeColor:function(){var e=this;function t(){var t=e.editor.GetIframeDoc(),r,n,i=[],o=e.editor.selection.GetRange();if(o){var a=o.getNodes([1]);if(a.length==0&&o.startContainer==o.endContainer&&o.startContainer.nodeName!="BODY"){a=[o.startContainer]}for(r=0;r<a.length;r++){n=BX.findParent(a[r],(function(e){return e.nodeName=="LI"&&e.style&&e.style.color}),t.body);if(n){i.push(n)}}}return i.length===0?false:i}function r(t){var r=e.editor.GetIframeDoc(),n=e.editor.selection.GetSelectedNode(),i,o,a,l,s,d,f;if(n&&(n.nodeType===3||n.nodeName=="SPAN")){s=n.nodeName=="SPAN"?n:BX.findParent(n,{tag:"span"},r.body);if(s&&s.style.color){d=BX.findParent(s,{tag:"li"},r.body);if(d){if(d.childNodes.length==1&&d.firstChild==s){e.editor.selection.ExecuteAndRestoreSimple((function(){d.style.color=t;s.style.color="";if(BX.util.trim(s.style.cssText)==""){e.editor.util.ReplaceWithOwnChildren(s)}}))}}}}else{if(!n){l=e.editor.selection.GetRange();f=l.getNodes([1])}else{f=[n]}for(i=0;i<f.length;i++){if(f[i]&&f[i].nodeName=="LI"&&!e.editor.bbCode){f[i].style.color=t;a=BX.findChild(f[i],(function(e){return e.nodeName=="SPAN"}),true,true);e.editor.selection.ExecuteAndRestoreSimple((function(){for(o=0;o<a.length;o++){if(a[o]&&a[o].parentNode&&a[o].parentNode.parentNode&&a[o].parentNode.parentNode.parentNode){try{a[o].style.color="";if(BX.util.trim(a[o].style.cssText)==""){e.editor.util.ReplaceWithOwnChildren(a[o])}}catch(e){}}}}))}}}}return{exec:function(t,n){var i;if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){if(n==""){i=e.actions.formatInline.exec(t,n,"span",{color:null},null,{bClear:true})}else{i=e.actions.formatInline.exec(t,n,"span",{color:n});r(n)}}else if(n){i=e.actions.formatBbCode.exec(t,{tag:"COLOR",value:n})}return i},state:function(r,n){var i=e.actions.formatInline.state(r,n,"span",{color:n});if(!i){i=t()}return i},value:BX.DoNothing}},GetBackgroundColor:function(){var e=this;return{exec:function(t,r){var n;if(r==""){n=e.actions.formatInline.exec(t,r,"span",{backgroundColor:null},null,{bClear:true})}else{n=e.actions.formatInline.exec(t,r,"span",{backgroundColor:r})}return n},state:function(t,r){return e.actions.formatInline.state(t,r,"span",{backgroundColor:r})},value:BX.DoNothing}},GetCreateLink:function(){var e=["title","id","name","target","rel"],t=this;return{exec:function(r,n){if(t.editor.bbCode&&t.editor.synchro.IsFocusedOnTextarea()){t.editor.textareaView.Focus();var i="[URL="+t.editor.util.spaceUrlEncode(n.href)+"]"+(n.text||n.href)+"[/URL]";t.editor.textareaView.WrapWith(false,false,i)}else{t.editor.iframeView.Focus();var o,a=n&&typeof n==="object"?n:{href:n},l,s,d=0,f,c;function u(r,n){var i;r.removeAttribute("class");r.removeAttribute("target");for(i in n){if(n.hasOwnProperty(i)&&BX.util.in_array(i,e)){if(n[i]==""||n[i]==undefined){r.removeAttribute(i)}else{r.setAttribute(i,n[i])}}}if(n.className)r.className=n.className;r.href=t.editor.util.spaceUrlEncode(n.href)||"";if(n.noindex){r.setAttribute("data-bx-noindex","Y")}else{r.removeAttribute("data-bx-noindex")}}c=n.node?[n.node]:t.actions.formatInline.state(r,n,"a");if(c){for(l=0;l<c.length;l++){s=c[l];if(s){u(s,a);f=s;d++}}if(d===1&&f&&(f.querySelector&&!f.querySelector("*"))&&a.text!=""){t.editor.util.SetTextContent(f,a.text)}o=f;if(o)t.editor.selection.SetAfter(o);setTimeout((function(){if(o)t.editor.selection.SetAfter(o)}),10)}else{var m="_bx-editor-temp-"+Math.round(Math.random()*1e6),h,g,N;t.actions.formatInline.exec(r,n,"A",false,m);if(t.document.querySelectorAll){c=t.document.querySelectorAll("A."+m)}else{c=[]}for(l=0;l<c.length;l++){s=c[l];if(s){u(s,a)}}o=s;if(c.length===1){N=t.editor.util.GetTextContent(s);g=N===""||N===t.editor.INVISIBLE_SPACE;if(N!=a.text){t.editor.util.SetTextContent(s,a.text||a.href)}if(s.querySelector&&!s.querySelector("*")&&g){t.editor.util.SetTextContent(s,a.text||a.href)}}if(s){if(s.nextSibling&&s.nextSibling.nodeType==3&&t.editor.util.IsEmptyNode(s.nextSibling)){h=s.nextSibling}else{h=t.editor.util.GetInvisibleTextNode()}t.editor.util.InsertAfter(h,s);o=h}if(o)t.editor.selection.SetAfter(o);setTimeout((function(){if(o)t.editor.selection.SetAfter(o)}),10)}}},state:function(e,r){return t.actions.formatInline.state(e,r,"a")},value:BX.DoNothing}},GetRemoveLink:function(){var e=this;return{exec:function(t,r){e.editor.iframeView.Focus();var n,i,o;if(r&&typeof r=="object"){o=r}else{o=e.actions.formatInline.state(t,r,"a")}if(o){e.editor.selection.ExecuteAndRestoreSimple((function(){for(n=0;n<o.length;n++){i=o[n];if(i){e.editor.util.ReplaceWithOwnChildren(o[n])}}}))}},state:function(e,t){},value:BX.DoNothing}},GetInsertHTML:function(){var e=this;return{exec:function(t,r){e.editor.iframeView.Focus();if(e.IsSupportedByBrowser(t))e.document.execCommand(t,false,r);else e.editor.selection.InsertHTML(r)},state:function(){return false},value:BX.DoNothing}},GetInsertImage:function(){var e=["title","alt","width","height","align"],t=this;return{exec:function(r,n){if(n.src=="")return;n.src=t.editor.util.spaceUrlEncode(n.src);if(t.editor.bbCode&&t.editor.synchro.IsFocusedOnTextarea()){t.editor.textareaView.Focus();var i="";if(n.width)i+=" WIDTH="+parseInt(n.width);if(n.height)i+=" HEIGHT="+parseInt(n.height);var o="[IMG"+i+"]"+n.src+"[/IMG]";t.editor.textareaView.WrapWith(false,false,o);return}t.editor.iframeView.Focus();var a=n&&typeof n==="object"?n:{src:n},l=n.image||t.actions.insertImage.state(r,n),s,d;function f(r,n){var i,o;r.removeAttribute("class");r.setAttribute("data-bx-orig-src",n.src||"");for(i in n){if(n.hasOwnProperty(i)&&BX.util.in_array(i,e)){if(n[i]==""||n[i]==undefined){r.removeAttribute(i)}else{o=r.getAttribute("data-bx-app-ex-"+i);if(!o||t.editor.phpParser.AdvancedPhpGetFragmentByCode(o,true)!=n[i]){r.setAttribute(i,n[i]);if(o){r.removeAttribute("data-bx-app-ex-"+i)}}}}}if(n.className){r.className=n.className}o=r.getAttribute("data-bx-app-ex-src");if(!o||t.editor.phpParser.AdvancedPhpGetFragmentByCode(o,true)!=n.src){r.src=n.src||"";if(o){r.removeAttribute("data-bx-app-ex-src")}}}if(!l){l=t.document.createElement("IMG");f(l,a);t.editor.selection.InsertNode(l)}else{f(l,a)}var c=l,u=l.parentNode&&l.parentNode.nodeName=="A"?l.parentNode:null;if(a.link){if(u){u.href=a.link}else{u=t.document.createElement("A");u.href=a.link;l.parentNode.insertBefore(u,l);u.appendChild(l)}c=u}else if(u){t.editor.util.ReplaceWithOwnChildren(u)}if(BX.browser.IsIE()){t.editor.selection.SetAfter(l);d=l.nextSibling;if(d&&d.nodeType==3&&t.editor.util.IsEmptyNode(d))s=d;else s=t.editor.util.GetInvisibleTextNode();t.editor.selection.InsertNode(s);c=s}t.editor.selection.SetAfter(c);t.editor.util.Refresh()},state:function(){var e,r,n;if(!t.editor.util.DocumentHasTag(t.document,"IMG"))return false;e=t.editor.selection.GetSelectedNode();if(!e)return false;if(e.nodeName==="IMG")return e;if(e.nodeType!==1)return false;r=BX.util.trim(t.editor.selection.GetText());if(r&&r!=t.editor.INVISIBLE_SPACE)return false;n=t.editor.selection.GetNodes(1,(function(e){return e.nodeName==="IMG"}));if(n.length!==1)return false;return n[0]},value:BX.DoNothing}},GetInsertLineBreak:function(){var e=this,t="<br>"+(BX.browser.IsOpera()?" ":"");return{exec:function(r){if(e.IsSupportedByBrowser(r)){e.document.execCommand(r,false,null)}else{e.actions.insertHTML.exec("insertHTML",t)}if(BX.browser.IsChrome()||BX.browser.IsSafari()||BX.browser.IsIE10()){e.editor.selection.ScrollIntoView()}},state:BX.DoNothing,value:BX.DoNothing}},GetInsertHr:function(){var e=this,t="<hr>"+(BX.browser.IsOpera()?" ":"");return{exec:function(r){e.actions.insertHTML.exec("insertHTML",t);if(BX.browser.IsChrome()||BX.browser.IsSafari()||BX.browser.IsIE10()){e.editor.selection.ScrollIntoView()}},state:BX.DoNothing,value:BX.DoNothing}},GetInsertTable:function(){var e=this,t=["title","id","border","cellSpacing","cellPadding","align"];function r(t){var r=e.document.createElement("TH");while(t.firstChild)r.appendChild(t.firstChild);e.editor.util.ReplaceNode(t,r)}function n(t){var r=e.document.createElement("TD");while(t.firstChild)r.appendChild(t.firstChild);e.editor.util.ReplaceNode(t,r)}function i(i,o){var a;i.removeAttribute("class");for(a in o){if(o.hasOwnProperty(a)&&BX.util.in_array(a,t)){if(o[a]===""||o[a]==undefined){i.removeAttribute(a)}else{i.setAttribute(a,o[a])}}}if(o.className){i.className=o.className}i.removeAttribute("data-bx-no-border");if(i.getAttribute("border")==0||!i.getAttribute("border")){i.removeAttribute("border");i.setAttribute("data-bx-no-border","Y")}if(o.width){if(parseInt(o.width)==o.width){o.width=o.width+"px"}if(i.getAttribute("width")){i.setAttribute("width",o.width)}else{i.style.width=o.width}}if(o.height){if(parseInt(o.height)==o.height){o.height=o.height+"px"}if(i.getAttribute("height")){i.setAttribute("height",o.height)}else{i.style.height=o.height}}var l,s,d;for(l=0;l<i.rows.length;l++){for(s=0;s<i.rows[l].cells.length;s++){d=i.rows[l].cells[s];if((o.headers=="top"||o.headers=="topleft")&&l==0||(o.headers=="left"||o.headers=="topleft")&&s==0){r(d)}else if(d.nodeName=="TH"){n(d)}}}var f=BX.findChild(i,{tag:"CAPTION"},false);if(o.caption){if(f){f.innerHTML=BX.util.htmlspecialchars(o.caption)}else{f=e.document.createElement("CAPTION");f.innerHTML=BX.util.htmlspecialchars(o.caption);i.insertBefore(f,i.firstChild)}}else if(f){BX.remove(f)}}return{exec:function(t,r){if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){if(!r||!r.rows||!r.cols){return false}e.editor.iframeView.Focus();var n=r.table||e.actions.insertTable.state(t,r);r.rows=parseInt(r.rows)||1;r.cols=parseInt(r.cols)||1;if(r.align=="left"||e.editor.bbCode){r.align=""}if(!n){n=e.document.createElement("TABLE");var o=n.appendChild(e.document.createElement("TBODY")),a,l,s,d;r.rows=parseInt(r.rows)||1;r.cols=parseInt(r.cols)||1;for(a=0;a<r.rows;a++){s=o.insertRow(-1);for(l=0;l<r.cols;l++){d=BX.adjust(s.insertCell(-1),{html:" "})}}i(n,r);e.editor.selection.InsertNode(n);var f=e.editor.util.GetNextNotEmptySibling(n);if(!f){e.editor.util.InsertAfter(BX.create("BR",{},e.document),n)}if(f&&f.nodeName=="BR"&&!f.nextSibling){e.editor.util.InsertAfter(e.editor.util.GetInvisibleTextNode(),f)}}else{i(n,r)}var c=n.rows[0].cells[0].firstChild;if(c){e.editor.selection.SetAfter(c)}setTimeout((function(){e.editor.util.Refresh(n)}),10)}else{e.editor.textareaView.Focus();var u="",m,h,g=e.editor.INVISIBLE_SPACE;if(r.rows>0&&r.cols>0){u+="[TABLE]\n";for(m=0;m<r.rows;m++){u+="\t[TR]\n";for(h=0;h<r.cols;h++){u+="\t\t[TD]"+g+"[/TD]\n"}u+="\t[/TR]\n"}u+="[/TABLE]\n"}e.editor.textareaView.WrapWith(false,false,u)}},state:function(t,r){var n,i;if(!e.editor.util.DocumentHasTag(e.document,"TABLE")){return false}n=e.editor.selection.GetSelectedNode();if(!n){return false}if(n.nodeName==="TABLE"){return n}if(n.nodeType!==1){return false}i=e.editor.selection.GetNodes(1,(function(e){return e.nodeName==="TABLE"}));if(i.length!==1){return false}return i[0]},value:BX.DoNothing}},GetInsertList:function(e){var t=this;var r=!!e.bOrdered,n=r?"OL":"UL",i=r?"UL":"OL";function o(e){var r=e.nextSibling;while(r&&r.nodeType==3&&t.editor.util.IsEmptyNode(r,true)){r=r.nextSibling}return r}function a(e){if(e.nodeName!=="MENU"&&e.nodeName!=="UL"&&e.nodeName!=="OL"){return}var r=t.document.createDocumentFragment(),n=e.previousSibling,i,o,a,l;if(n&&!t.editor.util.IsBlockElement(n)&&!t.editor.util.IsEmptyNode(n,true)){r.appendChild(t.document.createElement("BR"))}while(l=e.firstChild){o=l.lastChild;while(i=l.firstChild){if(i.nodeName=="I"&&i.innerHTML==""&&i.className!=""){BX.remove(i);i=l.firstChild;if(!i)break}a=i===o&&!t.editor.util.IsBlockElement(i)&&i.nodeName!=="BR";r.appendChild(i);if(a){r.appendChild(t.document.createElement("BR"))}}l.parentNode.removeChild(l)}var s=t.editor.util.GetNextNotEmptySibling(e);if(s&&s.nodeName=="BR"&&r.lastChild&&r.lastChild.nodeName=="BR"){BX.remove(r.lastChild)}e.parentNode.replaceChild(r,e)}function l(e,r){if(!e||!e.parentNode)return false;var n=e.nodeName.toUpperCase();if(n==="UL"||n==="OL"||n==="MENU"){return e}var i=t.document.createElement(r),o,a;while(e.firstChild){a=a||i.appendChild(t.document.createElement("li"));o=e.firstChild;if(t.editor.util.IsBlockElement(o)){a=a.firstChild?i.appendChild(t.document.createElement("li")):a;a.appendChild(o);a=null;continue}if(o.nodeName==="BR"){a=a.firstChild?null:a;e.removeChild(o);continue}a.appendChild(o)}e.parentNode.replaceChild(i,e);return i}function s(e){return e.nodeName=="OL"||e.nodeName=="UL"||e.nodeName=="MENU"}function d(e,r){if(!r){r=t.editor.selection.GetSelectedNode()}if(!r||r.nodeName=="BODY"){var n=t.editor.selection.GetRange(),i=t.editor.selection.GetCommonAncestorForRange(n);if(i&&s(i)){r=i}else{var o,a=true,l,d,f=n.getNodes([1]),c=f.length;if(i){l=d=BX.findParent(i,s,t.document.body)}if(!d){for(o=0;o<c;o++){d=BX.findParent(f[o],s,i);if(!d||l&&d!=l){a=false;break}l=d}}if(!l){var u=false;for(o=0;o<c;o++){if(s(f[o])){u=f[o];break}}if(u){var m=true;for(o=0;o<c;o++){if(f[o]==u||BX.findParent(f[o],(function(e){return e===u}),t.document.body)||f[o].nodeName=="BR"||t.editor.util.IsEmptyNode(f[o])){}else{m=false;break}}if(m){l=u}}}if(l){r=l}}}return r&&r.nodeName==e?r:BX.findParent(r,{tagName:e},t.document.body)}function f(e,t){if(!e)return false;if(!t)t={tag:"I",remove:true};var r,n,i,o=e.ownerDocument;for(r=0;r<e.childNodes.length;r++){n=e.childNodes[r];if(n&&n.nodeType==1&&n.nodeName=="LI"){i=n.firstChild;if(i.nodeName==t.tag&&i.innerHTML==""){if(t.remove)BX.remove(i);else i.className=t.className}else{n.insertBefore(BX.create(t.tag,{props:{className:t.className}},o),i)}}}}function c(e){if(!e)return false;var t,r,n;for(t=0;t<e.childNodes.length;t++){r=e.childNodes[t];if(r&&r.nodeType==1&&r.nodeName=="LI"){n=r.firstChild;if(n&&n.nodeName=="I"&&n.innerHTML==""&&n.className!==""){return n.className}}}return false}function u(e,r,n){if(e&&(e.nodeName=="UL"||e.nodeName=="OL")){var i,o,a,l=e.ownerDocument,s;for(i=0;i<e.childNodes.length;i++){o=e.childNodes[i];if(o&&o.nodeType==1&&o.nodeName=="LI"&&o.firstChild){a=o.firstChild;if(a.nodeName=="I"&&a.innerHTML==""&&a.className!==""){if(!r)r=a.className}else if(a.nodeName=="I"&&a.innerHTML==""&&r){a.className=r;s=a}else if(a&&r){s=o.insertBefore(BX.create("I",{props:{className:r}},l),a)}}}if(n&&s)t.editor.selection._MoveCursorAfterNode(s)}}return{exec:function(e,o){if(!t.editor.bbCode||!t.editor.synchro.IsFocusedOnTextarea()){var s=t.editor.selection.GetRange();if(t.IsSupportedByBrowser(e)&&s.collapsed){t.document.execCommand(e,false,null)}else{var f=t.editor.selection.GetSelectedNode(),c=d(n,f),u=d(i,f),m,h;if(c){t.editor.selection.ExecuteAndRestoreSimple((function(){a(c)}))}else if(u){t.editor.selection.ExecuteAndRestoreSimple((function(){t.editor.util.RenameNode(u,n)}))}else{h=t.document.createElement("span");t.editor.selection.Surround(h);m=h.innerHTML===""||h.innerHTML===t.editor.INVISIBLE_SPACE;t.editor.selection.ExecuteAndRestoreSimple((function(){var e,r=h.getElementsByTagName("SPAN");for(e=r.length-1;e>=0;e--){if(!r[e].className&&!r[e].id&&!r[e].style.cssText){t.editor.util.ReplaceWithOwnChildren(r[e])}}c=l(h,n)}));if(c){var g=0,N;while(g<c.childNodes.length){N=c.childNodes[g];if(N.nodeName=="LI"){if(t.editor.util.IsEmptyNode(N,true,true)){BX.remove(N);continue}g++}else if(N.nodeType==1){BX.remove(N)}}var p=t.editor.util.GetPreviousNotEmptySibling(c);if(p&&(p.nodeName=="BLOCKQUOTE"||p.nodeName=="PRE"||p.nodeName=="UL"||p.nodeName=="OL")&&c.childNodes[0]&&BX.findChild(c.childNodes[0],{tag:p.nodeName})){if(BX.util.trim(t.editor.util.GetTextContent(p))==""){BX.remove(p)}}}if(m&&c&&c.querySelector){t.editor.selection.SelectNode(c.querySelector("li"))}}}}else{if(o&&o.items){t.editor.textareaView.Focus();var v="[LIST"+(r?"=1":"")+"]\n",B;for(B=0;B<o.items.length;B++){v+="\t[*]"+o.items[B]+"\n"}v+="[/LIST]\n";t.editor.textareaView.WrapWith(false,false,v)}}},state:function(){return d(n)||false},value:BX.DoNothing,customBullit:f,getCustomBullitClass:c,checkCustomBullitList:u}},GetAlign:function(){var e="bx-align-tmp",t="data-bx-checked-align-list",r="left",n={TD:1,TR:1,TH:1,TABLE:1,TBODY:1,CAPTION:1,COL:1,COLGROUP:1,TFOOT:1,THEAD:1},i={IMG:1,P:1,DIV:1,TABLE:1,H1:1,H2:1,H3:1,H4:1,H5:1,H6:1},o=this;function a(e){var t=e.nodeName,r,n=false;if(e.nodeType===1){r=e.style.textAlign;if(e.style.textAlign){n={node:e,style:r}}if(i[t]){r=e.getAttribute("align");if(r){if(n){n.attribute=r}else{n={node:e,attribute:r}}}}}return n}function l(e){return e&&(e.nodeName=="TD"||e.nodeName=="TH")}function s(e,t){e.setAttribute("data-bx-tmp-align",t);e.style.textAlign=t}function d(e,t){if(t=="left"||t=="justify"||o.editor.bbCode){e.removeAttribute("align")}else{e.setAttribute("align",t)}}function f(e,t){var r,n,i=true,o=e.getElementsByTagName("TD");for(n=0;n<o.length;n++){if(o[n].getAttribute("data-bx-tmp-align")!=t){i=false;break}}if(i){r=e.getElementsByTagName("TH");for(n=0;n<r.length;n++){if(r[n].getAttribute("data-bx-tmp-align")!=t){i=false;break}}}if(i){d(e,t)}}function c(e,t){var r=BX.create("DIV",{style:{textAlign:t},html:e.innerHTML},o.editor.GetIframeDoc());e.innerHTML="";e.appendChild(r);return r}function u(e,t){var r=BX.create("DIV",{style:{textAlign:t}},o.editor.GetIframeDoc());e.parentNode.insertBefore(r,e);r.appendChild(e);return r}function m(e,r,n){var i=o.editor.GetIframeDoc(),a=o.editor.bbCode;if(!e&&r){e=BX.findParent(r,(function(e){return e.nodeName=="OL"||e.nodeName=="UL"||e.nodeName=="MENU"}),i)}if(e&&!e.getAttribute(t)){var l,s=true,d=e.getElementsByTagName("LI");for(l=0;l<d.length;l++){if(d[l].style.textAlign!==n){s=false;break}}if(a){e.style.textAlign="";if(e.style.cssText==""){e.removeAttribute("style")}h(e);u(e,n)}else if(s){e.style.textAlign=n;h(e)}e.setAttribute(t,"Y");return e}return false}function h(e){var t,r=e.getElementsByTagName("LI");for(t=0;t<r.length;t++){r[t].style.textAlign="";if(r[t].style.cssText==""){r[t].removeAttribute("style")}}}function g(e,t){if(t&&t.nodeName=="TABLE"){var r,n=false;for(r=0;r<e.length;r++){if(e[r]==t){n=true;break}}if(!n){e.push(t)}}return e}return{exec:function(r,i){var a;if(!o.editor.bbCode||!o.editor.synchro.IsFocusedOnTextarea()){var N,p="P",v=o.editor.selection.GetRange(),B=false,b=false,C=false,x=o.editor.selection.GetBookmark(),I=o.editor.selection.GetSelectedNode();if(I){if(o.editor.util.IsBlockNode(I)){B=I}else if(I.nodeType==1&&n[I.nodeName]){b=I;a=true;setTimeout((function(){o.editor.selection.SelectNode(b);if(b.nodeName=="TABLE"){d(b,i)}}),10)}else{if(I.nodeName=="LI"){C=I}else if(I.nodeName=="OL"||I.nodeName=="UL"||I.nodeName=="MENU"){if(o.editor.bbCode){u(I,i);I.style.textAlign=""}else{I.style.textAlign=i}a=true;h(I);setTimeout((function(){o.editor.selection.SelectNode(I)}),10)}else{C=BX.findParent(I,(function(e){return e.nodeName=="LI"}),o.document.body)}if(C){if(o.editor.bbCode){c(C,i);C.style.textAlign=""}else{C.style.textAlign=i}a=true;setTimeout((function(){o.editor.selection.SelectNode(C)}),10)}else{B=BX.findParent(I,(function(e){return o.editor.util.IsBlockNode(e)&&!o.actions.quote.checkNode(e)}),o.document.body)}}}else{var S=[],y=false,T=[],A=[],w=v.getNodes([1]);for(N=0;N<w.length;N++){if(l(w[N])){S=g(S,BX.findParent(w[N],{tagName:"TABLE"}));s(w[N],i);a=true}if(w[N].nodeName=="TABLE"){S=g(S,w[N]);y=true}else if(w[N].nodeName=="OL"||w[N].nodeName=="UL"||w[N].nodeName=="MENU"){w[N].style.textAlign=i;T.push(w[N]);a=true}else if(w[N].nodeName=="LI"){w[N].style.textAlign=i;a=true;A.push(w[N])}}for(N=0;N<S.length;N++){f(S[N],i)}if(a){var G=o.editor.selection.GetCommonAncestorForRange(v);if(G&&G.nodeName=="BODY"){a=false}}for(N=0;N<T.length;N++){h(T[N])}var E=[],X;for(N=0;N<A.length;N++){X=m(false,A[N],i);if(X){E.push(X)}}for(N=0;N<E.length;N++){E[N].removeAttribute(t)}}if(!a){if(B){if(o.editor.bbCode){c(B,i);B.style.textAlign=""}else{p=B.tagName!="DIV"?B.tagName:"P";a=o.actions.formatBlock.exec("formatBlock",p,null,{textAlign:i})}o.editor.util.Refresh(B)}else if(b){if(l(b)){s(b,i)}else{var L=BX.findChild(b,l,true,true),R=BX.findChild(b,l,true,true);for(N=0;N<L.length;N++){s(L[N],i)}for(N=0;N<R.length;N++){s(R[N],i)}}}else if(v.collapsed){a=o.actions.formatBlock.exec("formatBlock","P",e,{textAlign:i});var O,k=o.document.querySelectorAll("."+e);for(N=0;N<=k.length;N++){BX.removeClass(k[N],e);if(N==0){O=k[N].firstNode;if(!O)O=k[N].appendChild(o.editor.util.GetInvisibleTextNode());setTimeout((function(){if(O)o.editor.selection.SetAfter(O)}),100)}}}else{var D=o.actions.insertImage.state();if(!a&&false){var F=true;w=v.getNodes([1]);if(w&&w.length>0){for(N=0;N<w.length;N++){if(w[N].nodeName=="P"){w[N].style.textAlign=i}else{F=false}}a=F}}if(!a){p=o.editor.bbCode?"DIV":"P";a=o.actions.formatBlock.exec("formatBlock",p,null,{textAlign:i},{leaveChilds:true,splitBlock:true});if(a&&typeof a=="object"&&a.nodeName==p){var M=0,P=2e3,H,U,V,_=false;if(a.firstChild&&a.firstChild.nodeName=="BLOCKQUOTE"){H=o.editor.util.GetPreviousNotEmptySibling(a);if(H&&H.nodeName=="BLOCKQUOTE"&&o.editor.util.IsEmptyNode(H)){BX.remove(H)}}N=0;while(N<a.childNodes.length||M>P){U=a.childNodes[N];if(o.editor.util.IsBlockNode(U)){U.style.textAlign=i;_=true;N++}else{if(!V||_){V=o.document.createElement(p);V.style.textAlign=i;a.insertBefore(V,U);N++}V.appendChild(U);_=false}M++}if(a.previousSibling&&a.previousSibling.nodeName=="P"&&o.editor.util.IsEmptyNode(a.previousSibling,true,true)){BX.remove(a.previousSibling)}if(a.nextSibling&&a.nextSibling.nodeName=="P"&&o.editor.util.IsEmptyNode(a.nextSibling,true,true)){BX.remove(a.nextSibling)}o.editor.util.ReplaceWithOwnChildren(a);setTimeout((function(){if(V)o.editor.selection.SelectNode(V)}),100)}}if(D){o.editor.util.Refresh(D)}}}setTimeout((function(){o.editor.selection.SetBookmark(x)}),10)}else{if(i){a=o.actions.formatBbCode.exec(r,{tag:i.toUpperCase()})}}return a},state:function(e,t){var n,i,l=o.editor.selection.GetSelectedNode();if(l){n=a(l);if(!n){i=BX.findParent(l,(function(e){n=a(e);return n}),o.document.body)}return{node:n?n.node:null,value:n?n.style||n.attribute:r,res:n}}else{var s={node:null,value:r,res:true},d=o.editor.selection.GetRange();if(!d.collapsed){var f,c="",u,m=d.getNodes([1]);for(u=0;u<m.length;u++){if(!o.editor.util.CheckSurrogateNode(m[u])&&m[u].nodeName!=="BR"&&o.editor.util.GetNodeDomOffset(m[u])==0){f=a(m[u]);t=f?f.style||f.attribute:r;if(!c){c=t}if(t!=c){s.res=false;break}}}if(s.res){s.value=c}}else{s.res=false}return s}},value:BX.DoNothing}},GetIndent:function(){var e=this;return{exec:function(t){var r=e.editor.selection.GetRange();if(r&&r.collapsed&&r.endContainer==r.startContainer&&BX.util.in_array(r.startContainer.nodeName,["TD","TR","TH"])&&arguments[1]!==r.startContainer.nodeName){var n="bxed_bogus_node_59811",i=r.startContainer.appendChild(BX.create("SPAN",{props:{id:n},html:" "},e.document));is_text=e.editor.util.GetInvisibleTextNode();if(i){r.setStartBefore(i);r.setEndAfter(i);e.editor.selection.SetSelection(r);return setTimeout((function(){e.actions.indent.exec(t,r.startContainer.nodeName);var i=e.editor.GetIframeElement(n);if(i){e.editor.selection.SetAfter(i);BX.remove(i)}}),0)}}if(e.IsSupportedByBrowser(t)){e.document.execCommand(t)}else{e.actions.formatBlock.exec("formatBlock","BLOCKQUOTE")}var o=e.editor.selection.GetRange();if(o){var a=0,l,s=o.getNodes([1]);for(l=0;l<s.length;l++){if(s[l].nodeName=="BLOCKQUOTE"){a++;s[l].removeAttribute("style")}}if(o.startContainer){var d,f=false,c=o.startContainer;while(c){c=BX.findParent(c,{tag:"BLOCKQUOTE"},e.document.body);if(c){if(!f)f=c;c.removeAttribute("style")}}if(f){d=e.editor.util.GetInvisibleTextNode();f.appendChild(d);e.editor.selection.SetAfter(d)}}}},state:function(t,r){var n=false,i=e.editor.selection.GetRange();if(i){var o=e.editor.selection.GetCommonAncestorForRange(i);if(o&&o.nodeType==1&&o.nodeName==="BLOCKQUOTE"){n=o}}return n},value:BX.DoNothing}},GetOutdent:function(){var e=this;return{exec:function(t,r){var n,i="data-bx-tmp-flag",o=e.editor.GetIframeDoc(),a=o.getElementsByTagName("BLOCKQUOTE");{var l=[],s=o.getElementsByTagName("P");for(n=0;n<s.length;n++){s[n].setAttribute(i,"Y")}e.document.execCommand(t);s=o.getElementsByTagName("P");for(n=0;n<s.length;n++){if(!s[n].getAttribute(i)){l.push(s[n])}else{s[n].removeAttribute(i)}}e.editor.selection.ExecuteAndRestoreSimple((function(){for(n=0;n<l.length;n++){e.actions.formatBlock.addBrBeforeAndAfter(l[n]);e.editor.util.ReplaceWithOwnChildren(l[n])}}))}},state:function(t,r){var n=e.editor.selection.GetRange();return false},value:BX.DoNothing}},GetFontFamily:function(){var e=this;return{exec:function(t,r){var n;if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){if(r)n=e.actions.formatInline.exec(t,r,"span",{fontFamily:r});else n=e.actions.formatInline.exec(t,r,"span",{fontFamily:null},null,{bClear:true})}else{return e.actions.formatBbCode.exec(t,{tag:"FONT",value:r})}return n},state:function(t,r){return e.actions.formatInline.state(t,r,"span",{fontFamily:r})},value:BX.DoNothing}},GetFormatStyle:function(){var e=this,t=this.editor.toolbar.controls.StyleSelector,r=t?t.checkedClasses:[],n=t?t.checkedTags:[];function i(t){if(t&&t.nodeType==1&&t.nodeName!=="BODY"&&(BX.util.in_array(t.nodeName,n)||BX.util.in_array(t.className,r))){return!e.editor.GetBxTag(t.id).tag}return false}return{exec:function(t,r){if(!r){return e.actions.removeFormat.exec("removeFormat")}else if(typeof r==="string"){return e.actions.formatBlock.exec("formatBlock",r)}else if(typeof r==="object"){if(r.tag=="UL"){var n=e.actions.insertUnorderedList.state();if(n&&r.className&&r.className.indexOf("~~")!==-1){var i=r.className.split("~~");if(i&&i.length>=2){var o=i[0],a=i[1];n.className=o;e.actions.insertUnorderedList.customBullit(n,{tag:"I",className:a,html:""})}}else if(n){n.className=r.className||"";e.actions.insertUnorderedList.customBullit(n,false)}}else if(r.tag){var l=r.className,s=r.tag.toUpperCase();if(s=="SPAN"){e.actions.formatInline.exec(t,r,s,false,l)}else{e.actions.formatBlock.exec("formatBlock",s,l,null,{nestedBlocks:false})}}if(!e.editor.util.FirstLetterSupported()){e.editor.parser.FirstLetterCheckNodes("","",true)}}},state:function(t,r){var n=false,o=e.editor.selection.GetSelectedNode();if(o){if(i(o)){n=o}else{n=BX.findParent(o,i,e.document.body)}}else{var a=e.editor.selection.GetRange(),l=e.editor.selection.GetCommonAncestorForRange(a);if(i(l)){n=l}}return n},value:BX.DoNothing}},GetChangeTemplate:function(){var e=this;return{exec:function(t,r){e.editor.ApplyTemplate(r)},state:function(t,r){return e.editor.GetTemplateId()},value:BX.DoNothing}},GetSelectNode:function(){var e=this;return{exec:function(t,r){if(!e.editor.iframeView.IsFocused()){e.editor.iframeView.Focus()}if(r===false||r&&r.nodeName=="BODY"){if(e.IsSupportedByBrowser("SelectAll")){e.document.execCommand("SelectAll")}else{e.editor.selection.SelectNode(r)}}else{e.editor.selection.SelectNode(r)}},state:BX.DoNothing,value:BX.DoNothing}},GetUndoRedo:function(e){var t=this;return{exec:function(e){if(e=="doUndo"){t.editor.undoManager.Undo()}else if(e=="doRedo"){t.editor.undoManager.Redo()}},state:BX.DoNothing,value:BX.DoNothing}},GetUniversalFormatStyle:function(){var e="bx-tmp-ufs-class",t="data-bx-tmp-status",r=this;function n(n){var o=[];if(n&&n.length>0){var a,l,s=[],d,f;for(a=0,l=n.length;a<l;a++){if(!r.editor.util.CheckSurrogateNode(n[a])&&n[a].nodeName!=="BR"){n[a].setAttribute(t,"Y");s.push({node:n[a],nesting:r.editor.util.GetNodeDomOffset(n[a])})}}s=s.sort((function(e,t){return e.nesting-t.nesting}));for(a=0,l=s.length;a<l;a++){d=s[a].node;f=d.getAttribute(t);if(f=="Y"&&!i(d)){BX.findChild(d,(function(r){if(r.nodeType==1&&r.nodeName!=="BR"&&r.setAttribute){r.setAttribute(t,r.className==e?"GET_RID_OF":"SKIP")}return false}),true,true);o.push(d)}}}return o}function i(e){var r=BX.findChild(e,(function(e){return e.nodeType==1&&e.nodeName!=="BR"&&e.getAttribute&&e.getAttribute(t)!=="Y"}),true,false);return!!r}function o(e,t,r){try{if(t!==false){if(t==""){e.removeAttribute("class")}else{e.className=t}}if(r!==false){if(r==""){e.removeAttribute("style")}else{e.style.cssText=r}}}catch(e){}}return{exec:function(i,a){if(a.nodes&&a.nodes.length>0){for(s=0;s<a.nodes.length;s++){o(a.nodes[s],a.className,a.style)}}else{r.actions.formatInline.exec(i,a,"span",false,e);if(document.querySelectorAll){var l=r.editor.GetIframeDoc().querySelectorAll("."+e);if(l){for(s=0;s<l.length;s++){d=l[s];if(BX.util.trim(d.innerHTML)==""){r.editor.util.ReplaceWithOwnChildren(d)}}}}var s,d,f=r.actions.universalFormatStyle.state(i),c=n(f);for(s=0;s<c.length;s++){o(c[s],a.className,a.style)}if(document.querySelectorAll){l=r.editor.GetIframeDoc().querySelectorAll("."+e);if(l){for(s=0;s<l.length;s++){d=l[s];if(d.getAttribute(t)=="GET_RID_OF"){r.editor.util.ReplaceWithOwnChildren(l[s])}else{o(l[s],a.className,a.style)}}}}}},state:function(e){var t=r.editor.selection.GetRange();if(t){var n,i,o,a=t.getNodes([1]);if(a.length==0){n=t.getNodes([3]);if(n&&n.length==1){i=n[0]}if(!i&&t.startContainer==t.endContainer){if(t.startContainer.nodeType==3){i=t.startContainer}else{r.editor.selection.SelectNode(t.startContainer);a=[t.startContainer]}}if(i&&a.length==0){o=i.parentNode;if(o){a=[o]}}}return a}},value:BX.DoNothing}},GetSubSup:function(e){var t=this;e=e=="sup"?"sup":"sub";return{exec:function(r,n){return t.actions.formatInline.exec(r,n,e)},state:function(r,n){return t.actions.formatInline.state(r,n,e)},value:BX.DoNothing}},GetQuote:function(){var e,t,r=this;function n(e){return e&&e.className=="bxhtmled-quote"&&e.nodeName=="BLOCKQUOTE"}function i(e){t=e}function o(){return t}function a(t){return e=t}function l(e){e=e||r.editor.selection.GetRange(r.editor.selection.GetSelection(document));if(e){const a=3;const l=e.startContainer.nodeType===a&&e.startContainer===e.endContainer;const s=l&&e.startContainer.parentNode.hasAttribute("bx-attach-file-id");if(s){const t=e.startContainer;e.setStartBefore(t.parentElement);e.setEndAfter(t)}var t;if(e.startContainer==e.endContainer&&e.startOffset==0&&e.endOffset==e.endContainer.length&&e.startContainer.parentNode&&e.startContainer.parentNode.nodeName=="A"&&e.startContainer.parentNode.href){t=BX.create("DIV",{html:e.startContainer.parentNode.href},r.editor.GetIframeDoc())}else{var n=e.toHtml();n=n.replace(/<br.*?>/gi,"#BX_BR#");t=BX.create("DIV",{html:BX.util.htmlspecialchars(n)},r.editor.GetIframeDoc())}var o=r.editor.util.GetTextContentEx(t);o=o.replace(/#BX_BR#/gi,"<br>");i(o);BX.remove(t)}else{i("")}}function s(e){var t,n,i=e.querySelectorAll("blockquote.bxhtmled-quote");for(t=0;t<i.length;t++){n=i[t];if(n.nextSibling===null){r.editor.util.InsertAfter(r.editor.util.GetInvisibleTextNode(),n)}}}return{exec:function(t){var n=false,i=o();if(r.editor.bbCode&&r.editor.synchro.IsFocusedOnTextarea()){r.editor.textareaView.Focus();if(i){n=r.editor.textareaView.WrapWith(false,false,"[QUOTE]"+i+"[/QUOTE]")}else{n=r.actions.formatBbCode.exec(t,{tag:"QUOTE"})}}else{e=r.editor.iframeView.GetSelection().getRangeAt(0);r.editor.iframeView.Focus();if(e){r.editor.selection.SetSelection(e)}if(i){var a="bxq_"+Math.round(Math.random()*1e6);r.editor.InsertHtml('<blockquote id="'+a+'" class="bxhtmled-quote">'+i+"</blockquote>"+r.editor.INVISIBLE_SPACE,e);setTimeout((function(){var e=r.editor.GetIframeElement(a);if(e){var t=e.previousSibling;if(t&&t.nodeType==3&&r.editor.util.IsEmptyNode(t)&&t.previousSibling&&t.previousSibling.nodeName=="BR"){BX.remove(t)}e.removeAttribute("id")}}),0)}else{if(!e&&r.editor.selection.lastRange)e=r.editor.selection.lastRange;n=r.actions.formatBlock.exec("formatBlock","blockquote","bxhtmled-quote",false,{range:e})}if(!i)r.editor.selection.ScrollIntoView()}e=null;return n},state:function(){return r.actions.formatBlock.state("formatBlock","blockquote","bxhtmled-quote")},value:BX.DoNothing,setExternalSelectionFromRange:l,setExternalSelection:i,getExternalSelection:o,checkSpaceAfterQuotes:s,setRange:a,checkNode:n}},GetCode:function(){var e=this;return{exec:function(t){if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){var r=e.actions.code.state();if(r){var n=BX.util.trim(r.innerHTML);if(n=="<br>"||n===""){e.editor.selection.SetAfter(r);BX.remove(r)}else{e.editor.selection.ExecuteAndRestoreSimple((function(){r.className="";r=e.editor.util.RenameNode(r,"P")}))}}else{e.actions.formatBlock.exec("formatBlock","pre","bxhtmled-code")}}else{return e.actions.formatBbCode.exec(t,{tag:"CODE"})}},state:function(){return e.actions.formatBlock.state("formatBlock","pre","bxhtmled-code")},value:BX.DoNothing}},GetInsertSmile:function(){var e=this;return{exec:function(t,r){var n=e.editor.smilesIndex[r];if(e.editor.bbCode&&e.editor.synchro.IsFocusedOnTextarea()){e.editor.textareaView.Focus();e.editor.textareaView.WrapWith(false,false," "+n.code+" ")}else{e.editor.iframeView.Focus();if(n){var i=BX.create("IMG",{props:{src:n.path,title:n.name||n.code}},e.editor.iframeView.document);e.editor.SetBxTag(i,{tag:"smile",params:n});if(n.width)i.style.width=parseInt(n.width)+"px";if(n.height)i.style.height=parseInt(n.height)+"px";e.editor.selection.InsertNode(i);var o=e.editor.iframeView.document.createTextNode(" ");i.parentNode.insertBefore(o,i);var a=BX.create("SPAN",{html:" "},e.editor.iframeView.document);e.editor.util.InsertAfter(a,i);e.editor.selection.SetAfter(a);setTimeout((function(){e.editor.selection.SetAfter(a)}),10)}}},state:BX.DoNothing,value:BX.DoNothing}},GetTableOperation:function(){var e=this,t=" ";function r(e){var t=e.rows;var r=[],n,i,o,a,l,s,d,f,c=-1;for(n=0;n<t.length;n++){c++;if(!r[c]){r[c]=[]}i=-1;for(o=0;o<t[n].cells.length;o++){a=t[n].cells[o];i++;while(r[c][i]){i++}d=isNaN(a.colSpan)?1:a.colSpan;f=isNaN(a.rowSpan)?1:a.rowSpan;for(l=0;l<f;l++){if(!r[c+l]){r[c+l]=[]}for(s=0;s<d;s++){r[c+l][i+s]=t[n].cells[o]}}i+=d-1}}return r}function n(e,t){var r,n,i=[];for(r=0;r<t.length;r++){for(n=0,l=t[r].length;n<l;n++){if(t[r][n]==e){i.push({r:r,c:n})}}}return i}function i(e){var t=[],r=[],n={cells:0},i;for(i=0;i<e.length;i++){n.cells++;n.maxRow=i===0?e[i].r:Math.max(e[i].r,n.maxRow);n.minRow=i===0?e[i].r:Math.min(e[i].r,n.minRow);n.maxCol=i===0?e[i].c:Math.max(e[i].c,n.maxCol);n.minCol=i===0?e[i].c:Math.min(e[i].c,n.minCol);if(!BX.util.in_array(e[i].r,t))t.push(e[i].r);if(!BX.util.in_array(e[i].c,r))r.push(e[i].c)}n.rows=t.length;n.cols=r.length;return n}function o(e,t,r){if(t){t=c(t,r);if(t&&!BX.util.in_array(t,e))e.push(t)}return e}function a(t,r){var n=[],i;if(BX.browser.IsFirefox()){var a,l,s,d,f=rangy.getNativeSelection(e.editor.sandbox.GetWindow());for(a=0;a<f.rangeCount;a++){l=f.getRangeAt(a);s=l.startContainer.nodeType===1?l.startContainer.childNodes[l.startOffset]:l.startContainer;d=l.endContainer.nodeType===1?l.endContainer.childNodes[l.endOffset]:l.endContainer;n=o(n,s,r);n=o(n,d,r)}}else{if(t.collapsed){i=c(t.startContainer);n=o(n,i,r)}else{var u=t.getNodes([1]);for(a=0;a<u.length;a++){if(u[a].nodeName=="TD"||u[a].nodeName=="TH"){n=o(n,u[a],r)}}}}return n}function s(e,i,o){var a=BX.findParent(e,{tag:"TD"});if(!a)return;var l=a.parentNode,s=o=="insertColumnLeft"?a.cellIndex:a.cellIndex+1,d=l.rowIndex,f=r(i),c=n(a,f);l.insertCell(s).innerHTML=t;var u,m,h,g,N,p=o=="insertColumnLeft"?c[0].c:c[0].c+1;for(N=0;N<i.rows.length;N++){u=i.rows[N];if(u.rowIndex==d){continue}m=0;h=0;for(h=0;h<u.cells.length;h++){g=u.cells[h];c=n(g,f);if(c[0].c>=p){m=g.cellIndex;break}m=h+1}u.insertCell(m).innerHTML=" "}}function d(e,r,n){var i=BX.findParent(e,{tag:"TR"});if(!i||!r)return;var o,a,l=n=="insertRowUpper"?i.rowIndex:i.rowIndex+1,s=r.insertRow(l);for(o=0;o<i.cells.length;o++){a=s.insertCell(o);a.innerHTML=t;a.colSpan=i.cells[o].colSpan}}function f(e,r,n){var i=c(e,r);if(!i||!r)return;var o=i.parentNode,a=n=="insertCellLeft"?i.cellIndex:i.cellIndex+1;o.insertCell(a).innerHTML=t}function c(e,t){if(e.nodeName=="TD"||e.nodeName=="TH")return e;return BX.findParent(e,(function(e){return e.nodeName=="TD"||e.nodeName=="TH"}),t)}function u(e,t){var o,a,l=r(t),s=i(n(e[0],l)),d=s,f=false,c=true,u=true;for(a=1;a<e.length;a++){o=i(n(e[a],l));c=c&&o.rows==s.rows&&o.maxRow==s.maxRow&&o.minRow==s.minRow;u=u&&o.cols==s.cols&&o.maxCol==s.maxCol&&o.minCol==s.minCol;f=f||c&&Math.abs(o.minCol-d.maxCol)>1||u&&Math.abs(o.minRow-d.maxRow)>1||!c&&!u;d=o}return{sameCol:u,sameRow:c,gaps:f}}function m(e,t,r){if(!e)e=a(t,r);if(!e||e.length<2)return false;var n=u(e,r);return!n.gaps&&(!n.sameRow&&n.sameCol||n.sameRow&&!n.sameCol)}function h(e,t){var i=a(e,t);if(!i||i.length!==1)return false;var o=r(t),l=n(i[0],o);if(l.length<1)return false;var s,d,f=l[l.length-1].c,c=true,u;for(s=0;s<l.length;s++){if(l[s].c==f){if(o[l[s].r]&&o[l[s].r][l[s].c+1]){u=o[l[s].r][l[s].c+1];if(d===undefined)d=u;else if(d!==u)c=false}else{c=false}}}c=c&&d&&m([i[0],d],e,t);return c}function g(e,t){var i=a(e,t);if(!i||i.length!==1)return false;var o=r(t),l=n(i[0],o);if(l.length<1)return false;var s,d,f=l[l.length-1].r,c=true,u;for(s=0;s<l.length;s++){if(l[s].r==f){if(o[f+1]&&o[f+1][l[s].c]){u=o[f+1][l[s].c];if(d===undefined)d=u;else if(d!==u)c=false}else{c=false}}}c=c&&d&&m([i[0],d],e,t);return c}function N(e,t,r){if(!r)r=a(e,t);if(r.length<2)return;var n=u(r,t),i,o,l=0,s=0,d="";if(n.sameRow&&!n.sameCol&&!n.gaps){for(i=0;i<r.length;i++){d+=" "+BX.util.trim(r[i].innerHTML);o=r[i].parentNode;l+=r[i].colSpan;if(i>0)o.removeChild(r[i])}r[0].colSpan=l;r[0].innerHTML=BX.util.trim(d)}else if(!n.sameRow&&n.sameCol&&!n.gaps){for(i=0;i<r.length;i++){d+=" "+BX.util.trim(r[i].innerHTML);o=r[i].parentNode;s+=r[i].rowSpan;if(i>0)o.removeChild(r[i])}r[0].rowSpan=s;r[0].innerHTML=BX.util.trim(d)}else{alert(BX.message("BXEdTableMergeError"))}}function p(e,t){var r=a(e,t);if(!r||r.length!==1)return false;var n=BX.findParent(r[0],{tag:"TR"},t);if(r[0].cellIndex<n.cells.length-1){r.push(n.cells[r[0].cellIndex+1])}return N(e,t,r)}function v(e,t){var i=a(e,t);if(!i||i.length!==1)return false;var o=r(t),l=n(i[0],o),s,d,f=l[l.length-1].r,c=true,u;for(s=0;s<l.length;s++){if(l[s].r==f){if(o[f+1]&&o[f+1][l[s].c]){u=o[f+1][l[s].c];if(d===undefined)d=u;else if(d!==u)c=false}else{c=false}}}if(c){i.push(d);return N(e,t,i)}}function B(e,t){var r=a(e,t);if(!r||r.length!==1)return false;var n,i=[],o=r[0].parentNode;for(n=0;n<o.cells.length;n++){i.push(o.cells[n])}return N(e,t,i)}function b(e,t){var l=a(e,t);if(!l||l.length!==1)return false;var s,d,f=[],c=r(t),u=i(n(l[0],c));for(s=0;s<c.length;s++){for(d=u.minCol;d<=u.minCol;d++){f=o(f,c[s][d],t)}}return N(e,t,f)}function C(e,r){var n=a(e,r);if(!n||n.length!=1)return false;var i,o,l=0,s,d,f,c=n[0].colSpan,u=n[0].rowSpan,m=n[0].parentNode;for(i=0;i<=n[0].cellIndex;i++)l+=m.cells[i].colSpan;if(c>1){n[0].colSpan--}else{for(o=0;o<r.rows.length;o++){if(o==m.rowIndex||o>=m.rowIndex&&o<m.rowIndex+u)continue;s=0;d=r.rows[o];i=0;while(s<l&&i<d.cells.length)s+=d.cells[i++].colSpan;i--;d.cells[i].colSpan+=1;if(d.cells[i].rowSpan>1)o=o+d.cells[i].rowSpan-1}}f=m.insertCell(n[0].cellIndex+1);f.rowSpan=n[0].rowSpan;f.innerHTML=t}function x(e,i){var o=a(e,i);if(!o||o.length!=1)return false;var l,s,d,f,c,u,m,h,g=r(i),N=n(o[0],g),p=o[0].parentNode,v=p.rowIndex,B=o[0].cellIndex,b=N[0].r,C=N[0].c,x=true,I=true;for(l=1;l<N.length;l++){if(N[l].r!=b)I=false;if(N[l].c!=C)x=false}if(I){var S=i.insertRow(p.rowIndex+1),y=S.insertCell(-1);y.innerHTML=t;if(!x)y.colSpan=o[0].colSpan;for(s=0;s<=b;s++){f=i.rows[s];for(d=0;d<f.cells.length;d++){c=f.cells[d];if(s==v&&d==B)continue;m=s;if(c.rowSpan>1)m+=c.rowSpan-1;if(m>=b)c.rowSpan++}}}else{f=i.rows[v+--o[0].rowSpan];h=false;for(d=0;d<f.cells.length;d++){u=n(f.cells[d],g);for(l=0;l<u.length;l++){if(u[l].c>B)h=0;else if(u[l].c+1==B)h=f.cells[d].cellIndex+1;if(h!==false)break}}y=f.insertCell(h);y.innerHTML=t;if(!x)y.colSpan=o[0].colSpan}}function I(e,t){var i=a(e,t);if(!i||i.length!=1)return false;var o=i[0];if(!o)return false;var l,s,d=r(t),f=n(o,d),c;for(c=0;c<d.length;c++){s=d[c][f[0].c];if(s&&s.parentNode){l=s.parentNode;BX.remove(s);if(l.cells.length==0)BX.remove(l)}}if(t.rows.length==0)BX.remove(t)}function S(e,t){var r=a(e,t);if(!r||r.length!=1)return false;var n=r[0];if(!n)return false;BX.remove(n.parentNode);if(t.rows.length==0)BX.remove(t)}function y(e,t,r){if(!r){var n=a(e,t);if(!n||n.length!=1)return false;r=n[0]}if(!r)return false;var i=r.parentNode;BX.remove(r);if(i.cells.length==0)BX.remove(i);if(t.rows.length==0)BX.remove(t)}function T(e,t){var r=a(e,t);if(!r||r.length==1)return false;var n,i;for(n=0;n<r.length;n++){i=r[n].parentNode;BX.remove(r[n]);if(i.cells.length==0)BX.remove(i)}if(t.rows.length==0)BX.remove(t)}return{exec:function(e,t){var r=t.range.commonAncestorContainer;switch(t.actionType){case"insertColumnLeft":case"insertColumnRight":s(r,t.tableNode,t.actionType);break;case"insertRowUpper":case"insertRowLower":d(r,t.tableNode,t.actionType);break;case"insertCellLeft":case"insertCellRight":f(r,t.tableNode,t.actionType);break;case"removeColumn":I(t.range,t.tableNode);break;case"removeRow":S(t.range,t.tableNode);break;case"removeCell":y(t.range,t.tableNode);break;case"removeSelectedCells":T(t.range,t.tableNode);break;case"mergeSelectedCells":N(t.range,t.tableNode);break;case"mergeRightCell":p(t.range,t.tableNode);break;case"mergeBottomCell":v(t.range,t.tableNode);break;case"mergeRow":B(t.range,t.tableNode);break;case"mergeColumn":b(t.range,t.tableNode);break;case"splitHorizontally":C(t.range,t.tableNode);break;case"splitVertically":x(t.range,t.tableNode);break}},state:BX.DoNothing,value:BX.DoNothing,getSelectedCells:a,canBeMerged:m,canBeMergedWithRight:h,canBeMergedWithBottom:g}},GetFormatBbCode:function(){var e=this;return{view:"textarea",exec:function(t,r){var n=r.value,i=r.tag.toUpperCase(),o=i;if(i=="FONT"||i=="COLOR"||i=="SIZE"){i+="="+n}if(r.singleTag===true)e.editor.textareaView.WrapWith("[","]",i);else e.editor.textareaView.WrapWith("["+i+"]","[/"+o+"]")},state:BX.DoNothing,value:BX.DoNothing}}};window.BXEditorActions=e})(); //# sourceMappingURL=html-actions.map.js