Skip to content

feat(dockview-core): allow overriding the group drag ghost (#1167)#1281

Merged
mathuo merged 4 commits into
masterfrom
feat/1167-custom-group-drag-ghost
May 16, 2026
Merged

feat(dockview-core): allow overriding the group drag ghost (#1167)#1281
mathuo merged 4 commits into
masterfrom
feat/1167-custom-group-drag-ghost

Conversation

@mathuo
Copy link
Copy Markdown
Owner

@mathuo mathuo commented May 15, 2026

Summary

  • Closes Remove hard coded English text #1167. The group drag ghost previously rendered hard-coded "Multiple Panels (N)", blocking i18n. Adds a createGroupDragGhostComponent option (parallel to createTabGroupChipComponent) that lets consumers replace the entire ghost with their own renderer. Default behavior is unchanged when no factory is supplied.
  • New IGroupDragGhostRenderer interface exported from dockview-core: { element: HTMLElement; init({ group, api }); dispose?() }.
  • Plumbed groupDragGhostComponent props through dockview (React), dockview-vue, and dockview-angular, mirroring the existing chip component wiring.

Test plan

  • dockview-core — 2 new tests in groupDragHandler.spec.ts cover custom factory invocation/disposal and the default-ghost fallback. Full suite 909/909 passing.
  • dockview (React) — 6 tests in reactGroupDragGhostPart.spec.ts. Full suite 50/50 passing.
  • dockview-vue — 1 new test in dockview.spec.ts asserting createGroupDragGhostComponent flows through updateOptions. Full suite 78/78 passing.
  • dockview-angular — 4 tests in angular-group-drag-ghost-renderer.spec.ts. Full suite 126/126 passing.
  • yarn lint clean (0 errors).
  • Manual smoke: drag a group with a custom component to confirm the ghost renders the user's content. (Maintainer to verify locally — automated DnD coverage is hard for setDragImage snapshotting.)

Notes for reviewers

  • The factory is invoked inside GroupDragHandler.getData only when set; otherwise the original "Multiple Panels (N)" ghost is preserved verbatim.
  • addGhostImage already removes the ghost element via setTimeout(0); the custom renderer's dispose() is scheduled on the same tick so the framework portal/component is torn down together.
  • The browser captures the ghost at drag start, so framework components must render fast / synchronously to be visible before the snapshot. This is documented in the new JSDoc; users who hit timing issues can still construct a raw HTMLElement in their factory.

🤖 Generated with Claude Code

mathuo and others added 4 commits May 15, 2026 22:41
…om component

Closes #1167. The drag ghost previously rendered hard-coded English text
("Multiple Panels (N)"), preventing i18n. Introduces an
`IGroupDragGhostRenderer` interface and a `createGroupDragGhostComponent`
option (parallel to `createTabGroupChipComponent`) so consumers can
replace the entire ghost with their own renderer. Default behavior is
unchanged when no factory is supplied.

Wires `groupDragGhostComponent` props through the React, Vue, and
Angular wrappers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a "Customizing the group drag ghost" section to the DnD page with
framework-specific examples and DocRef blocks, exports
IDockviewGroupDragGhostProps from the React entry, and wires a sample
ghost component into the demo sandbox. Regenerates api.output.json so
the new DocRef references resolve.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a "Custom Drag Ghost" toggle to the demo sandbox's View settings
so flipping the switch exercises updateOptions({
createGroupDragGhostComponent }) at runtime, validating live swaps
between the built-in and a user-supplied ghost.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@mathuo mathuo merged commit 829301f into master May 16, 2026
9 checks passed
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.

Remove hard coded English text

1 participant