-
-
Notifications
You must be signed in to change notification settings - Fork 349
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
fix: the code block wrap state shoud be persisted in database #7062
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Your org has enabled the Graphite merge queue for merging into masterAdd the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4dd0dce
to
bb4c478
Compare
bb4c478
to
81e09cb
Compare
81e09cb
to
92221a1
Compare
Can you add a test for this case? |
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.
Need to test that for legacy data without the wrap
field, whether the backward compatibility could be supported.
92221a1
to
f97f465
Compare
@Flrande Thanks for your comments! I have added several tests in |
@doodlewind I suppose that legacy data will filled with default |
You can test by importing an old snapshot. |
I have tested both import old snapshot and paste old code block cases, and everything works fine! |
If we move the wrap property to the model, we may need to disable the wrap code button in code toolbar when readonly mode. Screen.Recording.2024-05-16.at.01.29.05.mov |
f97f465
to
0d1daec
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.
LGTM, for the feedback in #7062 (comment), it could be implemented in a standalone PR or simply marked help wanted!
Got it! Thanks for your comment, it helps a lot. |
0d1daec
to
73438d8
Compare
73438d8
to
a03c577
Compare
Merge activity
|
### TL;DR This Pull Request moves the `wrap` property from temporary state to persistent data model. When user refreshes the web browser, the code block warp style keeps. Fix affine-design/issue/BS-297. ### What changed? - In `code-block.ts`, the `_wrap` private state variable has been removed, and all references to it have instead been directed to `this.model.wrap`. - A `setWrap` function has been added to handle updating the `wrap` property in the block model, which can be persisted in database. ### How to test? Test this change by creating a code block in document and toggle the `wrap` icon. Check if this modifies the wrap state in the model and updates the UI accordingly. Refresh the browser, the code block warp styles keeps. <img width="735" alt="截屏2024-05-15 16 03 20" src="https://github.com/toeverything/blocksuite/assets/12724894/4a36124c-9bfb-451a-a1d4-bbc3888f7fa7"> <img width="723" alt="截屏2024-05-15 16 03 02" src="https://github.com/toeverything/blocksuite/assets/12724894/d613f033-038f-4f53-a476-4be87083fd2f"> ---
a03c577
to
3274a6c
Compare
## Features - toeverything/blocksuite#7052 @donteatfriedrice ## Bugfix - toeverything/blocksuite#7072 @Flrande - toeverything/blocksuite#7073 @Flrande - toeverything/blocksuite#7062 @akumatus - toeverything/blocksuite#7066 @L-Sun - toeverything/blocksuite#7061 @Flrande - toeverything/blocksuite#7058 @L-Sun - toeverything/blocksuite#7060 @doouding - toeverything/blocksuite#7051 @L-Sun - toeverything/blocksuite#7054 @L-Sun - toeverything/blocksuite#7023 @golok727 - toeverything/blocksuite#7022 @golok727 - toeverything/blocksuite#7047 @fundon - toeverything/blocksuite#7043 @akumatus - toeverything/blocksuite#7041 @donteatfriedrice - toeverything/blocksuite#7038 @fourdim - toeverything/blocksuite#7040 @regischen ## Refactor - toeverything/blocksuite#7068 @doouding - toeverything/blocksuite#7069 @zzj3720 - toeverything/blocksuite#7065 @Flrande - toeverything/blocksuite#7048 @fundon - toeverything/blocksuite#7045 @Flrande - toeverything/blocksuite#7046 @donteatfriedrice - toeverything/blocksuite#7039 @Flrande - toeverything/blocksuite#7036 @Saul-Mirone - toeverything/blocksuite#7032 @Saul-Mirone ## Misc - toeverything/blocksuite#7063 @Saul-Mirone - toeverything/blocksuite#7050 @fourdim - toeverything/blocksuite#7044 @doouding - toeverything/blocksuite#7042 @Flrande - toeverything/blocksuite#6992 @doouding
TL;DR
This Pull Request moves the
wrap
property from temporary state to persistent data model. When user refreshes the web browser, the code block warp style keeps.Fix affine-design/issue/BS-297.
What changed?
code-block.ts
, the_wrap
private state variable has been removed, and all references to it have instead been directed tothis.model.wrap
.setWrap
function has been added to handle updating thewrap
property in the block model, which can be persisted in database.How to test?
Test this change by creating a code block in document and toggle the
wrap
icon. Check if this modifies the wrap state in the model and updates the UI accordingly. Refresh the browser, the code block warp styles keeps.