diff --git a/docs/backend_api/becca_entities_bnote.js.html b/docs/backend_api/becca_entities_bnote.js.html index dec3f5ce6d..b28fbc47c8 100644 --- a/docs/backend_api/becca_entities_bnote.js.html +++ b/docs/backend_api/becca_entities_bnote.js.html @@ -119,7 +119,7 @@

Source: becca/entities/bnote.js

this.utcDateCreated = utcDateCreated || dateUtils.utcNowDateTime(); /** @type {string} */ this.utcDateModified = utcDateModified; - /** + /** * set during the deletion operation, before it is completed (removed from becca completely) * @type {boolean} */ @@ -784,7 +784,7 @@

Source: becca/entities/bnote.js

} else if (a.parentNote?.isHiddenCompletely()) { return 1; } else { - return -1; + return 0; } }); @@ -804,7 +804,7 @@

Source: becca/entities/bnote.js

const aBranch = becca.getBranchFromChildAndParent(a.noteId, this.noteId); const bBranch = becca.getBranchFromChildAndParent(b.noteId, this.noteId); - return aBranch?.notePosition < bBranch?.notePosition ? -1 : 1; + return (aBranch?.notePosition - bBranch?.notePosition) || 0; }); } diff --git a/docs/frontend_api/BasicWidget.html b/docs/frontend_api/BasicWidget.html index 021f24af1f..2e8edd905f 100644 --- a/docs/frontend_api/BasicWidget.html +++ b/docs/frontend_api/BasicWidget.html @@ -310,7 +310,7 @@
Returns:
-

doRender() → {JQuery.<HTMLElement>}

+

doRender()

@@ -321,6 +321,7 @@

doRender @@ -364,7 +365,7 @@

doRenderSource:
@@ -389,28 +390,6 @@

doRenderReturns:

- - -
- Your widget. -
- - - -
-
- Type -
-
- -JQuery.<HTMLElement> - - -
-
- - diff --git a/docs/frontend_api/NoteContextAwareWidget.html b/docs/frontend_api/NoteContextAwareWidget.html index cd5cee9607..cafbd5af47 100644 --- a/docs/frontend_api/NoteContextAwareWidget.html +++ b/docs/frontend_api/NoteContextAwareWidget.html @@ -628,7 +628,7 @@
Returns:
-

doRender() → {JQuery.<HTMLElement>}

+

doRender()

@@ -639,6 +639,7 @@

doRender @@ -687,7 +688,7 @@

doRenderSource:
@@ -712,28 +713,6 @@

doRenderReturns:

- - -
- Your widget. -
- - - -
-
- Type -
-
- -JQuery.<HTMLElement> - - -
-
- - diff --git a/docs/frontend_api/RightPanelWidget.html b/docs/frontend_api/RightPanelWidget.html index 2913dd240b..307ecefd46 100644 --- a/docs/frontend_api/RightPanelWidget.html +++ b/docs/frontend_api/RightPanelWidget.html @@ -93,7 +93,7 @@

new R
Source:
@@ -172,8 +172,10 @@

