MCPcopy Create free account
hub / github.com/anomalyco/opencode / buildDragImage

Function buildDragImage

packages/app/src/components/file-tree.tsx:88–100  ·  view source on GitHub ↗
(target: HTMLElement)

Source from the content-addressed store, hash-verified

86}
87
88const buildDragImage = (target: HTMLElement) => {
89 const icon = target.querySelector('[data-component="file-icon"]') ?? target.querySelector("svg")
90 const text = target.querySelector("span")
91 if (!icon || !text) return
92
93 const image = document.createElement("div")
94 image.className =
95 "flex items-center gap-x-2 px-2 py-1 bg-surface-raised-base rounded-md border border-border-base text-12-regular text-text-strong"
96 image.style.position = "absolute"
97 image.style.top = "-1000px"
98 image.innerHTML = (icon as SVGElement).outerHTML + (text as HTMLSpanElement).outerHTML
99 return image
100}
101
102const withFileDragImage = (event: DragEvent) => {
103 const image = buildDragImage(event.currentTarget as HTMLElement)

Callers 1

withFileDragImageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected