Skip to content

Conversation

@brainkim
Copy link
Member

This implements a two-layer architecture for simplifying Revise integration:

Layer 1: EditableState (Framework-Agnostic Core)

  • New EditableState class in src/state.ts
  • Manages value, history, keyer, and selection in one stateful coordinator
  • Provides unified callback pipeline for edit transformations
  • Handles source tracking to prevent infinite loops
  • Supports undo/redo, checkpointing, and reset operations

Layer 2: Editable Component (Crank Wrapper)

  • New @b9g/crank-editable package in packages/crank-editable
  • Bridges high-level EditableState to low-level ContentAreaElement
  • Handles DOM event interception and re-sourcing
  • Manages selection state bidirectionally
  • Provides useEditableState and useKeyer context hooks

This reduces complex integration code from 400+ lines to ~100 lines by separating concerns between state management and DOM bridging.

🤖 Generated with Claude Code

This implements a two-layer architecture for simplifying Revise integration:

**Layer 1: EditableState (Framework-Agnostic Core)**
- New EditableState class in src/state.ts
- Manages value, history, keyer, and selection in one stateful coordinator
- Provides unified callback pipeline for edit transformations
- Handles source tracking to prevent infinite loops
- Supports undo/redo, checkpointing, and reset operations

**Layer 2: Editable Component (Crank Wrapper)**
- New @b9g/crank-editable package in packages/crank-editable
- Bridges high-level EditableState to low-level ContentAreaElement
- Handles DOM event interception and re-sourcing
- Manages selection state bidirectionally
- Provides useEditableState and useKeyer context hooks

This reduces complex integration code from 400+ lines to ~100 lines by
separating concerns between state management and DOM bridging.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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.

3 participants