diff --git a/src/views/admin/components/edition/item-document-edition-form.vue b/src/views/admin/components/edition/item-document-edition-form.vue index 99d37b333..011bf04aa 100644 --- a/src/views/admin/components/edition/item-document-edition-form.vue +++ b/src/views/admin/components/edition/item-document-edition-form.vue @@ -20,7 +20,8 @@ v-if="form.document != undefined && form.document != null && form.document_type != undefined && form.document_type != null && form.document != '' && form.document_type != 'empty'" - class="document-field-content"> + class="document-field-content" + :class="'document-field-content--' + form.document_type">
@@ -590,7 +590,7 @@ :form="form" :is-loading="isLoading" @onDeleteThumbnail="deleteThumbnail" - @onUpdateThumbnailAlt="($event) => form.thumbnail_alt = $event.target.value" + @onUpdateThumbnailAlt="($event) => onUpdateThumbnailAlt($event)" @openThumbnailMediaFrame="thumbnailMediaFrame.openFrame($event)" />
@@ -791,7 +791,7 @@ export default { attachmentsMediaFrame: undefined, fileMediaFrame: undefined, urlLink: '', - textLink: '', + textContent: '', isUpdatingValues: false, entityName: 'item', activeTab: 'metadata', @@ -1382,6 +1382,9 @@ export default { if (item.document_type != undefined && item.document_type == 'url') this.urlLink = item.document; + + if (item.document_type != undefined && item.document_type == 'text') + this.textContent = item.document; if (item.document_options !== undefined && item.document_options['forced_iframe'] !== undefined) this.urlForcedIframe = item.document_options['forced_iframe']; @@ -1395,8 +1398,10 @@ export default { this.isLoading = false; let oldThumbnail = this.item.thumbnail; - if (item.document_type == 'url' && oldThumbnail != item.thumbnail ) + if (item.document_type == 'url' && oldThumbnail != item.thumbnail ) { this.item.thumbnail = item.thumbnail; + this.item.thumbnail_id = item.thumbnail_id; + } }) .catch((errors) => { for (let error of errors.errors) { @@ -1493,8 +1498,10 @@ export default { this.item.document_mimetype = item.document_mimetype; let oldThumbnail = this.item.thumbnail; - if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail ) + if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail ) { this.item.thumbnail = item.thumbnail; + this.item.thumbnail_id = item.thumbnail_id; + } this.shouldLoadAttachments = !this.shouldLoadAttachments; @@ -1552,11 +1559,12 @@ export default { }, onUpdateThumbnailAlt(updatedThumbnailAlt) { + this.isUpdatingValues = true; this.updateThumbnailAlt({ thumbnailId: this.item.thumbnail_id, thumbnailAlt: updatedThumbnailAlt }) .then((res) => { - this.form.thumbnail_id = res.thumbnail_id; - this.form.thumbnail_alt = res.thumbnail_alt; + this.form.thumbnail_alt = res.alt_text; + this.isUpdatingValues = false; }) .catch(error => this.$console.error(error)); }, diff --git a/src/views/admin/components/edition/item-thumbnail-edition-form.vue b/src/views/admin/components/edition/item-thumbnail-edition-form.vue index 913addf44..09acd4c74 100644 --- a/src/views/admin/components/edition/item-thumbnail-edition-form.vue +++ b/src/views/admin/components/edition/item-thumbnail-edition-form.vue @@ -42,6 +42,7 @@ :src="$thumbHelper.getEmptyThumbnailPlaceholder(item.document_mimetype)"> + :value="form.thumbnail_alt && form.thumbnail_alt != 'false' ? form.thumbnail_alt : ''" + @input="updateThumbnailAlt" />
diff --git a/src/views/admin/components/modals/item-document-text-modal.vue b/src/views/admin/components/modals/item-document-text-modal.vue index 2e48650f8..cba4d651b 100644 --- a/src/views/admin/components/modals/item-document-text-modal.vue +++ b/src/views/admin/components/modals/item-document-text-modal.vue @@ -24,7 +24,7 @@
@@ -55,6 +55,11 @@ export default { this.$refs['item-document-text-input']['$el'].children[0].focus(); this.$refs['item-document-text-input']['$el'].children[0].click(); } + }, + methods: { + confirmTextWriting() { + this.$emit('confirmTextWriting', this.localTextContent); + } } } \ No newline at end of file