added validation

This commit is contained in:
Henry Jameson 2024-11-18 03:53:37 +02:00
commit 973e8697bc
3 changed files with 23 additions and 5 deletions

View file

@ -597,7 +597,11 @@ export default {
const styleImporter = newImporter({
accept: '.piss',
parser: (string) => deserialize(string),
parser (string) { return deserialize(string) },
onImportFailure (result) {
console.error('Failure importing style:', result)
this.$store.dispatch('pushGlobalNotice', { messageKey: 'settings.invalid_theme_imported', level: 'error' })
},
onImport (parsed, filename) {
const editorComponents = parsed.filter(x => x.component.startsWith('@'))
const rootComponent = parsed.find(x => x.component === 'Root')