-
-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: the code block wrap state shoud be persisted in database (#7062)
### 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"> ---
- Loading branch information
Showing
5 changed files
with
122 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters