Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
import and export fixes
zadamca41806bc212
diff --git a/package-lock.json b/package-lock.jsonindex e940be6d7a..3c05b86da8 100644--- a/package-lock.json+++ b/package-lock.json@@ -40,7 +40,7 @@"html": "1.0.0","html2plaintext": "2.1.4","http-proxy-agent": "7.0.0",- "https-proxy-agent": "7.0.0",+ "https-proxy-agent": "7.0.1","image-type": "4.1.0","ini": "3.0.1","is-animated": "2.0.2",@@ -79,7 +79,7 @@},"devDependencies": {"cross-env": "7.0.3",- "electron": "25.2.0",+ "electron": "25.3.0","electron-builder": "24.4.0","electron-packager": "17.1.1","electron-rebuild": "3.2.9",@@ -88,7 +88,7 @@"eslint-config-prettier": "8.8.0","eslint-plugin-import": "2.27.5","eslint-plugin-jsonc": "2.9.0",- "eslint-plugin-prettier": "4.2.1",+ "eslint-plugin-prettier": "5.0.0","esm": "3.2.25","husky": "8.0.3","jasmine": "5.0.2",@@ -1363,6 +1363,56 @@"node": ">=14"}},+ "node_modules/@pkgr/utils": {+ "version": "2.4.2",+ "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz",+ "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==",+ "dev": true,+ "dependencies": {+ "cross-spawn": "^7.0.3",+ "fast-glob": "^3.3.0",+ "is-glob": "^4.0.3",+ "open": "^9.1.0",+ "picocolors": "^1.0.0",+ "tslib": "^2.6.0"+ },+ "engines": {+ "node": "^12.20.0 || ^14.18.0 || >=16.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/unts"+ }+ },+ "node_modules/@pkgr/utils/node_modules/define-lazy-prop": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",+ "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",+ "dev": true,+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/@pkgr/utils/node_modules/open": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz",+ "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==",+ "dev": true,+ "dependencies": {+ "default-browser": "^4.0.0",+ "define-lazy-prop": "^3.0.0",+ "is-inside-container": "^1.0.0",+ "is-wsl": "^2.2.0"+ },+ "engines": {+ "node": ">=14.16"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/@sindresorhus/is": {"version": "4.6.0","resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",@@ -2487,6 +2537,15 @@"prebuild-install": "^7.1.0"}},+ "node_modules/big-integer": {+ "version": "1.6.51",+ "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",+ "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==",+ "dev": true,+ "engines": {+ "node": ">=0.6"+ }+ },"node_modules/binary-extensions": {"version": "2.2.0","resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",@@ -2612,6 +2671,18 @@"integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==","optional": true},+ "node_modules/bplist-parser": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",+ "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==",+ "dev": true,+ "dependencies": {+ "big-integer": "^1.6.44"+ },+ "engines": {+ "node": ">= 5.10.0"+ }+ },"node_modules/brace-expansion": {"version": "1.1.11","resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",@@ -2803,6 +2874,21 @@"node": ">= 10.0.0"}},+ "node_modules/bundle-name": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz",+ "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==",+ "dev": true,+ "dependencies": {+ "run-applescript": "^5.0.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/busboy": {"version": "1.6.0","resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",@@ -3918,6 +4004,40 @@"node": ">=0.10.0"}},+ "node_modules/default-browser": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz",+ "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==",+ "dev": true,+ "dependencies": {+ "bundle-name": "^3.0.0",+ "default-browser-id": "^3.0.0",+ "execa": "^7.1.1",+ "titleize": "^3.0.0"+ },+ "engines": {+ "node": ">=14.16"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/default-browser-id": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz",+ "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==",+ "dev": true,+ "dependencies": {+ "bplist-parser": "^0.2.0",+ "untildify": "^4.0.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/defaults": {"version": "1.0.3","resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",@@ -4237,9 +4357,9 @@}},"node_modules/electron": {- "version": "25.2.0",- "resolved": "https://registry.npmjs.org/electron/-/electron-25.2.0.tgz",- "integrity": "sha512-I/rhcW2sV2fyiveVSBr2N7v5ZiCtdGY0UiNCDZgk2fpSC+irQjbeh7JT2b4vWmJ2ogOXBjqesrN9XszTIG6DHg==",+ "version": "25.3.0",+ "resolved": "https://registry.npmjs.org/electron/-/electron-25.3.0.tgz",+ "integrity": "sha512-cyqotxN+AroP5h2IxUsJsmehYwP5LrFAOO7O7k9tILME3Sa1/POAg3shrhx4XEnaAMyMqMLxzGvkzCVxzEErnA==","hasInstallScript": true,"dependencies": {"@electron/get": "^2.0.0",@@ -5253,21 +5373,29 @@}},"node_modules/eslint-plugin-prettier": {- "version": "4.2.1",- "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz",- "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==",+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz",+ "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==","dev": true,"dependencies": {- "prettier-linter-helpers": "^1.0.0"+ "prettier-linter-helpers": "^1.0.0",+ "synckit": "^0.8.5"},"engines": {- "node": ">=12.0.0"+ "node": "^14.18.0 || >=16.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/prettier"},"peerDependencies": {- "eslint": ">=7.28.0",- "prettier": ">=2.0.0"+ "@types/eslint": ">=8.0.0",+ "eslint": ">=8.0.0",+ "prettier": ">=3.0.0"},"peerDependenciesMeta": {+ "@types/eslint": {+ "optional": true+ },"eslint-config-prettier": {"optional": true}@@ -5851,6 +5979,22 @@"integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==","dev": true},+ "node_modules/fast-glob": {+ "version": "3.3.0",+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz",+ "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==",+ "dev": true,+ "dependencies": {+ "@nodelib/fs.stat": "^2.0.2",+ "@nodelib/fs.walk": "^1.2.3",+ "glob-parent": "^5.1.2",+ "merge2": "^1.3.0",+ "micromatch": "^4.0.4"+ },+ "engines": {+ "node": ">=8.6.0"+ }+ },"node_modules/fast-json-stable-stringify": {"version": "2.0.0","resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",@@ -6916,9 +7060,9 @@}},"node_modules/https-proxy-agent": {- "version": "7.0.0",- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.0.tgz",- "integrity": "sha512-0euwPCRyAPSgGdzD1IVN9nJYHtBhJwb6XPfbpQcYbPCwrBidX6GzxmchnaF4sfF/jPb74Ojx5g4yTg3sixlyPw==",+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.1.tgz",+ "integrity": "sha512-Eun8zV0kcYS1g19r78osiQLEFIRspRUDd9tIfBCTBPBeMieF/EsJNL8VI3xOIdYRDEkjQnqOYPsZ2DsWsVsFwQ==","dependencies": {"agent-base": "^7.0.2","debug": "4"@@ -7357,6 +7501,39 @@"node": ">=0.10.0"}},+ "node_modules/is-inside-container": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",+ "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",+ "dev": true,+ "dependencies": {+ "is-docker": "^3.0.0"+ },+ "bin": {+ "is-inside-container": "cli.js"+ },+ "engines": {+ "node": ">=14.16"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/is-inside-container/node_modules/is-docker": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",+ "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",+ "dev": true,+ "bin": {+ "is-docker": "cli.js"+ },+ "engines": {+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/is-interactive": {"version": "1.0.0","resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",@@ -8805,6 +8982,15 @@"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==","dev": true},+ "node_modules/merge2": {+ "version": "1.4.1",+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",+ "dev": true,+ "engines": {+ "node": ">= 8"+ }+ },"node_modules/methods": {"version": "1.1.2","resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",@@ -10823,6 +11009,98 @@"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz","integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw=="},+ "node_modules/run-applescript": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz",+ "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==",+ "dev": true,+ "dependencies": {+ "execa": "^5.0.0"+ },+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/run-applescript/node_modules/execa": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",+ "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",+ "dev": true,+ "dependencies": {+ "cross-spawn": "^7.0.3",+ "get-stream": "^6.0.0",+ "human-signals": "^2.1.0",+ "is-stream": "^2.0.0",+ "merge-stream": "^2.0.0",+ "npm-run-path": "^4.0.1",+ "onetime": "^5.1.2",+ "signal-exit": "^3.0.3",+ "strip-final-newline": "^2.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sindresorhus/execa?sponsor=1"+ }+ },+ "node_modules/run-applescript/node_modules/get-stream": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",+ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",+ "dev": true,+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/run-applescript/node_modules/human-signals": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",+ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",+ "dev": true,+ "engines": {+ "node": ">=10.17.0"+ }+ },+ "node_modules/run-applescript/node_modules/is-stream": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",+ "dev": true,+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/run-applescript/node_modules/npm-run-path": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",+ "dev": true,+ "dependencies": {+ "path-key": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/run-applescript/node_modules/strip-final-newline": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",+ "dev": true,+ "engines": {+ "node": ">=6"+ }+ },"node_modules/run-parallel": {"version": "1.2.0","resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",@@ -11777,6 +12055,22 @@"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz","integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="},+ "node_modules/synckit": {+ "version": "0.8.5",+ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz",+ "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==",+ "dev": true,+ "dependencies": {+ "@pkgr/utils": "^2.3.1",+ "tslib": "^2.5.0"+ },+ "engines": {+ "node": "^14.18.0 || >=16.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/unts"+ }+ },"node_modules/tapable": {"version": "2.2.1","resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",@@ -12003,6 +12297,18 @@"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz","integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="},+ "node_modules/titleize": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz",+ "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==",+ "dev": true,+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/tmp": {"version": "0.2.1","resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",@@ -12177,9 +12483,9 @@}},"node_modules/tslib": {- "version": "2.4.0",- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",- "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="+ "version": "2.6.0",+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz",+ "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA=="},"node_modules/tsscmp": {"version": "1.0.6",@@ -12378,6 +12684,15 @@"node": ">= 0.8"}},+ "node_modules/untildify": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",+ "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==",+ "dev": true,+ "engines": {+ "node": ">=8"+ }+ },"node_modules/unused-filename": {"version": "2.1.0","resolved": "https://registry.npmjs.org/unused-filename/-/unused-filename-2.1.0.tgz",@@ -13952,6 +14267,40 @@"integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==","optional": true},+ "@pkgr/utils": {+ "version": "2.4.2",+ "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.2.tgz",+ "integrity": "sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==",+ "dev": true,+ "requires": {+ "cross-spawn": "^7.0.3",+ "fast-glob": "^3.3.0",+ "is-glob": "^4.0.3",+ "open": "^9.1.0",+ "picocolors": "^1.0.0",+ "tslib": "^2.6.0"+ },+ "dependencies": {+ "define-lazy-prop": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",+ "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",+ "dev": true+ },+ "open": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/open/-/open-9.1.0.tgz",+ "integrity": "sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==",+ "dev": true,+ "requires": {+ "default-browser": "^4.0.0",+ "define-lazy-prop": "^3.0.0",+ "is-inside-container": "^1.0.0",+ "is-wsl": "^2.2.0"+ }+ }+ }+ },"@sindresorhus/is": {"version": "4.6.0","resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz",@@ -14881,6 +15230,12 @@"prebuild-install": "^7.1.0"}},+ "big-integer": {+ "version": "1.6.51",+ "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",+ "integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==",+ "dev": true+ },"binary-extensions": {"version": "2.2.0","resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",@@ -14994,6 +15349,15 @@"integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==","optional": true},+ "bplist-parser": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.2.0.tgz",+ "integrity": "sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==",+ "dev": true,+ "requires": {+ "big-integer": "^1.6.44"+ }+ },"brace-expansion": {"version": "1.1.11","resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",@@ -15151,6 +15515,15 @@"sax": "^1.2.4"}},+ "bundle-name": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-3.0.0.tgz",+ "integrity": "sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==",+ "dev": true,+ "requires": {+ "run-applescript": "^5.0.0"+ }+ },"busboy": {"version": "1.6.0","resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",@@ -15982,6 +16355,28 @@"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz","integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg=="},+ "default-browser": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-4.0.0.tgz",+ "integrity": "sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==",+ "dev": true,+ "requires": {+ "bundle-name": "^3.0.0",+ "default-browser-id": "^3.0.0",+ "execa": "^7.1.1",+ "titleize": "^3.0.0"+ }+ },+ "default-browser-id": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-3.0.0.tgz",+ "integrity": "sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==",+ "dev": true,+ "requires": {+ "bplist-parser": "^0.2.0",+ "untildify": "^4.0.0"+ }+ },"defaults": {"version": "1.0.3","resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz",@@ -16222,9 +16617,9 @@}},"electron": {- "version": "25.2.0",- "resolved": "https://registry.npmjs.org/electron/-/electron-25.2.0.tgz",- "integrity": "sha512-I/rhcW2sV2fyiveVSBr2N7v5ZiCtdGY0UiNCDZgk2fpSC+irQjbeh7JT2b4vWmJ2ogOXBjqesrN9XszTIG6DHg==",+ "version": "25.3.0",+ "resolved": "https://registry.npmjs.org/electron/-/electron-25.3.0.tgz",+ "integrity": "sha512-cyqotxN+AroP5h2IxUsJsmehYwP5LrFAOO7O7k9tILME3Sa1/POAg3shrhx4XEnaAMyMqMLxzGvkzCVxzEErnA==","requires": {"@electron/get": "^2.0.0","@types/node": "^18.11.18",@@ -17096,12 +17491,13 @@}},"eslint-plugin-prettier": {- "version": "4.2.1",- "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz",- "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==",+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz",+ "integrity": "sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==","dev": true,"requires": {- "prettier-linter-helpers": "^1.0.0"+ "prettier-linter-helpers": "^1.0.0",+ "synckit": "^0.8.5"}},"eslint-scope": {@@ -17423,6 +17819,19 @@"integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==","dev": true},+ "fast-glob": {+ "version": "3.3.0",+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.0.tgz",+ "integrity": "sha512-ChDuvbOypPuNjO8yIDf36x7BlZX1smcUMTTcyoIjycexOxd6DFsKsg21qVBzEmr3G7fUKIRy2/psii+CIUt7FA==",+ "dev": true,+ "requires": {+ "@nodelib/fs.stat": "^2.0.2",+ "@nodelib/fs.walk": "^1.2.3",+ "glob-parent": "^5.1.2",+ "merge2": "^1.3.0",+ "micromatch": "^4.0.4"+ }+ },"fast-json-stable-stringify": {"version": "2.0.0","resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",@@ -18243,9 +18652,9 @@}},"https-proxy-agent": {- "version": "7.0.0",- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.0.tgz",- "integrity": "sha512-0euwPCRyAPSgGdzD1IVN9nJYHtBhJwb6XPfbpQcYbPCwrBidX6GzxmchnaF4sfF/jPb74Ojx5g4yTg3sixlyPw==",+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.1.tgz",+ "integrity": "sha512-Eun8zV0kcYS1g19r78osiQLEFIRspRUDd9tIfBCTBPBeMieF/EsJNL8VI3xOIdYRDEkjQnqOYPsZ2DsWsVsFwQ==","requires": {"agent-base": "^7.0.2","debug": "4"@@ -18555,6 +18964,23 @@"is-extglob": "^2.1.1"}},+ "is-inside-container": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",+ "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",+ "dev": true,+ "requires": {+ "is-docker": "^3.0.0"+ },+ "dependencies": {+ "is-docker": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",+ "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",+ "dev": true+ }+ }+ },"is-interactive": {"version": "1.0.0","resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz",@@ -19633,6 +20059,12 @@"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==","dev": true},+ "merge2": {+ "version": "1.4.1",+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",+ "dev": true+ },"methods": {"version": "1.1.2","resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",@@ -21152,6 +21584,67 @@"resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz","integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw=="},+ "run-applescript": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-5.0.0.tgz",+ "integrity": "sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==",+ "dev": true,+ "requires": {+ "execa": "^5.0.0"+ },+ "dependencies": {+ "execa": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",+ "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",+ "dev": true,+ "requires": {+ "cross-spawn": "^7.0.3",+ "get-stream": "^6.0.0",+ "human-signals": "^2.1.0",+ "is-stream": "^2.0.0",+ "merge-stream": "^2.0.0",+ "npm-run-path": "^4.0.1",+ "onetime": "^5.1.2",+ "signal-exit": "^3.0.3",+ "strip-final-newline": "^2.0.0"+ }+ },+ "get-stream": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",+ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",+ "dev": true+ },+ "human-signals": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",+ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",+ "dev": true+ },+ "is-stream": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",+ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",+ "dev": true+ },+ "npm-run-path": {+ "version": "4.0.1",+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",+ "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",+ "dev": true,+ "requires": {+ "path-key": "^3.0.0"+ }+ },+ "strip-final-newline": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",+ "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",+ "dev": true+ }+ }+ },"run-parallel": {"version": "1.2.0","resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",@@ -21868,6 +22361,16 @@"resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz","integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw=="},+ "synckit": {+ "version": "0.8.5",+ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz",+ "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==",+ "dev": true,+ "requires": {+ "@pkgr/utils": "^2.3.1",+ "tslib": "^2.5.0"+ }+ },"tapable": {"version": "2.2.1","resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",@@ -22043,6 +22546,12 @@"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz","integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="},+ "titleize": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/titleize/-/titleize-3.0.0.tgz",+ "integrity": "sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==",+ "dev": true+ },"tmp": {"version": "0.2.1","resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz",@@ -22179,9 +22688,9 @@}},"tslib": {- "version": "2.4.0",- "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz",- "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ=="+ "version": "2.6.0",+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz",+ "integrity": "sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA=="},"tsscmp": {"version": "1.0.6",@@ -22337,6 +22846,12 @@"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz","integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="},+ "untildify": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",+ "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==",+ "dev": true+ },"unused-filename": {"version": "2.1.0","resolved": "https://registry.npmjs.org/unused-filename/-/unused-filename-2.1.0.tgz",diff --git a/package.json b/package.jsonindex bbaba9a9cf..5d41279ed3 100644--- a/package.json+++ b/package.json@@ -61,7 +61,7 @@"html": "1.0.0","html2plaintext": "2.1.4","http-proxy-agent": "7.0.0",- "https-proxy-agent": "7.0.0",+ "https-proxy-agent": "7.0.1","image-type": "4.1.0","ini": "3.0.1","is-animated": "2.0.2",@@ -97,7 +97,7 @@},"devDependencies": {"cross-env": "7.0.3",- "electron": "25.2.0",+ "electron": "25.3.0","electron-builder": "24.4.0","electron-packager": "17.1.1","electron-rebuild": "3.2.9",@@ -106,7 +106,7 @@"eslint-config-prettier": "8.8.0","eslint-plugin-import": "2.27.5","eslint-plugin-jsonc": "2.9.0",- "eslint-plugin-prettier": "4.2.1",+ "eslint-plugin-prettier": "5.0.0","esm": "3.2.25","husky": "8.0.3","jsonc-eslint-parser": "2.3.0",diff --git a/src/routes/api/attachments.js b/src/routes/api/attachments.jsindex e8fcbac81a..8ef0bcc305 100644--- a/src/routes/api/attachments.js+++ b/src/routes/api/attachments.js@@ -55,7 +55,7 @@ function uploadAttachment(req) {content: file.buffer});- url = `#${noteId}?viewMode=attachments&attachmentId=${attachment.attachmentId}`;+ url = `#root/${noteId}?viewMode=attachments&attachmentId=${attachment.attachmentId}`;}return {diff --git a/src/services/export/single.js b/src/services/export/single.jsindex 7d2852b269..7d2b92b7b2 100644--- a/src/services/export/single.js+++ b/src/services/export/single.js@@ -65,6 +65,23 @@ function exportSingleNote(taskContext, branch, format, res) {}function inlineAttachments(content) {+ content = content.replace(/src="[^"]*api\/images\/([a-zA-Z0-9_]+)\/?[^"]+"/g, (match, noteId) => {+ const note = becca.getNote(noteId);+ if (!note || !note.mime.startsWith('image/')) {+ return match;+ }++ const imageContent = note.getContent();+ if (!Buffer.isBuffer(imageContent)) {+ return match;+ }++ const base64Content = imageContent.toString('base64');+ const srcValue = `data:${note.mime};base64,${base64Content}`;++ return `src="${srcValue}"`;+ });+content = content.replace(/src="[^"]*api\/attachments\/([a-zA-Z0-9_]+)\/image\/?[^"]+"/g, (match, attachmentId) => {const attachment = becca.getAttachment(attachmentId);if (!attachment || !attachment.mime.startsWith('image/')) {diff --git a/src/services/import/zip.js b/src/services/import/zip.jsindex b0af9b678a..3fad97c4cc 100644--- a/src/services/import/zip.js+++ b/src/services/import/zip.js@@ -267,9 +267,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) {return noteId;}- /**- * @returns {{attachmentId: string}|{noteId: string}}- */+ /** @returns {{attachmentId: string}|{noteId: string}} */function getEntityIdFromRelativeUrl(url, filePath) {while (url.startsWith("./")) {url = url.substr(2);@@ -293,7 +291,8 @@ async function importZip(taskContext, fileBuffer, importRootNote) {if (attachmentMeta) {return {- attachmentId: getNewAttachmentId(attachmentMeta.attachmentId)+ attachmentId: getNewAttachmentId(attachmentMeta.attachmentId),+ noteId: getNewNoteId(noteMeta.noteId)};} else { // don't check for noteMeta since it's not mandatory for notesreturn {@@ -343,10 +342,10 @@ async function importZip(taskContext, fileBuffer, importRootNote) {const target = getEntityIdFromRelativeUrl(url, filePath);- if (target.noteId) {- return `src="api/images/${target.noteId}/${path.basename(url)}"`;- } else if (target.attachmentId) {+ if (target.attachmentId) {return `src="api/attachments/${target.attachmentId}/image/${path.basename(url)}"`;+ } else if (target.noteId) {+ return `src="api/images/${target.noteId}/${path.basename(url)}"`;} else {return match;}@@ -367,13 +366,13 @@ async function importZip(taskContext, fileBuffer, importRootNote) {const target = getEntityIdFromRelativeUrl(url, filePath);- if (!target.noteId) {+ if (target.attachmentId) {+ return `href="#root/${target.noteId}?viewMode=attachments&attachmentId=${target.attachmentId}"`;+ } else if (target.noteId) {+ return `href="#root/${target.noteId}"`;+ } else {return match;}-- // FIXME for linking attachments-- return `href="#root/${target.noteId}"`;});if (noteMeta) {diff --git a/src/services/notes.js b/src/services/notes.jsindex ebc7c0f1e1..85f6c00bfe 100644--- a/src/services/notes.js+++ b/src/services/notes.js@@ -22,6 +22,7 @@ const ValidationError = require("../errors/validation_error");const noteTypesService = require("./note_types");const fs = require("fs");const ws = require("./ws");+const html2plaintext = require('html2plaintext')/** @param {BNote} parentNote */function getNewNotePosition(parentNote) {@@ -504,10 +505,6 @@ function replaceUrl(content, url, attachment) {}function downloadImages(noteId, content) {- if (!optionService.getOptionBool("downloadImagesAutomatically")) {- return content;- }-const imageRe = /<img[^>]*?\ssrc=['"]([^'">]+)['"]/ig;let imageMatch;@@ -520,16 +517,20 @@ function downloadImages(noteId, content) {const imageBuffer = Buffer.from(imageBase64, 'base64');const imageService = require('../services/image');- const {note} = imageService.saveImage(noteId, imageBuffer, "inline image", true, true);+ const attachment = imageService.saveImageToAttachment(noteId, imageBuffer, "inline image", true, true);- const sanitizedTitle = note.title.replace(/[^a-z0-9-.]/gi, "");+ const sanitizedTitle = attachment.title.replace(/[^a-z0-9-.]/gi, "");- content = `${content.substr(0, imageMatch.index)}<img src="api/images/${note.noteId}/${sanitizedTitle}"${content.substr(imageMatch.index + imageMatch[0].length)}`;+ content = `${content.substr(0, imageMatch.index)}<img src="api/attachments/${attachment.attachmentId}/image/${sanitizedTitle}"${content.substr(imageMatch.index + imageMatch[0].length)}`;}else if (!url.includes('api/images/') && !/api\/attachments\/.+\/image\/?.*/.test(url)// this is an exception for the web clipper's "imageId"&& (url.length !== 20 || url.toLowerCase().startsWith('http'))) {+ if (!optionService.getOptionBool("downloadImagesAutomatically")) {+ continue;+ }+if (url in imageUrlToAttachmentIdMapping) {const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]);@@ -599,6 +600,39 @@ function downloadImages(noteId, content) {return content;}+/**+ * @param {BNote} note+ * @param {string} content+ */+function saveAttachments(note, content) {+ const inlineAttachmentRe = /<a[^>]*?\shref=['"]data:([^;'">]+);base64,([^'">]+)['"][^>]*>(.*?)<\/a>/igm;+ let attachmentMatch;++ while (attachmentMatch = inlineAttachmentRe.exec(content)) {+ const mime = attachmentMatch[1].toLowerCase();++ const base64data = attachmentMatch[2];+ const buffer = Buffer.from(base64data, 'base64');++ const title = html2plaintext(attachmentMatch[3]);++ const attachment = note.saveAttachment({+ role: 'file',+ mime: mime,+ title: title,+ content: buffer+ });++ content = `${content.substr(0, attachmentMatch.index)}<a class="reference-link" href="#root/${note.noteId}?viewMode=attachments&attachmentId=${attachment.attachmentId}">${title}</a>${content.substr(attachmentMatch.index + attachmentMatch[0].length)}`;+ }++ return content;+}++/**+ * @param {BNote} note+ * @param {string} content+ */function saveLinks(note, content) {if ((note.type !== 'text' && note.type !== 'relationMap')|| (note.isProtected && !protectedSessionService.isProtectedSessionAvailable())) {@@ -613,6 +647,7 @@ function saveLinks(note, content) {if (note.type === 'text') {content = downloadImages(note.noteId, content);+ content = saveAttachments(note, content);content = findImageLinks(content, foundLinks);content = findInternalLinks(content, foundLinks);