hoistedN -
Inherited From:
-
  • + + +
    Overrides:
    +
    @@ -194,8 +196,6 @@

    hoistedN - -
    Source:
    • @@ -235,8 +235,10 @@

      noteInherited From: -
      • + + +
        Overrides:
        +
        @@ -257,8 +259,6 @@

        noteSource:
        • @@ -308,8 +308,10 @@
          Type:
          -
          Inherited From:
          -
          • + + +
            Overrides:
            +
            @@ -330,8 +332,6 @@
            Type:
            - -
            Source:
            • @@ -371,8 +371,10 @@

              noteIdInherited From: -
              • + + +
                Overrides:
                +
                @@ -393,8 +395,6 @@

                noteIdSource:
                • @@ -434,8 +434,10 @@

                  notePathInherited From: -
                  • + + +
                    Overrides:
                    +
                    @@ -456,8 +458,6 @@

                    notePathSource:
                    • @@ -523,7 +523,7 @@

                      widgetTitl
                      Source:
                      @@ -629,14 +629,14 @@

                      Parameters:
                      - -
                      Inherited From:
                      -
                      +
                      Overrides:
                      +
                      + @@ -724,6 +724,7 @@

                      doRender Do not override this method unless you know what you're doing. +Do not override this method unless you know what you're doing. @@ -772,7 +773,7 @@

                      doRenderSource:
                      @@ -808,7 +809,7 @@

                      doRender(async) doRenderBody() → {JQuery.<HTMLElement>}

                      +

                      (async) doRenderBody() → {Promise|undefined}

                      @@ -816,7 +817,7 @@

                      (async) d
                      - 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.
                      @@ -862,7 +863,7 @@

                      (async) d
                      Source:
                      @@ -891,7 +892,7 @@

                      Returns:
                      - The body of your widget. + if widget needs async operation to initialize, it can return a Promise
                      @@ -902,7 +903,10 @@
                      Returns:
                      -JQuery.<HTMLElement> +Promise +| + +undefined
                      @@ -946,8 +950,10 @@

                      isEnabledInherited From: -
                      • + + +
                        Overrides:
                        +
                        @@ -968,8 +974,6 @@

                        isEnabledSource:
                        • @@ -1111,8 +1115,10 @@
                          Parameters:
                          -
                          Inherited From:
                          -
                          • + + +
                            Overrides:
                            +
                            @@ -1133,8 +1139,6 @@
                            Parameters:
                            - -
                            Source:
                            • diff --git a/docs/frontend_api/entities_fnote.js.html b/docs/frontend_api/entities_fnote.js.html index bcfc47f046..fcf02c5219 100644 --- a/docs/frontend_api/entities_fnote.js.html +++ b/docs/frontend_api/entities_fnote.js.html @@ -158,7 +158,7 @@

                              Source: entities/fnote.js

                              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 @@

                              Source: entities/fnote.js

                              return 1; } - return -1; + return aNoteId < bNoteId ? -1 : 1; }); } diff --git a/docs/frontend_api/widgets_basic_widget.js.html b/docs/frontend_api/widgets_basic_widget.js.html index 3958f10961..6a203fd6db 100644 --- a/docs/frontend_api/widgets_basic_widget.js.html +++ b/docs/frontend_api/widgets_basic_widget.js.html @@ -31,7 +31,7 @@

                              Source: widgets/basic_widget.js

                              /** * 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 @@

                              Source: widgets/basic_widget.js

                              } } - 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 @@

                              Source: widgets/basic_widget.js

                              /** * 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 @@

                              Source: widgets/basic_widget.js

                              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 @@

                              Source: widgets/basic_widget.js

                              /** * 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() {} diff --git a/docs/frontend_api/widgets_right_panel_widget.js.html b/docs/frontend_api/widgets_right_panel_widget.js.html index 02cbbc4acd..cf98c0aa5f 100644 --- a/docs/frontend_api/widgets_right_panel_widget.js.html +++ b/docs/frontend_api/widgets_right_panel_widget.js.html @@ -30,7 +30,10 @@

                              Source: widgets/right_panel_widget.js

                              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 @@

                              Source: widgets/right_panel_widget.js

                              /** 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 @@

                              Source: widgets/right_panel_widget.js

                              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; +export default RightPanelWidget; + diff --git a/package-lock.json b/package-lock.json index b9f0408fee..6e061384e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "trilium", - "version": "0.61.10-beta", + "version": "0.61.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "trilium", - "version": "0.61.10-beta", + "version": "0.61.11", "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { @@ -15,7 +15,7 @@ "@excalidraw/excalidraw": "0.16.1", "archiver": "6.0.1", "async-mutex": "0.4.0", - "axios": "1.5.1", + "axios": "1.6.0", "better-sqlite3": "8.4.0", "chokidar": "3.5.3", "cls-hooked": "4.2.2", @@ -32,7 +32,7 @@ "escape-html": "1.0.3", "express": "4.18.2", "express-partial-content": "1.0.2", - "express-rate-limit": "7.1.2", + "express-rate-limit": "7.1.3", "express-session": "1.17.3", "fs-extra": "11.1.1", "helmet": "7.0.0", @@ -47,7 +47,7 @@ "jimp": "0.22.10", "joplin-turndown-plugin-gfm": "1.0.12", "jsdom": "22.1.0", - "marked": "9.1.2", + "marked": "9.1.5", "mime-types": "2.1.35", "multer": "1.4.5-lts.1", "node-abi": "3.51.0", @@ -94,7 +94,7 @@ "husky": "8.0.3", "jasmine": "5.1.0", "jsdoc": "4.0.2", - "jsonc-eslint-parser": "2.3.0", + "jsonc-eslint-parser": "2.4.0", "lint-staged": "15.0.2", "lorem-ipsum": "2.0.8", "nodemon": "3.0.1", @@ -2474,9 +2474,9 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, "node_modules/axios": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", - "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -5751,14 +5751,14 @@ } }, "node_modules/express-rate-limit": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.1.2.tgz", - "integrity": "sha512-uvkFt5JooXDhUhrfgqXLyIsAMRCtU1o8W/p0Q2p5U2ude7fEOfFaP0kSYbHOHmPbA9ZEm1JqrRne3vL9pVCBXA==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.1.3.tgz", + "integrity": "sha512-BDes6WeNYSGRRGQU8QDNwUnwqaBro28HN/TTweM3RlxXRHDld8RLoH7tbfCxAc0hamQyn6aL0KrfR45+ZxknYg==", "engines": { "node": ">= 16" }, "peerDependencies": { - "express": "^4 || ^5" + "express": "4 || 5 || ^5.0.0-beta.1" } }, "node_modules/express-session": { @@ -8240,9 +8240,9 @@ } }, "node_modules/jsonc-eslint-parser": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/jsonc-eslint-parser/-/jsonc-eslint-parser-2.3.0.tgz", - "integrity": "sha512-9xZPKVYp9DxnM3sd1yAsh/d59iIaswDkai8oTxbursfKYbg/ibjX0IzFt35+VZ8iEW453TVTXztnRvYUQlAfUQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonc-eslint-parser/-/jsonc-eslint-parser-2.4.0.tgz", + "integrity": "sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==", "dev": true, "dependencies": { "acorn": "^8.5.0", @@ -9062,9 +9062,9 @@ } }, "node_modules/marked": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.2.tgz", - "integrity": "sha512-qoKMJqK0w6vkLk8+KnKZAH6neUZSNaQqVZ/h2yZ9S7CbLuFHyS2viB0jnqcWF9UKjwsAbMrQtnQhdmdvOVOw9w==", + "version": "9.1.5", + "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.5.tgz", + "integrity": "sha512-14QG3shv8Kg/xc0Yh6TNkMj90wXH9mmldi5941I2OevfJ/FQAFLEwtwU2/FfgSAOMlWHrEukWSGQf8MiVYNG2A==", "bin": { "marked": "bin/marked.js" }, @@ -15498,9 +15498,9 @@ "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, "axios": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", - "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "requires": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -18015,9 +18015,9 @@ "requires": {} }, "express-rate-limit": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.1.2.tgz", - "integrity": "sha512-uvkFt5JooXDhUhrfgqXLyIsAMRCtU1o8W/p0Q2p5U2ude7fEOfFaP0kSYbHOHmPbA9ZEm1JqrRne3vL9pVCBXA==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-7.1.3.tgz", + "integrity": "sha512-BDes6WeNYSGRRGQU8QDNwUnwqaBro28HN/TTweM3RlxXRHDld8RLoH7tbfCxAc0hamQyn6aL0KrfR45+ZxknYg==", "requires": {} }, "express-session": { @@ -19799,9 +19799,9 @@ "dev": true }, "jsonc-eslint-parser": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/jsonc-eslint-parser/-/jsonc-eslint-parser-2.3.0.tgz", - "integrity": "sha512-9xZPKVYp9DxnM3sd1yAsh/d59iIaswDkai8oTxbursfKYbg/ibjX0IzFt35+VZ8iEW453TVTXztnRvYUQlAfUQ==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonc-eslint-parser/-/jsonc-eslint-parser-2.4.0.tgz", + "integrity": "sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==", "dev": true, "requires": { "acorn": "^8.5.0", @@ -20392,9 +20392,9 @@ "requires": {} }, "marked": { - "version": "9.1.2", - "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.2.tgz", - "integrity": "sha512-qoKMJqK0w6vkLk8+KnKZAH6neUZSNaQqVZ/h2yZ9S7CbLuFHyS2viB0jnqcWF9UKjwsAbMrQtnQhdmdvOVOw9w==" + "version": "9.1.5", + "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.5.tgz", + "integrity": "sha512-14QG3shv8Kg/xc0Yh6TNkMj90wXH9mmldi5941I2OevfJ/FQAFLEwtwU2/FfgSAOMlWHrEukWSGQf8MiVYNG2A==" }, "matcher": { "version": "3.0.0", diff --git a/package.json b/package.json index 8190863ea3..748a536939 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@excalidraw/excalidraw": "0.16.1", "archiver": "6.0.1", "async-mutex": "0.4.0", - "axios": "1.5.1", + "axios": "1.6.0", "better-sqlite3": "8.4.0", "chokidar": "3.5.3", "cls-hooked": "4.2.2", @@ -58,7 +58,7 @@ "escape-html": "1.0.3", "express": "4.18.2", "express-partial-content": "1.0.2", - "express-rate-limit": "7.1.2", + "express-rate-limit": "7.1.3", "express-session": "1.17.3", "fs-extra": "11.1.1", "helmet": "7.0.0", @@ -73,7 +73,7 @@ "jimp": "0.22.10", "joplin-turndown-plugin-gfm": "1.0.12", "jsdom": "22.1.0", - "marked": "9.1.2", + "marked": "9.1.5", "mime-types": "2.1.35", "multer": "1.4.5-lts.1", "node-abi": "3.51.0", @@ -117,7 +117,7 @@ "husky": "8.0.3", "jasmine": "5.1.0", "jsdoc": "4.0.2", - "jsonc-eslint-parser": "2.3.0", + "jsonc-eslint-parser": "2.4.0", "lint-staged": "15.0.2", "lorem-ipsum": "2.0.8", "nodemon": "3.0.1",