#50 - Handling compositionStart/End events

This commit is contained in:
Simon Cambier
2022-05-15 09:08:06 +02:00
parent 69e062bc69
commit 6852c26958
3 changed files with 16 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
import { App, Modal, TFile } from 'obsidian'
import ModalVault from './components/ModalVault.svelte'
import ModalInFile from './components/ModalInFile.svelte'
import { eventBus } from './globals'
import { eventBus, isInputComposition } from './globals'
abstract class OmnisearchModal extends Modal {
constructor(app: App) {
@@ -42,8 +42,10 @@ abstract class OmnisearchModal extends Modal {
eventBus.emit('shift-enter') // Create a new note
})
this.scope.register([], 'Enter', e => {
e.preventDefault()
eventBus.emit('enter') // Open in current pane
if (!isInputComposition()) { // Check if the user is still typing
e.preventDefault()
eventBus.emit('enter') // Open in current pane
}
})
}
}