Files
dees-catalog/ts_web/elements/wysiwyg/CLEANUP-STATUS.md
Juergen Kunz 979877b3b0 update
2025-06-26 13:32:37 +00:00

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 in heading.block.ts
  • Remove .block.quote styles → Now in quote.block.ts
  • Remove .block.list styles → Now in list.block.ts
  • Remove .block.paragraph styles → Now in paragraph.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:

  1. Text blocks: paragraph, heading-1/2/3, quote, code, list
  2. Media blocks: image, youtube, attachment
  3. Content blocks: divider, markdown, html

Remaining Responsibilities of dees-wysiwyg-block.ts:

  1. Shadow DOM container management
  2. Handler delegation for all operations
  3. Generic block wrapper styles
  4. Selection/cursor tracking
  5. 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