super-productivity/packages/plugin-dev/document-mode
Johannes Millan d0e5373ddf feat(document-mode): parent + subtasks move as one group
Closes the biggest gap in the move/drag UX surfaced by review #8:
moving a parent taskRef should bring its subtasks along, not strand
them under the previous sibling. Also closes #9 (drop indicator
stuck if the drag leaves the iframe).

Changes:

- New moveContentSliceToIndex replaces moveBlockToIndex. It accepts
  a slice length so a single block (sliceLen=1) and a parent group
  (sliceLen = 1 + trailing subTaskRefs) share one implementation.
  Captures the slice's nodes and total size up front, applies a
  single delete + sequential insert.

- sliceLenAt(idx) returns the atomic-move length: 1 for any block
  except a taskRef, parent.nodeSize + sum of immediately-following
  subTaskRefs for a parent.

- Move up / Move down (block menu) now uses the slice. subTaskRef
  Move up/down refuses to cross the parent boundary; taskRef Move
  jumps past the previous / next group as a whole, not the next
  block.

- Drag flow: pendingDrag captures fromIdx + sliceLen + sourceType
  at pointerdown. computeDropTarget snaps the target — subtask
  source stays inside its parent's range; parent source advances
  past any foreign subTaskRef run so the parent never lands between
  a different parent and its first subtask. The .is-dragging dim is
  applied to every block in the slice so the whole group lifts
  visually.

- endBlockDrag now defends against drag-end never firing: window
  blur and document.documentElement pointerleave (with no
  relatedTarget, i.e. crossing the iframe boundary) abort any
  pending drag so the drop indicator and dim state don't stick.
2026-05-21 20:08:00 +02:00
..
scripts feat(document-mode): add TipTap-based document-mode plugin (POC) 2026-05-21 17:22:31 +02:00
src feat(document-mode): parent + subtasks move as one group 2026-05-21 20:08:00 +02:00
.gitignore feat(document-mode): add TipTap-based document-mode plugin (POC) 2026-05-21 17:22:31 +02:00
package-lock.json feat(document-mode): Notion-style UX (gutter, bubble menu, block menu) 2026-05-21 17:34:13 +02:00
package.json feat(document-mode): Notion-style UX (gutter, bubble menu, block menu) 2026-05-21 17:34:13 +02:00
tsconfig.json feat(document-mode): add TipTap-based document-mode plugin (POC) 2026-05-21 17:22:31 +02:00