mirror of
https://github.com/Blah-IM/Weblah.git
synced 2025-05-01 00:31:08 +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 },
|
{ mount: domEl },
|
||||||
{
|
{
|
||||||
state,
|
state,
|
||||||
dispatchTransaction: (tr) => {
|
dispatchTransaction(tr) {
|
||||||
const newState = state.apply(tr);
|
const newState = editorView.state.apply(tr);
|
||||||
editorView.updateState(newState);
|
editorView.updateState(newState);
|
||||||
onDocChange?.(newState.doc);
|
|
||||||
|
|
||||||
|
onDocChange?.(newState.doc);
|
||||||
isEmpty = newState.doc.textContent.length === 0;
|
isEmpty = newState.doc.textContent.length === 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue