Closed woigl closed 8 months ago
@woigl The question you're asking is all for Tiptap itself, and not pertaining to mui-tiptap. Please use Stack Overflow or perhaps the Tiptap repo (https://github.com/ueberdosis/tiptap) for this sort of thing in the future, after looking through Tiptap's docs, rather than posting here. For this particular issue, I happen to know you can use setContent(content, true)
, since the second argument is an emitUpdate
boolean which defaults to false
: https://tiptap.dev/docs/editor/api/commands/set-content (or see code here). I'll close this out.
@sjdemartini, I'm sorry. I thought the onUpdate was part of the mui-tiptap. Thanks a lot for the hint, which works perfectly!
Describe the bug
I am using the following code programmatically to set a new content to my editor:
const currentSelection = editor?.state.selection || 0; editor?.chain().setContent(newContent).setTextSelection(currentSelection).run();
I was expecting that the useEditor hook callback for onUpdate would be called. Is there any callback that gets executed when setting the content for the editor programmatically?
Expected behavior
Setting the content programmatically to the editor should call the useEditor hook onUpdate callback.