mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 01:47:35 +00:00
feature(edit) mv menu back from edward
This commit is contained in:
parent
897173b721
commit
b8d4404aac
2 changed files with 52 additions and 49 deletions
|
|
@ -1,4 +1,4 @@
|
|||
var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, Format, edward;
|
||||
var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, Format, MenuIO, edward;
|
||||
(function(CloudCmd, Util, DOM, CloudFunc) {
|
||||
'use strict';
|
||||
|
||||
|
|
@ -20,6 +20,8 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, Format, edward;
|
|||
Emmet,
|
||||
Modelist,
|
||||
|
||||
Menu,
|
||||
|
||||
RESTful = DOM.RESTful,
|
||||
Dialog = DOM.Dialog,
|
||||
Images = DOM.Images,
|
||||
|
|
@ -40,6 +42,8 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, Format, edward;
|
|||
function init(callback) {
|
||||
var element = createElement();
|
||||
|
||||
element.addEventListener('contextmenu', setMenu);
|
||||
|
||||
exec.series([
|
||||
CloudCmd.View,
|
||||
function(callback) {
|
||||
|
|
@ -522,6 +526,53 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, Format, edward;
|
|||
}
|
||||
}
|
||||
|
||||
function setMenu() {
|
||||
if (!Menu) {
|
||||
DOM.loadRemote('menu', function(error) {
|
||||
var position = CloudCmd.MousePosition,
|
||||
options = {
|
||||
beforeShow: function(params) {
|
||||
params.x -= 18;
|
||||
params.y -= 27;
|
||||
},
|
||||
afterClick: function() {
|
||||
edward.focus();
|
||||
}
|
||||
},
|
||||
menuData = {
|
||||
'Save Ctrl+S' : function() {
|
||||
CloudCmd.Edit.save();
|
||||
},
|
||||
'Go To Line Ctrl+G' : function() {
|
||||
CloudCmd.Edit.goToLine();
|
||||
},
|
||||
'Select All Ctrl+A' : function() {
|
||||
edward.selectAll();
|
||||
},
|
||||
'Delete Del' : function() {
|
||||
edward.remove('right');
|
||||
},
|
||||
'Beautify Ctrl+B' : function() {
|
||||
CloudCmd.Edit.beautify();
|
||||
},
|
||||
'Minify Ctrl+M' : function() {
|
||||
CloudCmd.Edit.minify();
|
||||
},
|
||||
'Close Esc' : CloudCmd.Edit.hide
|
||||
};
|
||||
|
||||
if (error) {
|
||||
alert(error);
|
||||
} else if (!Menu) {
|
||||
Menu = new MenuIO(Element, options, menuData);
|
||||
Menu.show(position.x, position.y);
|
||||
|
||||
Element.removeEventListener('contextmenu', setMenu);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Edit.beautify = function() {
|
||||
readWithFlag('beautify');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ var join, ace, Util, DOM, MenuIO, CloudCmd;
|
|||
Element = el || document.body;
|
||||
|
||||
Element.addEventListener('drop', onDrop);
|
||||
Element.addEventListener('contextmenu', setMenu);
|
||||
Element.addEventListener('dragover', function(event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
|
@ -175,53 +174,6 @@ var join, ace, Util, DOM, MenuIO, CloudCmd;
|
|||
});
|
||||
}
|
||||
|
||||
function setMenu() {
|
||||
if (!Menu) {
|
||||
loadRemote('menu', function(error) {
|
||||
var position = CloudCmd.MousePosition,
|
||||
options = {
|
||||
beforeShow: function(params) {
|
||||
params.x -= 18;
|
||||
params.y -= 27;
|
||||
},
|
||||
afterClick: function() {
|
||||
edward.focus();
|
||||
}
|
||||
},
|
||||
menuData = {
|
||||
'Save Ctrl+S' : function() {
|
||||
CloudCmd.Edit.save();
|
||||
},
|
||||
'Go To Line Ctrl+G' : function() {
|
||||
CloudCmd.Edit.goToLine();
|
||||
},
|
||||
'Select All Ctrl+A' : function() {
|
||||
edward.selectAll();
|
||||
},
|
||||
'Delete Del' : function() {
|
||||
edward.remove('right');
|
||||
},
|
||||
'Beautify Ctrl+B' : function() {
|
||||
CloudCmd.Edit.beautify();
|
||||
},
|
||||
'Minify Ctrl+M' : function() {
|
||||
CloudCmd.Edit.minify();
|
||||
},
|
||||
'Close Esc' : CloudCmd.Edit.hide
|
||||
};
|
||||
|
||||
if (error) {
|
||||
alert(error);
|
||||
} else if (!Menu) {
|
||||
Menu = new MenuIO(Element, options, menuData);
|
||||
Menu.show(position.x, position.y);
|
||||
|
||||
Element.removeEventListener('contextmenu', setMenu);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function loadFiles(callback) {
|
||||
var css = '/css/edward.css',
|
||||
dir = '/modules/ace-builds/src-noconflict/',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue