Studio: fix bug which prevented saving, allow setting a 'snapName'

This commit is contained in:
Pieter Vander Vennet 2025-05-03 23:44:08 +02:00
parent f801e89fc1
commit 612e71a4b6
2 changed files with 7 additions and 13 deletions

View file

@ -619,7 +619,7 @@ export interface LayerConfigJson {
* *
* In the move wizard, the option `snap object onto {snapName}` is shown * In the move wizard, the option `snap object onto {snapName}` is shown
* *
* group: hidden * group: expert
*/ */
snapName?: Translatable snapName?: Translatable

View file

@ -1,12 +1,7 @@
import { ConfigMeta } from "./configMeta" import { ConfigMeta } from "./configMeta"
import { Store, UIEventSource } from "../../Logic/UIEventSource" import { Store, UIEventSource } from "../../Logic/UIEventSource"
import { LayerConfigJson } from "../../Models/ThemeConfig/Json/LayerConfigJson" import { LayerConfigJson } from "../../Models/ThemeConfig/Json/LayerConfigJson"
import { import { Conversion, ConversionMessage, DesugaringContext, Pipe } from "../../Models/ThemeConfig/Conversion/Conversion"
Conversion,
ConversionMessage,
DesugaringContext,
Pipe,
} from "../../Models/ThemeConfig/Conversion/Conversion"
import { PrepareLayer } from "../../Models/ThemeConfig/Conversion/PrepareLayer" import { PrepareLayer } from "../../Models/ThemeConfig/Conversion/PrepareLayer"
import { PrevalidateTheme, ValidateLayer } from "../../Models/ThemeConfig/Conversion/Validation" import { PrevalidateTheme, ValidateLayer } from "../../Models/ThemeConfig/Conversion/Validation"
import { AllSharedLayers } from "../../Customizations/AllSharedLayers" import { AllSharedLayers } from "../../Customizations/AllSharedLayers"
@ -24,6 +19,7 @@ import { ConversionContext } from "../../Models/ThemeConfig/Conversion/Conversio
import { LocalStorageSource } from "../../Logic/Web/LocalStorageSource" import { LocalStorageSource } from "../../Logic/Web/LocalStorageSource"
import { TagRenderingConfigJson } from "../../Models/ThemeConfig/Json/TagRenderingConfigJson" import { TagRenderingConfigJson } from "../../Models/ThemeConfig/Json/TagRenderingConfigJson"
import { ValidateTheme } from "../../Models/ThemeConfig/Conversion/ValidateTheme" import { ValidateTheme } from "../../Models/ThemeConfig/Conversion/ValidateTheme"
import * as questions from "../../assets/generated/layers/questions.json"
export interface HighlightedTagRendering { export interface HighlightedTagRendering {
path: ReadonlyArray<string | number> path: ReadonlyArray<string | number>
@ -449,11 +445,10 @@ export default class EditLayerState extends EditJsonState<LayerConfigJson> {
configuration: Partial<LayerConfigJson> configuration: Partial<LayerConfigJson>
): Promise<ConversionMessage[]> { ): Promise<ConversionMessage[]> {
const layers = AllSharedLayers.getSharedLayersConfigs() const layers = AllSharedLayers.getSharedLayersConfigs()
const questionsLayer = questions
const questions = layers.get("questions")
const sharedQuestions = new Map<string, QuestionableTagRenderingConfigJson>() const sharedQuestions = new Map<string, QuestionableTagRenderingConfigJson>()
for (const question of questions.tagRenderings) { for (const question of questionsLayer.tagRenderings) {
sharedQuestions.set(question["id"], <QuestionableTagRenderingConfigJson>question) sharedQuestions.set(question["id"], <QuestionableTagRenderingConfigJson><unknown>question)
} }
const state: DesugaringContext = { const state: DesugaringContext = {
tagRenderings: sharedQuestions, tagRenderings: sharedQuestions,
@ -527,10 +522,9 @@ export class EditThemeState extends EditJsonState<ThemeConfigJson> {
layers.set(l, config) layers.set(l, config)
} }
const questions = layers.get("questions")
const sharedQuestions = new Map<string, QuestionableTagRenderingConfigJson>() const sharedQuestions = new Map<string, QuestionableTagRenderingConfigJson>()
for (const question of questions.tagRenderings) { for (const question of questions.tagRenderings) {
sharedQuestions.set(question["id"], <QuestionableTagRenderingConfigJson>question) sharedQuestions.set(question["id"], <QuestionableTagRenderingConfigJson><unknown>question)
} }
const state: DesugaringContext = { const state: DesugaringContext = {
tagRenderings: sharedQuestions, tagRenderings: sharedQuestions,