-
AFFINE uses blocksuite as the EditorProvider. When reading the code of AFFINE (of the pathfinder branch), I met a question that when window dispatches an event, (the Capture phrase is disabled by default) this event bubbles up from the "window" element, which element will receive this event? (window seems don't have any parent element) . I referred Bubbling and capturing explained.
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Beta Was this translation helpful? Give feedback.
-
After discussions with main maintainers (@colelawrence @doodlewind ), this turns out to be a workaround for now (As window exists in browser context, so components in whatever framework (Blocksuite uses Lit, AFFINE uses react) can add an event listener on it or dispatch an event on it. ), and @doodlewind suggests that a new comprehensive API design about how to reuse EditorContainer is welcomed. |
Beta Was this translation helpful? Give feedback.
-
You can read the DOM spec for a more detailed explanation. The parent of the window is https://dom.spec.whatwg.org/#dispatching-events
|
Beta Was this translation helpful? Give feedback.
-
thanks, It's very detailed, covering even situation of Nodes, shadow roots (Occasionally understand more about event bubbling rules) |
Beta Was this translation helpful? Give feedback.
You can read the DOM spec for a more detailed explanation. The parent of the window is
null
and the event will stop bubbling.https://dom.spec.whatwg.org/#dispatching-events