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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js

Issue 1844623002: [DevTools] Fixed context menu breakage when edit dom in console (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 contextMenu.appendItem(WebInspector.UIString.capitalize("Edit ^text" ), this._startEditingTextNode.bind(this, textNode)); 531 contextMenu.appendItem(WebInspector.UIString.capitalize("Edit ^text" ), this._startEditingTextNode.bind(this, textNode));
532 this.populateNodeContextMenu(contextMenu); 532 this.populateNodeContextMenu(contextMenu);
533 }, 533 },
534 534
535 populateNodeContextMenu: function(contextMenu) 535 populateNodeContextMenu: function(contextMenu)
536 { 536 {
537 // Add free-form node-related actions. 537 // Add free-form node-related actions.
538 var openTagElement = this._node[this.treeOutline.treeElementSymbol()] || this; 538 var openTagElement = this._node[this.treeOutline.treeElementSymbol()] || this;
539 var isEditable = this.hasEditableNode(); 539 var isEditable = this.hasEditableNode();
540 if (isEditable && !this._editing) 540 if (isEditable && !this._editing)
541 contextMenu.appendAction("elements.edit-as-html", WebInspector.UIStr ing("Edit as HTML")); 541 contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), this._ editAsHTML.bind(this));
542 var isShadowRoot = this._node.isShadowRoot(); 542 var isShadowRoot = this._node.isShadowRoot();
543 543
544 // Place it here so that all "Copy"-ing items stick together. 544 // Place it here so that all "Copy"-ing items stick together.
545 var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy ")); 545 var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy "));
546 var createShortcut = WebInspector.KeyboardShortcut.shortcutToString; 546 var createShortcut = WebInspector.KeyboardShortcut.shortcutToString;
547 var modifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta; 547 var modifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;
548 var menuItem; 548 var menuItem;
549 if (!isShadowRoot) 549 if (!isShadowRoot)
550 menuItem = copyMenu.appendItem(WebInspector.UIString("Copy outerHTML "), this.treeOutline.performCopyOrCut.bind(this.treeOutline, false, this._node)) ; 550 menuItem = copyMenu.appendItem(WebInspector.UIString("Copy outerHTML "), this.treeOutline.performCopyOrCut.bind(this.treeOutline, false, this._node)) ;
551 menuItem.setShortcut(createShortcut("V", modifier)); 551 menuItem.setShortcut(createShortcut("V", modifier));
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 this.scrollIntoViewIfNeeded(true); 1608 this.scrollIntoViewIfNeeded(true);
1609 } 1609 }
1610 1610
1611 if (object) 1611 if (object)
1612 object.callFunction(scrollIntoView); 1612 object.callFunction(scrollIntoView);
1613 } 1613 }
1614 1614
1615 this._node.resolveToObject("", scrollIntoViewCallback); 1615 this._node.resolveToObject("", scrollIntoViewCallback);
1616 }, 1616 },
1617 1617
1618 _editAsHTML: function ()
1619 {
1620 var promise = WebInspector.Revealer.revealPromise(this.node());
1621 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as- html").execute());
1622 },
1623
1618 __proto__: TreeElement.prototype 1624 __proto__: TreeElement.prototype
1619 } 1625 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698