Skip to content

Commit

Permalink
feat: Disable save button when editing note properties - EXO-74267 - M…
Browse files Browse the repository at this point in the history
  • Loading branch information
sofyenne authored and azayati committed Sep 24, 2024
1 parent 0bd807b commit cb3f786
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
:web-page-url="webPageUrl"
:editor-icon="editorIcon"
:save-button-icon="saveButtonIcon"
:save-button-disabled="saveButtonDisabled"
:save-button-disabled="saveNoteButtonDisabled"
:editor-ready="!!editor"
@editor-closed="editorClosed"
@post-note="postNote"
Expand Down Expand Up @@ -89,7 +89,8 @@ export default {
editor: null,
initialized: false,
instanceReady: false,
noteTitleMaxLength: 500
noteTitleMaxLength: 500,
updatingProperties: null
};
},
props: {
Expand Down Expand Up @@ -225,6 +226,9 @@ export default {
hasFeaturedImage() {
return !!this.noteObject?.properties?.featuredImage?.id;
},
saveNoteButtonDisabled() {
return this.updatingProperties || this.saveButtonDisabled;
}
},
created() {
this.cloneNoteObject();
Expand All @@ -238,10 +242,14 @@ export default {
},
methods: {
metadataUpdated(properties) {
this.updatingProperties = true;
this.noteObject.properties = properties;
this.updateData();
if (this.noteObject?.title?.length) {
this.autoSave();
this.waitForNoteMetadataUpdate();
} else {
this.updatingProperties = null;
}
},
editorClosed(){
Expand Down Expand Up @@ -515,6 +523,11 @@ export default {
message: this.$t('notes.title.max.length.warning.message', {0: this.noteTitleMaxLength})
};
this.displayAlert(messageObject);
},
waitForNoteMetadataUpdate() {
setTimeout(() => {
this.updatingProperties = null;
}, 1000);
}
}
};
Expand Down

0 comments on commit cb3f786

Please sign in to comment.