- Revision
- 259748
- Author
- [email protected]
- Date
- 2020-04-08 13:02:17 -0700 (Wed, 08 Apr 2020)
Log Message
Web Inspector: Search: populate the search field with the current selection when using the global search shortcut
https://bugs.webkit.org/show_bug.cgi?id=210207
Reviewed by Timothy Hatcher.
Add a setting to control whether the global search (⇧⌘F) should be populated by the current
selection (if it exists), allowing for a quicker flow for "show me everywhere this exists".
* UserInterface/Base/Setting.js:
* UserInterface/Views/SettingsTabContentView.js:
(WI.SettingsTabContentView.prototype._createGeneralSettingsView):
* UserInterface/Base/Main.js:
(WI._focusSearchField)
* Localizations/en.lproj/localizedStrings.js:
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (259747 => 259748)
--- trunk/Source/WebInspectorUI/ChangeLog 2020-04-08 20:01:39 UTC (rev 259747)
+++ trunk/Source/WebInspectorUI/ChangeLog 2020-04-08 20:02:17 UTC (rev 259748)
@@ -1,5 +1,24 @@
2020-04-08 Devin Rousso <[email protected]>
+ Web Inspector: Search: populate the search field with the current selection when using the global search shortcut
+ https://bugs.webkit.org/show_bug.cgi?id=210207
+
+ Reviewed by Timothy Hatcher.
+
+ Add a setting to control whether the global search (⇧⌘F) should be populated by the current
+ selection (if it exists), allowing for a quicker flow for "show me everywhere this exists".
+
+ * UserInterface/Base/Setting.js:
+ * UserInterface/Views/SettingsTabContentView.js:
+ (WI.SettingsTabContentView.prototype._createGeneralSettingsView):
+
+ * UserInterface/Base/Main.js:
+ (WI._focusSearchField)
+
+ * Localizations/en.lproj/localizedStrings.js:
+
+2020-04-08 Devin Rousso <[email protected]>
+
Web Inspector: Storage: cannot clear out multiple or all local storage entries
https://bugs.webkit.org/show_bug.cgi?id=209867
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (259747 => 259748)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2020-04-08 20:01:39 UTC (rev 259747)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2020-04-08 20:02:17 UTC (rev 259748)
@@ -615,6 +615,8 @@
localizedStrings["Getter"] = "Getter";
localizedStrings["Global Code"] = "Global Code";
localizedStrings["Global Lexical Environment"] = "Global Lexical Environment";
+/* Settings tab checkbox label for whether the global search should populate from the current selection. */
+localizedStrings["Global Search From Selection @ Settings"] = "%s from selection";
localizedStrings["Global Variables"] = "Global Variables";
localizedStrings["Grammar"] = "Grammar";
/* Name of Graphics Tab */
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (259747 => 259748)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2020-04-08 20:01:39 UTC (rev 259747)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2020-04-08 20:02:17 UTC (rev 259748)
@@ -1542,6 +1542,14 @@
WI._focusSearchField = function(event)
{
+ let searchQuery = "";
+
+ if (WI.settings.searchFromSelection.value) {
+ let selection = window.getSelection();
+ if (selection.type === "Range" || !selection.isCollapsed)
+ searchQuery = selection.toString().removeWordBreakCharacters();
+ }
+
WI.tabBrowser.showTabForContentView(WI._searchTabContentView, {
// Classify this as a keyboard shortcut, as the only other way to get to Search Tab is via TabBar itself.
initiatorHint: WI.TabBrowser.TabNavigationInitiator.KeyboardShortcut,
@@ -1548,6 +1556,9 @@
});
WI._searchTabContentView.focusSearchField();
+
+ if (searchQuery)
+ WI._searchTabContentView.performSearch(searchQuery);
};
WI._focusChanged = function(event)
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js (259747 => 259748)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js 2020-04-08 20:01:39 UTC (rev 259747)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js 2020-04-08 20:02:17 UTC (rev 259748)
@@ -193,6 +193,7 @@
indentWithTabs: new WI.Setting("indent-with-tabs", false),
resourceCachingDisabled: new WI.Setting("disable-resource-caching", false),
searchCaseSensitive: new WI.Setting("search-case-sensitive", false),
+ searchFromSelection: new WI.Setting("search-from-selection", false),
searchRegularExpression: new WI.Setting("search-regular-_expression_", false),
selectedNetworkDetailContentViewIdentifier: new WI.Setting("network-detail-content-view-identifier", "preview"),
sourceMapsEnabled: new WI.Setting("source-maps-enabled", true),
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js (259747 => 259748)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js 2020-04-08 20:01:39 UTC (rev 259747)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js 2020-04-08 20:02:17 UTC (rev 259748)
@@ -251,6 +251,7 @@
let searchGroup = generalSettingsView.addGroup(WI.UIString("Search:", "Search: @ Settings", "Settings tab label for search related settings"));
searchGroup.addSetting(WI.settings.searchCaseSensitive, WI.UIString("Case Sensitive", "Case Sensitive @ Settings", "Settings tab checkbox label for whether searches should be case sensitive."));
searchGroup.addSetting(WI.settings.searchRegularExpression, WI.UIString("Regular _expression_", "Regular _expression_ @ Settings", "Settings tab checkbox label for whether searches should be treated as regular expressions."));
+ searchGroup.addSetting(WI.settings.searchFromSelection, WI.UIString("%s from selection", "Global Search From Selection @ Settings", "Settings tab checkbox label for whether the global search should populate from the current selection.").format(WI.searchKeyboardShortcut.displayName));
generalSettingsView.addSeparator();