mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(edit) isChanged: create -> beforeClose
This commit is contained in:
parent
1c3a117d02
commit
2a8d7be8e2
1 changed files with 5 additions and 15 deletions
|
|
@ -27,6 +27,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format;
|
|||
ConfigView = {
|
||||
beforeClose: function() {
|
||||
exec.ifExist(Menu, 'hide');
|
||||
isChanged(Edit.hide);
|
||||
},
|
||||
afterShow: function() {
|
||||
editor
|
||||
|
|
@ -115,14 +116,6 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format;
|
|||
DOM.setCurrentSize(size);
|
||||
});
|
||||
|
||||
editor.addCommand({
|
||||
name : 'hide',
|
||||
bindKey : { win: 'Esc', mac: 'Esc' },
|
||||
exec : function () {
|
||||
isChanged(Edit.hide);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
|
@ -216,16 +209,13 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format;
|
|||
MSG_CHANGED = msg;
|
||||
}
|
||||
|
||||
function isChanged(fn) {
|
||||
function isChanged() {
|
||||
var is = editor.isChanged();
|
||||
|
||||
if (!is)
|
||||
fn();
|
||||
else
|
||||
Dialog.confirm(TITLE, MSG_CHANGED).then(function() {
|
||||
is && Dialog.confirm(TITLE, MSG_CHANGED, {cancel: false})
|
||||
.then(function() {
|
||||
editor.save();
|
||||
fn();
|
||||
}).catch(fn);
|
||||
});
|
||||
}
|
||||
|
||||
init(callback);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue