clean up invisible chars in yaml parse

This commit is contained in:
Ramnique Singh 2026-04-20 16:22:31 +05:30
parent 5d65616cfb
commit 56edc5a730

View file

@ -36,11 +36,12 @@ function TrackBlockView({ node, deleteNode, extension }: {
extension: { options: { notePath?: string } } extension: { options: { notePath?: string } }
}) { }) {
const raw = node.attrs.data as string const raw = node.attrs.data as string
const cleaned = raw.replace(/[\u200B-\u200D\uFEFF]/g, "");
const track = useMemo<z.infer<typeof TrackBlockSchema> | null>(() => { const track = useMemo<z.infer<typeof TrackBlockSchema> | null>(() => {
try { try {
return TrackBlockSchema.parse(parseYaml(raw)) return TrackBlockSchema.parse(parseYaml(cleaned))
} catch { return null } } catch(error) { console.error('error', error); return null }
}, [raw]) as z.infer<typeof TrackBlockSchema> | null; }, [raw]) as z.infer<typeof TrackBlockSchema> | null;
const trackId = track?.trackId ?? '' const trackId = track?.trackId ?? ''