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

Side by Side 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, 4 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 event.consume(true); 521 event.consume(true);
522 return; 522 return;
523 } 523 }
524 } 524 }
525 525
526 WebInspector.shortcutRegistry.handleShortcut(event); 526 WebInspector.shortcutRegistry.handleShortcut(event);
527 }, 527 },
528 528
529 _documentCanCopy: function(event) 529 _documentCanCopy: function(event)
530 { 530 {
531 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel()["handleCopyEvent"]) 531 var panel = WebInspector.inspectorView.currentPanel();
532 if (panel && panel["handleCopyEvent"])
532 event.preventDefault(); 533 event.preventDefault();
533 }, 534 },
534 535
535 _documentCopy: function(event) 536 _documentCopy: function(event)
536 { 537 {
537 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorV iew.currentPanel()["handleCopyEvent"]) 538 var panel = WebInspector.inspectorView.currentPanel();
538 WebInspector.inspectorView.currentPanel()["handleCopyEvent"](event); 539 if (panel && panel["handleCopyEvent"])
540 panel["handleCopyEvent"](event);
541 },
542
543 _documentCut: function(event)
544 {
545 var panel = WebInspector.inspectorView.currentPanel();
546 if (panel && panel["handleCutEvent"])
547 panel["handleCutEvent"](event);
548 },
549
550 _documentPaste: function(event)
551 {
552 var panel = WebInspector.inspectorView.currentPanel();
553 if (panel && panel["handlePasteEvent"])
554 panel["handlePasteEvent"](event);
539 }, 555 },
540 556
541 _contextMenuEventFired: function(event) 557 _contextMenuEventFired: function(event)
542 { 558 {
543 if (event.handled || event.target.classList.contains("popup-glasspane")) 559 if (event.handled || event.target.classList.contains("popup-glasspane"))
544 event.preventDefault(); 560 event.preventDefault();
545 }, 561 },
546 562
547 _addMainEventListeners: function(doc) 563 _addMainEventListeners: function(doc)
548 { 564 {
549 doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), fa lse); 565 doc.addEventListener("keydown", this._postDocumentKeyDown.bind(this), fa lse);
550 doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), tru e); 566 doc.addEventListener("beforecopy", this._documentCanCopy.bind(this), tru e);
551 doc.addEventListener("copy", this._documentCopy.bind(this), false); 567 doc.addEventListener("copy", this._documentCopy.bind(this), false);
568 doc.addEventListener("cut", this._documentCut.bind(this), false);
569 doc.addEventListener("paste", this._documentPaste.bind(this), false);
552 doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(thi s), true); 570 doc.addEventListener("contextmenu", this._contextMenuEventFired.bind(thi s), true);
553 doc.addEventListener("click", this._documentClick.bind(this), false); 571 doc.addEventListener("click", this._documentClick.bind(this), false);
554 }, 572 },
555 573
556 /** 574 /**
557 * @override 575 * @override
558 * @param {!RuntimeAgent.RemoteObject} payload 576 * @param {!RuntimeAgent.RemoteObject} payload
559 * @param {!Object=} hints 577 * @param {!Object=} hints
560 */ 578 */
561 inspect: function(payload, hints) 579 inspect: function(payload, hints)
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 916
899 WebInspector.Main.InspectedNodeRevealer.prototype = { 917 WebInspector.Main.InspectedNodeRevealer.prototype = {
900 /** 918 /**
901 * @param {!WebInspector.Event} event 919 * @param {!WebInspector.Event} event
902 */ 920 */
903 _inspectNode: function(event) 921 _inspectNode: function(event)
904 { 922 {
905 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data)); 923 WebInspector.Revealer.reveal(/** @type {!WebInspector.DOMNode} */ (event .data));
906 } 924 }
907 } 925 }
OLDNEW
« 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