25 |
Example View
26 |
27 |
28 |
Input:
29 |
30 |
31 |
32 |
Saved:
33 |
{value || You have inputed nothing.}
34 |
;
35 | }
36 |
37 | export default CustomViewContent;
38 |
--------------------------------------------------------------------------------
/src/constants.ts:
--------------------------------------------------------------------------------
1 | export const ICON_NAME = 'apple';
2 | export const FILE_EXTENSION = 'example';
3 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { Plugin } from 'obsidian';
2 | import { ExampleView, VIEW_TYPE_EXAMPLE } from './view';
3 | import { ICON_NAME, FILE_EXTENSION } from './constants';
4 | import { sendNotice } from './utils/notice';
5 | import { DEFAULT_DATA } from './view';
6 |
7 | export default class ExamplePlugin extends Plugin {
8 |
9 | async onload() {
10 | this.registerView(
11 | VIEW_TYPE_EXAMPLE,
12 | (leaf) => new ExampleView(leaf)
13 | );
14 |
15 | this.registerExtensions([FILE_EXTENSION], VIEW_TYPE_EXAMPLE);
16 |
17 | this.addRibbonIcon(ICON_NAME, "Create New Example File", async (e) => {
18 |
19 | this.createAndOpenDrawing();
20 | });
21 |
22 | sendNotice('Example Plugin Load!');
23 |
24 | }
25 |
26 |
27 | public async createAndOpenDrawing(): Promise