Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] fix: use body element if not the fullscreen #11260

Merged
merged 4 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading