Add menu command and keyboard shortcut to move focus to the search field.
This commit is contained in:
parent
315af1ef7f
commit
e0c7f8737b
|
@ -157,17 +157,18 @@
|
||||||
<modifierMask key="keyEquivalentModifierMask"/>
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
<menu key="submenu" title="Find" id="1b7-l0-nxx">
|
<menu key="submenu" title="Find" id="1b7-l0-nxx">
|
||||||
<items>
|
<items>
|
||||||
|
<menuItem title="Article Search" keyEquivalent="f" id="nB2-mv-2i5">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="moveFocusToSearchField:" target="Ady-hI-5gd" id="MhU-Pb-Po8"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="QuB-t0-74E"/>
|
||||||
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
|
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="cD7-Qs-BN4"/>
|
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="cD7-Qs-BN4"/>
|
||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
|
|
||||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
|
||||||
<connections>
|
|
||||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="WD3-Gg-5AJ"/>
|
|
||||||
</connections>
|
|
||||||
</menuItem>
|
|
||||||
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
|
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="NDo-RZ-v9R"/>
|
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="NDo-RZ-v9R"/>
|
||||||
|
@ -178,6 +179,7 @@
|
||||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="HOh-sY-3ay"/>
|
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="HOh-sY-3ay"/>
|
||||||
</connections>
|
</connections>
|
||||||
</menuItem>
|
</menuItem>
|
||||||
|
<menuItem isSeparatorItem="YES" id="fQa-bL-eze"/>
|
||||||
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
|
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="U76-nv-p5D"/>
|
<action selector="performFindPanelAction:" target="Ady-hI-5gd" id="U76-nv-p5D"/>
|
||||||
|
|
|
@ -195,8 +195,11 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations, NSW
|
||||||
return canShowShareMenu()
|
return canShowShareMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
if item.action == #selector(toggleSidebar(_:)) {
|
if item.action == #selector(moveFocusToSearchField(_:)) {
|
||||||
|
return currentSearchField != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if item.action == #selector(toggleSidebar(_:)) {
|
||||||
guard let splitViewItem = sidebarSplitViewItem else {
|
guard let splitViewItem = sidebarSplitViewItem else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -354,6 +357,12 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations, NSW
|
||||||
sharingServicePicker.show(relativeTo: view.bounds, of: view, preferredEdge: .minY)
|
sharingServicePicker.show(relativeTo: view.bounds, of: view, preferredEdge: .minY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IBAction func moveFocusToSearchField(_ sender: Any?) {
|
||||||
|
guard let searchField = currentSearchField else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window?.makeFirstResponder(searchField)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - SidebarDelegate
|
// MARK: - SidebarDelegate
|
||||||
|
|
Loading…
Reference in New Issue