mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 08:04:24 +01:00
fix(scripting): RightPanelWidget requiring async doRenderBody (closes #7778)
This commit is contained in:
parent
5da4762f40
commit
0d0448d86b
@ -66,9 +66,14 @@ class RightPanelWidget extends NoteContextAwareWidget {
|
||||
this.$buttons.append((buttonWidget as BasicWidget).render());
|
||||
}
|
||||
|
||||
this.initialized = this.doRenderBody().catch((e) => {
|
||||
this.logRenderingError(e);
|
||||
});
|
||||
const renderResult = this.doRenderBody();
|
||||
if (typeof renderResult === "object" && "catch" in renderResult) {
|
||||
this.initialized = renderResult.catch((e) => {
|
||||
this.logRenderingError(e);
|
||||
});
|
||||
} else {
|
||||
this.initialized = Promise.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +82,7 @@ class RightPanelWidget extends NoteContextAwareWidget {
|
||||
* Your class should override this method.
|
||||
* @returns {Promise|undefined} if widget needs async operation to initialize, it can return a Promise
|
||||
*/
|
||||
async doRenderBody() {}
|
||||
doRenderBody(): Promise<void> | void {}
|
||||
}
|
||||
|
||||
export default RightPanelWidget;
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
- traefik.http.middlewares.trilium-headers.headers.customrequestheaders.X-Forwarded-Proto=https</code></pre>
|
||||
<h3>Setup needed environment variables</h3>
|
||||
<p>After setting up a reverse proxy, make sure to configure the <a class="reference-link"
|
||||
href="Trusted%20proxy.md">[missing note]</a>.</p>
|
||||
href="#root/_help_LLzSMXACKhUs">[missing note]</a>.</p>
|
||||
<h3>Example <code>docker-compose.yaml</code></h3><pre><code class="language-text-x-yaml">services:
|
||||
trilium:
|
||||
image: triliumnext/trilium
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
<ul>
|
||||
<li><code>doRender</code> must not be overridden, instead <code>doRenderBody()</code> has
|
||||
to be overridden.</li>
|
||||
<li><code>parentWidget()</code> must be set to <code>“rightPane”</code>.</li>
|
||||
<li><code>widgetTitle()</code> getter can optionally be overriden, otherwise
|
||||
<li data-list-item-id="ef125f092e6b27dc2c8486d195be8be39"><code>doRender</code> must not be overridden, instead <code>doRenderBody()</code> has
|
||||
to be overridden.
|
||||
<ul>
|
||||
<li data-list-item-id="e632e4415d4439f862124dc2e024093db"><code>doRenderBody</code> can optionally be <code>async</code>.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li data-list-item-id="eef79d03bdc04d4869f6ee69f9086931f"><code>parentWidget()</code> must be set to <code>“rightPane”</code>.</li>
|
||||
<li
|
||||
data-list-item-id="e1bbd084dfcfdea1a8061159b8dcffd44"><code>widgetTitle()</code> getter can optionally be overriden, otherwise
|
||||
the widget will be displayed as “Untitled widget”.</li>
|
||||
</ul><pre><code class="language-text-x-trilium-auto">const template = `<div>Hi</div>`;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# Documentation
|
||||
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/eyrnitqBQ2w6/Documentation_image.png" width="205" height="162">
|
||||
There are multiple types of documentation for Trilium:<img class="image-style-align-right" src="api/images/veLUtimyaTkr/Documentation_image.png" width="205" height="162">
|
||||
|
||||
* The _User Guide_ represents the user-facing documentation. This documentation can be browsed by users directly from within Trilium, by pressing <kbd>F1</kbd>.
|
||||
* The _Developer's Guide_ represents a set of Markdown documents that present the internals of Trilium, for developers.
|
||||
|
||||
7
docs/User Guide/!!!meta.json
vendored
7
docs/User Guide/!!!meta.json
vendored
@ -1069,6 +1069,13 @@
|
||||
"type": "text",
|
||||
"mime": "text/html",
|
||||
"attributes": [
|
||||
{
|
||||
"type": "relation",
|
||||
"name": "internalLink",
|
||||
"value": "LLzSMXACKhUs",
|
||||
"isInheritable": false,
|
||||
"position": 10
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"name": "shareAlias",
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
# Right pane widget
|
||||
* `doRender` must not be overridden, instead `doRenderBody()` has to be overridden.
|
||||
* `doRenderBody` can optionally be `async`.
|
||||
* `parentWidget()` must be set to `“rightPane”`.
|
||||
* `widgetTitle()` getter can optionally be overriden, otherwise the widget will be displayed as “Untitled widget”.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user