diff --git a/src/public/app/services/attribute_parser.js b/src/public/app/services/attribute_parser.js
index 2f01b6daf..0513e11d6 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.js
index 3ef204027..054e68bec 100644
--- a/src/public/app/widgets/attribute_detail.js
+++ b/src/public/app/widgets/attribute_detail.js
@@ -121,6 +121,8 @@ const TPL = `
+
+
@@ -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.js
index 1b3e5320e..87f69acf6 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.js
index 6f63d2461..5ed72ce04 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);
}