mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-12 19:02:53 +08:00
allow comments in json
This commit is contained in:
parent
40aeda5bf3
commit
e19cdc70f8
@ -40,6 +40,7 @@ export const MonacoEditor = () => {
|
||||
if (monaco) {
|
||||
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||
validate: true,
|
||||
allowComments: true,
|
||||
...(jsonSchema && {
|
||||
schemas: [
|
||||
{
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { parse } from "jsonc-parser";
|
||||
import debounce from "lodash.debounce";
|
||||
import _get from "lodash.get";
|
||||
import _set from "lodash.set";
|
||||
@ -90,7 +91,7 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({
|
||||
getHasChanges: () => get().hasChanges,
|
||||
setContents: ({ contents, hasChanges = true }) => {
|
||||
set({ ...(contents && { contents }), hasChanges });
|
||||
debouncedUpdateJson(JSON.parse(contents as string));
|
||||
debouncedUpdateJson(parse(contents as string));
|
||||
},
|
||||
setError: error => set({ error }),
|
||||
setHasChanges: hasChanges => set({ hasChanges }),
|
||||
|
Loading…
x
Reference in New Issue
Block a user