Skip to content

Commit

Permalink
Merge pull request #11260 from nextcloud/backport/11222/stable27
Browse files Browse the repository at this point in the history
[stable27] fix: use body element if not the fullscreen
  • Loading branch information
nickvergessen authored Dec 19, 2023
2 parents d4c2b9a + 93497d9 commit 92fc5f6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,10 @@ export default {
z-index: 10001 !important;
}

/* FIXME: remove after https://github.com/nextcloud-libraries/nextcloud-vue/pull/4959 is released */
body .modal-wrapper * {
box-sizing: border-box;
}
</style>

<style lang="scss" scoped>
Expand Down
2 changes: 1 addition & 1 deletion src/components/CallView/shared/ViewerOverlayCallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default {
},

portalSelector() {
return this.$store.getters.isFullscreen() ? '#content-vue' : 'body'
return this.$store.getters.getMainContainerSelector()
},
},

Expand Down
14 changes: 12 additions & 2 deletions src/components/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
</div>

<NewMessage v-if="containerId"
:key="containerId"
role="region"
:token="token"
:container="containerId"
has-typing-indicator
:aria-label="t('spreed', 'Post message')" />

</div>
</template>

Expand Down Expand Up @@ -131,11 +131,21 @@ export default {
token() {
return this.$store.getters.getToken()
},

container() {
return this.$store.getters.getMainContainerSelector()
},
},

watch: {
container(value) {
this.containerId = value
},
},

mounted() {
// Postpone render of NewMessage until application is mounted
this.containerId = this.$store.getters.getMainContainerSelector()
this.containerId = this.container
},

methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default {
computed: {
lastReadMessageId() {
return this.$store.getters.conversation(this.token)?.lastReadMessage
}
},
},

watch: {
Expand Down
11 changes: 11 additions & 0 deletions src/components/TopBar/TopBarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ import StopIcon from 'vue-material-design-icons/Stop.vue'
import VideoIcon from 'vue-material-design-icons/Video.vue'

import { getCapabilities } from '@nextcloud/capabilities'
import { showWarning } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'

import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
Expand Down Expand Up @@ -391,6 +392,16 @@ export default {
},

toggleFullscreen() {
// Don't toggle fullscreen if there is an open modal
// FIXME won't be needed without Fulscreen API
if (Array.from(document.body.childNodes).filter(child => {
return child.nodeName === 'DIV' && child.classList.contains('modal-mask')
&& window.getComputedStyle(child).display !== 'none'
}).length !== 0) {
showWarning(t('spreed', 'You need to close a dialog to toggle full screen'))
return
}

if (this.isFullscreen) {
this.disableFullscreen()
this.$store.dispatch('setIsFullscreen', false)
Expand Down
4 changes: 2 additions & 2 deletions src/store/uiModeStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const state = {
}

const getters = {
getMainContainerSelector: (state) => () => {
return state.mainContainerSelector
getMainContainerSelector: (state, getters, rootState, rootGetters) => () => {
return rootGetters.isFullscreen() ? state.mainContainerSelector : 'body'
},
}

Expand Down

0 comments on commit 92fc5f6

Please sign in to comment.