Skip to content

Commit

Permalink
fix: prevent double close X
Browse files Browse the repository at this point in the history
Because X was denied for now.

Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Sep 9, 2024
1 parent e518dee commit 15a0f4d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
14 changes: 10 additions & 4 deletions src/Components/RightSidebar/RequestSignatureTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
</NcButton>
</div>
<VisibleElements />
<NcModal v-if="modalSrc" size="full" @close="closeModal()">
<NcModal v-if="modalSrc"
size="full"
:can-close="false">
<iframe :src="modalSrc" class="iframe" />
</NcModal>
</div>
Expand Down Expand Up @@ -157,16 +159,20 @@ export default {
},
},
async mounted() {
window.addEventListener('message', this.closeModal)
subscribe('libresign:edit-signer', this.editSigner)
this.filesStore.disableIdentifySigner()
},
beforeUnmount() {
window.removeEventListener('message', this.closeModal)
unsubscribe('libresign:edit-signer')
},
methods: {
closeModal() {
this.modalSrc = ''
this.filesStore.flushSelectedFile()
closeModal(message) {
if (message.data.type === 'close-modal') {
this.modalSrc = ''
this.filesStore.flushSelectedFile()
}
},
validationFile() {
if (this.useModal) {
Expand Down
37 changes: 26 additions & 11 deletions src/views/SignPDF/_partials/Sign.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
<Signatures v-if="hasSignatures" />
</div>
<div v-if="!loading" class="button-wrapper">
<div v-if="ableToSign" class="button-wrapper">
<NcButton :wide="true"
:disabled="loading"
type="primary"
@click="confirmSignDocument">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
</template>
{{ t('libresign', 'Sign the document.') }}
</NcButton>
</div>
<NcButton v-if="ableToSign"
:wide="true"
:disabled="loading"
type="primary"
@click="confirmSignDocument">
<template #icon>
<NcLoadingIcon v-if="loading" :size="20" />
</template>
{{ t('libresign', 'Sign the document.') }}
</NcButton>
<div v-else-if="signMethodsStore.needCreatePassword()">
<p>
{{ t('libresign', 'Please define your sign password') }}
Expand Down Expand Up @@ -42,6 +41,13 @@
{{ t('libresign', 'Unable to sign.') }}
</p>
</div>
<NcButton v-if="isModal"
:wide="true"
:disabled="loading"
type="secondary"
@click="closeModal">
{{ t('libresign', 'Cancel') }}
</NcButton>
</div>
<NcDialog v-if="signMethodsStore.modal.clickToSign"
:can-close="!loading"
Expand Down Expand Up @@ -150,6 +156,7 @@ export default {
},
signPassword: '',
showManagePassword: false,
isModal: window.self !== window.top,
}
},
computed: {
Expand Down Expand Up @@ -213,6 +220,11 @@ export default {
}
}
},
closeModal() {
window.parent?.postMessage({
type: 'close-modal',
}, '*')
},
toggleManagePassword() {
this.showManagePassword = !this.showManagePassword
},
Expand Down Expand Up @@ -318,6 +330,9 @@ export default {
.button-wrapper {
padding: calc(var(--default-grid-baseline, 4px)*2);
display: flex;
flex-direction: column;
gap: 12px;
}
.sign-elements {
Expand Down

0 comments on commit 15a0f4d

Please sign in to comment.