mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-24 15:47:08 +00:00
Show error when importing invalid json
This commit is contained in:
@@ -5,6 +5,7 @@ import config from '../../config.json'
|
||||
import { Analytics } from '../Analytics'
|
||||
import { Ad, Btn, BtnInput, BtnMenu, ErrorPanel, HasPreview, Octicon, PreviewPanel, SourcePanel, Tree } from '../components'
|
||||
import { fetchPreset } from '../DataFetcher'
|
||||
import { useModel } from '../hooks'
|
||||
import { locale } from '../Locales'
|
||||
import type { BlockStateRegistry, VersionId } from '../Schemas'
|
||||
import { checkVersion, getBlockStates, getCollections, getModel } from '../Schemas'
|
||||
@@ -55,6 +56,10 @@ export function Generator({ lang, changeTitle, version, onChangeVersion }: Gener
|
||||
.catch(e => { console.error(e); setError(e.message) })
|
||||
}, [version, gen.id])
|
||||
|
||||
useModel(model, () => {
|
||||
setError(null)
|
||||
})
|
||||
|
||||
const reset = () => {
|
||||
Analytics.generatorEvent('reset')
|
||||
model?.reset(model.schema.default(), true)
|
||||
|
||||
Reference in New Issue
Block a user