Skip to content

feat(blocks-editor): paste pipeline + dnd-kit multi-select + document outline - #465

Merged
tayebmokni merged 3 commits into
mainfrom
feat/blocks-editor-ux
May 25, 2026
Merged

feat(blocks-editor): paste pipeline + dnd-kit multi-select + document outline#465
tayebmokni merged 3 commits into
mainfrom
feat/blocks-editor-ux

Conversation

@tayebmokni

Copy link
Copy Markdown
Contributor

Closes #213, #117, #111.

Three editor UX additions:

  • paste-handler.ts: detects + converts Docs/Word/Notion/Markdown HTML to blocks
  • dnd/SortableBlockList.tsx: @dnd-kit-backed reorder + Shift/Cmd multi-select
  • outline/DocumentOutline.tsx + ListView.tsx: heading-tree outline + full block listview

Single integration point in editor-chrome.tsx mounts all three.

🤖 Generated with Claude Code

tib0o0o and others added 3 commits May 25, 2026 22:42
Detects the clipboard source via class/attribute fingerprints
(docs-internal-guid, ms-Office-/mso-, notion-) and dispatches to a
per-source HTML-to-block converter. Markdown falls back to a tiny
hand-rolled parser so we don't take a CommonMark dep just for paste.
Generic HTML and plain-text paths cover the long tail. The exported
onPaste(event) reads ClipboardData and returns a BlockTree the host
can splice into the document; null means "nothing to convert, let
the browser do its thing".

Tests cover happy-path detection + conversion for each source, plus
the onPaste integration over a hand-rolled ClipboardEvent stub.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Tayeb Mokni <tayeb.mokni@gmail.com>
Adds @dnd-kit/core + sortable + utilities and wires them into a new
SortableBlockList that wraps a flat block-id list in a SortableContext.
Each row carries a six-dot grip handle: plain click replaces the
selection, Cmd-click toggles a row, Shift-click selects the inclusive
range from the current anchor (Finder-style — the anchor doesn't
move on range clicks).

Selection state lives in a small SelectionProvider/useSelection
context so the outline + list-view (next commit) share the same
highlight set with the canvas. SortableBlockList mounts its own
provider by default, or reuses the host's if `externalSelectionProvider`
is set.

Drag-end logic supports multi-drag: if the picked row is in the
selection set, the whole bag moves as a group; otherwise it's a
single arrayMove.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Tayeb Mokni <tayeb.mokni@gmail.com>
#111)

Adds two side-panel components and a chrome-level integration:

  - <DocumentOutline>: tree view of core/heading blocks built via a
    single-pass level-aware stack walker (handles skipped levels,
    nested innerBlocks, malformed level attrs). Clicking a row fires
    onSelect(clientId) so the host can jump-scroll the canvas.
  - <ListView>: flat hierarchical tree of every block in the
    document. Hover emits onHover(id|null) so the canvas can mirror
    the hover highlight; selected rows get emerald, multi-selected
    siblings get a soft emerald tint.

The chrome additions are the **single integration point** for all
three P2 features (#213, #117, #111). editor-chrome.tsx grows by:

  - <OutlineToggle>: top-bar button to open/close the outline rail.
  - <EditorWorkspace>: composes <SelectionProvider>, the paste
    handler, the optional <SortableBlockList>, and the outline /
    list-view panels into a single layout. Pasting over the
    workspace routes through detectPasteSource + convertPaste from
    paste-handler.ts; reorders flow through <SortableBlockList>;
    the side panels share selection via the same context.

The block-edit-canvas.tsx file is intentionally untouched — the
admin app composes <EditorWorkspace> around it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Tayeb Mokni <tayeb.mokni@gmail.com>
@tayebmokni
tayebmokni enabled auto-merge (squash) May 25, 2026 20:52
@tayebmokni
tayebmokni merged commit 7efefcc into main May 25, 2026
12 of 16 checks passed
@tayebmokni
tayebmokni deleted the feat/blocks-editor-ux branch May 25, 2026 20:55
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.

Paste pipeline (Docs, Word, Notion, Markdown)

2 participants