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
note paths visually distinguishes between different note paths, closes #1669
zadam2cafda5f6695
diff --git a/package-lock.json b/package-lock.jsonindex dfa83a02bd..c7ec5ebc1e 100644--- a/package-lock.json+++ b/package-lock.json@@ -659,9 +659,9 @@"dev": true},"@types/eslint": {- "version": "7.2.6",- "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.6.tgz",- "integrity": "sha512-I+1sYH+NPQ3/tVqCeUSBwTE/0heyvtXqpIopUUArlBm0Kpocb8FbMa3AZ/ASKIFpN3rnEx932TTXDbt9OXsNDw==",+ "version": "7.2.7",+ "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.2.7.tgz",+ "integrity": "sha512-EHXbc1z2GoQRqHaAT7+grxlTJ3WE2YNeD6jlpPoRc83cCoThRY+NUWjCUZaYmk51OICkPXn2hhphcWcWXgNW0Q==","dev": true,"requires": {"@types/estree": "*",@@ -989,9 +989,9 @@}},"acorn": {- "version": "7.4.0",- "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz",- "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w=="+ "version": "8.0.5",+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.0.5.tgz",+ "integrity": "sha512-v+DieK/HJkJOpFBETDJioequtc3PfxsWMaxIdIwujtF7FEV/MAyDQLlm6/zPvr7Mix07mLh6ccVwIsloceodlg=="},"acorn-globals": {"version": "6.0.0",@@ -1000,6 +1000,13 @@"requires": {"acorn": "^7.1.1","acorn-walk": "^7.1.1"+ },+ "dependencies": {+ "acorn": {+ "version": "7.4.1",+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz",+ "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A=="+ }}},"acorn-walk": {@@ -1887,9 +1894,9 @@"dev": true},"caniuse-lite": {- "version": "1.0.30001194",- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001194.tgz",- "integrity": "sha512-iDUOH+oFeBYk5XawYsPtsx/8fFpndAPUQJC7gBTfxHM8xw5nOZv7ceAD4frS1MKCLUac7QL5wdAJiFQlDRjXlA==",+ "version": "1.0.30001197",+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001197.tgz",+ "integrity": "sha512-8aE+sqBqtXz4G8g35Eg/XEaFr2N7rd/VQ6eABGBmNtcB8cN6qNJhMi6oSFy4UWWZgqgL3filHT8Nha4meu3tsw==","dev": true},"caseless": {@@ -2562,9 +2569,9 @@"optional": true},"decimal.js": {- "version": "10.2.0",- "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz",- "integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw=="+ "version": "10.2.1",+ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.1.tgz",+ "integrity": "sha512-KaL7+6Fw6i5A2XSnsbhm/6B+NuEA7TZ4vqxnd5tXz9sbKtrN9Srj8ab4vKVdK8YAqZO9P1kg45Y6YLoduPf+kw=="},"decompress-response": {"version": "3.3.0",@@ -3573,9 +3580,9 @@}},"electron-to-chromium": {- "version": "1.3.679",- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.679.tgz",- "integrity": "sha512-PNF7JSPAEa/aV2nQLvflRcnIMy31EOuCY87Jbdz0KsUf8O/eFNGpuwgQn2DmyJkKzfQb0zrieanRGWvf/4H+BA==",+ "version": "1.3.682",+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.682.tgz",+ "integrity": "sha512-zok2y37qR00U14uM6qBz/3iIjWHom2eRfC2S1StA0RslP7x34jX+j4mxv80t8OEOHLJPVG54ZPeaFxEI7gPrwg==","dev": true},"electron-window-state": {@@ -3707,12 +3714,12 @@"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="},"escodegen": {- "version": "1.14.3",- "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz",- "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==",+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.0.0.tgz",+ "integrity": "sha512-mmHKys/C8BFUGI+MAWNcSYoORYLMdPzjrknd2Vc+bUsjN5bXcr8EhrNB+UTqfL1y3I9c4fw2ihgtMPQLBRiQxw==","requires": {"esprima": "^4.0.1",- "estraverse": "^4.2.0",+ "estraverse": "^5.2.0","esutils": "^2.0.2","optionator": "^0.8.1","source-map": "~0.6.1"@@ -3726,6 +3733,14 @@"requires": {"esrecurse": "^4.3.0","estraverse": "^4.1.1"+ },+ "dependencies": {+ "estraverse": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",+ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==",+ "dev": true+ }}},"esm": {@@ -3746,20 +3761,12 @@"dev": true,"requires": {"estraverse": "^5.2.0"- },- "dependencies": {- "estraverse": {- "version": "5.2.0",- "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",- "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",- "dev": true- }}},"estraverse": {- "version": "4.3.0",- "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz",- "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="+ "version": "5.2.0",+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",+ "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ=="},"esutils": {"version": "2.0.3",@@ -4762,11 +4769,6 @@"integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==","dev": true},- "ip-regex": {- "version": "2.1.0",- "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz",- "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk="- },"ipaddr.js": {"version": "1.9.0","resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz",@@ -5093,42 +5095,42 @@}},"jsdom": {- "version": "16.4.0",- "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.4.0.tgz",- "integrity": "sha512-lYMm3wYdgPhrl7pDcRmvzPhhrGVBeVhPIqeHjzeiHN3DFmD1RBpbExbi8vU7BJdH8VAZYovR8DMt0PNNDM7k8w==",+ "version": "16.5.0",+ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.5.0.tgz",+ "integrity": "sha512-QxZH0nmDTnTTVI0YDm4RUlaUPl5dcyn62G5TMDNfMmTW+J1u1v9gCR8WR+WZ6UghAa7nKJjDOFaI00eMMWvJFQ==","requires": {- "abab": "^2.0.3",- "acorn": "^7.1.1",+ "abab": "^2.0.5",+ "acorn": "^8.0.5","acorn-globals": "^6.0.0","cssom": "^0.4.4",- "cssstyle": "^2.2.0",+ "cssstyle": "^2.3.0","data-urls": "^2.0.0",- "decimal.js": "^10.2.0",+ "decimal.js": "^10.2.1","domexception": "^2.0.1",- "escodegen": "^1.14.1",+ "escodegen": "^2.0.0","html-encoding-sniffer": "^2.0.1","is-potential-custom-element-name": "^1.0.0","nwsapi": "^2.2.0",- "parse5": "5.1.1",+ "parse5": "6.0.1","request": "^2.88.2",- "request-promise-native": "^1.0.8",- "saxes": "^5.0.0",+ "request-promise-native": "^1.0.9",+ "saxes": "^5.0.1","symbol-tree": "^3.2.4",- "tough-cookie": "^3.0.1",+ "tough-cookie": "^4.0.0","w3c-hr-time": "^1.0.2","w3c-xmlserializer": "^2.0.0","webidl-conversions": "^6.1.0","whatwg-encoding": "^1.0.5","whatwg-mimetype": "^2.3.0","whatwg-url": "^8.0.0",- "ws": "^7.2.3",+ "ws": "^7.4.4","xml-name-validator": "^3.0.0"},"dependencies": {"parse5": {- "version": "5.1.1",- "resolved": "https://registry.npmjs.org/parse5/-/parse5-5.1.1.tgz",- "integrity": "sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug=="+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",+ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="}}},@@ -7726,13 +7728,13 @@"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="},"tough-cookie": {- "version": "3.0.1",- "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz",- "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==",+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",+ "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==","requires": {- "ip-regex": "^2.1.0",- "psl": "^1.1.28",- "punycode": "^2.1.1"+ "psl": "^1.1.33",+ "punycode": "^2.1.1",+ "universalify": "^0.1.2"}},"tr46": {@@ -8097,9 +8099,9 @@"integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w=="},"webpack": {- "version": "5.24.3",- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.24.3.tgz",- "integrity": "sha512-x7lrWZ7wlWAdyKdML6YPvfVZkhD1ICuIZGODE5SzKJjqI9A4SpqGTjGJTc6CwaHqn19gGaoOR3ONJ46nYsn9rw==",+ "version": "5.24.4",+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.24.4.tgz",+ "integrity": "sha512-RXOdxF9hFFFhg47BryCgyFrEyyu7Y/75/uiI2DoUiTMqysK+WczVSTppvkR47oZcmI/DPaXCiCiaXBP8QjkNpA==","dev": true,"requires": {"@types/eslint-scope": "^3.7.0",@@ -8127,12 +8129,6 @@"webpack-sources": "^2.1.1"},"dependencies": {- "acorn": {- "version": "8.0.5",- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.0.5.tgz",- "integrity": "sha512-v+DieK/HJkJOpFBETDJioequtc3PfxsWMaxIdIwujtF7FEV/MAyDQLlm6/zPvr7Mix07mLh6ccVwIsloceodlg==",- "dev": true- },"graceful-fs": {"version": "4.2.6","resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz",@@ -8205,9 +8201,9 @@"integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g=="},"whatwg-url": {- "version": "8.2.2",- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.2.2.tgz",- "integrity": "sha512-PcVnO6NiewhkmzV0qn7A+UZ9Xx4maNTI+O+TShmfE4pqjoCMwUMjkvoNhNHPTvgR7QH9Xt3R13iHuWy2sToFxQ==",+ "version": "8.4.0",+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.4.0.tgz",+ "integrity": "sha512-vwTUFf6V4zhcPkWp/4CQPr1TW9Ml6SF4lVyaIMBdJw5i6qUUJ1QWM4Z6YYVkfka0OUIzVo/0aNtGVGk256IKWw==","requires": {"lodash.sortby": "^4.7.0","tr46": "^2.0.2",diff --git a/package.json b/package.jsonindex 6d4f27bbc0..75fe677911 100644--- a/package.json+++ b/package.json@@ -51,7 +51,7 @@"is-animated": "^2.0.1","is-svg": "4.2.1","jimp": "0.16.1",- "jsdom": "^16.4.0",+ "jsdom": "16.5.0","mime-types": "2.1.29","multer": "1.4.2","node-abi": "2.21.0",@@ -87,7 +87,7 @@"jsdoc": "3.6.6","lorem-ipsum": "2.0.3","rcedit": "3.0.0",- "webpack": "5.24.3",+ "webpack": "5.24.4","webpack-cli": "4.5.0"},"optionalDependencies": {diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.jsindex 6b7a4b40d1..a97b74155a 100644--- a/src/public/app/entities/note_short.js+++ b/src/public/app/entities/note_short.js@@ -300,7 +300,7 @@ class NoteShort {}});- return notePaths.map(rec => rec.notePath);+ return notePaths;}__filterAttrs(attributes, type, name) {diff --git a/src/public/app/services/tree.js b/src/public/app/services/tree.jsindex 4eb6d32ed8..ee4b5bb83f 100644--- a/src/public/app/services/tree.js+++ b/src/public/app/services/tree.js@@ -101,7 +101,7 @@ function getSomeNotePathSegments(note, hoistedNotePath = 'root') {const notePaths = note.getSortedNotePaths(hoistedNotePath);- return notePaths[0];+ return notePaths[0].notePath;}function getSomeNotePath(note, hoistedNotePath = 'root') {diff --git a/src/public/app/widgets/note_paths.js b/src/public/app/widgets/note_paths.jsindex 73241e76dd..495dae8a8e 100644--- a/src/public/app/widgets/note_paths.js+++ b/src/public/app/widgets/note_paths.js@@ -15,12 +15,20 @@ const TPL = `}.note-path-list {- max-height: 600px;+ max-height: 700px;overflow-y: auto;}- .note-path-list .current {- text-decoration: underline;+ .note-path-list .path-current {+ font-weight: bold;+ }++ .note-path-list .path-archived {+ color: var(--muted-text-color) !important;+ }++ .note-path-list .path-search {+ font-style: italic;}</style>@@ -47,14 +55,12 @@ export default class NotePathsWidget extends TabAwareWidget {);if (this.noteId === 'root') {- await this.addPath('root', true);+ await this.addPath('root');return;}- for (const notePath of this.note.getSortedNotePaths(this.hoistedNoteId)) {- const notePathStr = notePath.join('/');-console.log(notePathStr, this.notePath, notePathStr === this.notePath);- await this.addPath(notePathStr, notePathStr === this.notePath);+ for (const notePathRecord of this.note.getSortedNotePaths(this.hoistedNoteId)) {+ await this.addPath(notePathRecord);}const cloneLink = $("<div>")@@ -68,7 +74,9 @@ console.log(notePathStr, this.notePath, notePathStr === this.notePath);this.$notePathList.append(cloneLink);}- async addPath(notePath, isCurrent) {+ async addPath(notePathRecord) {+ const notePath = notePathRecord.notePath.join('/');+const title = await treeService.getNotePathTitle(notePath);const $noteLink = await linkService.createNoteLink(notePath, {title});@@ -80,8 +88,33 @@ console.log(notePathStr, this.notePath, notePathStr === this.notePath);.find('a').addClass("no-tooltip-preview");- if (isCurrent) {- $noteLink.addClass("current");+ const comments = [];++ if (this.notePath === notePath) {+ $noteLink.addClass("path-current");+ }++ if (notePathRecord.isInHoistedSubTree) {+ $noteLink.addClass("path-in-hoisted-subtree");+ }+ else {+ comments.push("outside of hoisting");+ }++ if (notePathRecord.isArchived) {+ $noteLink.addClass("path-archived");++ comments.push("archived");+ }++ if (notePathRecord.isSearch) {+ $noteLink.addClass("path-search");++ comments.push("search");+ }++ if (comments.length > 0) {+ $noteLink.append(` (${comments.join(', ')})`);}this.$notePathList.append($noteLink);