cms.registerWidgetHandler("code",new function(){InlineWidget.apply(this,arguments);this.getName=function(){return"code"};this.getIcon=function(){return"fa-code"};this.getToolbarButtons=function(){var a=this;return{options:{icon:"fa-code",click:function(c,b){a.openOptionsForm(c,b)}}}};this.getOptionsFormSettings=function(){var a=this;return{width:650,onCreate:function(b){cms.loadCodeEditor(function(){$(".f-html textarea",b).data("editor",CodeMirror.fromTextArea($(".f-html textarea",b).get(0),{mode:{name:"xml",htmlMode:true},theme:"material"}));$(".f-js textarea",b).data("editor",CodeMirror.fromTextArea($(".f-js textarea",b).get(0),{mode:"javascript",theme:"material"}));$(".f-css textarea",b).data("editor",CodeMirror.fromTextArea($(".f-css textarea",b).get(0),{mode:"css",theme:"material"}))})},onBeforeSubmit:function(b){$(".f-html textarea",b).val($(".f-html textarea",b).data("editor").getValue());$(".f-js textarea",b).val($(".f-js textarea",b).data("editor").getValue());$(".f-css textarea",b).val($(".f-css textarea",b).data("editor").getValue())},onShow:function(b){if(!cms.isCodeEditorLoaded){return}$("textarea",b).each(function(){var c=$(this);var d=$(this).data("editor");if(!d){return}var e=c.val();d.setValue(e)})},onAfterShow:function(b){$(".CodeMirror:visible",b).each(function(c,d){d.CodeMirror.refresh()})},onTabChange:function(b){$(".CodeMirror:visible",b).each(function(c,d){d.CodeMirror.refresh()})}}};this.onCreateWidget=function(a,b){this.openOptionsForm(b,a.id);return a};this.applyOptions=function(c,a,b){console.log("apply");var d=this.dom(c);d.empty();if(a.html){$("<span/>").addClass("code-label").html('<i class="fa fa-code"></i> HTML').appendTo(d)}if(a.js){$("<span/>").addClass("code-label").html('<i class="fa fa-code"></i> JS').appendTo(d)}if(a.css){$("<span/>").addClass("code-label").html('<i class="fa fa-code"></i> CSS').appendTo(d)}if(a.php){$("<span/>").addClass("code-label").html('<i class="fa fa-code"></i> PHP').appendTo(d)}}});