Skip to content
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

Merged
merged 1 commit into from
May 16, 2024

Commits on May 16, 2024

  1. 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">
    
    ---
    akumatus committed May 16, 2024
    Configuration menu
    Copy the full SHA
    3274a6c View commit details
    Browse the repository at this point in the history