OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |