Skip to content

Commit

Permalink
fix importPixiVNJson
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackRam-oss committed Aug 12, 2024
1 parent d89c11a commit 329894f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/functions/Importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { StepLabelJsonType } from "../types";
export function importPixiVNJson(data: PixiVNJson | string) {
try {
if (typeof data === "string") {
data = JSON.parse(data)
data = JSON.parse(data) as PixiVNJson
}
}
catch (e) {
Expand All @@ -23,14 +23,17 @@ export function importPixiVNJson(data: PixiVNJson | string) {
console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object")
return
}
for (const labelId in data.labels) {
try {
const steps: StepLabelJsonType[] = (data as any)[labelId]
let label = new LabelJson(labelId, steps)
saveLabel(label)
}
catch (e) {
console.error(`[Pixi'VN] Error creating JSON label ${labelId}`, e)
if (data.labels) {
let labels = data.labels
for (const labelId in labels) {
try {
const steps: StepLabelJsonType[] = labels[labelId]
let label = new LabelJson(labelId, steps)
saveLabel(label)
}
catch (e) {
console.error(`[Pixi'VN] Error creating JSON label ${labelId}`, e)
}
}
}
}

0 comments on commit 329894f

Please sign in to comment.