Your IP : 3.23.101.75


Current Path : /var/www/u0635749/data/www/hobbyclick.ru/public/hobbyclick/bitrix/js/landing/node/
Upload File :
Current File : /var/www/u0635749/data/www/hobbyclick.ru/public/hobbyclick/bitrix/js/landing/node/text.min.js

(function(){"use strict";BX.namespace("BX.Landing");var t=BX.Landing.Utils.escapeText;var e=BX.Landing.Utils.Matchers.headerTag;var n=BX.Landing.Utils.changeTagName;var i=BX.Landing.Utils.textToPlaceholders;BX.Landing.Block.Node.Text=function(t){BX.Landing.Block.Node.apply(this,arguments);this.type="text";this.onClick=this.onClick.bind(this);this.onPaste=this.onPaste.bind(this);this.onDrop=this.onDrop.bind(this);this.onInput=this.onInput.bind(this);this.onMousedown=this.onMousedown.bind(this);this.onMouseup=this.onMouseup.bind(this);this.node.addEventListener("mousedown",this.onMousedown);this.node.addEventListener("click",this.onClick);this.node.addEventListener("paste",this.onPaste);this.node.addEventListener("drop",this.onDrop);this.node.addEventListener("input",this.onInput);this.node.addEventListener("keydown",this.onInput);document.addEventListener("mouseup",this.onMouseup)};BX.Landing.Block.Node.Text.currentNode=null;BX.Landing.Block.Node.Text.prototype={__proto__:BX.Landing.Block.Node.prototype,superClass:BX.Landing.Block.Node.prototype,constructor:BX.Landing.Block.Node.Text,onAllowInlineEdit:function(){this.node.setAttribute("title",t(BX.Landing.Loc.getMessage("LANDING_TITLE_OF_TEXT_NODE")))},onChange:function(t,e){this.superClass.onChange.call(this,arguments);if(!t){BX.Landing.UI.Panel.EditorPanel.getInstance().adjustPosition(this.node)}if(!e){BX.Landing.History.getInstance().push(new BX.Landing.History.Entry({block:this.getBlock().id,selector:this.selector,command:"editText",undo:this.lastValue,redo:this.getValue()}))}},onInput:function(t){clearTimeout(this.inputTimeout);var e=t.keyCode||t.which;if(!(e===90&&(top.window.navigator.userAgent.match(/win/i)?t.ctrlKey:t.metaKey))){this.inputTimeout=setTimeout(function(){if(this.lastValue!==this.getValue()){this.onChange(true);this.lastValue=this.getValue()}}.bind(this),400)}},onEscapePress:function(){if(this.isEditable()){if(this===BX.Landing.Block.Node.Text.currentNode){BX.Landing.UI.Panel.EditorPanel.getInstance().hide()}this.disableEdit()}},onDrop:function(t){t.preventDefault()},onPaste:function(t){t.preventDefault();if(t.clipboardData&&t.clipboardData.getData){var e=t.clipboardData.getData("text/plain");var n=BX.Text.encode(e);var i=n.replace(new RegExp("\n","g"),"<br>");document.execCommand("insertHTML",false,i)}else{var s=window.clipboardData.getData("text");document.execCommand("paste",true,BX.Text.encode(s))}this.onChange()},onDocumentClick:function(t){if(this.isEditable()&&!this.fromNode){BX.Landing.UI.Panel.EditorPanel.getInstance().hide();this.disableEdit()}this.fromNode=false},onMousedown:function(t){if(!this.manifest.group){this.fromNode=true;if(this.manifest.allowInlineEdit!==false&&BX.Landing.Main.getInstance().isControlsEnabled()){t.stopPropagation();this.enableEdit();BX.Landing.UI.Tool.ColorPicker.hideAll();BX.Landing.UI.Button.FontAction.hideAll()}requestAnimationFrame(function(){if(t.target.nodeName==="A"||t.target.parentElement.nodeName==="A"){var e=document.createRange();e.selectNode(t.target);window.getSelection().removeAllRanges();window.getSelection().addRange(e)}})}},onMouseup:function(){setTimeout(function(){this.fromNode=false}.bind(this),10)},onClick:function(t){t.stopPropagation();t.preventDefault();this.fromNode=false;if(t.target.nodeName==="A"||t.target.parentElement.nodeName==="A"){var e=document.createRange();e.selectNode(t.target);window.getSelection().removeAllRanges();window.getSelection().addRange(e)}},isEditable:function(){return this.node.isContentEditable},enableEdit:function(){if(!this.isEditable()&&!BX.Landing.UI.Panel.StylePanel.getInstance().isShown()){if(this!==BX.Landing.Block.Node.Text.currentNode&&BX.Landing.Block.Node.Text.currentNode!==null){BX.Landing.Block.Node.Text.currentNode.disableEdit()}BX.Landing.Block.Node.Text.currentNode=this;var t=[];t.push(this.getDesignButton());if(this.isHeader()){t.push(this.getChangeTagButton());this.getChangeTagButton().onChangeHandler=this.onChangeTag.bind(this)}if(!this.manifest.textOnly){BX.Landing.UI.Panel.EditorPanel.getInstance().show(this.node,null,t)}this.lastValue=this.getValue();this.node.contentEditable=true;this.node.setAttribute("title","")}},getDesignButton:function(){if(!this.designButton){this.designButton=new BX.Landing.UI.Button.Design("design",{html:BX.Landing.Loc.getMessage("LANDING_TITLE_OF_EDITOR_ACTION_DESIGN"),attrs:{title:BX.Landing.Loc.getMessage("LANDING_TITLE_OF_EDITOR_ACTION_DESIGN")},onClick:function(){BX.Landing.UI.Panel.EditorPanel.getInstance().hide();this.disableEdit();this.onDesignShow(this.manifest.code)}.bind(this)})}return this.designButton},disableEdit:function(){if(this.isEditable()){this.node.contentEditable=false;if(this.lastValue!==this.getValue()){this.onChange();this.lastValue=this.getValue()}if(this.isAllowInlineEdit()){this.node.setAttribute("title",t(BX.Landing.Loc.getMessage("LANDING_TITLE_OF_TEXT_NODE")))}}},getField:function(){if(!this.field){this.field=new BX.Landing.UI.Field.Text({selector:this.selector,title:this.manifest.name,content:this.node.innerHTML,textOnly:this.manifest.textOnly,bind:this.node});if(this.isHeader()){this.field.changeTagButton=this.getChangeTagButton()}}else{this.field.setValue(this.node.innerHTML);this.field.content=this.node.innerHTML}return this.field},setValue:function(t,e,n){this.preventSave(e);this.lastValue=this.isSavePrevented()?this.getValue():this.lastValue;this.node.innerHTML=t;this.onChange(false,n)},getValue:function(){return i(this.node.innerHTML)},isHeader:function(){return e.test(this.node.nodeName)},getChangeTagButton:function(){if(!this.changeTagButton){this.changeTagButton=new BX.Landing.UI.Button.ChangeTag("changeTag",{html:'<span class="landing-ui-icon-editor-'+this.node.nodeName.toLowerCase()+'"></span>',attrs:{title:BX.Landing.Loc.getMessage("LANDING_TITLE_OF_EDITOR_ACTION_CHANGE_TAG")},onChange:this.onChangeTag.bind(this)})}this.changeTagButton.insertAfter="unlink";this.changeTagButton.activateItem(this.node.nodeName);return this.changeTagButton},onChangeTag:function(t){this.node=n(this.node,t);this.node.addEventListener("mousedown",this.onMousedown);this.node.addEventListener("click",this.onClick);this.node.addEventListener("paste",this.onPaste);this.node.addEventListener("drop",this.onDrop);this.node.addEventListener("input",this.onInput);this.node.addEventListener("keydown",this.onInput);if(!this.getField().isEditable()){this.disableEdit();this.enableEdit()}var e={};e[this.selector]=t;this.changeOptionsHandler(e)}}})();
//# sourceMappingURL=text.map.js