ArkHost/HelixNotes
14
150
Fork
You've already forked HelixNotes
13

Refactor Editor.svelte gradually into smaller responsibilities #133

Open
opened 2026年06月18日 11:43:38 +02:00 by milaforge · 0 comments
Contributor
Copy link

src/lib/components/Editor.svelte is carrying too many responsibilities in one component. On my checkout it is about 9,700 lines and includes TipTap setup/extensions, markdown conversion, source-mode behavior, file paste/drop handling, context menus, history UI, AI actions, embedded renderers, and a large style block.

This is worth refactoring because it would make editor changes safer, reviews smaller, and future features easier to land without accidental regressions. The goal should not be a rewrite. It should be a gradual extraction of stable responsibilities while keeping behavior unchanged.

Suggested approach:

  1. Keep Editor.svelte as the orchestration layer for now.
  2. Extract one responsibility per PR: pure helpers first, then TipTap extensions, then focused UI pieces such as context menus.
  3. Add focused tests around extracted logic where practical.
  4. Treat each PR as behavior-preserving unless maintainers explicitly agree to a behavior change.

To avoid breaking functionality, each refactor PR should verify the relevant editor paths, especially:

  • rich text and source mode save/reload behavior
  • switching between rich text and source mode
  • title/H1 handling
  • links, images, PDFs, attachments, tables, task lists, code blocks, math, mermaid, details, and secret blocks
  • slash commands, context menus, paste/drop, history restore, and AI apply flows

Would you be open to this direction if it comes as small, reviewable PRs rather than one large editor rewrite? I can start with the lowest-risk extraction and include the relevant checks with it.

`src/lib/components/Editor.svelte` is carrying too many responsibilities in one component. On my checkout it is about 9,700 lines and includes TipTap setup/extensions, markdown conversion, source-mode behavior, file paste/drop handling, context menus, history UI, AI actions, embedded renderers, and a large style block. This is worth refactoring because it would make editor changes safer, reviews smaller, and future features easier to land without accidental regressions. The goal should not be a rewrite. It should be a gradual extraction of stable responsibilities while keeping behavior unchanged. Suggested approach: 1. Keep `Editor.svelte` as the orchestration layer for now. 2. Extract one responsibility per PR: pure helpers first, then TipTap extensions, then focused UI pieces such as context menus. 3. Add focused tests around extracted logic where practical. 4. Treat each PR as behavior-preserving unless maintainers explicitly agree to a behavior change. To avoid breaking functionality, each refactor PR should verify the relevant editor paths, especially: - rich text and source mode save/reload behavior - switching between rich text and source mode - title/H1 handling - links, images, PDFs, attachments, tables, task lists, code blocks, math, mermaid, details, and secret blocks - slash commands, context menus, paste/drop, history restore, and AI apply flows Would you be open to this direction if it comes as small, reviewable PRs rather than one large editor rewrite? I can start with the lowest-risk extraction and include the relevant checks with it.
milaforge changed title from (削除) Discuss gradual refactor of Editor.svelte into smaller responsibilities (削除ここまで) to Refactor Editor.svelte gradually into smaller responsibilities 2026年06月18日 11:46:06 +02:00
Sign in to join this conversation.
No Branch/Tag specified
main
fix/vault-indication
v1.3.3
v1.3.2
v1.3.1
v1.3.0
v1.2.9
v1.2.8
v1.2.7
v1.2.6
v1.2.5
v1.2.4
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.1.9
v1.1.8
v1.1.7
v1.1.6
v1.1.5
v1.1.4
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.9
v1.0.8
v1.0.7
v1.0.6
v1.0.5
v1.0.4
v1.0.3
v1.0.2
v1.0.1
v1.0.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ArkHost/HelixNotes#133
Reference in a new issue
ArkHost/HelixNotes
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?