2.5 KiB
2.5 KiB
WYSIWYG Block Cleanup Status
Overview
This document tracks the cleanup of dees-wysiwyg-block.ts
after migrating all block types to the new block handler architecture.
Completed ✅
All cleanup tasks have been successfully completed on 2025-06-26.
Cleanup Tasks
1. ✅ Remove Block-Specific Styles (lines 101-219)
- Remove
.block.heading-1/2/3
styles → Now inheading.block.ts
- Remove
.block.quote
styles → Now inquote.block.ts
- Remove
.block.list
styles → Now inlist.block.ts
- Remove
.block.paragraph
styles → Now inparagraph.block.ts
2. ✅ Remove Code Block Specific Logic
- Remove code block rendering in
renderBlockContent()
(lines 508-521) - Remove all
type === 'code'
conditional branches - Simplify element selection to not special-case code blocks
3. ✅ Remove List Block Specific Logic
- Remove
focusListItem()
method (lines 814-821) - Remove list-specific handling in
getContent()
(lines 732-734) - Remove list-specific handling in
setContent()
(lines 764-765) - Remove list content rendering in
firstUpdated()
(line 479)
4. ✅ Remove getPlaceholder() Method
- Remove entire method (lines 538-553)
- Update renderBlockContent() to not use placeholders
5. ✅ Clean Up Excessive Empty Lines
- Remove consecutive blank lines throughout the file
6. ✅ Centralize nonEditableTypes
- Create a single source of truth for non-editable block types
- Remove duplicate arrays
7. ✅ Simplify Handler Delegation
- Keep handler delegation pattern but ensure consistency
8. ✅ Remove Unused Properties (if confirmed unused)
- Keep
contentInitialized
- still used for tracking - Keep
blockElement
- used for caching - Keep cursor tracking properties - used for selection
Implementation Notes
Block Types Now Fully Handled by Handlers:
- Text blocks: paragraph, heading-1/2/3, quote, code, list
- Media blocks: image, youtube, attachment
- Content blocks: divider, markdown, html
Remaining Responsibilities of dees-wysiwyg-block.ts:
- Shadow DOM container management
- Handler delegation for all operations
- Generic block wrapper styles
- Selection/cursor tracking
- Event listener setup (until fully delegated to handlers)
Future Improvements
- Consider moving all event handling to block handlers
- Simplify the handler delegation pattern
- Move generic block styles to a shared location
- Consider removing the need for special-casing any block types