feat: keyboard shortcuts for primary actions (#2030)
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { WebApplication } from '@/Application/Application'
|
||||
import { InternalEventBus, SNNote } from '@standardnotes/snjs'
|
||||
import { OPEN_NOTE_HISTORY_COMMAND } from '@standardnotes/ui-services'
|
||||
import { action, makeObservable, observable } from 'mobx'
|
||||
import { AbstractViewController } from '../Abstract/AbstractViewController'
|
||||
import { NotesControllerInterface } from '../NotesController/NotesControllerInterface'
|
||||
|
||||
export class HistoryModalController extends AbstractViewController {
|
||||
note?: SNNote = undefined
|
||||
@@ -11,13 +13,23 @@ export class HistoryModalController extends AbstractViewController {
|
||||
this.note = undefined
|
||||
}
|
||||
|
||||
constructor(application: WebApplication, eventBus: InternalEventBus) {
|
||||
constructor(application: WebApplication, eventBus: InternalEventBus, notesController: NotesControllerInterface) {
|
||||
super(application, eventBus)
|
||||
|
||||
makeObservable(this, {
|
||||
note: observable,
|
||||
setNote: action,
|
||||
})
|
||||
|
||||
this.disposers.push(
|
||||
application.keyboardService.addCommandHandler({
|
||||
command: OPEN_NOTE_HISTORY_COMMAND,
|
||||
onKeyDown: () => {
|
||||
this.openModal(notesController.firstSelectedNote)
|
||||
return true
|
||||
},
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
setNote = (note: SNNote | undefined) => {
|
||||
|
||||
Reference in New Issue
Block a user