chore: better key label display for cmd and alt in macos (#428)
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
import { createNote, openNote } from '../tools/notes'
|
import { createNote, openNote } from '../tools/notes'
|
||||||
import {
|
import {
|
||||||
getCtrlKeyLabel,
|
getCtrlKeyLabel,
|
||||||
|
getAltKeyLabel,
|
||||||
getExtension,
|
getExtension,
|
||||||
isFilePDF,
|
isFilePDF,
|
||||||
loopIndex,
|
loopIndex,
|
||||||
@@ -44,20 +45,20 @@
|
|||||||
let openInCurrentPaneKey: string
|
let openInCurrentPaneKey: string
|
||||||
let createInNewPaneKey: string
|
let createInNewPaneKey: string
|
||||||
let createInCurrentPaneKey: string
|
let createInCurrentPaneKey: string
|
||||||
let openInNewLeafKey: string = getCtrlKeyLabel() + ' alt ↵'
|
let openInNewLeafKey: string = getCtrlKeyLabel() + getAltKeyLabel() + ' ↵'
|
||||||
|
|
||||||
$: selectedNote = resultNotes[selectedIndex]
|
$: selectedNote = resultNotes[selectedIndex]
|
||||||
$: searchQuery = searchQuery ?? previousQuery
|
$: searchQuery = searchQuery ?? previousQuery
|
||||||
$: if (plugin.settings.openInNewPane) {
|
$: if (plugin.settings.openInNewPane) {
|
||||||
openInNewPaneKey = '↵'
|
openInNewPaneKey = '↵'
|
||||||
openInCurrentPaneKey = getCtrlKeyLabel() + ' ↵'
|
openInCurrentPaneKey = getCtrlKeyLabel() + ' ↵'
|
||||||
createInNewPaneKey = 'shift ↵'
|
createInNewPaneKey = 'Shift ↵'
|
||||||
createInCurrentPaneKey = getCtrlKeyLabel() + ' shift ↵'
|
createInCurrentPaneKey = getCtrlKeyLabel() + ' Shift ↵'
|
||||||
} else {
|
} else {
|
||||||
openInNewPaneKey = getCtrlKeyLabel() + ' ↵'
|
openInNewPaneKey = getCtrlKeyLabel() + ' ↵'
|
||||||
openInCurrentPaneKey = '↵'
|
openInCurrentPaneKey = '↵'
|
||||||
createInNewPaneKey = getCtrlKeyLabel() + ' shift ↵'
|
createInNewPaneKey = getCtrlKeyLabel() + ' Shift ↵'
|
||||||
createInCurrentPaneKey = 'shift ↵'
|
createInCurrentPaneKey = 'Shift ↵'
|
||||||
}
|
}
|
||||||
$: if (searchQuery) {
|
$: if (searchQuery) {
|
||||||
updateResultsDebounced()
|
updateResultsDebounced()
|
||||||
@@ -354,7 +355,7 @@
|
|||||||
<span class="prompt-instruction-command">↑↓</span><span>to navigate</span>
|
<span class="prompt-instruction-command">↑↓</span><span>to navigate</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="prompt-instruction">
|
<div class="prompt-instruction">
|
||||||
<span class="prompt-instruction-command">alt ↑↓</span>
|
<span class="prompt-instruction-command">{getAltKeyLabel()} ↑↓</span>
|
||||||
<span>to cycle history</span>
|
<span>to cycle history</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="prompt-instruction">
|
<div class="prompt-instruction">
|
||||||
@@ -362,7 +363,7 @@
|
|||||||
<span>to open</span>
|
<span>to open</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="prompt-instruction">
|
<div class="prompt-instruction">
|
||||||
<span class="prompt-instruction-command">tab</span>
|
<span class="prompt-instruction-command">Tab</span>
|
||||||
<span>to switch to In-File Search</span>
|
<span>to switch to In-File Search</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -391,14 +392,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="prompt-instruction">
|
<div class="prompt-instruction">
|
||||||
<span class="prompt-instruction-command">alt ↵</span>
|
<span class="prompt-instruction-command">{getAltKeyLabel()} ↵</span>
|
||||||
<span>to insert a link</span>
|
<span>to insert a link</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="prompt-instruction">
|
<div class="prompt-instruction">
|
||||||
<span class="prompt-instruction-command">ctrl g</span>
|
<span class="prompt-instruction-command">Ctrl g</span>
|
||||||
<span>to toggle excerpts</span>
|
<span>to toggle excerpts</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="prompt-instruction">
|
<div class="prompt-instruction">
|
||||||
<span class="prompt-instruction-command">esc</span><span>to close</span>
|
<span class="prompt-instruction-command">Esc</span><span>to close</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
import { K_DISABLE_OMNISEARCH } from './globals'
|
import { K_DISABLE_OMNISEARCH } from './globals'
|
||||||
import type OmnisearchPlugin from './main'
|
import type OmnisearchPlugin from './main'
|
||||||
import { enableVerboseLogging } from './tools/utils'
|
import { enableVerboseLogging, getCtrlKeyLabel } from './tools/utils'
|
||||||
import { debounce } from 'lodash-es'
|
import { debounce } from 'lodash-es'
|
||||||
|
|
||||||
interface WeightingSettings {
|
interface WeightingSettings {
|
||||||
@@ -398,9 +398,7 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
// Set Vim like navigation keys
|
// Set Vim like navigation keys
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName('Set Vim like navigation keys')
|
.setName('Set Vim like navigation keys')
|
||||||
.setDesc(
|
.setDesc(`Navigate down the results with ${getCtrlKeyLabel()} + J/N, or navigate up with ${getCtrlKeyLabel()} + K/P.`)
|
||||||
'Navigate down the results with Ctrl/⌘ + J/N, or navigate up with Ctrl/⌘ + K/P'
|
|
||||||
)
|
|
||||||
.addToggle(toggle =>
|
.addToggle(toggle =>
|
||||||
toggle
|
toggle
|
||||||
.setValue(settings.vimLikeNavigationShortcut)
|
.setValue(settings.vimLikeNavigationShortcut)
|
||||||
|
|||||||
@@ -145,8 +145,12 @@ export function removeDiacritics(str: string, arabic = false): string {
|
|||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCtrlKeyLabel(): 'ctrl' | '⌘' {
|
export function getCtrlKeyLabel(): 'Ctrl' | '⌘' {
|
||||||
return Platform.isMacOS ? '⌘' : 'ctrl'
|
return Platform.isMacOS ? '⌘' : 'Ctrl'
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAltKeyLabel(): 'Alt' | '⌥' {
|
||||||
|
return Platform.isMacOS ? '⌥' : 'Alt'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isFileImage(path: string): boolean {
|
export function isFileImage(path: string): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user