| 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 e875ae7289fa69b7f40da4b815cbacfaa6022486..10cf3a115c434c4212f79d0c2056a0785bc39afd 100644
|
| --- a/Source/devtools/front_end/ui/InplaceEditor.js
|
| +++ b/Source/devtools/front_end/ui/InplaceEditor.js
|
| @@ -10,9 +10,14 @@ WebInspector.InplaceEditor = function()
|
| }
|
|
|
| /**
|
| + * @typedef {{cancel: function(), commit: function(), setWidth: function(number)}}
|
| + */
|
| +WebInspector.InplaceEditor.Controller;
|
| +
|
| +/**
|
| * @param {!Element} element
|
| * @param {!WebInspector.InplaceEditor.Config=} config
|
| - * @return {?{cancel: function(), commit: function(), setWidth: function(number)}}
|
| + * @return {?WebInspector.InplaceEditor.Controller}
|
| */
|
| WebInspector.InplaceEditor.startEditing = function(element, config)
|
| {
|
| @@ -21,6 +26,28 @@ WebInspector.InplaceEditor.startEditing = function(element, config)
|
| return WebInspector.InplaceEditor._defaultInstance.startEditing(element, config);
|
| }
|
|
|
| +/**
|
| + * @param {!Element} element
|
| + * @param {!WebInspector.InplaceEditor.Config=} config
|
| + * @return {!Promise.<!WebInspector.InplaceEditor.Controller>}
|
| + */
|
| +WebInspector.InplaceEditor.startMultilineEditing = function(element, config)
|
| +{
|
| + return self.runtime.instancePromise(WebInspector.InplaceEditor).then(startEditing);
|
| +
|
| + /**
|
| + * @param {!Object} inplaceEditor
|
| + * @return {!WebInspector.InplaceEditor.Controller|!Promise.<!WebInspector.InplaceEditor.Controller>}
|
| + */
|
| + function startEditing(inplaceEditor)
|
| + {
|
| + var controller = /** @type {!WebInspector.InplaceEditor} */ (inplaceEditor).startEditing(element, config);
|
| + if (!controller)
|
| + return Promise.rejectWithError("Editing is already in progress");
|
| + return controller;
|
| + }
|
| +}
|
| +
|
| WebInspector.InplaceEditor.prototype = {
|
| /**
|
| * @return {string}
|
| @@ -74,7 +101,7 @@ WebInspector.InplaceEditor.prototype = {
|
| /**
|
| * @param {!Element} element
|
| * @param {!WebInspector.InplaceEditor.Config=} config
|
| - * @return {?{cancel: function(), commit: function()}}
|
| + * @return {?WebInspector.InplaceEditor.Controller}
|
| */
|
| startEditing: function(element, config)
|
| {
|
| @@ -190,7 +217,8 @@ WebInspector.InplaceEditor.prototype = {
|
|
|
| var handle = {
|
| cancel: editingCancelled.bind(element),
|
| - commit: editingCommitted.bind(element)
|
| + commit: editingCommitted.bind(element),
|
| + setWidth: function() {}
|
| };
|
| this.augmentEditingHandle(editingContext, handle);
|
| return handle;
|
| @@ -246,6 +274,7 @@ WebInspector.InplaceEditor.Config.prototype = {
|
| */
|
| setMultilineOptions: function(initialValue, mode, theme, lineWrapping, smartIndent)
|
| {
|
| + this.multiline = true;
|
| this.initialValue = initialValue;
|
| this.mode = mode;
|
| this.theme = theme;
|
|
|