diff --git a/src/public/app/widgets/attribute_detail.js b/src/public/app/widgets/attribute_detail.js
index 126485f72..263feaa22 100644
--- a/src/public/app/widgets/attribute_detail.js
+++ b/src/public/app/widgets/attribute_detail.js
@@ -69,7 +69,7 @@ const TPL = `
-
+
@@ -190,7 +190,7 @@ const ATTR_HELP = {
"disableInclusion": "scripts with this label won't be included into parent script execution.",
"sorted": "keeps child notes sorted by title alphabetically",
"hidePromotedAttributes": "Hide promoted attributes on this note",
- "readOnly": "editor is in read only mode. Works only for text notes.",
+ "readOnly": "editor is in read only mode. Works only for text and code notes.",
"autoReadOnlyDisabled": "text/code notes can be set automatically into read mode when they are too large. You can disable this behavior on per-note basis by adding this label to the note",
"appCss": "marks CSS notes which are loaded into the Trilium application and can thus be used to modify Trilium's looks.",
"appTheme": "marks CSS notes which are full Trilium themes and are thus available in Trilium options.",
@@ -224,7 +224,7 @@ export default class AttributeDetailWidget extends TabAwareWidget {
this.$widget = $(TPL);
utils.bindElShortcut(this.$widget, 'ctrl+return', () => this.saveAndClose());
- utils.bindElShortcut(this.$widget, 'escape', () => alert("H!"));
+ utils.bindElShortcut(this.$widget, 'esc', () => this.cancelAndClose());
this.contentSized();
@@ -291,6 +291,8 @@ export default class AttributeDetailWidget extends TabAwareWidget {
this.$inputInheritable.on('change', () => this.userEditedAttribute());
this.$closeAttrDetailButton = this.$widget.find('.close-attr-detail-button');
+ this.$closeAttrDetailButton.on('click', () => this.cancelAndClose());
+
this.$attrIsOwnedBy = this.$widget.find('.attr-is-owned-by');
this.$attrSaveDeleteButtonContainer = this.$widget.find('.attr-save-delete-button-container');
@@ -316,8 +318,6 @@ export default class AttributeDetailWidget extends TabAwareWidget {
this.$relatedNotesList = this.$relatedNotesContainer.find('.related-notes-list');
this.$relatedNotesMoreNotes = this.$relatedNotesContainer.find('.related-notes-more-notes');
- this.$closeAttrDetailButton.on('click', () => this.hide());
-
$(window).on('mouseup', e => {
if (!$(e.target).closest(this.$widget[0]).length
&& !$(e.target).closest(".algolia-autocomplete").length
@@ -335,6 +335,14 @@ export default class AttributeDetailWidget extends TabAwareWidget {
this.triggerCommand('focusOnAttributes', {tabId: this.tabContext.tabId});
}
+ async cancelAndClose() {
+ await this.triggerCommand('reloadAttributes');
+
+ this.hide();
+
+ this.triggerCommand('focusOnAttributes', {tabId: this.tabContext.tabId});
+ }
+
userEditedAttribute() {
this.updateAttributeInEditor();
this.updateHelp();
diff --git a/src/public/app/widgets/attribute_list.js b/src/public/app/widgets/attribute_list.js
index bb676a05f..634d97498 100644
--- a/src/public/app/widgets/attribute_list.js
+++ b/src/public/app/widgets/attribute_list.js
@@ -230,6 +230,10 @@ export default class AttributeListWidget extends TabAwareWidget {
await this.attributeEditorWidget.save();
}
+ async reloadAttributesCommand() {
+ await this.attributeEditorWidget.refresh();
+ }
+
updateAttributeListCommand({attributes}) {
this.attributeEditorWidget.updateAttributeList(attributes);
}