Skip to content

Commit 7fd8d2a

Browse files
committed
don't parse absent attribute
1 parent 460a8ce commit 7fd8d2a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

web_src/js/features/codeeditor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ const baseOptions: MonacoOpts = {
4141
};
4242

4343
function getEditorconfig(input: HTMLInputElement): EditorConfig | null {
44+
const json = input.getAttribute('data-editorconfig');
45+
if (!json) return null;
4446
try {
45-
return JSON.parse(input.getAttribute('data-editorconfig') ?? '');
47+
return JSON.parse(json);
4648
} catch {
4749
return null;
4850
}

0 commit comments

Comments
 (0)