Editor has no way to import a SVG file as editable paths — user with an SVG file (e.g., a logo) on their disk wants to bring it in as vector paths, can only screenshot and re-digitize via the workspace #283
Labels
No labels
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:verify-failed
bug
deferred
feature-request
in-progress
needs-decompose
needs-triage
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/Kimi_Agent_Brother_10_Digitizing_App#283
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Finding
grep -rn 'import.*svg\|svg.*import' src/components/editor/returns 0. The editor has no SVG import.A user with an SVG file (e.g., a logo from Adobe Illustrator, an icon from a website, an SVG they made in Inkscape):
A direct SVG import would parse the SVG's
<path>elements and create editor paths directly.Where
grep -rn 'importFile\|importFile' src/components/editor/returns 0loadDesign), but it's not the editorSuggested fix shape
onImportSvgopens a file picker for.svgfiles. The user selects one, the file is read as text.svg-path-parseror write a simple parser to extract<path d="...">elements and convert toPathNode[]:Create a path for each
<path>element in the SVG.Thread colors: try to match each SVG path's
fillorstroketo the closest catalog color. The user can adjust.History: the import is a single undoable action.
Severity
Medium. The user can re-digitize via the workspace, but loses fidelity. Power users with vector source files notice.
Discovered by
Gap analysis (2026-10-02) of editor file import.
Related
Shipped fix at
e321fb9on origin/main.Added an 'Import SVG' button to the editor toolbar (FileUp icon, sits next to the reference-image button) that opens a .svg file picker. The handler parses each
<path>element into a realStitchPathrow — distinct from the existing reference-image picker, which rasterizes an SVG into a backdrop.Implementation lives in
src/components/editor/svgImport.ts:svg-path-parserruntime dep, no reliance onSVGPathElement.getTotalLength(jsdom doesn't implement those).Color mapping: closest-by-RGB against the user's current thread catalog. Fill wins over stroke; outline-only art falls back to the catalog's first entry.
History contract: single
pushHistory(paths)covers the whole import — one undo undoes the entire file. Selection is promoted to the new paths so the user can immediately re-color / reposition. Aeditor:fit-all-to-viewevent is dispatched post-import so a tiny SVG dropped into an empty editor is visible.Tests: 22 unit tests (svgImport.test.ts) + 7 page-level integration tests (pages/issue-283.test.tsx) covering toolbar wiring, single + multi-path import, malformed / empty / non-SVG error paths, color matching by fill / stroke / fallback, history push, fit-to-view dispatch, and selection promote. All 537 editor tests + the full project build + lint stay green.