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
adding a button to the detail to explicitly save changes.
zadamaa4a645670f5
diff --git a/src/public/app/services/attribute_parser.js b/src/public/app/services/attribute_parser.jsindex 2f01b6dafa..0513e11d63 100644--- a/src/public/app/services/attribute_parser.js+++ b/src/public/app/services/attribute_parser.js@@ -203,7 +203,7 @@ function parser(tokens, str, allowEmptyRelations = false) {attr.endIndex = tokens[i].endIndex;}else {- throw new Error(`Unrecognized attribute "${text}" in ${context(i)}`);+ throw new Error(`Invalid attribute "${text}" in ${context(i)}`);}}diff --git a/src/public/app/widgets/attribute_detail.js b/src/public/app/widgets/attribute_detail.jsindex 3ef2040273..054e68becf 100644--- a/src/public/app/widgets/attribute_detail.js+++ b/src/public/app/widgets/attribute_detail.js@@ -121,6 +121,8 @@ const TPL = `</tr></table>+ <button class="btn btn-primary btn-sm attr-save-changes-and-close-button" style="width: 100%; margin-top: 15px;">Save & close</button>+<div class="related-notes-container"><br/>@@ -199,6 +201,13 @@ export default class AttributeDetailWidget extends BasicWidget {this.$closeAttrDetailButton = this.$widget.find('.close-attr-detail-button');this.$attrIsOwnedBy = this.$widget.find('.attr-is-owned-by');+ this.$saveAndCloseButton = this.$widget.find('.attr-save-changes-and-close-button');+ this.$saveAndCloseButton.on('click', async () => {+ await this.triggerCommand('saveAttributes');++ this.hide();+ });+this.$closeAttrDetailButton.on('click', () => this.hide());$(window).on('mouseup', e => {@@ -388,6 +397,10 @@ export default class AttributeDetailWidget extends BasicWidget {if (this.attrType === 'label-definition') {props.push(this.$attrInputLabelType.val());++ if (this.$attrInputLabelType.val() === 'number' && this.$attrInputNumberPrecision.val() !== '') {+ props.push('precision=' + this.$attrInputNumberPrecision.val());+ }} else if (this.attrType === 'relation-definition' && this.$attrInputInverseRelation.val().trim().length > 0) {props.push("inverse=" + this.$attrInputInverseRelation.val());}diff --git a/src/public/app/widgets/attribute_editor.js b/src/public/app/widgets/attribute_editor.jsindex 1b3e5320e9..87f69acf6c 100644--- a/src/public/app/widgets/attribute_editor.js+++ b/src/public/app/widgets/attribute_editor.js@@ -17,7 +17,7 @@ const TPL = `padding: 0 0 0 5px !important;margin: 0 !important;color: var(--muted-text-color);- max-height: 200px;+ max-height: 100px;overflow: auto;}@@ -282,12 +282,12 @@ export default class AttributeEditorWidget extends TabAwareWidget {}async save() {- this.$saveAttributesButton.fadeOut();-const attributes = this.parseAttributes();if (attributes) {await server.put(`notes/${this.noteId}/attributes`, attributes, this.componentId);++ this.$saveAttributesButton.fadeOut();}}diff --git a/src/public/app/widgets/attribute_list.js b/src/public/app/widgets/attribute_list.jsindex 6f63d24617..5ed72ce044 100644--- a/src/public/app/widgets/attribute_list.js+++ b/src/public/app/widgets/attribute_list.js@@ -184,6 +184,10 @@ export default class AttributeListWidget extends TabAwareWidget {}}+ async saveAttributesCommand() {+ await this.attributeEditorWidget.save();+ }+updateAttributeListCommand({attributes}) {this.attributeEditorWidget.updateAttributeList(attributes);}