Fix Open locally button behaviour with WOPI in preview [SCI-10546]

This commit is contained in:
Martin Artnik 2024-03-28 14:51:28 +01:00
parent 3369ec07ec
commit a84958f7bf
2 changed files with 13 additions and 10 deletions

View file

@ -1,13 +1,12 @@
<template>
<div class="sn-open-locally-menu" @mouseenter="fetchLocalAppInfo">
<button class="btn btn-light" v-if="!editWopiSupported" style="pointer-events: all;"
:title="attachment.attributes.wopi_context.title" disabled="true">
{{ attachment.attributes.wopi_context.button_text }}
</button>
<div v-else-if="!canOpenLocally && (attachment.attributes.wopi && attachment.attributes.urls.edit_asset)">
<a :href="`${attachment.attributes.urls.edit_asset}`" target="_blank"
class="block whitespace-nowrap rounded px-3 py-2.5
hover:!text-sn-blue hover:no-underline cursor-pointer hover:bg-sn-super-light-grey">
<div v-if="!canOpenLocally && (attachment.attributes.wopi && attachment.attributes.urls.edit_asset)">
<a :href="editWopiSupported ? attachment.attributes.urls.edit_asset : null" target="_blank"
class="block whitespace-nowrap rounded px-3 py-2.5 hover:!text-sn-blue hover:no-underline cursor-pointer hover:bg-sn-super-light-grey"
:class="{ 'disabled': !editWopiSupported }"
:title="editWopiSupported ? null : attachment.attributes.wopi_context.title"
style="pointer-events: all"
>
{{ attachment.attributes.wopi_context.button_text }}
</a>
</div>
@ -75,7 +74,9 @@ export default {
if (this.attachment.attributes.wopi && this.attachment.attributes.urls.edit_asset) {
menu.push({
text: this.attachment.attributes.wopi_context.button_text,
url: this.attachment.attributes.urls.edit_asset,
url: this.editWopiSupported ? this.attachment.attributes.urls.edit_asset : null,
disabled: !this.editWopiSupported && 'style-only',
title: this.editWopiSupported ? null : this.attachment.attributes.wopi_context.title,
url_target: '_blank'
});
}

View file

@ -19,7 +19,9 @@
<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"
:target="item.url_target || '_self'"
:class="{ 'bg-sn-super-light-blue': item.active }"
:class="{ 'bg-sn-super-light-blue': item.active, 'disabled': item.disabled }"
:style="item.disabled === 'style-only' && 'pointer-events: all'"
:title="item.title"
:data-toggle="item.modalTarget && 'modal'"
:data-target="item.modalTarget"
:data-e2e="item.data_e2e"