Conversation
Contributor
Reviewer's GuideImplements an opt-in, per-code-block line-wrapping feature on desktop/web by extending the code block component, wiring a new "Wrap code" toggle into the copy button actions, persisting the wrap state on the node, and adding integration coverage and translations for the new tooltip. Sequence diagram for toggling code block wrap and re-renderingsequenceDiagram
actor User
participant WrapCodeButton
participant EditorState
participant Node
participant AppFlowyCodeBlockComponentBuilder
participant CodeBlockComponentWidget
User->>WrapCodeButton: tap FlowyIconButton.onPressed
WrapCodeButton->>Node: read codeBlockWrapLines
WrapCodeButton->>EditorState: transaction.updateNode(node, {wrap_lines: !codeBlockWrapLines})
WrapCodeButton->>EditorState: apply(transaction)
User->>AppFlowyCodeBlockComponentBuilder: trigger build(node)
AppFlowyCodeBlockComponentBuilder->>Node: read codeBlockWrapLines
AppFlowyCodeBlockComponentBuilder->>AppFlowyCodeBlockComponentBuilder: styleBuilder()
AppFlowyCodeBlockComponentBuilder->>CodeBlockComponentWidget: create with CodeBlockStyle(wrapLines, showLineNumbers)
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
🥷 Ninja i18n – 🎉 Translations have been successfully updated |
ocp1006
marked this pull request as ready for review
August 3, 2026 21:06
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
AppFlowyCodeBlockComponentBuilder.build, constructing a newCodeBlockStylefrom scratch instead of deriving frombaseStylerisks silently dropping any additional fields added toCodeBlockStylelater; if acopyWithor similar exists, consider using it and overriding onlyshowLineNumbers/wrapLines. - The integration test uses hard-coded node paths like
[0]and[1]to assertwrapLines; if the document structure changes, these may become brittle, so consider using a helper to locate code block nodes by type or attributes instead of fixed indices.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `AppFlowyCodeBlockComponentBuilder.build`, constructing a new `CodeBlockStyle` from scratch instead of deriving from `baseStyle` risks silently dropping any additional fields added to `CodeBlockStyle` later; if a `copyWith` or similar exists, consider using it and overriding only `showLineNumbers`/`wrapLines`.
- The integration test uses hard-coded node paths like `[0]` and `[1]` to assert `wrapLines`; if the document structure changes, these may become brittle, so consider using a helper to locate code block nodes by type or attributes instead of fixed indices.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This was referenced Aug 11, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8914
Adds an opt-in, per-block Wrap code toggle for document code blocks on desktop and web. Existing and new blocks remain unwrapped by default.
Summary by Sourcery
Add per-code-block word wrap support for document code blocks on desktop and web, including persistence of wrap state and integration into the existing code block component.
New Features:
Enhancements:
Documentation:
Tests: