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

Unified Diff: Source/devtools/front_end/ui/InplaceEditor.js

Issue 1196343002: Revert of 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 | « Source/devtools/front_end/elements/ElementsTreeElement.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/InplaceEditor.js
diff --git a/Source/devtools/front_end/ui/InplaceEditor.js b/Source/devtools/front_end/ui/InplaceEditor.js
index 9bb9cb48a4cdee2c313c9c0694d0803f7fac8786..c8c4620834c6f85b5699cc340704c5496432efa9 100644
--- a/Source/devtools/front_end/ui/InplaceEditor.js
+++ b/Source/devtools/front_end/ui/InplaceEditor.js
@@ -169,10 +169,6 @@
committedCallback(this, self.editorContent(editingContext), editingContext.oldText, context, moveDirection);
}
- /**
- * @param {!Event} event
- * @return {string}
- */
function defaultFinishHandler(event)
{
var isMetaOrCtrl = WebInspector.isMac() ?
@@ -184,7 +180,6 @@
return "cancel";
else if (!isMultiline && event.keyIdentifier === "U+0009") // Tab key
return "move-" + (event.shiftKey ? "backward" : "forward");
- return "";
}
function handleEditingResult(result, event)
@@ -202,23 +197,16 @@
}
}
- /**
- * @param {!Event} event
- */
function pasteEventListener(event)
{
var result = pasteCallback(event);
handleEditingResult(result, event);
}
- /**
- * @param {!Event} event
- */
function keyDownEventListener(event)
{
- var result = defaultFinishHandler(event);
- if (!result && config.postKeydownFinishHandler)
- result = config.postKeydownFinishHandler(event);
+ var handler = config.customFinishHandler || defaultFinishHandler;
+ var result = handler(event);
handleEditingResult(result, event);
}
@@ -253,19 +241,22 @@
this.blurHandler = blurHandler;
/**
- * @type {function(!Event):string|undefined}
+ * Handles the "paste" event, return values are the same as those for customFinishHandler
+ * @type {function(!Element)|undefined}
*/
this.pasteHandler;
/**
+ * Whether the edited element is multiline
* @type {boolean|undefined}
*/
this.multiline;
/**
- * @type {function(!Event):string|undefined}
- */
- this.postKeydownFinishHandler;
+ * Custom finish handler for the editing session (invoked on keydown)
+ * @type {function(!Element,*)|undefined}
+ */
+ this.customFinishHandler;
}
WebInspector.InplaceEditor.Config.prototype = {
@@ -291,11 +282,8 @@
this.smartIndent = smartIndent;
},
- /**
- * @param {function(!Event):string} postKeydownFinishHandler
- */
- setPostKeydownFinishHandler: function(postKeydownFinishHandler)
- {
- this.postKeydownFinishHandler = postKeydownFinishHandler;
+ setCustomFinishHandler: function(customFinishHandler)
+ {
+ this.customFinishHandler = customFinishHandler;
}
}
« no previous file with comments | « Source/devtools/front_end/elements/ElementsTreeElement.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698