20 lines
8.9 KiB
JavaScript
20 lines
8.9 KiB
JavaScript
//>>built
|
|
define("xace/views/_Actions","dcl/dcl xide/utils xide/types xide/types/Types xaction/types xaction/ActionProvider xace/views/ACEEditor xaction/Toolbar xaction/DefaultActions dojo/Deferred xace/formatters".split(" "),function(p,m,f,h,w,l,r,t,n,u,q){h=f.ACTION;var k=f.VIEW_SPLIT_MODE;h=[h.RELOAD,h.SAVE,h.FIND,h.TOOLBAR,"Editor/Keyboard","View/Increase Font Size","View/Decrease Font Size","View/Themes","Help/Editor Shortcuts","Editor/Snippets","Editor/Console","Editor/Settings",h.FULLSCREEN,"View/Layout",
|
|
"Edit/Format"];l=p([r,t.dcl,l.dcl],{permissions:h,_searchBoxOpen:!1,onSingleView:function(){},setSplitMode:function(a){this.splitMode=a;if(!this.doSplit)if("Diff"==a)this.doDiff();else{var b=a==k.SPLIT_HORIZONTAL||a==k.SPLIT_VERTICAL,d=this.getEditor(),c=this.split;b?(b=1==c.getSplits(),c.setOrientation(a==k.SPLIT_HORIZONTAL?c.BELOW:c.BESIDE),c.setSplits(2),b&&(a=c.getEditor(0).session,c.setSession(a,1).name=a.name,d=d.getOptions(),c.getEditor(1).setOptions(d))):(c.setSplits(1),this.onSingleView())}},
|
|
onMaximized:function(a){var b=this.getParent();!1===a&&b&&b.resize&&b.resize();var d=this.getToolbar();d&&(a?$(d.domNode).addClass("bg-opaque"):$(d.domNode).removeClass("bg-opaque"));!1===a&&(this.resize(),b&&m.resizeTo(this,b,!0,!0),this.publish(f.EVENTS.ON_VIEW_MAXIMIZE_END));this.getEditor().focus()},maximize:function(){var a=this.domNode,b=$(a);this.getToolbar();if(this._isMaximized)this._isMaximized=!1,b.removeClass("AceEditorPaneFullScreen"),this._lastParent.appendChild(a),m.destroy(this._maximizeContainer);
|
|
else{this.publish(f.EVENTS.ON_VIEW_MAXIMIZE_START);this._isMaximized=!0;var b=$(this.domNode.ownerDocument),d=$("body")[0],c=m.create("div",{className:"ACEContainer bg-opaque",style:"z-index:300;height:100%;width:100%"});this._maximizeContainer=c;d.appendChild(c);$(a).addClass("AceEditorPaneFullScreen");$(a).css("width",b.width());$(a).css("height",b.height());this.resize();this._lastParent=a.parentNode;c.appendChild(a);$(c).addClass("bg-opaque");$(c).css("width",b.width());$(c).css("height",b.height());
|
|
$(c).css({position:"absolute",left:"0px",top:"0px",border:"none medium",width:"100%",height:"100%"})}this.onMaximized(this._isMaximized);return!0},save:function(a){var b=this.get("value"),d=this.saveContent(this.get("value"),a),c=this;this._emit(f.EVENTS.ON_FILE_CONTENT_CHANGED,{content:b,item:a});setTimeout(function(){var a=c.getEditor();a&&a.focus()},600);return d},reload:function(){var a=this,b=new u;this.getContent(this.item,function(d){a.lastSavedContent=d;a.set("value",d);b.resolve(d)},function(a){logError(a,
|
|
"error loading content from file");b.reject(a)});return b},runAction:function(a){a=this.getAction(a);if(!a)return!1;var b=this,d=a.command,c=f.ACTION,e=this.getEditor(),g=this.editorSession;-1!=d.indexOf("View/Layout")&&b.setSplitMode(a.option,null);switch(d){case c.RELOAD:return this.reload();case "View/Increase Font Size":return e.setFontSize(e.getFontSize()+1),!0;case "View/Decrease Font Size":return e.setFontSize(e.getFontSize()-1),!0;case c.FULLSCREEN:return this.maximize();case "Help/Editor Shortcuts":b.showHelp();
|
|
break;case c.SAVE:b.save(this.item);break;case c.FIND:var h=function(a){b._searchBoxOpen?(a.hide(),b._searchBoxOpen=!1):(a.show(e.session.getTextRange(),null),b._searchBoxOpen=!0)},g=ace.require("ace/lib/net"),d=this.getWebRoot();(c=e.searchBox)?h(c):g.loadScript(d+"/xfile/ext/ace/ext-searchbox.js",function(a){a=ace.require("ace/ext/searchbox");h(new a.SearchBox(e))});return!0}if(-1!==d.indexOf("View/Themes")){b.set("theme",a.theme);if(c=a.getParent?a.getParent():null)c=c.getChildren(),_.each(c,function(a){a.set("icon",
|
|
a._oldIcon)});a.set("icon","fa fa-check")}-1!==d.indexOf("Edit/Format")&&e&&(c=q.format(e,a.formatter),b.set("value",c));if(-1!==d.indexOf("Editor/Settings")){var d=a.option,c=e.getOption(a.option),v=_.isBoolean(c);if("highlightActive"===d){e.setHighlightActiveLine(!e.getHighlightActiveLine());return}if(v)e.setOption(a.option,!c);else{if("wordWrap"===d)return g=g.getUseWrapMode(),this.set("wordWrap",!g),!0;"off"===c||"on"===c?e.setOption(d,"off"===c?"on":"off"):e.setOption(a.option,!1)}return!0}return this.inherited(arguments)},
|
|
getEditorActions:function(a){function b(a,b,e,f,g,h,k,l){g=g=g||{};a=c.createAction(m.mixin({label:a,command:b||"Editor/Settings/"+a||"Editor/Settings/"+a,icon:e||"fa-cogs",group:h||"Settings",mixin:m.mixin({addPermission:!0,option:f,actionType:k,owner:c},g)},l));d.push(a);return a}var d=[],c=this,e=f.ACTION,g=f.ACTION_ICON;d.push(this.createAction({label:"Save",command:e.SAVE,icon:g.SAVE,keycombo:"ctrl s",group:"File"}));d.push(this.createAction({label:"Find",command:e.FIND,icon:g.SEARCH,keycombo:"ctrl f",
|
|
group:"Search"}));d.push(this.createAction({label:"Fullscreen",command:e.FULLSCREEN,icon:g.MAXIMIZE,keycombo:"ctrl f11",group:"View"}));d.push(this.createAction({label:"Increase Fontsize",command:"View/Increase Font Size",icon:"fa-text-height",group:"View"}));d.push(this.createAction({label:"Decrease Fontsize",command:"View/Decrease Font Size",icon:"fa-text-height",group:"View"}));n.hasAction(a,"View/Themes")&&(d.push(this.createAction({label:"Themes",command:"View/Themes",icon:"fa-paint-brush",group:"View",
|
|
mixin:{closeOnClick:!1,value:this.defaultPrefenceTheme},onCreate:function(a){var b=c.getDefaultOptions();a.set("value",b.theme)}})),c._addThemes&&c._addThemes(d));d.push(this.createAction({label:"Help",command:"Help/Editor Shortcuts",icon:"fa-question",keycombo:"f1"}));d.push(this.createAction({label:"Settings",command:"Editor/Settings",icon:"fa-cogs",group:"Settings"}));e={onCreate:function(a){var b=c.getOptionsMixed()[this.option];null!==b&&a.set("value",b)},onChange:function(a,b){this.value=b;
|
|
c.runAction(this)}};b("Show Gutters",null,null,"showGutter",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Show Print Margin",null,null,"showPrintMargin",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Display Intend Guides",null,null,"displayIndentGuides",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Show Line Numbers",null,null,"showLineNumbers",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Show Indivisibles",null,null,"showInvisibles",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Use Soft Tabs",null,null,"useSoftTabs",
|
|
null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Use Elastic Tab Stops",null,null,"useElasticTabstops",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Animated Scroll",null,null,"animatedScroll",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Word Wrap",null,null,"wordWrap",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);b("Highlight Active Line",null,null,"highlightActive",null,null,f.ACTION_TYPE.MULTI_TOGGLE,e);if(n.hasAction(a,"Edit/Format")){d.push(this.createAction({label:"Format",command:"Edit/Format",icon:"fa-indent",
|
|
group:"Edit"}));var e=q.modes,g=function(a,b,e){a=c.createAction({label:a,command:"Edit/Format/"+a,icon:"fa-indent",group:"Edit",mixin:{addPermission:!0,formatter:e},onCreate:function(a){}});d.push(a)},h;for(h in e)d.push(g(e[h],"",h))}n.hasAction(a,"View/Layout")&&(d.push(this.createAction({label:"Split",command:"View/Layout",icon:"fa-columns",group:"View"})),d.push(b("None","View/Layout/None","fa-columns",k.SOURCE,null,"View",f.ACTION_TYPE.SINGLE_TOGGLE)),d.push(b("Horizontal","View/Layout/Horizontal",
|
|
"layoutIcon-horizontalSplit",k.SPLIT_HORIZONTAL,null,"View",f.ACTION_TYPE.SINGLE_TOGGLE)),d.push(b("Vertical","View/Layout/Vertical","layoutIcon-layout293",k.SPLIT_VERTICAL,null,"View",f.ACTION_TYPE.SINGLE_TOGGLE)));return d},_addThemes:function(a){for(var b=this.getThemeData(),d=this,c=function(a,b,c){return d.createAction({label:a,command:"View/Themes/"+a,group:"View",icon:b,mixin:{addPermission:!0,value:c,theme:c,closeOnClick:!1},onCreate:function(a){a._oldIcon=b;a.set("value",c);a.actionType=
|
|
f.ACTION_TYPE.SINGLE_TOGGLE}})},e=0;e<b.length;e++){var g=b[e],h=g[1]||g[0].replace(/ /g,"_").toLowerCase(),g=c(g[0]," ",h);a.push(g)}},showHelp:function(a){a=a||this.getEditor();ace.require("ace/config").loadModule("ace/ext/keybinding_menu",function(b){b.init(a);a.showKeyboardShortcuts()})},getThemeData:function(){return[["Chrome"],["Clouds"],["Crimson Editor"],["Dawn"],["Dreamweaver"],["Eclipse"],["GitHub"],["Solarized Light"],["TextMate"],["Tomorrow"],["XCode"],["Kuroir"],["KatzenMilch"],["Ambiance",
|
|
"ambiance","dark"],["Day","cloud9_day"],["Night","cloud9_night"],["Chaos","chaos","dark"],["Midnight","clouds_midnight","dark"],["Cobalt","cobalt","dark"],["idle Fingers","idle_fingers","dark"],["krTheme","kr_theme","dark"],["Merbivore","merbivore","dark"],["Merbivore-Soft","merbivore_soft","dark"],["Mono Industrial","mono_industrial","dark"],["Monokai","monokai","dark"],["Pastel on dark","pastel_on_dark","dark"],["Solarized Dark","solarized_dark","dark"],["Terminal","terminal","dark"],["Tomorrow-Night",
|
|
"tomorrow_night","dark"],["Tomorrow-Night-Blue","tomorrow_night_blue","dark"],["Tomorrow-Night-Bright","tomorrow_night_bright","dark"],["Tomorrow-Night-80s","tomorrow_night_eighties","dark"],["Twilight","twilight","dark"],["Vibrant Ink","vibrant_ink","dark"]]}});l.DEFAULT_PERMISSIONS=h;p.chainAfter("runAction",l);return l});
|
|
//# sourceMappingURL=_Actions.js.map
|