Conversation
79801ff to
eeead96
Compare
| get #editorElement() { | ||
| return this.editor.getRootElement().parentElement | ||
| } | ||
| } |
There was a problem hiding this comment.
I don't love this. We could instead invert the dependency here and pass editorElement instead of editor?
@MatheusRich I agree this doesn't feel great. this.editor isn't passed in: the reference is created at node init.
Nodes having knowledge of top-level DOM, even if only to fire an event, feels against the grain of Lexical's design. How would you feel about firing a bubbling event against the Node's DOM? This could be achieved by passing the DOM ref we already have in createDOM, or using getElementByKey if the delegate had the node key.
Alternatively, the messages might be passed via registered Lexical commands, but that facade might be too much weight for this?
There was a problem hiding this comment.
@samuelpecher I've changed the implementation. Seems much simpler now. Thank you!
eeead96 to
ef8fd9d
Compare
samuelpecher
left a comment
There was a problem hiding this comment.
Would you be ok to propose documentation for the new events?
test/system/events_test.rb
Outdated
| test "dispatch lexxy:upload-progress during upload" do | ||
| visit edit_post_path(posts(:empty)) | ||
|
|
||
| attach_file file_fixture("example.png") do | ||
| click_on "Upload file" | ||
| end | ||
|
|
||
| assert_image_figure_attachment content_type: "image/png", caption: "example.png" | ||
| assert_dispatched_event "lexxy:upload-progress" | ||
| end |
There was a problem hiding this comment.
Could this be combined with the test above?
There was a problem hiding this comment.
Done. Docs were also added.
Dispatch lexxy:upload-start, lexxy:upload-progress, and lexxy:upload-end events on the editor element during file uploads, letting consumers react to the upload lifecycle (e.g., disabling submit buttons, showing progress). Closes basecamp#735 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ef8fd9d to
3b914fb
Compare
Dispatches lexxy:upload-start, lexxy:upload-progress, and lexxy:upload-end events on the editor element during file uploads. This lets consumers react to the upload lifecycle — for example, disabling submit buttons or showing custom progress UI.
Events bubble up from the element with relevant detail (file, progress, error).
Closes #735