Skip to content

Build your personal knowledge base with Trilium Notes

add symbol to shared notes in the tree

zadam94e18dfb7cf7
diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js
index f004a32398..749d8986dd 100644
--- a/src/public/app/entities/note_short.js
+++ b/src/public/app/entities/note_short.js
@@ -778,6 +778,26 @@ class NoteShort {
throw new Error(`Unrecognized env type ${env} for note ${this.noteId}`);
}
}
+
+ isShared() {
+ for (const parentNoteId of this.parents) {
+ if (parentNoteId === 'root' || parentNoteId === 'none') {
+ continue;
+ }
+
+ const parentNote = froca.notes[parentNoteId];
+
+ if (!parentNote) {
+ continue;
+ }
+
+ if (parentNote.noteId === 'share' || parentNote.isShared()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
}
export default NoteShort;
diff --git a/src/public/app/widgets/note_tree.js b/src/public/app/widgets/note_tree.js
index a9538645db..859d2d9877 100644
--- a/src/public/app/widgets/note_tree.js
+++ b/src/public/app/widgets/note_tree.js
@@ -661,7 +661,10 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
extraClasses.push("protected");
}
- if (note.getParentNoteIds().length > 1) {
+ if (note.isShared()) {
+ extraClasses.push("shared");
+ }
+ else if (note.getParentNoteIds().length > 1) {
const notSearchParents = note.getParentNoteIds()
.map(noteId => froca.notes[noteId])
.filter(note => !!note)
diff --git a/src/public/app/widgets/shared_info.js b/src/public/app/widgets/shared_info.js
index 646b3c4f59..143a083be1 100644
--- a/src/public/app/widgets/shared_info.js
+++ b/src/public/app/widgets/shared_info.js
@@ -50,5 +50,8 @@ export default class SharedInfoWidget extends NoteContextAwareWidget {
if (loadResults.getAttributes().find(attr => attr.name.startsWith("share") && attributeService.isAffecting(attr, this.note))) {
this.refresh();
}
+ else if (loadResults.getBranches().find(branch => branch.noteId === this.noteId)) {
+ this.refresh();
+ }
}
}
diff --git a/src/public/stylesheets/tree.css b/src/public/stylesheets/tree.css
index f3b4ca6195..ac1fae7667 100644
--- a/src/public/stylesheets/tree.css
+++ b/src/public/stylesheets/tree.css
@@ -135,7 +135,11 @@ span.fancytree-node.protected > span.fancytree-custom-icon {
}
span.fancytree-node.multiple-parents .fancytree-title::after {
- content: " *"
+ content: " *";
+}
+
+span.fancytree-node.shared .fancytree-title::after {
+ content: " \2197";
}
span.fancytree-node.fancytree-active-clone:not(.fancytree-active) .fancytree-title {