Changeset 246658 in webkit
- Timestamp:
- Jun 20, 2019 3:45:17 PM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r246624 r246658 1 2019-06-20 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Edit -> Tag doesn't do anything for html, head, and body elements 4 https://bugs.webkit.org/show_bug.cgi?id=199052 5 <rdar://problem/51923906> 6 7 Reviewed by Matt Baker. 8 9 * UserInterface/Views/DOMTreeElement.js: 10 (WI.DOMTreeElement.prototype.populateDOMNodeContextMenu): 11 - Don't show an "Edit > Tag" for <html>, <head>, and <body> nodes 12 - Disable any "Edit" submenu item if it's target is already being edited 13 - Prevent "Add" submenu items from being shown for text nodes 14 1 15 2019-06-19 Devin Rousso <drousso@apple.com> 2 16 -
trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js
r245827 r246658 744 744 populateDOMNodeContextMenu(contextMenu, subMenus, event) 745 745 { 746 let attribute = event.target.closest(".html-attribute");746 let attributeNode = event.target.closest(".html-attribute"); 747 747 let textNode = event.target.closest(".html-text-node"); 748 748 749 749 let attributeName = null; 750 if (attribute ) {751 let attributeNameElement = attribute .getElementsByClassName("html-attribute-name")[0];750 if (attributeNode) { 751 let attributeNameElement = attributeNode.getElementsByClassName("html-attribute-name")[0]; 752 752 if (attributeNameElement) 753 753 attributeName = attributeNameElement.textContent.trim(); … … 760 760 761 761 let isEditableNode = this.representedObject.nodeType() === Node.ELEMENT_NODE && this.editable; 762 let isNonShadowEditable = !this.representedObject.isInUserAgentShadowTree() && this.editable;763 let forbiddenClosingTag = WI.DOMTreeElement.ForbiddenClosingTagElements.has(this.representedObject.nodeNameInCorrectCase());762 let isNonShadowEditable = !this.representedObject.isInUserAgentShadowTree() && isEditableNode; 763 let alreadyEditingHTML = this._htmlEditElement && WI.isBeingEdited(this._htmlEditElement); 764 764 765 765 if (isEditableNode) { 766 if (! forbiddenClosingTag) {766 if (!DOMTreeElement.ForbiddenClosingTagElements.has(this.representedObject.nodeNameInCorrectCase())) { 767 767 subMenus.add.appendItem(WI.UIString("Child", "A submenu item of 'Add' to append DOM nodes to the selected DOM node"), () => { 768 768 this._addHTML(); 769 } );769 }, alreadyEditingHTML); 770 770 } 771 771 772 772 subMenus.add.appendItem(WI.UIString("Previous Sibling", "A submenu item of 'Add' to add DOM nodes before the selected DOM node"), () => { 773 773 this._addPreviousSibling(); 774 } );774 }, alreadyEditingHTML); 775 775 776 776 subMenus.add.appendItem(WI.UIString("Next Sibling", "A submenu item of 'Add' to add DOM nodes after the selected DOM node"), () => { 777 777 this._addNextSibling(); 778 } );778 }, alreadyEditingHTML); 779 779 } 780 780 … … 788 788 subMenus.edit.appendItem(WI.UIString("HTML"), () => { 789 789 this._editAsHTML(); 790 } );790 }, alreadyEditingHTML); 791 791 } 792 792 … … 794 794 if (attributeName) { 795 795 subMenus.edit.appendItem(WI.UIString("Attribute"), () => { 796 this._startEditingAttribute(attribute, event.target); 797 }); 798 } 799 800 subMenus.edit.appendItem(WI.UIString("Tag", "A submenu item of 'Edit' to change DOM element's tag name"), () => { 801 this._startEditingTagName(); 802 }); 796 this._startEditingAttribute(attributeNode, event.target); 797 }, WI.isBeingEdited(attributeNode)); 798 } 799 800 if (!DOMTreeElement.EditTagBlacklist.has(this.representedObject.nodeNameInCorrectCase())) { 801 let tagNameNode = event.target.closest(".html-tag-name"); 802 803 subMenus.edit.appendItem(WI.UIString("Tag", "A submenu item of 'Edit' to change DOM element's tag name"), () => { 804 this._startEditingTagName(tagNameNode); 805 }, WI.isBeingEdited(tagNameNode)); 806 } 803 807 } 804 808 … … 806 810 subMenus.edit.appendItem(WI.UIString("Text"), () => { 807 811 this._startEditingTextNode(textNode); 808 } );812 }, WI.isBeingEdited(textNode)); 809 813 } 810 814
Note: See TracChangeset
for help on using the changeset viewer.