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

Unified Diff: Source/devtools/front_end/main/Main.js

Issue 397303002: DevTools: [Elements] Implement shortcut-based node cut-copy-pasting (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reset clipboard if node on it is removed Created 6 years, 5 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
« no previous file with comments | « Source/devtools/front_end/inspectorStyle.css ('k') | Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/main/Main.js
diff --git a/Source/devtools/front_end/main/Main.js b/Source/devtools/front_end/main/Main.js
index 0a38ab266dcdba92d46e6d2e2313a4925f700a4b..42f85d7dc4dda2e627e183c5d6dd5423695131dd 100644
--- a/Source/devtools/front_end/main/Main.js
+++ b/Source/devtools/front_end/main/Main.js
@@ -528,14 +528,30 @@ WebInspector.Main.prototype = {
_documentCanCopy: function(event)
{
- if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorView.currentPanel()["handleCopyEvent"])
+ var panel = WebInspector.inspectorView.currentPanel();
+ if (panel && panel["handleCopyEvent"])
event.preventDefault();
},
_documentCopy: function(event)
{
- if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorView.currentPanel()["handleCopyEvent"])
- WebInspector.inspectorView.currentPanel()["handleCopyEvent"](event);
+ var panel = WebInspector.inspectorView.currentPanel();
+ if (panel && panel["handleCopyEvent"])
+ panel["handleCopyEvent"](event);
+ },
+
+ _documentCut: function(event)
+ {
+ var panel = WebInspector.inspectorView.currentPanel();
+ if (panel && panel["handleCutEvent"])
+ panel["handleCutEvent"](event);
+ },
+
+ _documentPaste: function(event)
+ {
+ var panel = WebInspector.inspectorView.currentPanel();
+ if (panel && panel["handlePasteEvent"])
+ panel["handlePasteEvent"](event);
},
_contextMenuEventFired: function(event)
@@ -549,6 +565,8 @@ WebInspector.Main.prototype = {
doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), false);
doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), true);
doc.addEventListener("copy", this._documentCopy.bind(this), false);
+ doc.addEventListener("cut", this._documentCut.bind(this), false);
+ doc.addEventListener("paste", this._documentPaste.bind(this), false);
doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
doc.addEventListener("click", this._documentClick.bind(this), false);
},
« no previous file with comments | « Source/devtools/front_end/inspectorStyle.css ('k') | Source/devtools/front_end/sdk/DOMModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698