attribute fixes

This commit is contained in:
zadam 2020-08-12 23:39:05 +02:00
parent eaac65142f
commit 1810116a34
5 changed files with 16 additions and 7 deletions

View file

@ -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 || "";

View file

@ -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();
}

View file

@ -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;

View file

@ -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;

View file

@ -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;