Title: [239481] trunk/Source/WebInspectorUI
- Revision
- 239481
- Author
- [email protected]
- Date
- 2018-12-20 17:29:54 -0800 (Thu, 20 Dec 2018)
Log Message
Web Inspector: Styles: Pressing Esc when editing name/value should select entire property
https://bugs.webkit.org/show_bug.cgi?id=192919
Reviewed by Devin Rousso.
- Esc still hides the completion popover.
- Esc still discards changes.
- When there's no completion popover, Esc selects outer scope.
I.e., it goes from editing name/value to selecting the entire property.
- Pressing Esc for newly added properties discards those properties.
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertyRemoved):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertyDidPressEsc):
* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype.spreadsheetTextFieldDidPressEsc):
* UserInterface/Views/SpreadsheetTextField.js:
(WI.SpreadsheetTextField.prototype._discardChange):
(WI.SpreadsheetTextField.prototype._handleKeyDown):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (239480 => 239481)
--- trunk/Source/WebInspectorUI/ChangeLog 2018-12-21 01:25:17 UTC (rev 239480)
+++ trunk/Source/WebInspectorUI/ChangeLog 2018-12-21 01:29:54 UTC (rev 239481)
@@ -1,3 +1,25 @@
+2018-12-20 Nikita Vasilyev <[email protected]>
+
+ Web Inspector: Styles: Pressing Esc when editing name/value should select entire property
+ https://bugs.webkit.org/show_bug.cgi?id=192919
+
+ Reviewed by Devin Rousso.
+
+ - Esc still hides the completion popover.
+ - Esc still discards changes.
+ - When there's no completion popover, Esc selects outer scope.
+ I.e., it goes from editing name/value to selecting the entire property.
+ - Pressing Esc for newly added properties discards those properties.
+
+ * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertyRemoved):
+ (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertyDidPressEsc):
+ * UserInterface/Views/SpreadsheetStyleProperty.js:
+ (WI.SpreadsheetStyleProperty.prototype.spreadsheetTextFieldDidPressEsc):
+ * UserInterface/Views/SpreadsheetTextField.js:
+ (WI.SpreadsheetTextField.prototype._discardChange):
+ (WI.SpreadsheetTextField.prototype._handleKeyDown):
+
2018-12-20 Joseph Pecoraro <[email protected]>
Web Inspector: Charles Proxy errors opening har files exported from Safari (invalid startedDateTime)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js (239480 => 239481)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js 2018-12-21 01:25:17 UTC (rev 239480)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js 2018-12-21 01:29:54 UTC (rev 239481)
@@ -480,7 +480,7 @@
for (let index = 0; index < this._propertyViews.length; index++)
this._propertyViews[index].index = index;
- this._focused = false;
+ this.focused = false;
}
spreadsheetStylePropertyShowProperty(propertyView, property)
@@ -489,6 +489,14 @@
this._delegate.spreadsheetCSSStyleDeclarationEditorShowProperty(this, property);
}
+ spreadsheetStylePropertyDidPressEsc(propertyView)
+ {
+ let index = this._propertyViews.indexOf(propertyView);
+ console.assert(index !== -1, `Can't find StyleProperty to select (${propertyView.property.name})`);
+ if (index !== -1)
+ this.selectProperties(index, index);
+ }
+
stylePropertyInlineSwatchActivated()
{
this.inlineSwatchActive = true;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (239480 => 239481)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2018-12-21 01:25:17 UTC (rev 239480)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js 2018-12-21 01:29:54 UTC (rev 239481)
@@ -391,6 +391,15 @@
this._nameTextField.startEditing();
}
+ spreadsheetTextFieldDidPressEsc(textField, textBeforeEditing)
+ {
+ let isNewProperty = !textBeforeEditing;
+ if (isNewProperty)
+ this.remove();
+ else if (this._delegate.spreadsheetStylePropertyDidPressEsc)
+ this._delegate.spreadsheetStylePropertyDidPressEsc(this);
+ }
+
// Private
_isEditable()
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js (239480 => 239481)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js 2018-12-21 01:25:17 UTC (rev 239480)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js 2018-12-21 01:29:54 UTC (rev 239481)
@@ -191,7 +191,6 @@
{
if (this._valueBeforeEditing !== this.value) {
this.value = this._valueBeforeEditing;
- this._selectText();
if (this._delegate && typeof this._delegate.spreadsheetTextFieldDidChange === "function")
this._delegate.spreadsheetTextFieldDidChange(this);
@@ -282,6 +281,10 @@
if (event.key === "Escape") {
event.stop();
this._discardChange();
+ window.getSelection().removeAllRanges();
+
+ if (this._delegate && this._delegate.spreadsheetTextFieldDidPressEsc)
+ this._delegate.spreadsheetTextFieldDidPressEsc(this, this._valueBeforeEditing);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes