Only show the selected step if not already selected
This commit is contained in:
parent
a5778f9dbc
commit
3020b59d86
|
@ -2,7 +2,7 @@
|
||||||
import { getContext, setContext } from "svelte"
|
import { getContext, setContext } from "svelte"
|
||||||
import Placeholder from "../Placeholder.svelte"
|
import Placeholder from "../Placeholder.svelte"
|
||||||
|
|
||||||
export let step
|
export let step = 1
|
||||||
|
|
||||||
const { styleable, builderStore } = getContext("sdk")
|
const { styleable, builderStore } = getContext("sdk")
|
||||||
const component = getContext("component")
|
const component = getContext("component")
|
||||||
|
@ -14,16 +14,15 @@
|
||||||
$: formState = formContext?.formState
|
$: formState = formContext?.formState
|
||||||
$: currentStep = $formState?.currentStep
|
$: currentStep = $formState?.currentStep
|
||||||
|
|
||||||
// If in the builder preview, show this step if it is selected
|
// If in the builder preview, show this step if a child is selected
|
||||||
$: {
|
$: {
|
||||||
if (step && formContext && $builderStore.inBuilder) {
|
if (
|
||||||
console.log($builderStore.selectedPath)
|
formContext &&
|
||||||
console.log($component.id)
|
$builderStore.inBuilder &&
|
||||||
|
$builderStore.selectedComponentPath?.includes($component.id) &&
|
||||||
if ($builderStore.selectedComponentPath?.includes($component.id)) {
|
$formState?.currentStep !== step
|
||||||
console.log("selecting " + step)
|
) {
|
||||||
formContext.formApi.setStep(step)
|
formContext.formApi.setStep(step)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue