-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: embed-synced-doc-block #6193
feat: embed-synced-doc-block #6193
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
ec97480
to
a6b46d6
Compare
7723b43
to
8ca883f
Compare
7e05038
to
c1e8b81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the line diff is significantly larger than the initial draft, could you help pointing out the major source of the additional code, and the modifications worth being know about for other teams members? Thanks 🙏
@doodlewind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Notes:
- Use the
affine:embed-synced-doc
naming - Move the utils to be shared between synced-doc and linked-doc.
Thanks for the feat!
TOV-443
Playground Demo
Changes:
getPageMode
&getPageUpdatedAt
topage-service
. This was inembed-linked-doc-service
before but is now required by synced block as well. Affine integration is still pending and can be done directly onpage-service
, after pr merge.Notes for nested editor:
Active (editing) state: For a multi editor scenarios, in order to avoid conflicting / double actions... Active editor state was added in PR refactor: support multiple-editors #5878. It allows only one editor to stay active globally. This was tested for parallel editors before and is now being extended for nested editors in this PR. A static slot
activeChanged
is added to notify all editors and update view according to editor state.Scale & Pan mutation observers: When editor (synced block) is in surface, it can be scaled and panned on the whiteboard. Additionally, all ancestor editors will have their own native scaling(zoom) and whiteboard pan. The current active editor needs to factor in total scaling/pan due to transform for displaying overlay (e.g. drag-handle) and canvas items in correct position. This is to be added in addition to child editor's native zoom & pan. As scale and pan is done using transform (translate, scale). This does not change the layout of the element, but just the element's visual size and hence does not trigger resize observers. I have added data attributes (data-scale, data-transform) on relevant elements. On load, block/std searches for all ancestor of current editor having these attributes and initiates mutation observer on these elements.
cumulativeParentScale
is also available in PointerStateEvent, and is used in calculating the correct host offsets.Drag-handle widget: To support component specific logic for AffineDragHandleWidget, components can register on the static field
staticOptionRunner
usingAffineDragHandleWidget.registerOption
.this.host
&this.page
in such options, becausethis.host
on the static field can be referring toeditorHost
of another editor. InsteadeditorHost
is supplied as an argument from the Widget itself which will always be referring to widget's own editorHost.Use of
element.closest()
- In nested editors'element.closest()
can return an element from ancestor editors as well. e.g. to check page mode or edgeless mode,!!editorHost.closest('doc-editor')
&!!editorHost.closest('edgeless-editor')
was used previously. When and edgeless editor is inside a page editor, this will return true for both queries.Use of unscoped css - Same as closest() method, unscoped css will get applied to elements in all child editors.