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

Unified Diff: Source/devtools/front_end/elements/ElementsTreeElement.js

Issue 1200833006: DevTools: [Elements] F2 should commit changes in edit-as-html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « no previous file | Source/devtools/front_end/ui/InplaceEditor.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/elements/ElementsTreeElement.js
diff --git a/Source/devtools/front_end/elements/ElementsTreeElement.js b/Source/devtools/front_end/elements/ElementsTreeElement.js
index cec3da0f1f6759093aaddc61d42dfa5a4ebdbd04..9954b0c8700990f94a2be55d2cdd8fec5ce56774 100644
--- a/Source/devtools/front_end/elements/ElementsTreeElement.js
+++ b/Source/devtools/front_end/elements/ElementsTreeElement.js
@@ -666,24 +666,16 @@ WebInspector.ElementsTreeElement.prototype = {
var config = new WebInspector.InplaceEditor.Config(this._attributeEditingCommitted.bind(this), this._editingCancelled.bind(this), attributeName);
- function handleKeyDownEvents(event)
+ /**
+ * @param {!Event} event
+ * @return {string}
+ */
+ function postKeyDownFinishHandler(event)
{
- var isMetaOrCtrl = WebInspector.isMac() ?
- event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey :
- event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
- if (isEnterKey(event) && (event.isMetaOrCtrlForTest || !config.multiline || isMetaOrCtrl))
- return "commit";
- else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code || event.keyIdentifier === "U+001B")
- return "cancel";
- else if (event.keyIdentifier === "U+0009") // Tab key
- return "move-" + (event.shiftKey ? "backward" : "forward");
- else {
- WebInspector.handleElementValueModifications(event, attribute);
- return "";
- }
+ WebInspector.handleElementValueModifications(event, attribute);
+ return "";
}
-
- config.customFinishHandler = handleKeyDownEvents;
+ config.setPostKeydownFinishHandler(postKeyDownFinishHandler);
this._editing = WebInspector.InplaceEditor.startEditing(attribute, config);
@@ -848,8 +840,20 @@ WebInspector.ElementsTreeElement.prototype = {
this.treeOutline.focus();
}
+ /**
+ * @param {!Event} event
+ * @return {string}
+ */
+ function postKeyDownFinishHandler(event)
+ {
+ if (event.keyCode === WebInspector.KeyboardShortcut.Keys.F2.code)
pfeldman 2015/06/22 17:59:37 I'd move this to ElementsPanel.js
+ return "commit";
+ return "";
+ }
+
var config = new WebInspector.InplaceEditor.Config(commit.bind(this), dispose.bind(this));
config.setMultilineOptions(initialValue, { name: "xml", htmlMode: true }, "web-inspector-html", WebInspector.moduleSetting("domWordWrap").get(), true);
+ config.setPostKeydownFinishHandler(postKeyDownFinishHandler);
WebInspector.InplaceEditor.startMultilineEditing(this._htmlEditElement, config).then(markAsBeingEdited.bind(this));
/**
« no previous file with comments | « no previous file | Source/devtools/front_end/ui/InplaceEditor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698