1
0
Fork 0
mirror of synced 2024-06-29 03:20:34 +12:00

Don't clear grid dnd state when loading client library

This commit is contained in:
Andrew Kingston 2022-08-26 14:47:29 +01:00
parent 16c9c6c0dc
commit c2efdd059e
3 changed files with 16 additions and 4 deletions

View file

@ -93,6 +93,7 @@
// Update grid styles
if ($builderStore.gridStyles) {
builderStore.actions.updateStyles($builderStore.gridStyles)
builderStore.actions.clearGridNextLoad()
}
// Reset state and styles

View file

@ -9,6 +9,10 @@ loadSpectrumIcons()
let app
const loadBudibase = () => {
if (get(builderStore).clearGridNextLoad) {
builderStore.actions.setDragging(false)
}
// Update builder store with any builder flags
builderStore.set({
inBuilder: !!window["##BUDIBASE_IN_BUILDER##"],
@ -21,6 +25,8 @@ const loadBudibase = () => {
previewDevice: window["##BUDIBASE_PREVIEW_DEVICE##"],
navigation: window["##BUDIBASE_PREVIEW_NAVIGATION##"],
hiddenComponentIds: window["##BUDIBASE_HIDDEN_COMPONENT_IDS##"],
gridStyles: get(builderStore).gridStyles,
isDragging: get(builderStore).isDragging,
})
// Set app ID - this window flag is set by both the preview and the real
@ -32,10 +38,6 @@ const loadBudibase = () => {
const enableDevTools = !get(builderStore).inBuilder && get(appStore).isDevApp
devToolsStore.actions.setEnabled(enableDevTools)
if (get(builderStore).gridOffset) {
builderStore.actions.setDragging(false)
}
// Create app if one hasn't been created yet
if (!app) {
app = new ClientApp({

View file

@ -19,6 +19,8 @@ const createBuilderStore = () => {
isDragging: false,
navigation: null,
hiddenComponentIds: [],
gridStyles: null,
clearGridNextLoad: false,
// Legacy - allow the builder to specify a layout
layout: null,
@ -74,6 +76,7 @@ const createBuilderStore = () => {
...state,
isDragging: dragging,
gridStyles: null,
clearGridNextLoad: false,
}))
},
setEditMode: enabled => {
@ -97,6 +100,12 @@ const createBuilderStore = () => {
return state
})
},
clearGridNextLoad: () => {
store.update(state => {
state.clearGridNextLoad = true
return state
})
},
}
return {
...store,