fix(outline): fix mobile detection and box shadow

Also enable outline on mobile in read-write mode.

Fixes: #6410
Fixes: #6693

Signed-off-by: Jonas <jonas@freesources.org>
This commit is contained in:
Jonas 2024-12-03 14:23:09 +01:00 коммит произвёл backportbot[bot]
Родитель 3bcb8e16a8
Коммит 64c4371dd9
2 изменённых файлов: 11 добавлений и 24 удалений

Просмотреть файл

@ -4,7 +4,7 @@
-->
<template>
<div data-text-el="editor-outline" class="editor--outline" :class="{ 'editor--outline-mobile': mobile }">
<div data-text-el="editor-outline" class="editor--outline" :class="{ 'editor--outline-mobile': $isMobile }">
<header class="editor--outline__header">
<NcButton class="editor--outline__btn-close"
type="tertiary"
@ -26,6 +26,7 @@ import TableOfContents from './TableOfContents.vue'
import { useOutlineStateMixin, useOutlineActions } from './Wrapper.provider.js'
import { Close } from './../icons.js'
import useStore from '../../mixins/store.js'
import { useIsMobileMixin } from '../Editor.provider.js'
export default {
name: 'EditorOutline',
@ -34,27 +35,12 @@ export default {
NcButton,
TableOfContents,
},
mixins: [useStore, useOutlineStateMixin, useOutlineActions],
data: () => ({
mobile: false,
}),
mounted() {
this.$resizeObserver = new ResizeObserver(this.onResize)
this.$resizeObserver.observe(this.$el.parentElement)
this.onResize([this.$el.parentElement])
},
beforeDestroy() {
this.$resizeObserver.unobserve(this.$el.parentElement)
this.$resizeObserver = null
this.$onResize = null
},
methods: {
onResize([el]) {
window.requestAnimationFrame(() => {
this.mobile = el.clientWidth < 320
})
},
},
mixins: [
useIsMobileMixin,
useStore,
useOutlineStateMixin,
useOutlineActions,
],
}
</script>
@ -68,7 +54,8 @@ export default {
max-height: calc(100% - 204px);
&-mobile {
box-shadow: 8px 0 17px -19px var(--color-box-shadow);
border-radius: var(--border-radius-large);
box-shadow: 0 1px 10px var(--color-box-shadow);
background-color: var(--color-main-background-translucent);
z-index: 1;
}

Просмотреть файл

@ -80,7 +80,7 @@ export default {
return false
}
return this.viewWidth > 1265
return true
},
},