Your IP : 18.219.68.154


Current Path : /home/bitrix/ext_www/dev.shuft.com.ua/bitrix/js/fileman/html_editor/
Upload File :
Current File : /home/bitrix/ext_www/dev.shuft.com.ua/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()},i={insertHTML:BX.browser.IsFirefox()};if(!r[e]){try{return this.document.queryCommandSupported(e)}catch(n){}try{return this.document.queryCommandEnabled(e)}catch(o){return!!i[e]}}return false},IsSupported:function(e){return!!this.actions[e]},IsContentAction:function(e){return this.contentActionIndex[e]},Exec:function(e,t,r){var i=this,n=this.actions[e],o=n&&n.exec,a=this.IsContentAction(e),l=null;if(!r){this.editor.On("OnBeforeCommandExec",[a,e,n,t])}if(a){this.editor.Focus(false)}if(o){l=o.apply(n,arguments)}else{try{l=this.document.execCommand(e,false,t)}catch(s){}}if(a){setTimeout(function(){i.editor.Focus(false)},1)}if(!r){this.editor.On("OnAfterCommandExec",[a,e])}return l},CheckState:function(e,t){var r=this.actions[e],i=null;if(r&&r.state){i=r.state.apply(r,arguments)}else{try{i=this.document.queryCommandState(e)}catch(n){i=false}}return i},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(i){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 i(e,t,r){var i=e+":";if(r)i+=r;if(t){for(var n in t)if(t.hasOwnProperty(n))i+=n+"="+t[n]+";"}return i}function n(n,o,a){var l=i(n,o,a);if(!r[l]){var s=t[n];var d=s?[n.toLowerCase(),s.toLowerCase()]:[n.toLowerCase()];r[l]=new e.editor.HTMLStyler(e.editor,d,o,a,true)}return r[l]}return{exec:function(t,r,i,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=n(i,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,i,n,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(i=0;i<t.rows.length;i++){for(n=0;n<t.rows[i].childNodes.length;n++){o=t.rows[i].childNodes[n];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,i,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=n(o,a,l);return c.IsAppliedToRange(f,false)},value:BX.DoNothing}},GetFormatBlock:function(){var e=this,t="DIV",r=e.editor.GetBlockTags(),i=e.editor.NESTED_BLOCK_TAGS;function n(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),i=e.editor.util.GetPreviousNotEmptySibling(t);if(r&&!d(r)){t.parentNode.insertBefore(e.document.createElement("BR"),r)}if(i&&!d(i)){t.parentNode.insertBefore(e.document.createElement("BR"),t)}}function l(t){var r=e.editor.util.GetNextNotEmptySibling(t),i=e.editor.util.GetPreviousNotEmptySibling(t);if(r&&r.nodeName==="BR"){r.parentNode.removeChild(r)}if(i&&i.nodeName==="BR"){i.parentNode.removeChild(i)}}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,i,n){if(i||n){}e.document.execCommand(t,false,r)}function c(e){return!e.className||BX.util.trim(e.className)===""}function u(t,r,i,n){if(r){if(t.nodeName!==r){t=e.editor.util.RenameNode(t,r)}if(i){t.className=i}if(n&&n.length>0){e.editor.util.SetCss(t,n)}}else{a(t);e.editor.util.ReplaceWithOwnChildren(t)}}return{exec:function(n,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(n,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,i)&&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,i)){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,i,n){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 i(i,n){if(!i)return;var o=i.nodeName;if(e[o]){r.editor.util.ReplaceWithOwnChildren(i)}else if(t[o]){r.actions.formatBlock.addBrBeforeAndAfter(i);r.editor.util.ReplaceWithOwnChildren(i)}else{i.removeAttribute("style");i.removeAttribute("class");i.removeAttribute("align");if(r.editor.bbCode&&i.nodeName=="TABLE"){i.removeAttribute("align")}}}function n(e){return BX.findParent(e,function(e){return e.nodeName=="TABLE"},r.editor.GetIframeDoc().body)}function o(e){var t,i,n=e.parentNode;while(n&&n.nodeName!=="BODY"){t=n.previousSibling&&!r.editor.util.IsEmptyNode(n.previousSibling);i=n.nextSibling&&!r.editor.util.IsEmptyNode(n.nextSibling);if(t||i||n.parentNode.nodeName=="BODY"){break}n=n.parentNode}return n}function a(e){var t=r.editor.GetIframeDoc(),i=BX.findParent(e,function(e){return e.nodeName=="UL"||e.nodeName=="OL"||e.nodeName=="MENU"},t.body);if(i){var n,o,a=i.cloneNode(false),l=i.cloneNode(false),s=true;BX.cleanNode(a);BX.cleanNode(l);for(n=0;n<i.childNodes.length;n++){o=i.childNodes[n];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){i.parentNode.insertBefore(a,i)}i.parentNode.insertBefore(e,i);if(l.childNodes.length>0){i.parentNode.insertBefore(l,i)}BX.remove(i);return true}return false}function l(e,t){if(e&&e.length>0){var n,o,a=[];for(n=0,o=e.length;n<o;n++){if(!r.editor.util.CheckSurrogateNode(e[n])){a.push({node:e[n],nesting:r.editor.util.GetNodeDomOffset(e[n])})}}a=a.sort(function(e,t){return t.nesting-e.nesting});for(n=0,o=a.length;n<o;n++){i(a[n].node,t)}}}function s(e){var t,i=false,n=r.editor.selection.SelectNode(e),o=n.getNodes([1]);if(e.nodeType==1){for(t=0;t<o.length;t++){if(o[t]==e){i=true;break}}if(!i){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 i=r.editor.selection.GetRange();if(!i||r.editor.iframeView.IsEmpty())return;var d=true,f,c,u,m,h,g=i.getNodes([1]),N=r.editor.GetIframeDoc();if(g.length==0){c=i.getNodes([3]);if(c&&c.length==1){u=c[0]}if(!u&&i.startContainer==i.endContainer){if(i.startContainer.nodeType==3){u=i.startContainer}else{d=false;g=s(i.startContainer)}}if(u&&g.length==0){m=o(u);if(m&&(m.nodeName!="BODY"||i.collapsed)){d=false;g=s(m)}}}else{var p=false,v=[],B=n(i.startContainer),b=n(i.endContainer);if(B){v.push({startContainer:i.startContainer,startOffset:i.startOffset,end:B});i.setStartAfter(B);p=true}if(b){p=true;v.push({start:b,endContainer:i.endContainer,endOffset:i.endOffset});i.setEndBefore(b)}var C=r.editor.util.FindParentEx(i.startContainer,function(e){return e.nodeName=="UL"||e.nodeName=="OL"||e.nodeName=="MENU"},N.body),x=r.editor.util.FindParentEx(i.endContainer,function(e){return e.nodeName=="UL"||e.nodeName=="OL"||e.nodeName=="MENU"},N.body);if(C){i.setStartBefore(C);if(!x)i.setEndAfter(C);p=true}if(x){p=true;i.setEndAfter(x);if(!C)i.setStartBefore(x)}if(p){r.editor.selection.SetSelection(i);g=i.getNodes([1])}}if(d){h=N.createElement("span");r.editor.selection.Surround(h,i);g=s(h)}if(g&&g.length>0){r.editor.selection.ExecuteAndRestoreSimple(function(){l(g,N)})}if(v&&v.length>0){var I=i.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(i)}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 i;if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){if(r>0)i=e.actions.formatInline.exec(t,r,"span",{fontSize:r+"pt"});else i=e.actions.formatInline.exec(t,r,"span",{fontSize:null},null,{bClear:true})}else{i=e.actions.formatBbCode.exec(t,{tag:"SIZE",value:r+"pt"})}return i},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,i,n=[],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++){i=BX.findParent(a[r],function(e){return e.nodeName=="LI"&&e.style&&e.style.color},t.body);if(i){n.push(i)}}}return n.length===0?false:n}function r(t){var r=e.editor.GetIframeDoc(),i=e.editor.selection.GetSelectedNode(),n,o,a,l,s,d,f;if(i&&(i.nodeType===3||i.nodeName=="SPAN")){s=i.nodeName=="SPAN"?i:BX.findParent(i,{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(!i){l=e.editor.selection.GetRange();f=l.getNodes([1])}else{f=[i]}for(n=0;n<f.length;n++){if(f[n]&&f[n].nodeName=="LI"&&!e.editor.bbCode){f[n].style.color=t;a=BX.findChild(f[n],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(t){}}}})}}}}return{exec:function(t,i){var n;if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){if(i==""){n=e.actions.formatInline.exec(t,i,"span",{color:null},null,{bClear:true})}else{n=e.actions.formatInline.exec(t,i,"span",{color:i});r(i)}}else if(i){n=e.actions.formatBbCode.exec(t,{tag:"COLOR",value:i})}return n},state:function(r,i){var n=e.actions.formatInline.state(r,i,"span",{color:i});if(!n){n=t()}return n},value:BX.DoNothing}},GetBackgroundColor:function(){var e=this;return{exec:function(t,r){var i;if(r==""){i=e.actions.formatInline.exec(t,r,"span",{backgroundColor:null},null,{bClear:true})}else{i=e.actions.formatInline.exec(t,r,"span",{backgroundColor:r})}return i},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,i){if(t.editor.bbCode&&t.editor.synchro.IsFocusedOnTextarea()){t.editor.textareaView.Focus();var n="[URL="+t.editor.util.spaceUrlEncode(i.href)+"]"+(i.text||i.href)+"[/URL]";t.editor.textareaView.WrapWith(false,false,n)}else{t.editor.iframeView.Focus();var o,a=i&&typeof i==="object"?i:{href:i},l,s,d=0,f,c;function u(r,i){var n;r.removeAttribute("class");r.removeAttribute("target");for(n in i){if(i.hasOwnProperty(n)&&BX.util.in_array(n,e)){if(i[n]==""||i[n]==undefined){r.removeAttribute(n)}else{r.setAttribute(n,i[n])}}}if(i.className)r.className=i.className;r.href=t.editor.util.spaceUrlEncode(i.href)||"";if(i.noindex){r.setAttribute("data-bx-noindex","Y")}else{r.removeAttribute("data-bx-noindex")}}c=i.node?[i.node]:t.actions.formatInline.state(r,i,"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,i,"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 i,n,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(i=0;i<o.length;i++){n=o[i];if(n){e.editor.util.ReplaceWithOwnChildren(o[i])}}})}},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,i){if(i.src=="")return;i.src=t.editor.util.spaceUrlEncode(i.src);if(t.editor.bbCode&&t.editor.synchro.IsFocusedOnTextarea()){t.editor.textareaView.Focus();var n="";if(i.width)n+=" WIDTH="+parseInt(i.width);if(i.height)n+=" HEIGHT="+parseInt(i.height);var o="[IMG"+n+"]"+i.src+"[/IMG]";t.editor.textareaView.WrapWith(false,false,o);return}t.editor.iframeView.Focus();var a=i&&typeof i==="object"?i:{src:i},l=i.image||t.actions.insertImage.state(r,i),s,d;function f(r,i){var n,o;r.removeAttribute("class");r.setAttribute("data-bx-orig-src",i.src||"");for(n in i){if(i.hasOwnProperty(n)&&BX.util.in_array(n,e)){if(i[n]==""||i[n]==undefined){r.removeAttribute(n)}else{o=r.getAttribute("data-bx-app-ex-"+n);if(!o||t.editor.phpParser.AdvancedPhpGetFragmentByCode(o,true)!=i[n]){r.setAttribute(n,i[n]);if(o){r.removeAttribute("data-bx-app-ex-"+n)}}}}}if(i.className){r.className=i.className}o=r.getAttribute("data-bx-app-ex-src");if(!o||t.editor.phpParser.AdvancedPhpGetFragmentByCode(o,true)!=i.src){r.src=i.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,i;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;i=t.editor.selection.GetNodes(1,function(e){return e.nodeName==="IMG"});if(i.length!==1)return false;return i[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 i(t){var r=e.document.createElement("TD");while(t.firstChild)r.appendChild(t.firstChild);e.editor.util.ReplaceNode(t,r)}function n(n,o){var a;n.removeAttribute("class");for(a in o){if(o.hasOwnProperty(a)&&BX.util.in_array(a,t)){if(o[a]===""||o[a]==undefined){n.removeAttribute(a)}else{n.setAttribute(a,o[a])}}}if(o.className){n.className=o.className}n.removeAttribute("data-bx-no-border");if(n.getAttribute("border")==0||!n.getAttribute("border")){n.removeAttribute("border");n.setAttribute("data-bx-no-border","Y")}if(o.width){if(parseInt(o.width)==o.width){o.width=o.width+"px"}if(n.getAttribute("width")){n.setAttribute("width",o.width)}else{n.style.width=o.width}}if(o.height){if(parseInt(o.height)==o.height){o.height=o.height+"px"}if(n.getAttribute("height")){n.setAttribute("height",o.height)}else{n.style.height=o.height}}var l,s,d;for(l=0;l<n.rows.length;l++){for(s=0;s<n.rows[l].cells.length;s++){d=n.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"){i(d)}}}var f=BX.findChild(n,{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);n.insertBefore(f,n.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 i=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(!i){i=e.document.createElement("TABLE");var o=i.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:"&nbsp;"})}}n(i,r);e.editor.selection.InsertNode(i);var f=e.editor.util.GetNextNotEmptySibling(i);if(!f){e.editor.util.InsertAfter(BX.create("BR",{},e.document),i)}if(f&&f.nodeName=="BR"&&!f.nextSibling){e.editor.util.InsertAfter(e.editor.util.GetInvisibleTextNode(),f)}}else{n(i,r)}var c=i.rows[0].cells[0].firstChild;if(c){e.editor.selection.SetAfter(c)}setTimeout(function(){e.editor.util.Refresh(i)},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+="	[TR]\n";for(h=0;h<r.cols;h++){u+="		[TD]"+g+"[/TD]\n"}u+="	[/TR]\n"}u+="[/TABLE]\n"}e.editor.textareaView.WrapWith(false,false,u)}},state:function(t,r){var i,n;if(!e.editor.util.DocumentHasTag(e.document,"TABLE")){return false}i=e.editor.selection.GetSelectedNode();if(!i){return false}if(i.nodeName==="TABLE"){return i}if(i.nodeType!==1){return false}n=e.editor.selection.GetNodes(1,function(e){return e.nodeName==="TABLE"});if(n.length!==1){return false}return n[0]},value:BX.DoNothing}},GetInsertList:function(e){var t=this;var r=!!e.bOrdered,i=r?"OL":"UL",n=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(),i=e.previousSibling,n,o,a,l;if(i&&!t.editor.util.IsBlockElement(i)&&!t.editor.util.IsEmptyNode(i,true)){r.appendChild(t.document.createElement("BR"))}while(l=e.firstChild){o=l.lastChild;while(n=l.firstChild){if(n.nodeName=="I"&&n.innerHTML==""&&n.className!=""){BX.remove(n);n=l.firstChild;if(!n)break}a=n===o&&!t.editor.util.IsBlockElement(n)&&n.nodeName!=="BR";r.appendChild(n);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 i=e.nodeName.toUpperCase();if(i==="UL"||i==="OL"||i==="MENU"){return e}var n=t.document.createElement(r),o,a;while(e.firstChild){a=a||n.appendChild(t.document.createElement("li"));o=e.firstChild;if(t.editor.util.IsBlockElement(o)){a=a.firstChild?n.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(n,e);return n}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 i=t.editor.selection.GetRange(),n=t.editor.selection.GetCommonAncestorForRange(i);if(n&&s(n)){r=n}else{var o,a=true,l,d,f=i.getNodes([1]),c=f.length;if(n){l=d=BX.findParent(n,s,t.document.body)}if(!d){for(o=0;o<c;o++){d=BX.findParent(f[o],s,n);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,i,n,o=e.ownerDocument;for(r=0;r<e.childNodes.length;r++){i=e.childNodes[r];if(i&&i.nodeType==1&&i.nodeName=="LI"){n=i.firstChild;if(n.nodeName==t.tag&&n.innerHTML==""){if(t.remove)BX.remove(n);else n.className=t.className}else{i.insertBefore(BX.create(t.tag,{props:{className:t.className}},o),n)}}}}function c(e){if(!e)return false;var t,r,i;for(t=0;t<e.childNodes.length;t++){r=e.childNodes[t];if(r&&r.nodeType==1&&r.nodeName=="LI"){i=r.firstChild;if(i&&i.nodeName=="I"&&i.innerHTML==""&&i.className!==""){return i.className}}}return false}function u(e,r,i){if(e&&(e.nodeName=="UL"||e.nodeName=="OL")){var n,o,a,l=e.ownerDocument,s;for(n=0;n<e.childNodes.length;n++){o=e.childNodes[n];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(i&&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(i,f),u=d(n,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,i)})}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,i)});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+="	[*]"+o.items[B]+"\n"}v+="[/LIST]\n";t.editor.textareaView.WrapWith(false,false,v)}}},state:function(){return d(i)||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",i={TD:1,TR:1,TH:1,TABLE:1,TBODY:1,CAPTION:1,COL:1,COLGROUP:1,TFOOT:1,THEAD:1},n={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,i=false;if(e.nodeType===1){r=e.style.textAlign;if(e.style.textAlign){i={node:e,style:r}}if(n[t]){r=e.getAttribute("align");if(r){if(i){i.attribute=r}else{i={node:e,attribute:r}}}}}return i}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,i,n=true,o=e.getElementsByTagName("TD");for(i=0;i<o.length;i++){if(o[i].getAttribute("data-bx-tmp-align")!=t){n=false;break}}if(n){r=e.getElementsByTagName("TH");for(i=0;i<r.length;i++){if(r[i].getAttribute("data-bx-tmp-align")!=t){n=false;break}}}if(n){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,i){var n=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"},n)}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!==i){s=false;break}}if(a){e.style.textAlign="";if(e.style.cssText==""){e.removeAttribute("style")}h(e);u(e,i)}else if(s){e.style.textAlign=i;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,i=false;for(r=0;r<e.length;r++){if(e[r]==t){i=true;break}}if(!i){e.push(t)}}return e}return{exec:function(r,n){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&&i[I.nodeName]){b=I;a=true;setTimeout(function(){o.editor.selection.SelectNode(b);if(b.nodeName=="TABLE"){d(b,n)}},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,n);I.style.textAlign=""}else{I.style.textAlign=n}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,n);C.style.textAlign=""}else{C.style.textAlign=n}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],n);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=n;T.push(w[N]);a=true}else if(w[N].nodeName=="LI"){w[N].style.textAlign=n;a=true;A.push(w[N])}}for(N=0;N<S.length;N++){f(S[N],n)}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],n);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,n);B.style.textAlign=""}else{p=B.tagName!="DIV"?B.tagName:"P";a=o.actions.formatBlock.exec("formatBlock",p,null,{textAlign:n})}o.editor.util.Refresh(B)}else if(b){if(l(b)){s(b,n)}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],n)}for(N=0;N<R.length;N++){s(R[N],n)}}}else if(v.collapsed){a=o.actions.formatBlock.exec("formatBlock","P",e,{textAlign:n});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=n}else{F=false}}a=F}}if(!a){p=o.editor.bbCode?"DIV":"P";a=o.actions.formatBlock.exec("formatBlock",p,null,{textAlign:n},{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=n;_=true;N++}else{if(!V||_){V=o.document.createElement(p);V.style.textAlign=n;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(n){a=o.actions.formatBbCode.exec(r,{tag:n.toUpperCase()})}}return a},state:function(e,t){var i,n,l=o.editor.selection.GetSelectedNode();if(l){i=a(l);if(!i){n=BX.findParent(l,function(e){i=a(e);return i},o.document.body)}return{node:i?i.node:null,value:i?i.style||i.attribute:r,res:i}}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 i="bxed_bogus_node_59811",n=r.startContainer.appendChild(BX.create("SPAN",{props:{id:i},html:"&nbsp;"},e.document));is_text=e.editor.util.GetInvisibleTextNode();if(n){r.setStartBefore(n);r.setEndAfter(n);e.editor.selection.SetSelection(r);return setTimeout(function(){e.actions.indent.exec(t,r.startContainer.nodeName);var n=e.editor.GetIframeElement(i);if(n){e.editor.selection.SetAfter(n);BX.remove(n)}},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 i=false,n=e.editor.selection.GetRange();if(n){var o=e.editor.selection.GetCommonAncestorForRange(n);if(o&&o.nodeType==1&&o.nodeName==="BLOCKQUOTE"){i=o}}return i},value:BX.DoNothing}},GetOutdent:function(){var e=this;return{exec:function(t,r){var i,n="data-bx-tmp-flag",o=e.editor.GetIframeDoc(),a=o.getElementsByTagName("BLOCKQUOTE");{var l=[],s=o.getElementsByTagName("P");for(i=0;i<s.length;i++){s[i].setAttribute(n,"Y")}e.document.execCommand(t);s=o.getElementsByTagName("P");for(i=0;i<s.length;i++){if(!s[i].getAttribute(n)){l.push(s[i])}else{s[i].removeAttribute(n)}}e.editor.selection.ExecuteAndRestoreSimple(function(){for(i=0;i<l.length;i++){e.actions.formatBlock.addBrBeforeAndAfter(l[i]);e.editor.util.ReplaceWithOwnChildren(l[i])}})}},state:function(t,r){var i=e.editor.selection.GetRange();return false},value:BX.DoNothing}},GetFontFamily:function(){var e=this;return{exec:function(t,r){var i;if(!e.editor.bbCode||!e.editor.synchro.IsFocusedOnTextarea()){if(r)i=e.actions.formatInline.exec(t,r,"span",{fontFamily:r});else i=e.actions.formatInline.exec(t,r,"span",{fontFamily:null},null,{bClear:true})}else{return e.actions.formatBbCode.exec(t,{tag:"FONT",value:r})}return i},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:[],i=t?t.checkedTags:[];function n(t){if(t&&t.nodeType==1&&t.nodeName!=="BODY"&&(BX.util.in_array(t.nodeName,i)||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 i=e.actions.insertUnorderedList.state();if(i&&r.className&&r.className.indexOf("~~")!==-1){var n=r.className.split("~~");if(n&&n.length>=2){var o=n[0],a=n[1];i.className=o;e.actions.insertUnorderedList.customBullit(i,{tag:"I",className:a,html:""})}}else if(i){i.className=r.className||"";e.actions.insertUnorderedList.customBullit(i,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 i=false,o=e.editor.selection.GetSelectedNode();if(o){if(n(o)){i=o}else{i=BX.findParent(o,n,e.document.body)}}else{var a=e.editor.selection.GetRange(),l=e.editor.selection.GetCommonAncestorForRange(a);if(n(l)){i=l}}return i},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 i(i){var o=[];if(i&&i.length>0){var a,l,s=[],d,f;for(a=0,l=i.length;a<l;a++){if(!r.editor.util.CheckSurrogateNode(i[a])&&i[a].nodeName!=="BR"){i[a].setAttribute(t,"Y");s.push({node:i[a],nesting:r.editor.util.GetNodeDomOffset(i[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"&&!n(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 n(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(i){}}return{exec:function(n,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(n,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(n),c=i(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 i,n,o,a=t.getNodes([1]);if(a.length==0){i=t.getNodes([3]);if(i&&i.length==1){n=i[0]}if(!n&&t.startContainer==t.endContainer){if(t.startContainer.nodeType==3){n=t.startContainer}else{r.editor.selection.SelectNode(t.startContainer);a=[t.startContainer]}}if(n&&a.length==0){o=n.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,i){return t.actions.formatInline.exec(r,i,e)},state:function(r,i){return t.actions.formatInline.state(r,i,e)},value:BX.DoNothing}},GetQuote:function(){var e,t,r=this;function i(e){return e&&e.className=="bxhtmled-quote"&&e.nodeName=="BLOCKQUOTE"}function n(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){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 i=e.toHtml();i=i.replace(/<br.*?>/gi,"#BX_BR#");t=BX.create("DIV",{html:BX.util.htmlspecialchars(i)},r.editor.GetIframeDoc())}var o=r.editor.util.GetTextContentEx(t);o=o.replace(/#BX_BR#/gi,"<br>");n(o);BX.remove(t)}else{n("")}}function s(e){var t,i,n=e.querySelectorAll("blockquote.bxhtmled-quote");for(t=0;t<n.length;t++){i=n[t];if(i.nextSibling===null){r.editor.util.InsertAfter(r.editor.util.GetInvisibleTextNode(),i)}}}return{exec:function(t){var i=false,n=o();if(r.editor.bbCode&&r.editor.synchro.IsFocusedOnTextarea()){r.editor.textareaView.Focus();if(n){i=r.editor.textareaView.WrapWith(false,false,"[QUOTE]"+n+"[/QUOTE]")}else{i=r.actions.formatBbCode.exec(t,{tag:"QUOTE"})}}else{if(!e&&r.editor.selection.lastCheckedRange&&r.editor.selection.lastCheckedRange.range){e=r.editor.selection.lastCheckedRange.range}r.editor.iframeView.Focus();if(e){r.editor.selection.SetSelection(e)}if(n){var a="bxq_"+Math.round(Math.random()*1e6);r.editor.InsertHtml('<blockquote id="'+a+'" class="bxhtmled-quote">'+n+"</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;i=r.actions.formatBlock.exec("formatBlock","blockquote","bxhtmled-quote",false,{range:e})}if(!n)r.editor.selection.ScrollIntoView()}e=null;return i},state:function(){return r.actions.formatBlock.state("formatBlock","blockquote","bxhtmled-quote")},value:BX.DoNothing,setExternalSelectionFromRange:l,setExternalSelection:n,getExternalSelection:o,checkSpaceAfterQuotes:s,setRange:a,checkNode:i}},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 i=BX.util.trim(r.innerHTML);if(i=="<br>"||i===""){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 i=e.editor.smilesIndex[r];if(e.editor.bbCode&&e.editor.synchro.IsFocusedOnTextarea()){e.editor.textareaView.Focus();e.editor.textareaView.WrapWith(false,false," "+i.code+" ")}else{e.editor.iframeView.Focus();if(i){var n=BX.create("IMG",{props:{src:i.path,title:i.name||i.code}},e.editor.iframeView.document);e.editor.SetBxTag(n,{tag:"smile",params:i});if(i.width)n.style.width=parseInt(i.width)+"px";if(i.height)n.style.height=parseInt(i.height)+"px";e.editor.selection.InsertNode(n);var o=e.editor.iframeView.document.createTextNode(" ");n.parentNode.insertBefore(o,n);var a=BX.create("SPAN",{html:"&nbsp;"},e.editor.iframeView.document);e.editor.util.InsertAfter(a,n);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="&nbsp;";function r(e){var t=e.rows;var r=[],i,n,o,a,l,s,d,f,c=-1;for(i=0;i<t.length;i++){c++;if(!r[c]){r[c]=[]}n=-1;for(o=0;o<t[i].cells.length;o++){a=t[i].cells[o];n++;while(r[c][n]){n++}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][n+s]=t[i].cells[o]}}n+=d-1}}return r}function i(e,t){var r,i,n=[];for(r=0;r<t.length;r++){for(i=0,l=t[r].length;i<l;i++){if(t[r][i]==e){n.push({r:r,c:i})}}}return n}function n(e){var t=[],r=[],i={cells:0},n;for(n=0;n<e.length;n++){i.cells++;i.maxRow=n===0?e[n].r:Math.max(e[n].r,i.maxRow);i.minRow=n===0?e[n].r:Math.min(e[n].r,i.minRow);i.maxCol=n===0?e[n].c:Math.max(e[n].c,i.maxCol);i.minCol=n===0?e[n].c:Math.min(e[n].c,i.minCol);if(!BX.util.in_array(e[n].r,t))t.push(e[n].r);if(!BX.util.in_array(e[n].c,r))r.push(e[n].c)}i.rows=t.length;i.cols=r.length;return i}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 i=[],n;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;i=o(i,s,r);i=o(i,d,r)}}else{if(t.collapsed){n=c(t.startContainer);i=o(i,n,r)}else{var u=t.getNodes([1]);for(a=0;a<u.length;a++){if(u[a].nodeName=="TD"||u[a].nodeName=="TH"){i=o(i,u[a],r)}}}}return i}function s(e,n,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(n),c=i(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<n.rows.length;N++){u=n.rows[N];if(u.rowIndex==d){continue}m=0;h=0;for(h=0;h<u.cells.length;h++){g=u.cells[h];c=i(g,f);if(c[0].c>=p){m=g.cellIndex;break}m=h+1}u.insertCell(m).innerHTML="&nbsp;"}}function d(e,r,i){var n=BX.findParent(e,{tag:"TR"});if(!n||!r)return;var o,a,l=i=="insertRowUpper"?n.rowIndex:n.rowIndex+1,s=r.insertRow(l);for(o=0;o<n.cells.length;o++){a=s.insertCell(o);a.innerHTML=t;a.colSpan=n.cells[o].colSpan}}function f(e,r,i){var n=c(e,r);if(!n||!r)return;var o=n.parentNode,a=i=="insertCellLeft"?n.cellIndex:n.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=n(i(e[0],l)),d=s,f=false,c=true,u=true;for(a=1;a<e.length;a++){o=n(i(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 i=u(e,r);return!i.gaps&&(!i.sameRow&&i.sameCol||i.sameRow&&!i.sameCol)}function h(e,t){var n=a(e,t);if(!n||n.length!==1)return false;var o=r(t),l=i(n[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([n[0],d],e,t);return c}function g(e,t){var n=a(e,t);if(!n||n.length!==1)return false;var o=r(t),l=i(n[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([n[0],d],e,t);return c}function N(e,t,r){if(!r)r=a(e,t);if(r.length<2)return;var i=u(r,t),n,o,l=0,s=0,d="";if(i.sameRow&&!i.sameCol&&!i.gaps){for(n=0;n<r.length;n++){d+=" "+BX.util.trim(r[n].innerHTML);o=r[n].parentNode;l+=r[n].colSpan;if(n>0)o.removeChild(r[n])}r[0].colSpan=l;r[0].innerHTML=BX.util.trim(d)}else if(!i.sameRow&&i.sameCol&&!i.gaps){for(n=0;n<r.length;n++){d+=" "+BX.util.trim(r[n].innerHTML);o=r[n].parentNode;s+=r[n].rowSpan;if(n>0)o.removeChild(r[n])}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 i=BX.findParent(r[0],{tag:"TR"},t);if(r[0].cellIndex<i.cells.length-1){r.push(i.cells[r[0].cellIndex+1])}return N(e,t,r)}function v(e,t){var n=a(e,t);if(!n||n.length!==1)return false;var o=r(t),l=i(n[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){n.push(d);return N(e,t,n)}}function B(e,t){var r=a(e,t);if(!r||r.length!==1)return false;var i,n=[],o=r[0].parentNode;for(i=0;i<o.cells.length;i++){n.push(o.cells[i])}return N(e,t,n)}function b(e,t){var l=a(e,t);if(!l||l.length!==1)return false;var s,d,f=[],c=r(t),u=n(i(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 i=a(e,r);if(!i||i.length!=1)return false;var n,o,l=0,s,d,f,c=i[0].colSpan,u=i[0].rowSpan,m=i[0].parentNode;for(n=0;n<=i[0].cellIndex;n++)l+=m.cells[n].colSpan;if(c>1){i[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];n=0;while(s<l&&n<d.cells.length)s+=d.cells[n++].colSpan;n--;d.cells[n].colSpan+=1;if(d.cells[n].rowSpan>1)o=o+d.cells[n].rowSpan-1}}f=m.insertCell(i[0].cellIndex+1);f.rowSpan=i[0].rowSpan;f.innerHTML=t}function x(e,n){var o=a(e,n);if(!o||o.length!=1)return false;var l,s,d,f,c,u,m,h,g=r(n),N=i(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=n.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=n.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=n.rows[v+--o[0].rowSpan];h=false;for(d=0;d<f.cells.length;d++){u=i(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 n=a(e,t);if(!n||n.length!=1)return false;var o=n[0];if(!o)return false;var l,s,d=r(t),f=i(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 i=r[0];if(!i)return false;BX.remove(i.parentNode);if(t.rows.length==0)BX.remove(t)}function y(e,t,r){if(!r){var i=a(e,t);if(!i||i.length!=1)return false;r=i[0]}if(!r)return false;var n=r.parentNode;BX.remove(r);if(n.cells.length==0)BX.remove(n);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 i,n;for(i=0;i<r.length;i++){n=r[i].parentNode;BX.remove(r[i]);if(n.cells.length==0)BX.remove(n)}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 i=r.value,n=r.tag.toUpperCase(),o=n;if(n=="FONT"||n=="COLOR"||n=="SIZE"){n+="="+i}if(r.singleTag===true)e.editor.textareaView.WrapWith("[","]",n);else e.editor.textareaView.WrapWith("["+n+"]","[/"+o+"]")},state:BX.DoNothing,value:BX.DoNothing}}};window.BXEditorActions=e})();
//# sourceMappingURL=html-actions.map.js