Skip to content

Commit

Permalink
fix(editor): resize when resizeobserver is done
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Dec 23, 2024
1 parent f840ae0 commit 27a444a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</template>

<script>
import Vue, { ref, set, watch } from 'vue'
import Vue, { ref, set, watch, nextTick } from 'vue'

Check warning on line 76 in src/components/Editor.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor.vue#L76

Added line #L76 was not covered by tests
import { getCurrentUser } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import { isPublicShare } from '@nextcloud/sharing/public'
Expand Down Expand Up @@ -239,7 +239,9 @@ export default {
const { width } = useElementSize(el)
watch(width, value => {
const maxWidth = Math.floor(value) - 36
el.value.style.setProperty('--widget-full-width', `${maxWidth}px`)
nextTick(() => {
el.value.style.setProperty('--widget-full-width', `${maxWidth}px`)
})

Check warning on line 244 in src/components/Editor.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Editor.vue#L242-L244

Added lines #L242 - L244 were not covered by tests
})
return { el, width }
},
Expand Down
10 changes: 8 additions & 2 deletions src/components/Menu/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</template>

<script>
import { ref } from 'vue'
import { nextTick, ref, watch } from 'vue'

Check warning on line 62 in src/components/Menu/MenuBar.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Menu/MenuBar.vue#L62

Added line #L62 was not covered by tests
import { NcActionSeparator, NcActionButton } from '@nextcloud/vue'
import { loadState } from '@nextcloud/initial-state'
import { useElementSize } from '@vueuse/core'
Expand Down Expand Up @@ -125,7 +125,13 @@ export default {
setup() {
const menubar = ref()
const { width } = useElementSize(menubar)
return { menubar, width }
const widthAfterResize = ref(width)
watch(width, value => {
nextTick(() => {
widthAfterResize.value = value
})
})
return { menubar, width: widthAfterResize }

Check warning on line 134 in src/components/Menu/MenuBar.vue

View check run for this annotation

Codecov / codecov/patch

src/components/Menu/MenuBar.vue#L128-L134

Added lines #L128 - L134 were not covered by tests
},

data() {
Expand Down

0 comments on commit 27a444a

Please sign in to comment.