Skip to content

Feat: Convert list back to text - #354

Closed
katsyuta wants to merge 9 commits into
DeepinkApp:masterfrom
katsyuta:275-implement-toggling-between-list-and-plain-text
Closed

katsyuta wants to merge 9 commits into
DeepinkApp:masterfrom
katsyuta:275-implement-toggling-between-list-and-plain-text

Conversation

@katsyuta

@katsyuta katsyuta commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

Closed #275

Added test for #260

Behavior:

  • Converting a list to the same type turns it into plain paragraphs
  • Converting a list to plain text removes nesting, resulting in flat paragraphs
  • Selecting any item or the entire list converts the whole list
  • For mixed-type lists, the first conversion unifies the list type; the next converts it to plain text
list-to-text.mp4

Summary by CodeRabbit

  • New Features

    • List formatting now works as a toggle: applying the active list style converts selected list content back to paragraphs.
    • Converting lists to paragraphs preserves nested and mixed list content.
  • Tests

    • Added coverage for list-to-paragraph conversion, paragraph-to-list conversion, nested lists, round trips, and preserving unselected content.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: adacec69-aef0-46fc-8e0d-ddeae1063d4b

📥 Commits

Reviewing files that changed from the base of the PR and between 2efb7ed and 218e844.

📒 Files selected for processing (3)
  • packages/app/src/features/NoteEditor/RichEditor/__tests__/spec/list.dom.test.ts
  • packages/app/src/features/NoteEditor/RichEditor/plugins/EditorPanelPlugin/EditorPanelPlugin.tsx
  • packages/app/src/features/NoteEditor/RichEditor/plugins/EditorPanelPlugin/utils/$convertListToParagraphs.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The list formatting action now toggles matching lists to paragraphs. A recursive helper handles nested lists. DOM tests cover flat, nested, mixed, selected, and round-trip conversions.

Changes

List formatting toggle

Layer / File(s) Summary
List conversion and handler integration
packages/app/src/features/NoteEditor/RichEditor/plugins/EditorPanelPlugin/...
The list handler detects selected ancestor lists and converts them to paragraphs when their type matches the requested type. Otherwise, it applies the requested list type.
List toggle DOM validation
packages/app/src/features/NoteEditor/RichEditor/__tests__/spec/list.dom.test.ts
Tests cover flat and nested lists, mixed list types, paragraph conversion, round trips, and preserving unselected paragraphs.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🟡 Moderate · up to 218e8

Toggling a same-type nested list selection may fail instead of converting the selected content to plain text. Resolve the nested-selection conversion order before merging.

Suggested reviewers: vitonsky

Sequence Diagram(s)

sequenceDiagram
  participant Selection
  participant EditorPanelPlugin
  participant ListNode
  participant ParagraphNodes
  Selection->>EditorPanelPlugin: Provide selected range
  EditorPanelPlugin->>ListNode: Find selected ancestor lists
  EditorPanelPlugin->>ParagraphNodes: Convert matching lists with $convertListToParagraphs
  ParagraphNodes-->>EditorPanelPlugin: Replace lists with paragraphs
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #275 by toggling selected list content between list formatting and plain paragraphs. The implementation supports requested list types, nested content, and selection-based con…
Out of Scope Changes check ✅ Passed The plugin changes, conversion helper, and DOM tests directly support the list-to-plain-text toggle described in issue #275. No unrelated code changes are identified.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: converting selected list content back to plain text.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@katsyuta katsyuta changed the title Feat: implement toggling between list and plain text Feat: Convert list back to text Sep 6, 2026
@katsyuta
katsyuta marked this pull request as ready for review September 6, 2026 22:17
@katsyuta

katsyuta commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@katsyuta
katsyuta requested a review from vitonsky September 16, 2026 13:45
@vitonsky

Copy link
Copy Markdown
Member

Is it ready for review?

How this PR related to a #260? Is it closes this issue? Please sync its relationships.

Please add use case examples to explain motivation for all behaviour choices in this pr.
I'm not sure in motivation of most of decisions here.

Converting a list to plain text removes nesting, resulting in flat paragraphs

Why we remove nesting? It seems we loss the structure of text in that case. When user want to have such result?

It seems it was implemented like that just because it is the simplest behaviour to implement?

Selecting any item or the entire list converts the whole list

Why? Let's say we have

- foo
  - bar
  - qux
- baz

How it will works on this example?

Let's consider 2 different scenarious:

  • user will focus on bar and will pick another list
  • user will focus on foo and will pick another list

For mixed-type lists, the first conversion unifies the list type; the next converts it to plain text

I don't understand this scenario

@vitonsky

Copy link
Copy Markdown
Member

Superseded by #375

@vitonsky vitonsky closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement toggling between list and plain text

2 participants