`resolvePasteTarget` is not exported, so an embedder cannot place dropped files where the engine would

Author: royvillasanaCreated Sep 26, 2026Updated Sep 26, 2026

editor.placeFiles() — the OS file drop behind useCanvasDrop — decides WHERE a dropped image or SVG lands with resolvePasteTarget:

javascript
// dist/editor/clipboard/assets.js
import { resolvePasteTarget } from "./paste-target.js";

It is compiled and typed (dist/editor/clipboard/paste-target.js and .d.ts), and unreachable: not on @open-pencil/core/editor (which exports createEditor only), not on the barrel, and the exports map has no wildcard, so a deep specifier is refused.

Everything else the drop needs IS public — createSVGNodesFromImport, prepareSVGImport, computeImageHash and computeAllLayouts are all on the barrel. The one missing piece is the placement rule.

Why it matters more than it looks. Placement is not a detail an embedder can invent: "which container does a file dropped at this point belong to, and at what coordinates" is a rule users notice immediately when it disagrees with the rest of the app. Re-deriving it guarantees drift from paste, which uses the same function.

editor.placeFiles() itself is not a way round it for the same reason as U18: it writes to ctx.graph directly, which an embedder routing writes through its own mutation layer cannot use.

Suggested fix: export resolvePasteTarget from ./editor (or add "./editor/clipboard" to the exports map). It is a pure query over the graph and a point — no mutation — so exporting it commits to nothing beyond the rule itself.


Measured on 0.14.0 (commit a9bf1b3). Reported from an embedding project that routes every document write through its own mutation layer; happy to test a patch.