diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets.html index ce9190a4e..56a1c3491 100644 --- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets.html +++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets.html @@ -4,149 +4,146 @@
In older versions of Trilium, custom widgets were exclusively written
in a combination of jQuery with Trilium's internal widget architecture
- (e.g., BasicWidget, NoteContextAwareWidget).
BasicWidget, NoteContextAwareWidget).
Starting with v0.101.0, custom widgets can also be written in JSX using the Preact framework. Both legacy and Preact widgets have the same capabilities, with a single difference:
this.contentSized() applied
- in the constructor. For more information, see the corresponding section
- in Troubleshooting.this.contentSized()applied in the constructor. For more information,
+ see the corresponding section in Troubleshooting.Wherever possible, widget examples will be both in the legacy and Preact format.
#widget label.#widget label.Let's start by creating a widget that shows a message near the content area. Follow the previous section to create a code note, and use the following content.
-| Legacy | -Preact (v0.101.0+) | -
|---|---|
|
-
- |
-
Refresh the application and the widget should appear underneath the content area.
A widget can be placed in one of the following sections of the applications:
-Value for parentWidget
- |
- Description | -Sample widget | -Special requirements | -
|---|---|---|---|
left-pane
- |
- Appears within the same pane that holds the Note Tree. | -Same as above, with only a different parentWidget. |
- None. | -
center-pane
- |
- In the content area. If a split is open, the widget will span all of the - splits. | -See example above. | -None. | -
note-detail-pane
- |
-
- In the content area, inside the note detail area. If a split is open, - the widget will be contained inside the split. -This is ideal if the widget is note-specific. - |
- Note context aware widget - | -
-
|
-
right-pane
- |
- In the Right Sidebar, - as a dedicated section. | -Right pane widget - | -
-
|
-
Value for parentWidget
+ |
+ Description | +Sample widget | +Special requirements | +
|---|---|---|---|
left-pane
+ |
+ Appears within the same pane that holds the Note Tree. | +Same as above, with only a different parentWidget. |
+ None. | +
center-pane
+ |
+ In the content area. If a split is open, the widget will span all of the + splits. | +See example above. | +None. | +
note-detail-pane
+ |
+
+ In the content area, inside the note detail area. If a split is open, + the widget will be contained inside the split. +This is ideal if the widget is note-specific. + |
+ Note context aware widget + | +
+
|
+
right-pane
+ |
+ In the Right Sidebar, + as a dedicated section. | +Right pane widget + | +
+
|
+
To position the widget somewhere else, just change the value passed to get parentWidget() for
- legacy widgets or the parent field for Preact. Do note that
- some positions such as note-detail-pane and right-pane have
- special requirements that need to be accounted for (see the table above).
To position the widget somewhere else, just change the value passed to
+ get parentWidget()for legacy widgets or the parent field
+ for Preact. Do note that some positions such as note-detail-pane and
+ right-panehave special requirements that need to be accounted for
+ (see the table above).
Launch bar widgets are similar to Custom widgets but are specific to the Launch Bar. diff --git a/docs/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets.md b/docs/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets.md index 431b814db..392f5a734 100644 --- a/docs/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets.md +++ b/docs/User Guide/User Guide/Scripting/Frontend Basics/Custom Widgets.md @@ -23,20 +23,39 @@ Wherever possible, widget examples will be both in the legacy and Preact format. Let's start by creating a widget that shows a message near the content area. Follow the previous section to create a code note, and use the following content. -
| Legacy | Preact (v0.101.0+) |
|---|---|
| |
Value for parentWidget | Description | Sample widget | Special requirements |
|---|---|---|---|
left-pane | Appears within the same pane that holds the Note Tree. | Same as above, with only a different parentWidget. | None. |
center-pane | In the content area. If a split is open, the widget will span all of the splits. | See example above. | None. |
note-detail-pane | In the content area, inside the note detail area. If a split is open, the widget will be contained inside the split. This is ideal if the widget is note-specific. | Note context aware widget |
|
right-pane | In the Right Sidebar, as a dedicated section. | Right pane widget |
|
Value for parentWidget | Description | Sample widget | Special requirements |
|---|---|---|---|
left-pane | Appears within the same pane that holds the Note Tree. | Same as above, with only a different parentWidget. | None. |
center-pane | In the content area. If a split is open, the widget will span all of the splits. | See example above. | None. |
note-detail-pane | In the content area, inside the note detail area. If a split is open, the widget will be contained inside the split. This is ideal if the widget is note-specific. | Note context aware widget |
|
right-pane | In the Right Sidebar, as a dedicated section. | Right pane widget |
|