Closed stecydube closed 1 year ago
Turn on "Expose internal modules" in plugin settings and use the following code:
const { Modal } = await require.import("obsidian");
export class MyModal extends Modal {
// custom modal code
}
Then you can use it:
const { MyModal } = await require.import("path/to/script.js");
new MyModal(app).open();
For future references, require("obsidian")
will return an object containing everything in obsidian.d.ts
. You just need to access them by name, like require("obsidian").Modal
for Modal
.
Awesome. Thanks!
Sorry to raise an issue as this repo does not have a discussion area.
Is it possible to create a class that extends Modal and being able to use it somewhere?
Thanks 😀