mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-24 00:21:18 +00:00
refactor(edit) init
This commit is contained in:
parent
ab2a064544
commit
572e000b6c
1 changed files with 17 additions and 19 deletions
|
|
@ -22,7 +22,20 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
Events = DOM.Events,
|
||||
Dialog = DOM.Dialog,
|
||||
Images = DOM.Images,
|
||||
Element, JSHintConfig, EditConfig;
|
||||
Element, JSHintConfig, EditConfig,
|
||||
ConfigView = {
|
||||
beforeClose: function() {
|
||||
isChanged();
|
||||
|
||||
if (Menu)
|
||||
Menu.hide();
|
||||
},
|
||||
afterShow: function() {
|
||||
Ace.clearSelection();
|
||||
Ace.moveCursorTo(0, 0);
|
||||
Ace.focus();
|
||||
}
|
||||
};
|
||||
|
||||
function init() {
|
||||
Loading = true;
|
||||
|
|
@ -38,12 +51,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
onMenu,
|
||||
isStr = Util.isString(value),
|
||||
name = Info.name,
|
||||
isDir = Info.isDir,
|
||||
focus = function() {
|
||||
Ace.clearSelection();
|
||||
Ace.moveCursorTo(0, 0);
|
||||
Ace.focus();
|
||||
};
|
||||
isDir = Info.isDir;
|
||||
|
||||
if (!Loading) {
|
||||
Images.showLoad();
|
||||
|
|
@ -66,9 +74,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
Events.addOnce('contextmenu', Element, onMenu)
|
||||
.add(Element, {
|
||||
drop : onDrop,
|
||||
dragover : function(event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
dragover : DOM.preventDefault
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -93,15 +99,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip, MenuI
|
|||
var UndoManager = ace.require('ace/undomanager').UndoManager;
|
||||
|
||||
Ace.setValue(Value);
|
||||
CloudCmd.View.show(Element, {
|
||||
beforeClose: function() {
|
||||
isChanged();
|
||||
|
||||
if (Menu)
|
||||
Menu.hide();
|
||||
},
|
||||
afterShow: focus
|
||||
});
|
||||
CloudCmd.View.show(Element, ConfigView);
|
||||
|
||||
Session.setUndoManager(new UndoManager());
|
||||
}, function(callback) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue