mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(edit) addEventListener -> addOnce
This commit is contained in:
parent
ca1f7c6a26
commit
0ce42cfc9d
1 changed files with 39 additions and 43 deletions
|
|
@ -37,7 +37,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
|
|||
|
||||
element = createElement();
|
||||
|
||||
element.addEventListener('contextmenu', setMenu);
|
||||
DOM.Events.addOnce('contextmenu', element, setMenu);
|
||||
|
||||
exec.series([
|
||||
CloudCmd.View,
|
||||
|
|
@ -164,51 +164,47 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
|
|||
|
||||
event.preventDefault();
|
||||
|
||||
if (!Menu) {
|
||||
DOM.loadRemote('menu', function(error) {
|
||||
var options = {
|
||||
beforeShow: function(params) {
|
||||
params.x -= 18;
|
||||
params.y -= 27;
|
||||
},
|
||||
afterClick: function() {
|
||||
edward.focus();
|
||||
}
|
||||
},
|
||||
menuData = {
|
||||
'Save Ctrl+S' : function() {
|
||||
edward.save();
|
||||
!Menu && DOM.loadRemote('menu', function(error) {
|
||||
var options = {
|
||||
beforeShow: function(params) {
|
||||
params.x -= 18;
|
||||
params.y -= 27;
|
||||
},
|
||||
'Go To Line Ctrl+L' : function() {
|
||||
edward.goToLine();
|
||||
},
|
||||
'Select All Ctrl+A' : function() {
|
||||
edward.selectAll();
|
||||
},
|
||||
'Delete Del' : function() {
|
||||
edward.remove('right');
|
||||
},
|
||||
'Beautify Ctrl+B' : function() {
|
||||
edward.beautify();
|
||||
},
|
||||
'Minify Ctrl+M' : function() {
|
||||
edward.minify();
|
||||
},
|
||||
'Close Esc' : function() {
|
||||
Edit.hide();
|
||||
afterClick: function() {
|
||||
edward.focus();
|
||||
}
|
||||
};
|
||||
|
||||
if (error) {
|
||||
Dialog.alert(error);
|
||||
} else if (!Menu && MenuIO) {
|
||||
Menu = new MenuIO(Element, options, menuData);
|
||||
Menu.show(position.x, position.y);
|
||||
|
||||
Element.removeEventListener('contextmenu', setMenu);
|
||||
},
|
||||
menuData = {
|
||||
'Save Ctrl+S' : function() {
|
||||
edward.save();
|
||||
},
|
||||
'Go To Line Ctrl+L' : function() {
|
||||
edward.goToLine();
|
||||
},
|
||||
'Select All Ctrl+A' : function() {
|
||||
edward.selectAll();
|
||||
},
|
||||
'Delete Del' : function() {
|
||||
edward.remove('right');
|
||||
},
|
||||
'Beautify Ctrl+B' : function() {
|
||||
edward.beautify();
|
||||
},
|
||||
'Minify Ctrl+M' : function() {
|
||||
edward.minify();
|
||||
},
|
||||
'Close Esc' : function() {
|
||||
Edit.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (error) {
|
||||
Dialog.alert(error);
|
||||
} else if (!Menu && MenuIO) {
|
||||
Menu = new MenuIO(Element, options, menuData);
|
||||
Menu.show(position.x, position.y);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function setMsgChanged(name) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue