feat: support expanding/collapsing toggle list in read-only mode#8755
Open
Ramrajnagar wants to merge 2 commits into
Open
feat: support expanding/collapsing toggle list in read-only mode#8755Ramrajnagar wants to merge 2 commits into
Ramrajnagar wants to merge 2 commits into
Conversation
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds support for toggling the expanded/collapsed state of toggle list blocks while the document is in read‑only mode by separating the persisted collapsed state from a local UI-only state and routing all UI logic through an effective collapsed flag. Sequence diagram for toggle collapse behavior in editable vs read_only modesequenceDiagram
actor User
participant ToggleListBlockComponentWidgetState as ToggleListBlockState
participant EditorState
User->>ToggleListBlockState: onCollapsed()
ToggleListBlockState->>EditorState: editable
alt editorState.editable == false
ToggleListBlockState->>ToggleListBlockState: setState(_readOnlyCollapsed = !_effectiveCollapsed)
ToggleListBlockState->>ToggleListBlockState: _effectiveCollapsed used in build()
else editorState.editable == true
ToggleListBlockState->>EditorState: transaction.updateNode(node, {collapsed: !collapsed})
EditorState-->>ToggleListBlockState: updated node.attributes[collapsed]
ToggleListBlockState->>ToggleListBlockState: _effectiveCollapsed uses collapsed
end
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
_readOnlyCollapsedstate is never reset when the editor transitions from read-only to editable (or when the underlyingcollapsedattribute changes), so once a user has toggled in read-only mode,_effectiveCollapsedmay keep using a stale_readOnlyCollapsedinstead of the persisted value; consider clearing or resyncing_readOnlyCollapsedindidUpdateWidget/didChangeDependencieswheneditorState.editableornode.attributes[ToggleListBlockKeys.collapsed]changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `_readOnlyCollapsed` state is never reset when the editor transitions from read-only to editable (or when the underlying `collapsed` attribute changes), so once a user has toggled in read-only mode, `_effectiveCollapsed` may keep using a stale `_readOnlyCollapsed` instead of the persisted value; consider clearing or resyncing `_readOnlyCollapsed` in `didUpdateWidget`/`didChangeDependencies` when `editorState.editable` or `node.attributes[ToggleListBlockKeys.collapsed]` changes.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Author
|
Hi team! I have addressed the edge-case feedback regarding the The CLA is signed, and the PR is ready for your review and for the CI workflows to be approved. Thank you! |
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.
Feature Preview
PR Checklist
Summary by Sourcery
Support toggling the collapsed state of toggle list blocks while in read-only mode without persisting changes to the document.
New Features:
Enhancements: