mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
Actually change version schema
This commit is contained in:
@@ -233,14 +233,24 @@ Promise.all([
|
||||
if (id === version) return
|
||||
|
||||
const newCollections = versionSchemas[id].getCollections()
|
||||
RegistryFetcher(COLLECTIONS, id).then(() => {
|
||||
SCHEMAS = versionSchemas[id].getSchemas(COLLECTIONS)
|
||||
COLLECTIONS = newCollections
|
||||
RegistryFetcher(newCollections, id).then(() => {
|
||||
|
||||
const newSchemas = versionSchemas[id].getSchemas(newCollections)
|
||||
|
||||
const fixModel = (model: any) => {
|
||||
if (model.schema) {
|
||||
models[model.id].schema = newSchemas.get(model.schema)
|
||||
models[model.id].validate()
|
||||
models[model.id].invalidate()
|
||||
} else if (model.children) {
|
||||
model.children.forEach(fixModel)
|
||||
}
|
||||
}
|
||||
config.models.forEach(fixModel)
|
||||
|
||||
treeVersionLabel.textContent = id
|
||||
version = id
|
||||
ga('set', 'dimension3', version);
|
||||
updateModel()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,14 @@ export const renderHtml: Hook<[any, Mounter], [string, string, string]> = {
|
||||
|
||||
choice({ choices, config, switchNode }, path, value, mounter) {
|
||||
const choice = switchNode.activeCase(path, true)
|
||||
const pathWithContext = (config?.context) ?
|
||||
new ModelPath(path.getModel(), new Path(path.getArray(), [config.context])) : path
|
||||
const pathWithContext = (config?.context) ? new ModelPath(path.getModel(), new Path(path.getArray(), [config.context])) : path
|
||||
const pathWithChoiceContext = config?.choiceContext ? new Path([], [config.choiceContext]) : config?.context ? new Path([], [config.context]) : path
|
||||
|
||||
const [prefix, suffix, body] = choice.node.hook(this, pathWithContext, value, mounter)
|
||||
if (choices.length === 1) {
|
||||
return [prefix, suffix, body]
|
||||
}
|
||||
|
||||
const inputId = mounter.register(el => {
|
||||
(el as HTMLSelectElement).value = choice.type
|
||||
el.addEventListener('change', () => {
|
||||
@@ -52,7 +56,6 @@ export const renderHtml: Hook<[any, Mounter], [string, string, string]> = {
|
||||
</option>`).join('')}
|
||||
</select>`
|
||||
|
||||
const [prefix, suffix, body] = choice.node.hook(this, pathWithContext, value, mounter)
|
||||
return [prefix, inject + suffix, body]
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user