Merge pull request #343 from lfnovo/fix/note-editor-fullscreen-observer-optimization

fix(ui): optimize MutationObserver in NoteEditorDialog
This commit is contained in:
Luis Novo 2025-12-20 10:16:49 -03:00 committed by GitHub
commit 040cfbad88
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -70,12 +70,14 @@ export function NoteEditorDialog({ open, onOpenChange, notebookId, note }: NoteE
}, [open, note, fetchedNote, reset])
useEffect(() => {
if (!open) return
const observer = new MutationObserver(() => {
setIsEditorFullscreen(!!document.querySelector('.w-md-editor-fullscreen'))
})
observer.observe(document.body, {subtree: true, attributes: true, attributeFilter: ['class']})
observer.observe(document.body, { subtree: true, attributes: true, attributeFilter: ['class'] })
return () => observer.disconnect()
}, [])
}, [open])
const onSubmit = async (data: CreateNoteFormData) => {
if (note) {