in main menu, bind to history events
This commit is contained in:
parent
010e15b6b6
commit
8f5abd2cc1
2 changed files with 14 additions and 7 deletions
|
@ -401,12 +401,14 @@ pandora.ui.mainMenu = function() {
|
||||||
pandora.reloadList();
|
pandora.reloadList();
|
||||||
});
|
});
|
||||||
} else if (data.id == 'undo') {
|
} else if (data.id == 'undo') {
|
||||||
|
fromMenu = true;
|
||||||
pandora.undoHistory();
|
pandora.undoHistory();
|
||||||
} else if (data.id == 'redo') {
|
} else if (data.id == 'redo') {
|
||||||
|
fromMenu = true;
|
||||||
pandora.redoHistory();
|
pandora.redoHistory();
|
||||||
} else if (data.id == 'clearhistory') {
|
} else if (data.id == 'clearhistory') {
|
||||||
|
fromMenu = true;
|
||||||
pandora.history.clear();
|
pandora.history.clear();
|
||||||
that.replaceMenu('itemMenu', getItemMenu());
|
|
||||||
} else if (data.id == 'showsidebar') {
|
} else if (data.id == 'showsidebar') {
|
||||||
pandora.UI.set({showSidebar: !ui.showSidebar});
|
pandora.UI.set({showSidebar: !ui.showSidebar});
|
||||||
} else if (data.id == 'showinfo') {
|
} else if (data.id == 'showinfo') {
|
||||||
|
@ -741,11 +743,19 @@ pandora.ui.mainMenu = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
pandora.clipboard.bindEvent(function(data, event) {
|
pandora.clipboard.bindEvent(function(data, event) {
|
||||||
if (Ox.contains(['add', 'copy', 'paste'], event) && !fromMenu) {
|
|
||||||
that.highlightMenu('itemMenu');
|
|
||||||
}
|
|
||||||
if (Ox.contains(['add', 'copy', 'clear'], event)) {
|
if (Ox.contains(['add', 'copy', 'clear'], event)) {
|
||||||
that.replaceMenu('itemMenu', getItemMenu());
|
that.replaceMenu('itemMenu', getItemMenu());
|
||||||
|
if (Ox.contains(['add', 'copy'], event) && !fromMenu) {
|
||||||
|
that.highlightMenu('itemMenu');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fromMenu = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
pandora.history.bindEvent(function(data, event) {
|
||||||
|
that.replaceMenu('itemMenu', getItemMenu());
|
||||||
|
if (Ox.contains(['add', 'undo', 'redo'], event) && !fromMenu) {
|
||||||
|
that.highlightMenu('itemMenu');
|
||||||
}
|
}
|
||||||
fromMenu = false;
|
fromMenu = false;
|
||||||
});
|
});
|
||||||
|
|
|
@ -320,7 +320,6 @@ pandora.createLinks = function($element) {
|
||||||
targets: targets,
|
targets: targets,
|
||||||
text: text
|
text: text
|
||||||
});
|
});
|
||||||
pandora.$ui.mainMenu.replaceItemMenu();
|
|
||||||
callback(result);
|
callback(result);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -328,7 +327,6 @@ pandora.createLinks = function($element) {
|
||||||
pandora.redoHistory = function(callback) {
|
pandora.redoHistory = function(callback) {
|
||||||
var object = pandora.history.redo();
|
var object = pandora.history.redo();
|
||||||
if (object) {
|
if (object) {
|
||||||
pandora.$ui.mainMenu.replaceItemMenu();
|
|
||||||
if (object.action == 'copy' || object.action == 'paste') {
|
if (object.action == 'copy' || object.action == 'paste') {
|
||||||
addItems(object.items[0], object.targets[0], done);
|
addItems(object.items[0], object.targets[0], done);
|
||||||
} else if (object.action == 'cut' || object.action == 'delete') {
|
} else if (object.action == 'cut' || object.action == 'delete') {
|
||||||
|
@ -347,7 +345,6 @@ pandora.createLinks = function($element) {
|
||||||
pandora.undoHistory = function(callback) {
|
pandora.undoHistory = function(callback) {
|
||||||
var object = pandora.history.undo();
|
var object = pandora.history.undo();
|
||||||
if (object) {
|
if (object) {
|
||||||
pandora.$ui.mainMenu.replaceItemMenu();
|
|
||||||
if (object.action == 'copy' || object.action == 'paste') {
|
if (object.action == 'copy' || object.action == 'paste') {
|
||||||
removeItems(object.items[0], object.targets[0], done);
|
removeItems(object.items[0], object.targets[0], done);
|
||||||
} else if (object.action == 'cut' || object.action == 'delete') {
|
} else if (object.action == 'cut' || object.action == 'delete') {
|
||||||
|
|
Loading…
Reference in a new issue