mirror of
https://github.com/Blah-IM/Weblah.git
synced 2025-04-30 16:21:09 +00:00
fix: State reference in RichTextInput dispatchTransaction
Use editorView.state instead of closed-over state variable to ensure we're always working with the latest editor state
This commit is contained in:
parent
a5ae23b229
commit
39de2176fa
1 changed files with 3 additions and 3 deletions
|
@ -27,11 +27,11 @@
|
|||
{ mount: domEl },
|
||||
{
|
||||
state,
|
||||
dispatchTransaction: (tr) => {
|
||||
const newState = state.apply(tr);
|
||||
dispatchTransaction(tr) {
|
||||
const newState = editorView.state.apply(tr);
|
||||
editorView.updateState(newState);
|
||||
onDocChange?.(newState.doc);
|
||||
|
||||
onDocChange?.(newState.doc);
|
||||
isEmpty = newState.doc.textContent.length === 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue