generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: open TemplateBuilder in a modal
- Loading branch information
1 parent
2377ad7
commit e376cd0
Showing
5 changed files
with
84 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { App, Modal } from "obsidian"; | ||
import { TemplateBuilderModel } from "./components/TemplateBuilder"; | ||
import TemplateBuilder from "./components/TemplateBuilder.svelte"; | ||
/** | ||
* This class is just the minimum glue code to bind our core logic | ||
* with the svelte UI and obsidian API modal. | ||
*/ | ||
export class TemplateBuilderModal extends Modal { | ||
_component!: TemplateBuilder; | ||
|
||
constructor( | ||
app: App, | ||
private deps: TemplateBuilderModel, | ||
) { | ||
super(app); | ||
} | ||
|
||
onClose() { | ||
this._component.$destroy(); | ||
} | ||
|
||
onOpen() { | ||
const { contentEl } = this; | ||
this._component = new TemplateBuilder({ | ||
target: contentEl, | ||
props: { model: this.deps }, | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters