mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 18:05:55 +01:00
updates
This commit is contained in:
@@ -310,7 +310,7 @@ For information on using widgets, see the tutorial widget_basics.</div>
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="doRender"><span class="type-signature"></span>doRender<span class="signature">()</span><span class="type-signature"> → {JQuery.<HTMLElement>}</span></h4>
|
||||
<h4 class="name" id="doRender"><span class="type-signature"></span>doRender<span class="signature">()</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
|
||||
@@ -321,6 +321,7 @@ For information on using widgets, see the tutorial widget_basics.</div>
|
||||
Method used for rendering the widget.
|
||||
|
||||
Your class should override this method.
|
||||
The method is expected to create a this.$widget containing jQuery object
|
||||
</div>
|
||||
|
||||
|
||||
@@ -364,7 +365,7 @@ Your class should override this method.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line131">line 131</a>
|
||||
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line132">line 132</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -389,28 +390,6 @@ Your class should override this method.
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
Your widget.
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">JQuery.<HTMLElement></span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -628,7 +628,7 @@
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="doRender"><span class="type-signature"></span>doRender<span class="signature">()</span><span class="type-signature"> → {JQuery.<HTMLElement>}</span></h4>
|
||||
<h4 class="name" id="doRender"><span class="type-signature"></span>doRender<span class="signature">()</span><span class="type-signature"></span></h4>
|
||||
|
||||
|
||||
|
||||
@@ -639,6 +639,7 @@
|
||||
Method used for rendering the widget.
|
||||
|
||||
Your class should override this method.
|
||||
The method is expected to create a this.$widget containing jQuery object
|
||||
</div>
|
||||
|
||||
|
||||
@@ -687,7 +688,7 @@ Your class should override this method.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line131">line 131</a>
|
||||
<a href="widgets_basic_widget.js.html">widgets/basic_widget.js</a>, <a href="widgets_basic_widget.js.html#line132">line 132</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -712,28 +713,6 @@ Your class should override this method.
|
||||
|
||||
|
||||
|
||||
<h5>Returns:</h5>
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
Your widget.
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>
|
||||
Type
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">JQuery.<HTMLElement></span>
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="widgets_right_panel_widget.js.html">widgets/right_panel_widget.js</a>, <a href="widgets_right_panel_widget.js.html#line16">line 16</a>
|
||||
<a href="widgets_right_panel_widget.js.html">widgets/right_panel_widget.js</a>, <a href="widgets_right_panel_widget.js.html#line19">line 19</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -172,8 +172,10 @@
|
||||
|
||||
|
||||
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
|
||||
|
||||
<dt class="tag-overrides">Overrides:</dt>
|
||||
<dd class="tag-overrides"><ul class="dummy"><li>
|
||||
<a href="NoteContextAwareWidget.html#hoistedNoteId">NoteContextAwareWidget#hoistedNoteId</a>
|
||||
</li></ul></dd>
|
||||
|
||||
@@ -194,8 +196,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
@@ -235,8 +235,10 @@
|
||||
|
||||
|
||||
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
|
||||
|
||||
<dt class="tag-overrides">Overrides:</dt>
|
||||
<dd class="tag-overrides"><ul class="dummy"><li>
|
||||
<a href="NoteContextAwareWidget.html#note">NoteContextAwareWidget#note</a>
|
||||
</li></ul></dd>
|
||||
|
||||
@@ -257,8 +259,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
@@ -308,8 +308,10 @@
|
||||
|
||||
|
||||
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
|
||||
|
||||
<dt class="tag-overrides">Overrides:</dt>
|
||||
<dd class="tag-overrides"><ul class="dummy"><li>
|
||||
<a href="NoteContextAwareWidget.html#noteContext">NoteContextAwareWidget#noteContext</a>
|
||||
</li></ul></dd>
|
||||
|
||||
@@ -330,8 +332,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
@@ -371,8 +371,10 @@
|
||||
|
||||
|
||||
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
|
||||
|
||||
<dt class="tag-overrides">Overrides:</dt>
|
||||
<dd class="tag-overrides"><ul class="dummy"><li>
|
||||
<a href="NoteContextAwareWidget.html#noteId">NoteContextAwareWidget#noteId</a>
|
||||
</li></ul></dd>
|
||||
|
||||
@@ -393,8 +395,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
@@ -434,8 +434,10 @@
|
||||
|
||||
|
||||
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
|
||||
|
||||
<dt class="tag-overrides">Overrides:</dt>
|
||||
<dd class="tag-overrides"><ul class="dummy"><li>
|
||||
<a href="NoteContextAwareWidget.html#notePath">NoteContextAwareWidget#notePath</a>
|
||||
</li></ul></dd>
|
||||
|
||||
@@ -456,8 +458,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
@@ -523,7 +523,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="widgets_right_panel_widget.js.html">widgets/right_panel_widget.js</a>, <a href="widgets_right_panel_widget.js.html#line18">line 18</a>
|
||||
<a href="widgets_right_panel_widget.js.html">widgets/right_panel_widget.js</a>, <a href="widgets_right_panel_widget.js.html#line21">line 21</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -629,14 +629,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
<a href="BasicWidget.html#cssBlock">BasicWidget#cssBlock</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
<dt class="tag-overrides">Overrides:</dt>
|
||||
<dd class="tag-overrides"><ul class="dummy"><li>
|
||||
<a href="NoteContextAwareWidget.html#cssBlock">NoteContextAwareWidget#cssBlock</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -724,6 +724,7 @@
|
||||
|
||||
<div class="description">
|
||||
Do not override this method unless you know what you're doing.
|
||||
Do not override this method unless you know what you're doing.
|
||||
</div>
|
||||
|
||||
|
||||
@@ -772,7 +773,7 @@
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="widgets_right_panel_widget.js.html">widgets/right_panel_widget.js</a>, <a href="widgets_right_panel_widget.js.html#line25">line 25</a>
|
||||
<a href="widgets_right_panel_widget.js.html">widgets/right_panel_widget.js</a>, <a href="widgets_right_panel_widget.js.html#line37">line 37</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -808,7 +809,7 @@
|
||||
|
||||
|
||||
|
||||
<h4 class="name" id="doRenderBody"><span class="type-signature">(async) </span>doRenderBody<span class="signature">()</span><span class="type-signature"> → {JQuery.<HTMLElement>}</span></h4>
|
||||
<h4 class="name" id="doRenderBody"><span class="type-signature">(async) </span>doRenderBody<span class="signature">()</span><span class="type-signature"> → {Promise|undefined}</span></h4>
|
||||
|
||||
|
||||
|
||||
@@ -816,7 +817,7 @@
|
||||
|
||||
|
||||
<div class="description">
|
||||
Method used for rendering the body of the widget.
|
||||
Method used for rendering the body of the widget (via existing this.$body)
|
||||
|
||||
Your class should override this method.
|
||||
</div>
|
||||
@@ -862,7 +863,7 @@ Your class should override this method.
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="widgets_right_panel_widget.js.html">widgets/right_panel_widget.js</a>, <a href="widgets_right_panel_widget.js.html#line47">line 47</a>
|
||||
<a href="widgets_right_panel_widget.js.html">widgets/right_panel_widget.js</a>, <a href="widgets_right_panel_widget.js.html#line66">line 66</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
@@ -891,7 +892,7 @@ Your class should override this method.
|
||||
|
||||
|
||||
<div class="param-desc">
|
||||
The body of your widget.
|
||||
if widget needs async operation to initialize, it can return a Promise
|
||||
</div>
|
||||
|
||||
|
||||
@@ -902,7 +903,10 @@ Your class should override this method.
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
<span class="param-type">JQuery.<HTMLElement></span>
|
||||
<span class="param-type">Promise</span>
|
||||
|
|
||||
|
||||
<span class="param-type">undefined</span>
|
||||
|
||||
|
||||
</dd>
|
||||
@@ -946,8 +950,10 @@ Your class should override this method.
|
||||
|
||||
|
||||
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
|
||||
|
||||
<dt class="tag-overrides">Overrides:</dt>
|
||||
<dd class="tag-overrides"><ul class="dummy"><li>
|
||||
<a href="NoteContextAwareWidget.html#isEnabled">NoteContextAwareWidget#isEnabled</a>
|
||||
</li></ul></dd>
|
||||
|
||||
@@ -968,8 +974,6 @@ Your class should override this method.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
@@ -1111,8 +1115,10 @@ widget with each note.
|
||||
|
||||
|
||||
|
||||
<dt class="inherited-from">Inherited From:</dt>
|
||||
<dd class="inherited-from"><ul class="dummy"><li>
|
||||
|
||||
|
||||
<dt class="tag-overrides">Overrides:</dt>
|
||||
<dd class="tag-overrides"><ul class="dummy"><li>
|
||||
<a href="NoteContextAwareWidget.html#refreshWithNote">NoteContextAwareWidget#refreshWithNote</a>
|
||||
</li></ul></dd>
|
||||
|
||||
@@ -1133,8 +1139,6 @@ widget with each note.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
|
||||
@@ -158,7 +158,7 @@ class FNote {
|
||||
branchIdPos[branchId] = this.froca.getBranch(branchId).notePosition;
|
||||
}
|
||||
|
||||
this.children.sort((a, b) => branchIdPos[this.childToBranch[a]] < branchIdPos[this.childToBranch[b]] ? -1 : 1);
|
||||
this.children.sort((a, b) => branchIdPos[this.childToBranch[a]] - branchIdPos[this.childToBranch[b]]);
|
||||
}
|
||||
|
||||
/** @returns {boolean} */
|
||||
@@ -256,7 +256,7 @@ class FNote {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
return aNoteId < bNoteId ? -1 : 1;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
/**
|
||||
* This is the base widget for all other widgets.
|
||||
*
|
||||
*
|
||||
* For information on using widgets, see the tutorial {@tutorial widget_basics}.
|
||||
*/
|
||||
class BasicWidget extends Component {
|
||||
@@ -61,7 +61,7 @@ class BasicWidget extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
this.children.sort((a, b) => a.position - b.position < 0 ? -1 : 1);
|
||||
this.children.sort((a, b) => a.position - b.position);
|
||||
|
||||
return this;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class BasicWidget extends Component {
|
||||
|
||||
/**
|
||||
* Accepts a string of CSS to add with the widget.
|
||||
* @param {string} block
|
||||
* @param {string} block
|
||||
* @returns {this} for chaining
|
||||
*/
|
||||
cssBlock(block) {
|
||||
@@ -112,7 +112,8 @@ class BasicWidget extends Component {
|
||||
this.doRender();
|
||||
|
||||
this.$widget.attr('data-component-id', this.componentId);
|
||||
this.$widget.addClass('component')
|
||||
this.$widget
|
||||
.addClass('component')
|
||||
.prop('component', this);
|
||||
|
||||
if (!this.isEnabled()) {
|
||||
@@ -152,9 +153,9 @@ class BasicWidget extends Component {
|
||||
|
||||
/**
|
||||
* Method used for rendering the widget.
|
||||
*
|
||||
*
|
||||
* Your class should override this method.
|
||||
* @returns {JQuery<HTMLElement>} Your widget.
|
||||
* The method is expected to create a this.$widget containing jQuery object
|
||||
*/
|
||||
doRender() {}
|
||||
|
||||
|
||||
@@ -30,7 +30,10 @@
|
||||
|
||||
const WIDGET_TPL = `
|
||||
<div class="card widget">
|
||||
<div class="card-header"></div>
|
||||
<div class="card-header">
|
||||
<div class="card-header-title"></div>
|
||||
<div class="card-header-buttons"></div>
|
||||
</div>
|
||||
|
||||
<div id="[to be set]" class="body-wrapper">
|
||||
<div class="card-body"></div>
|
||||
@@ -45,9 +48,18 @@ class RightPanelWidget extends NoteContextAwareWidget {
|
||||
/** Title to show in the panel. */
|
||||
get widgetTitle() { return "Untitled widget"; }
|
||||
|
||||
get widgetButtons() { return []; }
|
||||
|
||||
get help() { return {}; }
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.child(...this.widgetButtons);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do not override this method unless you know what you're doing.
|
||||
* Do not override this method unless you know what you're doing.
|
||||
*/
|
||||
doRender() {
|
||||
@@ -60,22 +72,30 @@ class RightPanelWidget extends NoteContextAwareWidget {
|
||||
|
||||
this.$body = this.$bodyWrapper.find('.card-body');
|
||||
|
||||
this.$title = this.$widget.find('.card-header');
|
||||
this.$title = this.$widget.find('.card-header .card-header-title');
|
||||
this.$title.text(this.widgetTitle);
|
||||
|
||||
this.$buttons = this.$widget.find('.card-header .card-header-buttons');
|
||||
this.$buttons.empty();
|
||||
|
||||
for (const buttonWidget of this.children) {
|
||||
this.$buttons.append(buttonWidget.render());
|
||||
}
|
||||
|
||||
this.initialized = this.doRenderBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used for rendering the body of the widget.
|
||||
*
|
||||
* Method used for rendering the body of the widget (via existing this.$body)
|
||||
*
|
||||
* Your class should override this method.
|
||||
* @returns {JQuery<HTMLElement>} The body of your widget.
|
||||
* @returns {Promise|undefined} if widget needs async operation to initialize, it can return a Promise
|
||||
*/
|
||||
async doRenderBody() {}
|
||||
}
|
||||
|
||||
export default RightPanelWidget;</code></pre>
|
||||
export default RightPanelWidget;
|
||||
</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user