diff --git a/src/views/admin/components/edition/item-edition-form.vue b/src/views/admin/components/edition/item-edition-form.vue index 98febea0c..86a88fe1f 100644 --- a/src/views/admin/components/edition/item-edition-form.vue +++ b/src/views/admin/components/edition/item-edition-form.vue @@ -1337,13 +1337,14 @@ export default { this.onPrevInSequence(); } - } else { - parent.postMessage({ - type: 'itemEditionMessage', - item: this.item - }, - tainacan_plugin.admin_url); } + + // Sends info to iframe containing item edition form and other use cases + parent.postMessage({ + type: 'itemEditionMessage', + item: this.$adminOptions.itemEditionMode ? this.item : null + }, + tainacan_plugin.admin_url); }) .catch((errors) => { @@ -1367,12 +1368,12 @@ export default { onDiscard() { if (!this.$adminOptions.itemEditionMode) this.$router.go(-1); - else - parent.postMessage({ - type: 'itemEditionMessage', - item: null - }, - tainacan_plugin.admin_url); + + parent.postMessage({ + type: 'itemEditionMessage', + item: this.$adminOptions.itemEditionMode ? false : null + }, + tainacan_plugin.admin_url); }, createNewItem() { diff --git a/src/views/admin/components/lists/related-items-list.vue b/src/views/admin/components/lists/related-items-list.vue index 5bbec9e5f..bdd6d01ea 100644 --- a/src/views/admin/components/lists/related-items-list.vue +++ b/src/views/admin/components/lists/related-items-list.vue @@ -225,7 +225,7 @@ const message = event.message ? 'message' : 'data'; const data = event[message]; - if (data.type == 'itemEditionMessage') { + if (data.type == 'itemEditionMessage' && data.item !== null) { this.editItemModal = false; } } diff --git a/src/views/admin/components/metadata-types/relationship/Relationship.vue b/src/views/admin/components/metadata-types/relationship/Relationship.vue index ea49cc39c..4986f9a0b 100644 --- a/src/views/admin/components/metadata-types/relationship/Relationship.vue +++ b/src/views/admin/components/metadata-types/relationship/Relationship.vue @@ -406,7 +406,7 @@ const message = event.message ? 'message' : 'data'; const data = event[message]; - if (data.type == 'itemEditionMessage') { + if (data.type == 'itemEditionMessage' && data.item !== null) { this.editItemModalOpen = false; // An item is being edited from the modal