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
global link map WIP
zadamdd37f0930957
diff --git a/package-lock.json b/package-lock.jsonindex b86febd1e5..6906c9f532 100644--- a/package-lock.json+++ b/package-lock.json@@ -1365,9 +1365,9 @@}},"better-sqlite3": {- "version": "7.1.4",- "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.1.4.tgz",- "integrity": "sha512-9BvUSm8/xSyxZbnWpcRAwEZsfTK0196qi4592N5WoVMM3dAH9g0E3/colX0dxhGVSLcVfkiBUoCEBkFz8uvySw==",+ "version": "7.4.3",+ "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.4.3.tgz",+ "integrity": "sha512-07bKjClZg/f4KMVRkzWtoIvazVPcF1gsvVKVIXlxwleC2DxuIhnra3KCMlUT1rFeRYXXckot2a46UciF2d9KLw==","requires": {"bindings": "^1.5.0","prebuild-install": "^6.0.1",@@ -1899,9 +1899,9 @@"dev": true},"caniuse-lite": {- "version": "1.0.30001256",- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001256.tgz",- "integrity": "sha512-QirrvMLmB4txNnxiaG/xbm6FSzv9LqOZ3Jp9VtCYb3oPIfCHpr/oGn38pFq0udwlkctvXQgPthaXqJ76DaYGnA==",+ "version": "1.0.30001258",+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001258.tgz",+ "integrity": "sha512-RBByOG6xWXUp0CR2/WU2amXz3stjKpSl5J1xU49F1n2OxD//uBZO4wCKUiG+QMGf7CHGfDDcqoKriomoGVxTeA==","dev": true},"caseless": {@@ -2901,9 +2901,9 @@},"dependencies": {"@types/node": {- "version": "14.17.15",- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.15.tgz",- "integrity": "sha512-D1sdW0EcSCmNdLKBGMYb38YsHUS6JcM7yQ6sLQ9KuZ35ck7LYCKE7kYFHOO59ayFOY3zobWVZxf4KXhYHcHYFA==",+ "version": "14.17.17",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.17.tgz",+ "integrity": "sha512-niAjcewgEYvSPCZm3OaM9y6YQrL2SEPH9PymtE6fuZAvFiP6ereCcvApGl2jKTq7copTIguX3PBvfP08LN4LvQ==","dev": true}}@@ -3586,9 +3586,9 @@}},"electron-to-chromium": {- "version": "1.3.836",- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.836.tgz",- "integrity": "sha512-Ney3pHOJBWkG/AqYjrW0hr2AUCsao+2uvq9HUlRP8OlpSdk/zOHOUJP7eu0icDvePC9DlgffuelP4TnOJmMRUg==",+ "version": "1.3.843",+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.843.tgz",+ "integrity": "sha512-OWEwAbzaVd1Lk9MohVw8LxMXFlnYd9oYTYxfX8KS++kLLjDfbovLOcEEXwRhG612dqGQ6+44SZvim0GXuBRiKg==","dev": true},"electron-window-state": {@@ -4996,9 +4996,9 @@"dev": true},"jest-worker": {- "version": "27.1.1",- "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.1.1.tgz",- "integrity": "sha512-XJKCL7tu+362IUYTWvw8+3S75U7qMiYiRU6u5yqscB48bTvzwN6i8L/7wVTXiFLwkRsxARNM7TISnTvcgv9hxA==",+ "version": "27.2.0",+ "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.2.0.tgz",+ "integrity": "sha512-laB0ZVIBz+voh/QQy9dmUuuDsadixeerrKqyVpgPz+CCWiOYjOBabUXHIXZhsdvkWbLqSHbgkAHWl5cg24Q6RA==","dev": true,"requires": {"@types/node": "*",@@ -7485,9 +7485,9 @@"dev": true},"tapable": {- "version": "2.2.0",- "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz",- "integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==",+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",+ "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==","dev": true},"tar": {@@ -7561,14 +7561,14 @@}},"terser": {- "version": "5.7.2",- "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.2.tgz",- "integrity": "sha512-0Omye+RD4X7X69O0eql3lC4Heh/5iLj3ggxR/B5ketZLOtLiOqukUgjw3q4PDnNQbsrkKr3UMypqStQG3XKRvw==",+ "version": "5.8.0",+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.8.0.tgz",+ "integrity": "sha512-f0JH+6yMpneYcRJN314lZrSwu9eKkUFEHLN/kNy8ceh8gaRiLgFPJqrB9HsXjhEGdv4e/ekjTOFxIlL6xlma8A==","dev": true,"requires": {"commander": "^2.20.0","source-map": "~0.7.2",- "source-map-support": "~0.5.19"+ "source-map-support": "~0.5.20"},"dependencies": {"commander": {@@ -7582,6 +7582,24 @@"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz","integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==","dev": true+ },+ "source-map-support": {+ "version": "0.5.20",+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.20.tgz",+ "integrity": "sha512-n1lZZ8Ve4ksRqizaBQgxXDgKwttHDhyfQjA6YZZn8+AroHbsIz+JjwxQDxbp+7y5OYCI8t1Yk7etjD9CRd2hIw==",+ "dev": true,+ "requires": {+ "buffer-from": "^1.0.0",+ "source-map": "^0.6.0"+ },+ "dependencies": {+ "source-map": {+ "version": "0.6.1",+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",+ "dev": true+ }+ }}}},@@ -8041,9 +8059,9 @@"integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w=="},"webpack": {- "version": "5.52.1",- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.52.1.tgz",- "integrity": "sha512-wkGb0hLfrS7ML3n2xIKfUIwHbjB6gxwQHyLmVHoAqEQBw+nWo+G6LoHL098FEXqahqximsntjBLuewStrnJk0g==",+ "version": "5.53.0",+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.53.0.tgz",+ "integrity": "sha512-RZ1Z3z3ni44snoWjfWeHFyzvd9HMVYDYC5VXmlYUT6NWgEOWdCNpad5Fve2CzzHoRED7WtsKe+FCyP5Vk4pWiQ==","dev": true,"requires": {"@types/eslint-scope": "^3.7.0",@@ -8112,9 +8130,9 @@}},"webpack-sources": {- "version": "3.2.0",- "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.0.tgz",- "integrity": "sha512-fahN08Et7P9trej8xz/Z7eRu8ltyiygEo/hnRi9KqBUs80KeDcnf96ZJo++ewWd84fEf3xSX9bp4ZS9hbw0OBw==",+ "version": "3.2.1",+ "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.1.tgz",+ "integrity": "sha512-t6BMVLQ0AkjBOoRTZgqrWm7xbXMBzD+XDq2EZ96+vMfn3qKgsvdXZhbPZ4ElUOpdv4u+iiGe+w3+J75iy/bYGA==","dev": true},"whatwg-encoding": {diff --git a/package.json b/package.jsonindex 658302368f..8db25fd4d5 100644--- a/package.json+++ b/package.json@@ -27,7 +27,7 @@"archiver": "5.3.0","async-mutex": "0.3.2","axios": "0.21.4",- "better-sqlite3": "7.1.4",+ "better-sqlite3": "7.4.3","body-parser": "1.19.0","chokidar": "3.5.2","cls-hooked": "4.2.2",diff --git a/src/becca/entities/note.js b/src/becca/entities/note.jsindex f6db3e718a..d148363d74 100644--- a/src/becca/entities/note.js+++ b/src/becca/entities/note.js@@ -233,6 +233,8 @@ class Note extends AbstractEntity {}}+ console.log("POJO update", pojo);+sql.upsert("note_contents", "noteId", pojo);const hash = utils.hash(this.noteId + "|" + pojo.content.toString());diff --git a/src/public/app/widgets/note_detail.js b/src/public/app/widgets/note_detail.jsindex 7747e049f0..a0e5019d3e 100644--- a/src/public/app/widgets/note_detail.js+++ b/src/public/app/widgets/note_detail.js@@ -63,6 +63,11 @@ export default class NoteDetailWidget extends NoteContextAwareWidget {const dto = note.dto;dto.content = this.getTypeWidget().getContent();+ // for read only notes+ if (dto.content === undefined) {+ return;+ }+protectedSessionHolder.touchProtectedSessionIfNecessary(note);await server.put('notes/' + noteId, dto, this.componentId);diff --git a/src/public/app/widgets/type_widgets/global_link_map.js b/src/public/app/widgets/type_widgets/global_link_map.jsindex c5aaf23ceb..042d5b7945 100644--- a/src/public/app/widgets/type_widgets/global_link_map.js+++ b/src/public/app/widgets/type_widgets/global_link_map.js@@ -1,13 +1,31 @@import TypeWidget from "./type_widget.js";import libraryLoader from "../../services/library_loader.js";import server from "../../services/server.js";+import attributeService from "../../services/attributes.js";-const TPL = `<div class="note-detail-global-link-map note-detail-printable">+const TPL = `<div class="note-detail-global-link-map note-detail-printable" style="position: relative;"><style>.type-special .note-detail, .note-detail-global-link-map {height: 100%;}++ .map-switcher {+ position: absolute;+ top: 10px;+ right: 10px;+ background-color: var(--accented-background-color);+ z-index: 1000;+ }++ .map-switcher .bx {+ font-size: x-large;+ }</style>++ <div class="btn-group btn-group-sm map-switcher" role="group">+ <button type="button" class="btn btn-secondary" title="Link Map" data-type="link"><span class="bx bx-network-chart"></span></button>+ <button type="button" class="btn btn-secondary" title="Tree map" data-type="tree"><span class="bx bx-sitemap"></span></button>+ </div><div class="link-map-container"></div></div>`;@@ -22,6 +40,12 @@ export default class GlobalLinkMapTypeWidget extends TypeWidget {window.addEventListener('resize', () => this.setFullHeight(), false);+ this.$widget.find(".map-switcher button").on("click", async e => {+ const type = $(e.target).closest("button").attr("data-type");++ await attributeService.setLabel(this.noteId, 'mapType', type);+ });+super.doRender();}@@ -47,6 +71,8 @@ export default class GlobalLinkMapTypeWidget extends TypeWidget {async doRefresh(note) {this.$widget.show();+ this.mapType = this.note.getLabelValue("mapType") === "tree" ? "tree" : "link";+this.setFullHeight();await libraryLoader.requireLibrary(libraryLoader.FORCE_GRAPH);@@ -268,4 +294,8 @@ export default class GlobalLinkMapTypeWidget extends TypeWidget {setTimeout(() => this.graph.zoomToFit(400, zoomPadding), 1000);}}++ cleanup() {+ this.$container.html('');+ }}diff --git a/src/services/consistency_checks.js b/src/services/consistency_checks.jsindex 7816e471c5..a6ddffa021 100644--- a/src/services/consistency_checks.js+++ b/src/services/consistency_checks.js@@ -328,9 +328,10 @@ class ConsistencyChecks {({noteId, type, mime}) => {if (this.autoFix) {const note = becca.getNote(noteId);- note.setContent(getBlankContent(false, type, mime));+ const blankContent = getBlankContent(false, type, mime);+ note.setContent(blankContent);- logFix(`Note ${noteId} content was set to empty string since it was null even though it is not deleted`);+ logFix(`Note ${noteId} content was set to "${blankContent}" since it was null even though it is not deleted`);} else {logError(`Note ${noteId} content is null even though it is not deleted`);}