Merge pull request #6363 from artoscinote/ma_SCI_9410

Fix attachment issues [SCI-9410]
This commit is contained in:
Martin Artnik 2023-10-05 16:42:10 +02:00 committed by GitHub
commit 19c44c50ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 29 additions and 5 deletions

View file

@ -201,6 +201,8 @@ var MarvinJsEditorApi = (function() {
} }
$(marvinJsModal).modal('hide'); $(marvinJsModal).modal('hide');
config.button.dataset.inProgress = false; config.button.dataset.inProgress = false;
if (MarvinJsEditor.saveCallback) MarvinJsEditor.saveCallback();
}, },
error: function(response) { error: function(response) {
if (response.status === 403) { if (response.status === 403) {
@ -295,6 +297,7 @@ $(document).on('click', '.marvinjs-edit-button', function() {
var editButton = $(this); var editButton = $(this);
$.post(editButton.data('sketch-start-edit-url')); $.post(editButton.data('sketch-start-edit-url'));
$('#filePreviewModal').modal('hide'); $('#filePreviewModal').modal('hide');
MarvinJsEditor.open({ MarvinJsEditor.open({
mode: 'edit', mode: 'edit',
data: editButton.data('sketch-description'), data: editButton.data('sketch-description'),

View file

@ -36,6 +36,12 @@
text-align: center; text-align: center;
width: calc(100% - 4rem); width: calc(100% - 4rem);
&.file-preview-container__wopi {
height: 100%;
margin: 0;
width: 100%;
}
.asset-image { .asset-image {
background-color: var(--sn-white); background-color: var(--sn-white);
} }

View file

@ -32,6 +32,7 @@
@attachment:viewMode="updateAttachmentViewMode" @attachment:viewMode="updateAttachmentViewMode"
@attachment:delete="deleteAttachment(attachment.id)" @attachment:delete="deleteAttachment(attachment.id)"
@attachment:moved="attachmentMoved" @attachment:moved="attachmentMoved"
@attachment:uploaded="$emit('attachment:uploaded')"
/> />
</div> </div>
</div> </div>

View file

@ -154,7 +154,14 @@
openOVEditor(url) { openOVEditor(url) {
window.showIFrameModal(url); window.showIFrameModal(url);
}, },
reloadAttachments() {
this.$emit('attachment:uploaded');
},
openMarvinJsEditor() { openMarvinJsEditor() {
MarvinJsEditor.initNewButton(
this.$refs.marvinjsEditButton,
this.reloadAttachments
);
$(this.$refs.marvinjsEditButton).trigger('click'); $(this.$refs.marvinjsEditButton).trigger('click');
}, },
openScinoteEditor() { openScinoteEditor() {

View file

@ -33,6 +33,7 @@
@attachment:viewMode="updateViewMode" @attachment:viewMode="updateViewMode"
@attachment:delete="deleteAttachment" @attachment:delete="deleteAttachment"
@attachment:moved="attachmentMoved" @attachment:moved="attachmentMoved"
@attachment:uploaded="reloadAttachments"
/> />
</div> </div>
<template v-if="attachment.attributes.wopi"> <template v-if="attachment.attributes.wopi">

View file

@ -33,6 +33,7 @@
@attachment:viewMode="updateViewMode" @attachment:viewMode="updateViewMode"
@attachment:delete="deleteAttachment" @attachment:delete="deleteAttachment"
@attachment:moved="attachmentMoved" @attachment:moved="attachmentMoved"
@attachment:uploaded="reloadAttachments"
/> />
</div> </div>
</template> </template>

View file

@ -18,6 +18,9 @@ export default {
HelperModule.flashAlertMsg(this.i18n.t('general.no_permissions'), 'danger'); HelperModule.flashAlertMsg(this.i18n.t('general.no_permissions'), 'danger');
} }
}); });
},
reloadAttachments() {
this.$emit('attachment:uploaded');
} }
} }
}; };

View file

@ -48,6 +48,7 @@
:href="attachment.attributes.urls.edit_asset" :href="attachment.attributes.urls.edit_asset"
id="wopi_file_edit_button" id="wopi_file_edit_button"
:class="attachment.attributes.wopi_context.edit_supported ? '' : 'disabled'" :class="attachment.attributes.wopi_context.edit_supported ? '' : 'disabled'"
target="_blank"
> >
<i class="sn-icon sn-icon-edit"></i> <i class="sn-icon sn-icon-edit"></i>
</a> </a>
@ -102,6 +103,7 @@
@attachment:viewMode="updateViewMode" @attachment:viewMode="updateViewMode"
@attachment:delete="deleteAttachment" @attachment:delete="deleteAttachment"
@attachment:moved="attachmentMoved" @attachment:moved="attachmentMoved"
@attachment:uploaded="reloadAttachments"
:withBorder="true" :withBorder="true"
/> />
<deleteAttachmentModal <deleteAttachmentModal

View file

@ -32,9 +32,7 @@ export default {
this.uploadFiles(this.$refs.fileSelector.files); this.uploadFiles(this.$refs.fileSelector.files);
}, },
openMarvinJsModal(button) { openMarvinJsModal(button) {
MarvinJsEditor.initNewButton('.new-marvinjs-upload-button', () => { MarvinJsEditor.initNewButton('.new-marvinjs-upload-button', this.loadAttachments);
this.loadAttachments
});
button.click(); button.click();
}, },
openWopiFileModal() { openWopiFileModal() {

View file

@ -1,4 +1,6 @@
export default function isInViewPort(el) { export default function isInViewPort(el) {
if (!el) return;
const rect = el.getBoundingClientRect(); const rect = el.getBoundingClientRect();
return ( return (

View file

@ -19,7 +19,7 @@
<span v-for="(item, i) in listItems" :key="i" class="contents"> <span v-for="(item, i) in listItems" :key="i" class="contents">
<div v-if="item.dividerBefore" class="border-0 border-t border-solid border-sn-light-grey"></div> <div v-if="item.dividerBefore" class="border-0 border-t border-solid border-sn-light-grey"></div>
<a :href="item.url" v-if="!item.submenu" <a :href="item.url" v-if="!item.submenu"
:traget="item.url_target || '_self'" :target="item.url_target || '_self'"
:class="{ 'bg-sn-super-light-blue': item.active }" :class="{ 'bg-sn-super-light-blue': item.active }"
:data-toggle="item.modalTarget && 'modal'" :data-toggle="item.modalTarget && 'modal'"
:data-target="item.modalTarget" :data-target="item.modalTarget"

View file

@ -54,7 +54,7 @@
</div> </div>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="file-preview-container"> <div class="file-preview-container <%= 'file-preview-container__wopi' if wopi_file?(asset) %>">
<% if asset.previewable? %> <% if asset.previewable? %>
<% if wopi_enabled? && wopi_file?(asset) %> <% if wopi_enabled? && wopi_file?(asset) %>
<iframe class="wopi-file-preview" src="<%= asset.get_action_url(current_user, 'embedview') %>"></iframe> <iframe class="wopi-file-preview" src="<%= asset.get_action_url(current_user, 'embedview') %>"></iframe>