Skip to content

Commit

Permalink
Merge pull request #5427 from nextcloud/enh/interactive-widget
Browse files Browse the repository at this point in the history
fix: Expose css var for maximum full size widgets
  • Loading branch information
juliusknorr authored Mar 4, 2024
2 parents f8a32bf + eb25c68 commit 62ecb11
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { Collaboration } from '@tiptap/extension-collaboration'
import Autofocus from '../extensions/Autofocus.js'
import { Doc } from 'yjs'
import { useResizeObserver } from '@vueuse/core'
import {
EDITOR,
Expand Down Expand Up @@ -327,6 +328,12 @@ export default {
subscribe('text:image-node:add', this.onAddImageNode)
subscribe('text:image-node:delete', this.onDeleteImageNode)
this.emit('update:loaded', true)
useResizeObserver(this.$el, (entries) => {
const entry = entries[0]
const { width } = entry.contentRect
const maxWidth = width - 36
this.$el.style.setProperty('--widget-full-width', `${maxWidth}px`)
})
},
created() {
this.$ydoc = new Doc()
Expand Down

0 comments on commit 62ecb11

Please sign in to comment.