saving progress based on review reccomendations

This commit is contained in:
mikesealey 2024-04-17 16:27:23 +01:00
parent 359355b58d
commit ad10679115
4 changed files with 12 additions and 14 deletions

View File

@ -6724,18 +6724,17 @@
"showEmptyState": false, "showEmptyState": false,
"draggable": false, "draggable": false,
"info": "Side panels are hidden by default. They will only be revealed when triggered by the 'Open Side Panel' action.", "info": "Side panels are hidden by default. They will only be revealed when triggered by the 'Open Side Panel' action.",
"sendEvents": true,
"settings": [ "settings": [
{ {
"type": "boolean", "type": "boolean",
"key": "clickOutsideToClose", "key": "ignoreClicksOutside",
"label": "Click outside to close", "label": "Ignore clicks outside",
"defaultValue": true "defaultValue": false
}, },
{ {
"type": "event", "type": "event",
"key": "onSidePanelClose", "key": "onClose",
"label": "On side panel close" "label": "On close"
} }
] ]
}, },

View File

@ -76,7 +76,7 @@
$: autoCloseSidePanel = $: autoCloseSidePanel =
!$builderStore.inBuilder && !$builderStore.inBuilder &&
$sidePanelStore.open && $sidePanelStore.open &&
$sidePanelStore.clickOutsideToClose $sidePanelStore.ignoreClicksOutside
$: screenId = $builderStore.inBuilder $: screenId = $builderStore.inBuilder
? `${$builderStore.screen?._id}-screen` ? `${$builderStore.screen?._id}-screen`
: "screen" : "screen"

View File

@ -6,7 +6,7 @@
getContext("sdk") getContext("sdk")
export let sidePanelClose export let sidePanelClose
export let clickOutsideToClose export let ignoreClicksOutside
// Automatically show and hide the side panel when inside the builder. // Automatically show and hide the side panel when inside the builder.
// For some unknown reason, svelte reactivity breaks if we reference the // For some unknown reason, svelte reactivity breaks if we reference the
@ -30,7 +30,7 @@
} }
$: { $: {
sidePanelStore.actions.setSidepanelState(clickOutsideToClose) sidePanelStore.actions.setIgnoreClicksOutside(ignoreClicksOutside)
} }
// Derive visibility // Derive visibility

View File

@ -3,7 +3,7 @@ import { writable, derived } from "svelte/store"
export const createSidePanelStore = () => { export const createSidePanelStore = () => {
const initialState = { const initialState = {
contentId: null, contentId: null,
clickOutsideToClose: true, ignoreClicksOutside: true,
} }
const store = writable(initialState) const store = writable(initialState)
const derivedStore = derived(store, $store => { const derivedStore = derived(store, $store => {
@ -33,10 +33,9 @@ export const createSidePanelStore = () => {
}, 50) }, 50)
} }
const setSidepanelState = bool => { const setIgnoreClicksOutside = bool => {
clearTimeout(timeout)
store.update(state => { store.update(state => {
state.clickOutsideToClose = bool state.ignoreClicksOutside = bool
return state return state
}) })
} }
@ -45,7 +44,7 @@ export const createSidePanelStore = () => {
actions: { actions: {
open, open,
close, close,
setSidepanelState, setIgnoreClicksOutside,
}, },
} }
} }