Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Unified Diff: chrome/browser/resources/md_bookmarks/command_manager.js

Issue 2901463002: [MD Bookmarks] Add undo/redo functionality to MD Bookmarks. (Closed)
Patch Set: fix DEPS Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_bookmarks/command_manager.js
diff --git a/chrome/browser/resources/md_bookmarks/command_manager.js b/chrome/browser/resources/md_bookmarks/command_manager.js
index 7dbf8d0761bdc5483eb2c99414124e2efad14d2a..aef8c5ae9f941b70e76dec863e453070faf347f5 100644
--- a/chrome/browser/resources/md_bookmarks/command_manager.js
+++ b/chrome/browser/resources/md_bookmarks/command_manager.js
@@ -58,6 +58,9 @@ cr.define('bookmarks', function() {
cr.isMac ? 'meta+enter' : 'ctrl+enter';
this.shortcuts_[Command.OPEN_NEW_WINDOW] = 'shift+enter';
this.shortcuts_[Command.OPEN] = cr.isMac ? 'meta+down' : 'enter';
+ this.shortcuts_[Command.UNDO] = cr.isMac ? 'meta+z' : 'ctrl+z';
+ this.shortcuts_[Command.REDO] =
+ cr.isMac ? 'meta+shift+z' : 'ctrl+y ctrl+shift+z';
},
detached: function() {
@@ -107,6 +110,9 @@ cr.define('bookmarks', function() {
switch (command) {
case Command.OPEN:
return itemIds.size > 0;
+ case Command.UNDO:
+ case Command.REDO:
+ return true;
default:
return this.isCommandVisible_(command, itemIds) &&
this.isCommandEnabled_(command, itemIds);
@@ -178,6 +184,12 @@ cr.define('bookmarks', function() {
// TODO(jiaxi): Add toast later.
});
break;
+ case Command.UNDO:
+ chrome.bookmarkManagerPrivate.undo();
+ break;
+ case Command.REDO:
+ chrome.bookmarkManagerPrivate.redo();
+ break;
case Command.OPEN_NEW_TAB:
case Command.OPEN_NEW_WINDOW:
case Command.OPEN_INCOGNITO:
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model_factory.cc ('k') | chrome/browser/resources/md_bookmarks/constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698