Skip to content

Build your personal knowledge base with Trilium Notes

attribute fixes

zadam1810116a340c
diff --git a/src/public/app/services/note_autocomplete.js b/src/public/app/services/note_autocomplete.js
index baa12c604b..af1a6da8bd 100644
--- a/src/public/app/services/note_autocomplete.js
+++ b/src/public/app/services/note_autocomplete.js
@@ -120,6 +120,13 @@ function init() {
}
};
+ $.fn.getSelectedNoteId = function () {
+ const notePath = $(this).getSelectedNotePath();
+ const chunks = notePath.split('/');
+
+ return chunks.length >= 1 ? chunks[chunks.length - 1] : null;
+ }
+
$.fn.setSelectedNotePath = function (notePath) {
notePath = notePath || "";
diff --git a/src/public/app/widgets/attribute_detail.js b/src/public/app/widgets/attribute_detail.js
index 89a0bfbb17..1b56969d04 100644
--- a/src/public/app/widgets/attribute_detail.js
+++ b/src/public/app/widgets/attribute_detail.js
@@ -404,6 +404,9 @@ export default class AttributeDetailWidget extends BasicWidget {
if (this.attrType.endsWith('-definition')) {
this.attribute.value = this.buildDefinitionValue();
}
+ else if (this.attrType === 'relation') {
+ this.attribute.value = this.$attrInputTargetNote.getSelectedNoteId();
+ }
else {
this.attribute.value = this.$attrInputValue.val();
}
diff --git a/src/public/app/widgets/attribute_editor.js b/src/public/app/widgets/attribute_editor.js
index 0418480baf..45c0bd80fa 100644
--- a/src/public/app/widgets/attribute_editor.js
+++ b/src/public/app/widgets/attribute_editor.js
@@ -80,9 +80,8 @@ const mentionSetup = {
});
},
itemRenderer: item => {
- const itemElement = document.createElement('span');
+ const itemElement = document.createElement('button');
- itemElement.classList.add('mentions-item');
itemElement.innerHTML = `${item.highlightedNotePathTitle} `;
return itemElement;
diff --git a/src/public/app/widgets/type_widgets/editable_text.js b/src/public/app/widgets/type_widgets/editable_text.js
index 7c0ebd3df7..143178ec4c 100644
--- a/src/public/app/widgets/type_widgets/editable_text.js
+++ b/src/public/app/widgets/type_widgets/editable_text.js
@@ -30,9 +30,8 @@ const mentionSetup = {
});
},
itemRenderer: item => {
- const itemElement = document.createElement('span');
+ const itemElement = document.createElement('button');
- itemElement.classList.add('mentions-item');
itemElement.innerHTML = `${item.highlightedNotePathTitle} `;
return itemElement;
diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css
index 01750974f9..93c531346f 100644
--- a/src/public/stylesheets/style.css
+++ b/src/public/stylesheets/style.css
@@ -647,16 +647,17 @@ a.external:not(.no-arrow):after, a[href^="http://"]:not(.no-arrow):after, a[href
color: var(--main-text-color) !important;
}
-.mentions-item {
+.ck-mentions .ck-button {
font-size: var(--main-font-size) !important;
+ padding: 5px;
}
-.mentions-item.ck-on {
+.ck-mentions .ck-button.ck-on {
background-color: var(--active-item-background-color) !important;
color: var(--active-item-text-color) !important;
}
-.mentions-item b {
+.ck-mentions .ck-button b {
font-weight: bold !important;
color: inherit !important;
vertical-align: baseline !important;