Merge pull request #202 from shogunpurple/screenslot
show screenslot and layout together
This commit is contained in:
commit
aedb6ffe46
|
@ -29,10 +29,12 @@
|
||||||
[map(s => `<link rel="stylesheet" href="${s}"/>`), join("\n")]
|
[map(s => `<link rel="stylesheet" href="${s}"/>`), join("\n")]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
$: screensExist = $store.currentPreviewItem._screens && $store.currentPreviewItem._screens.length > 0
|
||||||
|
|
||||||
$: frontendDefinition = {
|
$: frontendDefinition = {
|
||||||
componentLibraries: $store.loadLibraryUrls($store.currentPageName),
|
componentLibraries: $store.loadLibraryUrls($store.currentPageName),
|
||||||
page: $store.currentPreviewItem,
|
page: $store.currentPreviewItem,
|
||||||
screens: [{
|
screens: screensExist ? $store.currentPreviewItem._screens : [{
|
||||||
name: "Screen Placeholder",
|
name: "Screen Placeholder",
|
||||||
route: "*",
|
route: "*",
|
||||||
props: {
|
props: {
|
||||||
|
|
|
@ -34,9 +34,9 @@ export const createApp = (
|
||||||
routeTo,
|
routeTo,
|
||||||
appRootPath: frontendDefinition.appRootPath,
|
appRootPath: frontendDefinition.appRootPath,
|
||||||
})
|
})
|
||||||
const getAttchChildrenParams = attachChildrenParams(stateManager)
|
const getAttachChildrenParams = attachChildrenParams(stateManager)
|
||||||
screenSlotNode.props._children = [screen.props]
|
screenSlotNode.props._children = [screen.props]
|
||||||
const initialiseChildParams = getAttchChildrenParams(screenSlotNode)
|
const initialiseChildParams = getAttachChildrenParams(screenSlotNode)
|
||||||
attachChildren(initialiseChildParams)(screenSlotNode.rootElement, {
|
attachChildren(initialiseChildParams)(screenSlotNode.rootElement, {
|
||||||
hydrate: true,
|
hydrate: true,
|
||||||
force: true,
|
force: true,
|
||||||
|
@ -102,6 +102,7 @@ export const createApp = (
|
||||||
|
|
||||||
return rootTreeNode
|
return rootTreeNode
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
initialisePage,
|
initialisePage,
|
||||||
screenStore: () => screenStateManager.store,
|
screenStore: () => screenStateManager.store,
|
||||||
|
|
|
@ -44,11 +44,9 @@ export const screenRouter = (screens, onScreenSelected, appRootPath) => {
|
||||||
storeInitial["##routeParams"] = params
|
storeInitial["##routeParams"] = params
|
||||||
const store = writable(storeInitial)
|
const store = writable(storeInitial)
|
||||||
|
|
||||||
if (current !== -1) {
|
const screenIndex = current !== -1 ? current : fallback;
|
||||||
onScreenSelected(screens[current], store, _url)
|
|
||||||
} else {
|
onScreenSelected(screens[screenIndex], store, _url)
|
||||||
onScreenSelected(screens[fallback], store, _url)
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
!url.state && history.pushState(_url, null, _url)
|
!url.state && history.pushState(_url, null, _url)
|
||||||
|
|
Loading…
Reference in New Issue