Skip to content

Commit

Permalink
fix(NcModal): don't close modals if they were filled
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
  • Loading branch information
Antreesy committed Mar 27, 2024
1 parent 62596a9 commit 91b07c4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<!-- New group form -->
<NcModal v-show="page !== 2"
class="new-group-conversation"
:close-on-click-outside="!isFilled"
:container="container"
@close="closeModal">
<h2 class="new-group-conversation__header">
Expand Down Expand Up @@ -227,6 +228,11 @@ export default {
|| this.conversationName.length > CONVERSATION.MAX_NAME_LENGTH
|| this.newConversation.description.length > CONVERSATION.MAX_DESCRIPTION_LENGTH
},

isFilled() {
return JSON.stringify(this.newConversation) !== JSON.stringify(NEW_CONVERSATION)
|| this.listable !== CONVERSATION.LISTABLE.NONE || this.isAvatarEdited
},
},

watch: {
Expand Down
5 changes: 5 additions & 0 deletions src/components/NewMessage/NewMessagePollEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

<template>
<NcModal size="small"
:close-on-click-outside="!isFilled"
:container="container"
v-on="$listeners">
<div class="poll-editor">
Expand Down Expand Up @@ -133,6 +134,10 @@ export default {
container() {
return this.$store.getters.getMainContainerSelector()
},

isFilled() {
return !!this.pollQuestion || this.pollOptions.some(option => option)
},
},

methods: {
Expand Down
1 change: 1 addition & 0 deletions src/components/NewMessage/NewMessageUploadEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<NcModal v-if="showModal"
ref="modal"
:size="isVoiceMessage ? 'small' : 'normal'"
:close-on-click-outside="false"
:container="container"
@close="handleDismiss">
<div class="upload-editor"
Expand Down

0 comments on commit 91b07c4

Please sign in to comment.