Skip to content

Commit

Permalink
fix: Expose css var for maximum full size widgets
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliushaertl committed Feb 29, 2024
1 parent 1ce51ea commit 36bf1b5
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 36bf1b5

Please sign in to comment.