Removed modal from stores
This commit is contained in:
15
src/modal.ts
15
src/modal.ts
@@ -2,10 +2,14 @@ import { Modal, TFile } from 'obsidian'
|
||||
import type OmnisearchPlugin from './main'
|
||||
import CmpModalVault from './CmpModalVault.svelte'
|
||||
import CmpModalInFile from './CmpModalInFile.svelte'
|
||||
import { modal } from './stores'
|
||||
|
||||
export class OmnisearchModal extends Modal {
|
||||
constructor(plugin: OmnisearchPlugin, file?: TFile, canGoBack = false) {
|
||||
constructor(
|
||||
plugin: OmnisearchPlugin,
|
||||
file?: TFile,
|
||||
canGoBack = false,
|
||||
parent?: OmnisearchModal,
|
||||
) {
|
||||
super(plugin.app)
|
||||
|
||||
// Remove all the default modal's children (except the close button)
|
||||
@@ -15,20 +19,23 @@ export class OmnisearchModal extends Modal {
|
||||
this.modalEl.append(closeEl)
|
||||
this.modalEl.addClass('omnisearch-modal', 'prompt')
|
||||
|
||||
modal.set(this)
|
||||
|
||||
if (file) {
|
||||
new CmpModalInFile({
|
||||
target: this.modalEl,
|
||||
props: {
|
||||
modal: this,
|
||||
canGoBack,
|
||||
singleFilePath: file.path,
|
||||
parent: parent,
|
||||
},
|
||||
})
|
||||
}
|
||||
else {
|
||||
new CmpModalVault({
|
||||
target: this.modalEl,
|
||||
props: {
|
||||
modal: this,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user