diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml index fe895b409..b55ffea4b 100644 --- a/.github/actions/build-electron/action.yml +++ b/.github/actions/build-electron/action.yml @@ -15,13 +15,22 @@ runs: if: ${{ inputs.os == 'macos' }} shell: bash run: brew install python-setuptools - - name: Install rpm on Ubuntu for RPM package building + - name: Install dependencies for RPM and Flatpak package building if: ${{ inputs.os == 'linux' }} shell: bash - run: sudo apt install rpm + run: | + sudo apt-get update && sudo apt-get install rpm flatpak-builder elfutils + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + FLATPAK_ARCH=$(if [[ ${{ inputs.arch }} = 'arm64' ]]; then echo 'aarch64'; else echo 'x86_64'; fi) + FLATPAK_VERSION='24.08' + flatpak install --user --no-deps --arch $FLATPAK_ARCH --assumeyes runtime/org.freedesktop.Platform/$FLATPAK_ARCH/$FLATPAK_VERSION runtime/org.freedesktop.Sdk/$FLATPAK_ARCH/$FLATPAK_VERSION org.electronjs.Electron2.BaseApp/$FLATPAK_ARCH/$FLATPAK_VERSION - name: Install dependencies shell: bash run: npm ci + - name: Temporary Flatpak arm64 workaround till https://github.com/electron/forge/pull/3839 is merged + if: ${{ inputs.os == 'linux' && inputs.arch == 'arm64' }} + shell: bash + run: sed -e "s/case 'armv7l'/case 'arm64'/g" -e "s/return 'arm'/return 'aarch64'/g" -i node_modules/@electron-forge/maker-flatpak/dist/MakerFlatpak.js - name: Update build info shell: bash run: npm run update-build-info diff --git a/.github/actions/build-server/action.yml b/.github/actions/build-server/action.yml index 162116e87..694005c1b 100644 --- a/.github/actions/build-server/action.yml +++ b/.github/actions/build-server/action.yml @@ -25,4 +25,4 @@ runs: run: | mkdir -p upload file=$(find dist -name '*.tar.xz' -print -quit) - cp "$file" "upload/TriliumNextNotes-linux-${{ inputs.arch }}-${{ github.ref_name }}.tar.xz" + cp "$file" "upload/TriliumNextNotes-Server-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}.tar.xz" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b9ec71b1..b19145ca1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -26,7 +26,7 @@ jobs: extension: [dmg, zip] - name: linux image: ubuntu-latest - extension: [deb, rpm, zip] + extension: [deb, rpm, zip, flatpak] - name: windows image: windows-latest extension: exe @@ -53,6 +53,7 @@ jobs: with: name: TriliumNextNotes ${{ matrix.os.name }} ${{ matrix.arch }}.${{matrix.os.extension}} path: upload/*.${{ matrix.os.extension }} + build_linux_server: name: Build Linux Server strategy: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 22a6b26b6..2b1fbe57e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -23,7 +23,7 @@ jobs: extension: [dmg, zip] - name: linux image: ubuntu-latest - extension: [deb, rpm, zip] + extension: [deb, rpm, zip, flatpak] - name: windows image: windows-latest extension: exe @@ -49,11 +49,14 @@ jobs: - name: Publish release uses: softprops/action-gh-release@v2 with: - draft: true + make_latest: false + prerelease: true + draft: false fail_on_unmatched_files: true files: upload/*.* tag_name: nightly name: Nightly Build + nightly-server: name: Deploy server nightly strategy: @@ -77,7 +80,9 @@ jobs: - name: Publish release uses: softprops/action-gh-release@v2 with: - draft: true + make_latest: false + prerelease: true + draft: false fail_on_unmatched_files: true files: upload/*.* tag_name: nightly diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5cfcae17..b7625a706 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: extension: [dmg, zip] - name: linux image: ubuntu-latest - extension: [deb, rpm, zip] + extension: [deb, rpm, zip, flatpak] - name: windows image: windows-latest extension: exe @@ -46,6 +46,7 @@ jobs: draft: true fail_on_unmatched_files: true files: upload/*.* + build_linux_server-x64: name: Build Linux Server strategy: diff --git a/.gitignore b/.gitignore index 09804755d..bbfb24483 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ src/public/app-dist/ npm-debug.log yarn-error.log po-*/ +.flatpak-builder/ *.db !integration-tests/db/document.db diff --git a/README.md b/README.md index 1800f667e..e2a81aa4c 100644 --- a/README.md +++ b/README.md @@ -118,8 +118,10 @@ Head on over to our [Docs repo](https://github.com/TriliumNext/Docs) ## 🤝 Support -You can support the original Trilium developer using GitHub Sponsors, [PayPal](https://paypal.me/za4am) or Bitcoin (bitcoin:bc1qv3svjn40v89mnkre5vyvs2xw6y8phaltl385d2). -Support for the TriliumNext organization will be possible in the near future. +Support for the TriliumNext organization will be possible in the near future. For now, you can: +- Support continued development on TriliumNext by supporting our developers: [eliandoran](https://github.com/sponsors/eliandoran) (See the [repository insights]([developers]([url](https://github.com/TriliumNext/Notes/graphs/contributors))) for a full list) +- Show a token of gratitude to the original Trilium developer ([zadam](https://github.com/sponsors/zadam)) via [PayPal](https://paypal.me/za4am) or Bitcoin (bitcoin:bc1qv3svjn40v89mnkre5vyvs2xw6y8phaltl385d2). + ## 🔑 License diff --git a/db/demo.zip b/db/demo.zip index b972fedd2..39c0875fe 100644 Binary files a/db/demo.zip and b/db/demo.zip differ diff --git a/forge.config.cjs b/forge.config.cjs index b3765a35b..91000d63c 100644 --- a/forge.config.cjs +++ b/forge.config.cjs @@ -7,6 +7,7 @@ const extraResourcesForPlatform = getExtraResourcesForPlatform(); const baseLinuxMakerConfigOptions = { icon: "./images/app-icons/png/128x128.png", desktopTemplate: path.resolve("./bin/electron-forge/desktop.ejs"), + categories: ["Office", "Utility"] }; module.exports = { @@ -59,6 +60,29 @@ module.exports = { } } }, + { + name: "@electron-forge/maker-flatpak", + config: { + options: { + ...baseLinuxMakerConfigOptions, + id: "com.triliumnext.notes", + runtimeVersion: "24.08", + base: "org.electronjs.Electron2.BaseApp", + baseVersion: "24.08", + baseFlatpakref: "https://flathub.org/repo/flathub.flatpakrepo", + modules: [ + { + name: "zypak", + sources: { + type: "git", + url: "https://github.com/refi64/zypak", + tag: "v2024.01.17" + } + } + ] + }, + } + }, { name: "@electron-forge/maker-rpm", config: { diff --git a/images/app-icons/win/setup.ico b/images/app-icons/win/setup.ico index 34dd447c5..671c19e7a 100644 Binary files a/images/app-icons/win/setup.ico and b/images/app-icons/win/setup.ico differ diff --git a/images/icon-installer.svg b/images/icon-installer.svg index 9edc6b331..3886e7904 100644 --- a/images/icon-installer.svg +++ b/images/icon-installer.svg @@ -1,124 +1,125 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package-lock.json b/package-lock.json index 80f8f05b1..c945393fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -108,6 +108,7 @@ "@electron-forge/cli": "7.6.1", "@electron-forge/maker-deb": "7.6.1", "@electron-forge/maker-dmg": "7.6.1", + "@electron-forge/maker-flatpak": "7.6.1", "@electron-forge/maker-rpm": "7.6.1", "@electron-forge/maker-squirrel": "7.6.1", "@electron-forge/maker-zip": "7.6.1", @@ -152,7 +153,7 @@ "@types/yargs": "17.0.33", "@vitest/coverage-v8": "3.0.5", "cross-env": "7.0.3", - "electron": "34.0.2", + "electron": "34.1.0", "esm": "3.2.25", "jasmine": "5.5.0", "jsdoc": "4.0.4", @@ -781,6 +782,52 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/@electron-forge/maker-flatpak": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@electron-forge/maker-flatpak/-/maker-flatpak-7.6.1.tgz", + "integrity": "sha512-a9EekF8cNzjizwMs8HObxRii2tkLrTcTNMvWNhQqcJohEkJV81zNOLu9l/OdIMlKQ9cF5SuRvA4/m2bQGfT80w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@electron-forge/maker-base": "7.6.1", + "@electron-forge/shared-types": "7.6.1", + "fs-extra": "^10.0.0" + }, + "engines": { + "node": ">= 16.4.0" + }, + "optionalDependencies": { + "@malept/electron-installer-flatpak": "^0.11.4" + } + }, + "node_modules/@electron-forge/maker-flatpak/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@electron-forge/maker-flatpak/node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/@electron-forge/maker-rpm": { "version": "7.6.1", "resolved": "https://registry.npmjs.org/@electron-forge/maker-rpm/-/maker-rpm-7.6.1.tgz", @@ -2752,6 +2799,203 @@ "node": ">= 12.13.0" } }, + "node_modules/@malept/electron-installer-flatpak": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/@malept/electron-installer-flatpak/-/electron-installer-flatpak-0.11.4.tgz", + "integrity": "sha512-ZdwhT4WeeJWdnsmALUtQ7bn4pzYVh0Vg+4NnF1S3n3OACc9IWg+B+LxI5gT3XSXIrxogouqkjM6gD8S592awyA==", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin", + "linux" + ], + "dependencies": { + "@malept/flatpak-bundler": "^0.4.0", + "debug": "^4.1.1", + "electron-installer-common": "^0.10.0", + "lodash": "^4.17.15", + "semver": "^7.1.1", + "yargs": "^16.0.0" + }, + "bin": { + "electron-installer-flatpak": "bin/electron-installer-flatpak.js" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@malept/electron-installer-flatpak/node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "license": "ISC", + "optional": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/@malept/flatpak-bundler": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@malept/flatpak-bundler/-/flatpak-bundler-0.4.0.tgz", + "integrity": "sha512-9QOtNffcOF/c1seMCDnjckb3R9WHcG34tky+FHpNKKCW0wc/scYLwMtO+ptyGUfMW0/b/n4qRiALlaFHc9Oj7Q==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.0", + "lodash": "^4.17.15", + "tmp-promise": "^3.0.2" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@malept/flatpak-bundler/node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/@mermaid-js/layout-elk": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/@mermaid-js/layout-elk/-/layout-elk-0.1.7.tgz", @@ -7666,9 +7910,9 @@ } }, "node_modules/electron": { - "version": "34.0.2", - "resolved": "https://registry.npmjs.org/electron/-/electron-34.0.2.tgz", - "integrity": "sha512-u3F+DSUlg9NaGS+9qnYmSRN8VjAnc3LJDDk1ye1uISJnh4gjG76y3681qLowsPMx4obvCP2eBINnmbLo0yT5WA==", + "version": "34.1.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-34.1.0.tgz", + "integrity": "sha512-ZUid8XrGPA0dfes97PPADc8ecWOUX/qYRNp1glze9coZLEYc+PsMvgjVDCHSvjfHfiI+V3unwngSVpBouX71YQ==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -8387,9 +8631,9 @@ } }, "node_modules/electron/node_modules/@types/node": { - "version": "20.17.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.16.tgz", - "integrity": "sha512-vOTpLduLkZXePLxHiHsBLp98mHGnl8RptV4YAO3HfKO5UHjDvySGbxKtpYfy8Sx5+WKcgc45qNreJJRVM3L6mw==", + "version": "20.17.17", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.17.tgz", + "integrity": "sha512-/WndGO4kIfMicEQLTi/mDANUu/iVUhT7KboZPdEqqHQ4aTS+3qT3U5gIqWDFV+XouorjfgGqvKILJeHhuQgFYg==", "license": "MIT", "dependencies": { "undici-types": "~6.19.2" diff --git a/package.json b/package.json index 8bdc25874..47b2337a1 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,7 @@ "@electron-forge/cli": "7.6.1", "@electron-forge/maker-deb": "7.6.1", "@electron-forge/maker-dmg": "7.6.1", + "@electron-forge/maker-flatpak": "7.6.1", "@electron-forge/maker-rpm": "7.6.1", "@electron-forge/maker-squirrel": "7.6.1", "@electron-forge/maker-zip": "7.6.1", @@ -194,7 +195,7 @@ "@types/yargs": "17.0.33", "@vitest/coverage-v8": "3.0.5", "cross-env": "7.0.3", - "electron": "34.0.2", + "electron": "34.1.0", "esm": "3.2.25", "jasmine": "5.5.0", "jsdoc": "4.0.4", diff --git a/spec/support/becca_mocking.ts b/spec/support/becca_mocking.ts index 0c65f16b6..db2382cd5 100644 --- a/spec/support/becca_mocking.ts +++ b/spec/support/becca_mocking.ts @@ -4,14 +4,14 @@ import BAttribute from "../../src/becca/entities/battribute.js"; import becca from "../../src/becca/becca.js"; import randtoken from "rand-token"; import type SearchResult from "../../src/services/search/search_result.js"; -import type { NoteType } from "../../src/becca/entities/rows.js"; +import type { NoteRow, NoteType } from "../../src/becca/entities/rows.js"; randtoken.generator({ source: "crypto" }); -function findNoteByTitle(searchResults: Array, title: string): BNote | undefined { +export function findNoteByTitle(searchResults: Array, title: string): BNote | undefined { return searchResults.map((sr) => becca.notes[sr.noteId]).find((note) => note.title === title); } -class NoteBuilder { +export class NoteBuilder { note: BNote; constructor(note: BNote) { this.note = note; @@ -55,11 +55,11 @@ class NoteBuilder { } } -function id() { +export function id() { return randtoken.generate(10); } -function note(title: string, extraParams = {}) { +export function note(title: string, extraParams: Partial = {}) { const row = Object.assign( { noteId: id(), @@ -74,9 +74,3 @@ function note(title: string, extraParams = {}) { return new NoteBuilder(note); } - -export default { - NoteBuilder, - findNoteByTitle, - note -}; diff --git a/src/public/app/services/attribute_renderer.ts b/src/public/app/services/attribute_renderer.ts index 6c7b9412d..f09ecf8f9 100644 --- a/src/public/app/services/attribute_renderer.ts +++ b/src/public/app/services/attribute_renderer.ts @@ -79,7 +79,7 @@ async function renderAttributes(attributes: FAttribute[], renderIsInheritable: b return $container; } -const HIDDEN_ATTRIBUTES = ["originalFileName", "fileSize", "template", "inherit", "cssClass", "iconClass", "pageSize", "viewType"]; +const HIDDEN_ATTRIBUTES = ["originalFileName", "fileSize", "template", "inherit", "cssClass", "iconClass", "pageSize", "viewType", "geolocation"]; async function renderNormalAttributes(note: FNote) { const promotedDefinitionAttributes = note.getPromotedDefinitionAttributes(); diff --git a/src/public/app/services/content_renderer.ts b/src/public/app/services/content_renderer.ts index 546d836d2..18aafdb4f 100644 --- a/src/public/app/services/content_renderer.ts +++ b/src/public/app/services/content_renderer.ts @@ -238,12 +238,16 @@ async function renderMermaid(note: FNote, $renderedContent: JQuery) * @param {FNote} note * @returns {Promise} */ -async function renderChildrenList($renderedContent: JQuery, note: FNote) { +async function renderChildrenList($renderedContent: JQuery, note: FNote) { + let childNoteIds = note.getChildNoteIds(); + + if (!childNoteIds.length) { + return; + } + $renderedContent.css("padding", "10px"); $renderedContent.addClass("text-with-ellipsis"); - let childNoteIds = note.getChildNoteIds(); - if (childNoteIds.length > 10) { childNoteIds = childNoteIds.slice(0, 10); } diff --git a/src/public/app/services/link.ts b/src/public/app/services/link.ts index 581f30ff6..2edccdd55 100644 --- a/src/public/app/services/link.ts +++ b/src/public/app/services/link.ts @@ -376,6 +376,10 @@ function linkContextMenu(e: PointerEvent) { const $link = $(e.target as any).closest("a"); const url = $link.attr("href") || $link.attr("data-href"); + if ($link.attr("data-no-context-menu")) { + return; + } + const { notePath, viewScope } = parseNavigationStateFromUrl(url); if (!notePath) { diff --git a/src/public/app/services/note_tooltip.ts b/src/public/app/services/note_tooltip.ts index 179ded65a..28937f3e2 100644 --- a/src/public/app/services/note_tooltip.ts +++ b/src/public/app/services/note_tooltip.ts @@ -140,10 +140,6 @@ async function renderTooltip(note: FNote | null) { } const noteTitleWithPathAsSuffix = await treeService.getNoteTitleWithPathAsSuffix(bestNotePath); - let content = ""; - if (noteTitleWithPathAsSuffix) { - content = `
${noteTitleWithPathAsSuffix.prop("outerHTML")}
`; - } const { $renderedAttributes } = await attributeRenderer.renderNormalAttributes(note); @@ -151,8 +147,21 @@ async function renderTooltip(note: FNote | null) { tooltip: true, trim: true }); + const isContentEmpty = ($renderedContent[0].innerHTML.length === 0); - content = `${content}
${$renderedAttributes[0].outerHTML}
${$renderedContent[0].outerHTML}`; + let content = ""; + if (noteTitleWithPathAsSuffix) { + const classes = [ "note-tooltip-title" ]; + if (isContentEmpty) { + classes.push("note-no-content"); + } + content = `
${noteTitleWithPathAsSuffix.prop("outerHTML")}
`; + } + + content = `${content}
${$renderedAttributes[0].outerHTML}
`; + if (!isContentEmpty) { + content += $renderedContent[0].outerHTML; + } return content; } diff --git a/src/public/app/widgets/attribute_widgets/attribute_detail.ts b/src/public/app/widgets/attribute_widgets/attribute_detail.ts index c5c56102e..866cff805 100644 --- a/src/public/app/widgets/attribute_widgets/attribute_detail.ts +++ b/src/public/app/widgets/attribute_widgets/attribute_detail.ts @@ -13,7 +13,7 @@ import appContext from "../../components/app_context.js"; import type { Attribute } from "../../services/attribute_parser.js"; const TPL = ` -
+
' - ); + const $helpButton = $(` + ' - ); + const $helpButton = $(` + + `); utils.initHelpButtons($helpButton); const noteLink = await linkService.createLink(this.noteId); // do separately to avoid race condition between empty() and .append() @@ -52,7 +53,7 @@ export default class AttachmentListTypeWidget extends TypeWidget { this.$linksWrapper.empty().append( $("
").append(t("attachment_list.owning_note"), noteLink), - $("
").append( + $(`
`).append( $('