Skip to content

Build your personal knowledge base with Trilium Notes

make sure the attribute is not duplicated in TreeCache and NoteCache, #1278

zadamcba9b92202e0
diff --git a/src/entities/note.js b/src/entities/note.js
index 1db0e8abb6..873a997e1b 100644
--- a/src/entities/note.js
+++ b/src/entities/note.js
@@ -373,6 +373,7 @@ class Note extends Entity {
return false;
}
+ // FIXME: this code is quite questionable, one problem is that other caches (TreeCache, NoteCache) have nothing like that
if (attr.isDefinition()) {
const firstDefinitionIndex = attributes.findIndex(el => el.type === attr.type && el.name === attr.name);
diff --git a/src/public/app/entities/note_short.js b/src/public/app/entities/note_short.js
index 384e4f35dc..a3e23112da 100644
--- a/src/public/app/entities/note_short.js
+++ b/src/public/app/entities/note_short.js
@@ -205,7 +205,16 @@ class NoteShort {
}
}
- noteAttributeCache.attributes[this.noteId] = attrArrs.flat();
+ noteAttributeCache.attributes[this.noteId] = [];
+ const addedAttributeIds = new Set();
+
+ for (const attr of attrArrs.flat()) {
+ if (!addedAttributeIds.has(attr.attributeId)) {
+ addedAttributeIds.add(attr.attributeId);
+
+ noteAttributeCache.attributes[this.noteId].push(attr);
+ }
+ }
}
return noteAttributeCache.attributes[this.noteId];
diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css
index dc1cfa22c4..6d96c7795f 100644
--- a/src/public/stylesheets/style.css
+++ b/src/public/stylesheets/style.css
@@ -852,7 +852,10 @@ ul.fancytree-container li {
contain: layout paint;
}
-/** ckeditor's autocomplete */
+/**
+ ckeditor's autocomplete
+ should be higher than 1070 of tooltip
+*/
.ck.ck-balloon-panel {
- z-index: 1001;
+ z-index: 1101;
}
diff --git a/src/services/note_cache/entities/note.js b/src/services/note_cache/entities/note.js
index 0ed575941b..6793ad476d 100644
--- a/src/services/note_cache/entities/note.js
+++ b/src/services/note_cache/entities/note.js
@@ -92,7 +92,18 @@ class Note {
}
}
- this.attributeCache = parentAttributes.concat(templateAttributes);
+ this.attributeCache = [];
+
+ const addedAttributeIds = new Set();
+
+ for (const attr of parentAttributes.concat(templateAttributes)) {
+ if (!addedAttributeIds.has(attr.attributeId)) {
+ addedAttributeIds.add(attr.attributeId);
+
+ this.attributeCache.push(attr);
+ }
+ }
+
this.inheritableAttributeCache = [];
for (const attr of this.attributeCache) {
diff --git a/src/services/note_cache/similarity.js b/src/services/note_cache/similarity.js
index 28619c9442..d80d399e63 100644
--- a/src/services/note_cache/similarity.js
+++ b/src/services/note_cache/similarity.js
@@ -106,6 +106,10 @@ function buildRewardMap(note) {
addToRewardMap(attr.name, reward);
}
+ if (attr.name === 'cliptype') {
+ reward /= 2;
+ }
+
let value = attr.value;
if (value.startsWith('http')) {