This commit is contained in:
Andrew Kingston 2022-10-24 09:43:45 +01:00
parent ce532cc403
commit c6b7b1a2d4
2 changed files with 8 additions and 15 deletions

View File

@ -124,6 +124,7 @@
if (!message?.data?.type) { if (!message?.data?.type) {
return return
} }
console.debug(`CLIENT: [${message.data.type}]`)
// Await the event handler // Await the event handler
try { try {
@ -139,20 +140,11 @@
} }
const handleBudibaseEvent = async event => { const handleBudibaseEvent = async event => {
const { type, data } = event.data || event.detail const { type, data } = event.data
if (!type) {
return
}
if (type === MessageTypes.READY) { if (type === MessageTypes.READY) {
// Initialise the app when mounted // Initialise the app when mounted
if ($store.clientFeatures.messagePassing) { if (!loading) {
if (!loading) return return
}
// Display preview immediately if the intelligent loading feature
// is not supported
if (!$store.clientFeatures.intelligentLoading) {
loading = false
} }
refreshContent(json) refreshContent(json)
} else if (type === MessageTypes.ERROR) { } else if (type === MessageTypes.ERROR) {

View File

@ -7,10 +7,12 @@
let gridStyles let gridStyles
let id let id
// Some memoisation of primitive types for performance
$: jsonStyles = JSON.stringify(gridStyles) $: jsonStyles = JSON.stringify(gridStyles)
$: id = dragInfo?.id || id $: id = dragInfo?.id || id
$: instance = componentStore.actions.getComponentInstance(id)
$: instance?.setEphemeralStyles({ // Set ephemeral grid styles on the dragged component
$: componentStore.actions.getComponentInstance(id)?.setEphemeralStyles({
...gridStyles, ...gridStyles,
...(gridStyles ? { "z-index": 999 } : null), ...(gridStyles ? { "z-index": 999 } : null),
}) })
@ -193,7 +195,6 @@
// Callback when drag stops (whether dropped or not) // Callback when drag stops (whether dropped or not)
const stopDragging = async () => { const stopDragging = async () => {
console.log("STOP")
// Save changes // Save changes
if (gridStyles) { if (gridStyles) {
await builderStore.actions.updateStyles(gridStyles, dragInfo.id) await builderStore.actions.updateStyles(gridStyles, dragInfo.id)