Current File : /home/n742ef5/royalanteam.com/wp-content/plugins/js_composer/assets/js/dist/post-code-editor.min.js |
(t=>{_.isUndefined(window.vc)&&(window.vc={}),window.Vc_postSettingsEditor=Backbone.View.extend({$editor:!1,sel:"",mode:"",is_focused:!1,ace_enabled:!1,initialize:function(e){e&&0<e.length&&(this.sel=e),this.ace_enabled=!0},aceEnabled:function(){return this.ace_enabled&&window.ace&&window.ace.edit},setEditor:function(e){if(!this.missingUnfilteredHtml())return this.aceEnabled()?this.setEditorAce(e):this.setEditorTextarea(e),this.$editor},missingUnfilteredHtml:function(){return t("#"+this.sel).hasClass("wpb_missing_unfiltered_html")},focus:function(){var e;this.is_focused&&(this.aceEnabled()?(this.$editor.focus(),e=this.$editor.session.getLength(),this.$editor.gotoLine(e,this.$editor.session.getLine(e-1).length)):this.$editor.focus())},setEditorAce:function(o){this.$editor||(this.$editor=ace.edit(this.sel),this.$editor.getSession().setMode("ace/mode/"+this.mode),this.$editor.setTheme("ace/theme/chrome"),n=document.getElementById(this.sel),h=this.$editor,e=n.getAttribute("data-ace-location"),d=o,(r=this).$editor.session.on("change",function(){var s;"page-settings"===e&&(s=r.$editor.curOp&&r.$editor.curOp.command.name,clearTimeout(t),t=setTimeout(()=>{var e,t,i=h.getValue();d!==i&&(t=n.id,(e=window.vc.pagesettingseditor||{})[t]={editor:r.$editor},s&&(e[t].currentValue=i,e[t].previousValue=o),window.vc.pagesettingseditor=e,t=new CustomEvent("wpbAceEditorContentChanged",{detail:e}),s&&document.dispatchEvent(t),d=i)},1e3))}),this.$editor.session.setOption("wrap","free")),this.$editor.setValue(o),this.$editor.clearSelection(),this.is_focused&&this.$editor.focus();var n,h,e,t,d,r,i=this.$editor.getSession().getLength();return this.$editor.gotoLine(i,this.$editor.getSession().getLine(i-1).length),this.$editor},setEditorTextarea:function(e){return this.$editor||(this.$editor=t("<textarea></textarea>").css({width:"100%",height:"100%",minHeight:"300px"}),t("#"+this.sel).empty().append(this.$editor).css({overflowLeft:"hidden",width:"100%",height:"100%"})),this.$editor.val(e),this.is_focused&&this.$editor.focus(),this.$editor.parent().css({overflow:"auto"}),this.$editor},setSize:function(){var e=t(window).height()-380;this.aceEnabled()?t("#"+this.sel).css({height:e,minHeight:e}):(this.$editor.parent().css({height:e,minHeight:e}),this.$editor.css({height:"98%",width:"98%"}))},setSizeResizable:function(){var e=t("#"+this.sel);this.aceEnabled()?e.css({height:"30vh",minHeight:"30vh"}):(this.$editor.parent().css({height:"30vh",minHeight:"30vh"}),this.$editor.css({height:"98%",width:"98%"}))},getEditor:function(){return this.$editor},getValue:function(){return this.aceEnabled()?this.$editor.getValue():this.$editor.val()}})})(window.jQuery);