[Bug]: Editor is not actually read when onCreate is called #5237
Labels
Category: Open Source
The issue or pull reuqest is related to the open source packages of Tiptap.
Type: Bug
The issue or pullrequest is related to a bug
Affected Packages
react? or otherwise core
Version(s)
2.5.0-beta.3 and below
Bug Description
The editor cannot be focused when
onCreate
is called because the editor DOM element is not yet attached to the page's DOM.This occurs even if you wait until an animation frame has passed. In CodeSandbox it seems that two animation frames are sufficient to access the editor's DOM on the page, but in my project that's not the case and instead it takes three, so it seems like there might be two components to this issue.
Browser Used
Chrome
Code Example URL
https://codesandbox.io/p/sandbox/dark-worker-tjp86f?file=%2Fsrc%2FApp.js%3A19%2C35
Expected Behavior
I'd suggest a
ready
event, which occurs after thecreate
event that means the editor is fully ready. Short of that, I'd think thatcreate
means I can access the editor to do whatever I need, especially based on the description.Additional Context (Optional)
The
create
event is described as "The editor is ready." That's arguably true because the headless editor is ready, but it's arguably not, because some real world uses aren't possible at that time.Regarding the repro you have to click into the frame for the focus command to actually work, so I'd recommend:
focus
command worked, the editor will now have a caret shortly after refreshDependency Updates
The text was updated successfully, but these errors were encountered: