⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259748 in webkit


Ignore:
Timestamp:
Apr 8, 2020, 1:02:17 PM (6 years ago)
Author:
Devin Rousso
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:
Location:
trunk/Source/WebInspectorUI
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r259744 r259748  
     12020-04-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Search: populate the search field with the current selection when using the global search shortcut
     4        https://bugs.webkit.org/show_bug.cgi?id=210207
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Add a setting to control whether the global search (⇧⌘F) should be populated by the current
     9        selection (if it exists), allowing for a quicker flow for "show me everywhere this exists".
     10
     11        * UserInterface/Base/Setting.js:
     12        * UserInterface/Views/SettingsTabContentView.js:
     13        (WI.SettingsTabContentView.prototype._createGeneralSettingsView):
     14
     15        * UserInterface/Base/Main.js:
     16        (WI._focusSearchField)
     17
     18        * Localizations/en.lproj/localizedStrings.js:
     19
    1202020-04-08  Devin Rousso  <drousso@apple.com>
    221
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r259744 r259748  
    616616localizedStrings["Global Code"] = "Global Code";
    617617localizedStrings["Global Lexical Environment"] = "Global Lexical Environment";
     618/* Settings tab checkbox label for whether the global search should populate from the current selection. */
     619localizedStrings["Global Search From Selection @ Settings"] = "%s from selection";
    618620localizedStrings["Global Variables"] = "Global Variables";
    619621localizedStrings["Grammar"] = "Grammar";
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r259277 r259748  
    15431543WI._focusSearchField = function(event)
    15441544{
     1545    let searchQuery = "";
     1546
     1547    if (WI.settings.searchFromSelection.value) {
     1548        let selection = window.getSelection();
     1549        if (selection.type === "Range" || !selection.isCollapsed)
     1550            searchQuery = selection.toString().removeWordBreakCharacters();
     1551    }
     1552
    15451553    WI.tabBrowser.showTabForContentView(WI._searchTabContentView, {
    15461554        // Classify this as a keyboard shortcut, as the only other way to get to Search Tab is via TabBar itself.
     
    15491557
    15501558    WI._searchTabContentView.focusSearchField();
     1559
     1560    if (searchQuery)
     1561        WI._searchTabContentView.performSearch(searchQuery);
    15511562};
    15521563
  • trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js

    r257759 r259748  
    194194    resourceCachingDisabled: new WI.Setting("disable-resource-caching", false),
    195195    searchCaseSensitive: new WI.Setting("search-case-sensitive", false),
     196    searchFromSelection: new WI.Setting("search-from-selection", false),
    196197    searchRegularExpression: new WI.Setting("search-regular-expression", false),
    197198    selectedNetworkDetailContentViewIdentifier: new WI.Setting("network-detail-content-view-identifier", "preview"),
  • trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js

    r259101 r259748  
    252252        searchGroup.addSetting(WI.settings.searchCaseSensitive, WI.UIString("Case Sensitive", "Case Sensitive @ Settings", "Settings tab checkbox label for whether searches should be case sensitive."));
    253253        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."));
     254        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));
    254255
    255256        generalSettingsView.addSeparator();
Note: See TracChangeset for help on using the changeset viewer.