1
0
Fork 0
mirror of synced 2024-10-04 20:13:35 +13:00

bugfix: dnd over screenslot was throwing err

This commit is contained in:
Michael Shanks 2020-08-13 14:02:15 +01:00
parent 2f8d63959d
commit 764a09118c
4 changed files with 11 additions and 6 deletions

View file

@ -25,6 +25,7 @@ import {
saveScreenApi as _saveScreenApi, saveScreenApi as _saveScreenApi,
regenerateCssForCurrentScreen, regenerateCssForCurrentScreen,
generateNewIdsForComponent, generateNewIdsForComponent,
getComponentDefinition,
} from "../storeUtils" } from "../storeUtils"
export const getStore = () => { export const getStore = () => {
const initial = { const initial = {
@ -77,9 +78,6 @@ export const getStore = () => {
export default getStore export default getStore
export const getComponentDefinition = (state, name) =>
name.startsWith("##") ? getBuiltin(name) : state.components[name]
const setPackage = (store, initial) => async pkg => { const setPackage = (store, initial) => async pkg => {
const [main_screens, unauth_screens] = await Promise.all([ const [main_screens, unauth_screens] = await Promise.all([
api api

View file

@ -1,4 +1,7 @@
import { makePropsSafe } from "components/userInterface/pagesParsing/createProps" import {
makePropsSafe,
getBuiltin,
} from "components/userInterface/pagesParsing/createProps"
import api from "./api" import api from "./api"
import { generate_screen_css } from "./generate_css" import { generate_screen_css } from "./generate_css"
import { uuid } from "./uuid" import { uuid } from "./uuid"
@ -85,3 +88,6 @@ export const generateNewIdsForComponent = c =>
walkProps(c, p => { walkProps(c, p => {
p._id = uuid() p._id = uuid()
}) })
export const getComponentDefinition = (state, name) =>
name.startsWith("##") ? getBuiltin(name) : state.components[name]

View file

@ -1,7 +1,7 @@
<script> <script>
import { MoreIcon } from "components/common/Icons" import { MoreIcon } from "components/common/Icons"
import { store } from "builderStore" import { store } from "builderStore"
import { getComponentDefinition } from "builderStore/store" import { getComponentDefinition } from "builderStore/storeUtils"
import ConfirmDialog from "components/common/ConfirmDialog.svelte" import ConfirmDialog from "components/common/ConfirmDialog.svelte"
import { last, cloneDeep } from "lodash/fp" import { last, cloneDeep } from "lodash/fp"
import UIkit from "uikit" import UIkit from "uikit"

View file

@ -10,6 +10,7 @@
ChevronDownIcon, ChevronDownIcon,
CopyIcon, CopyIcon,
} from "../common/Icons" } from "../common/Icons"
import { getComponentDefinition } from "builderStore/storeUtils"
export let components = [] export let components = []
export let currentComponent export let currentComponent
@ -51,7 +52,7 @@
const dragover = (component, index) => e => { const dragover = (component, index) => e => {
const canHaveChildrenButIsEmpty = const canHaveChildrenButIsEmpty =
$store.components[component._component].children && getComponentDefinition($store, component._component).children &&
component._children.length === 0 component._children.length === 0
e.dataTransfer.dropEffect = "copy" e.dataTransfer.dropEffect = "copy"