Merge Country Posters' pane address (shareable pages P2)
This commit is contained in:
commit
2b62cc0120
1 changed files with 9 additions and 1 deletions
|
|
@ -32,6 +32,7 @@
|
|||
*/
|
||||
import { ref, computed, inject, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { buildPaneColumn, PANE_GRID_STYLES } from '@map/layouts/pane-wrapper/pane-wrapper.js'
|
||||
import { urlOwnerOf, ownAddress } from '@map/composables/useViewAddress.js'
|
||||
import { useShadowStyles } from '@map/composables/useShadowStyles.js'
|
||||
import ViewSelect from '@map/components/ViewSelect.vue'
|
||||
import { countryName } from '@map/utils/countryName.js'
|
||||
|
|
@ -104,6 +105,11 @@ const view = computed({
|
|||
})
|
||||
let column = null
|
||||
let offScroll = null
|
||||
let offOwn = null
|
||||
// The page address (useViewAddress): ?pane= is the open view ('map'; the first pane is the default and never written).
|
||||
// On this composite's own leaf it owns the address (ownAddress); nested in a shell it announces and the shell writes.
|
||||
// The India pane exists only in an opted-in preview, so ?pane=india names nothing anywhere else.
|
||||
const owner = () => urlOwnerOf(cfg.value)
|
||||
|
||||
// PAGE-LEVEL config keys a pane INHERITS from the host page. A cap-4 composite
|
||||
// nests children as custom elements in THIS document, so anything the generator
|
||||
|
|
@ -209,8 +215,9 @@ function onShowOnMap(e) {
|
|||
|
||||
onMounted(() => {
|
||||
if (!stage.value) return
|
||||
column = buildPaneColumn(spec.value, { host: stage.value })
|
||||
column = buildPaneColumn(spec.value, { host: stage.value, address: { owner } })
|
||||
if (!column) return
|
||||
offOwn = ownAddress(stage.value, owner)
|
||||
for (const pane of column.panes) {
|
||||
if (!pane.config) continue
|
||||
// ★ KEEP THE ELEMENT. It used to be created and dropped on the same line, so there was no
|
||||
|
|
@ -236,6 +243,7 @@ onMounted(() => {
|
|||
onBeforeUnmount(() => {
|
||||
window.removeEventListener(SHOW_ON_MAP, onShowOnMap)
|
||||
offScroll?.()
|
||||
offOwn?.()
|
||||
column?.destroy()
|
||||
column = null
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue