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

Unified Diff: Source/devtools/front_end/elements/ElementsPanel.js

Issue 768773002: Revert of DevTools: Migrate elements panel undo/redo shortcuts to declarative actions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | Source/devtools/front_end/elements/module.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/elements/ElementsPanel.js
diff --git a/Source/devtools/front_end/elements/ElementsPanel.js b/Source/devtools/front_end/elements/ElementsPanel.js
index fcebcf18380f10802525ccc3618effddca4d1f9a..a86493dae54c2e2a4adf8ee3ee0f29bcde80dcb9 100644
--- a/Source/devtools/front_end/elements/ElementsPanel.js
+++ b/Source/devtools/front_end/elements/ElementsPanel.js
@@ -204,7 +204,7 @@
else
treeOutline.domModel().requestDocument();
}
- WebInspector.context.setFlavor(WebInspector.ElementsPanel, this);
+
},
willHide: function()
@@ -218,7 +218,6 @@
}
this._popoverHelper.hidePopover();
WebInspector.Panel.prototype.willHide.call(this);
- WebInspector.context.setFlavor(WebInspector.ElementsPanel, null);
},
onResize: function()
@@ -690,30 +689,44 @@
this.sidebarPanes.platformFonts.setNode(selectedDOMNode);
},
- _undo: function()
- {
- var treeOutline = this._treeOutlineForNode(this._lastValidSelectedNode);
- if (!treeOutline || WebInspector.isEditing())
- return;
- treeOutline.target().domModel.undo(this._updateSidebars.bind(this));
- },
-
- _redo: function()
- {
- var treeOutline = this._treeOutlineForNode(this._lastValidSelectedNode);
- if (!treeOutline || WebInspector.isEditing())
- return;
- treeOutline.target().domModel.redo(this._updateSidebars.bind(this));
- },
-
/**
* @param {!KeyboardEvent} event
*/
handleShortcut: function(event)
{
- var treeOutline = this._treeOutlineForNode(this._lastValidSelectedNode);
+ /**
+ * @param {!WebInspector.ElementsTreeOutline} treeOutline
+ * @this {WebInspector.ElementsPanel}
+ */
+ function handleUndoRedo(treeOutline)
+ {
+ if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && event.keyIdentifier === "U+005A") { // Z key
+ treeOutline.target().domModel.undo(this._updateSidebars.bind(this));
+ event.handled = true;
+ return;
+ }
+
+ var isRedoKey = WebInspector.isMac() ? event.metaKey && event.shiftKey && event.keyIdentifier === "U+005A" : // Z key
+ event.ctrlKey && event.keyIdentifier === "U+0059"; // Y key
+ if (isRedoKey) {
+ treeOutline.target().domModel.redo(this._updateSidebars.bind(this));
+ event.handled = true;
+ }
+ }
+
+ var treeOutline = null;
+ for (var i = 0; i < this._treeOutlines.length; ++i) {
+ if (this._treeOutlines[i].selectedDOMNode() === this._lastValidSelectedNode)
+ treeOutline = this._treeOutlines[i];
+ }
if (!treeOutline)
return;
+
+ if (!treeOutline.editing()) {
+ handleUndoRedo.call(this, treeOutline);
+ if (event.handled)
+ return;
+ }
treeOutline.handleShortcut(event);
if (event.handled)
@@ -1098,44 +1111,3 @@
return WebInspector.ElementsPanel.instance();
}
}
-
-/**
- * @constructor
- * @implements {WebInspector.ActionDelegate}
- */
-WebInspector.ElementsPanel.UndoActionDelegate = function()
-{
-}
-
-WebInspector.ElementsPanel.UndoActionDelegate.prototype = {
- /**
- * @return {boolean}
- */
- handleAction: function()
- {
- var panel = WebInspector.ElementsPanel.instance();
- panel._undo();
- return true;
- }
-}
-
-/**
- * @constructor
- * @implements {WebInspector.ActionDelegate}
- */
-WebInspector.ElementsPanel.RedoActionDelegate = function()
-{
-}
-
-WebInspector.ElementsPanel.RedoActionDelegate.prototype = {
- /**
- * @return {boolean}
- */
- handleAction: function()
- {
- var panel = WebInspector.ElementsPanel.instance();
- panel._redo();
- return true;
- }
-}
-
« no previous file with comments | « no previous file | Source/devtools/front_end/elements/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698