mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-04-05 00:56:32 +00:00
Fix: Remove UUID from URL when popup closes
Co-authored-by: antontranelis <31516529+antontranelis@users.noreply.github.com>
This commit is contained in:
parent
0456046ed8
commit
a0b70136b5
@ -169,6 +169,23 @@ export function UtopiaMapInner({
|
|||||||
document.title = `${document.title.split('-')[0]} - ${title}`
|
document.title = `${document.title.split('-')[0]} - ${title}`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
popupclose: () => {
|
||||||
|
// Remove UUID from URL when popup closes
|
||||||
|
if (containsUUID(window.location.pathname)) {
|
||||||
|
const params = new URLSearchParams(window.location.search)
|
||||||
|
window.history.pushState({}, '', '/' + `${params.toString() !== '' ? `?${params}` : ''}`)
|
||||||
|
// Reset page title
|
||||||
|
document.title = document.title.split('-')[0]
|
||||||
|
// Reset meta tags
|
||||||
|
document.querySelector('meta[property="og:title"]')?.setAttribute('content', document.title)
|
||||||
|
document
|
||||||
|
.querySelector('meta[property="og:description"]')
|
||||||
|
?.setAttribute(
|
||||||
|
'content',
|
||||||
|
`${document.querySelector('meta[name="description"]')?.getAttribute('content')}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const openPopup = () => {
|
const openPopup = () => {
|
||||||
@ -206,7 +223,7 @@ export function UtopiaMapInner({
|
|||||||
|
|
||||||
const resetMetaTags = () => {
|
const resetMetaTags = () => {
|
||||||
const params = new URLSearchParams(window.location.search)
|
const params = new URLSearchParams(window.location.search)
|
||||||
if (!containsUUID(window.location.pathname)) {
|
if (containsUUID(window.location.pathname)) {
|
||||||
window.history.pushState({}, '', '/' + `${params.toString() !== '' ? `?${params}` : ''}`)
|
window.history.pushState({}, '', '/' + `${params.toString() !== '' ? `?${params}` : ''}`)
|
||||||
}
|
}
|
||||||
document.title = document.title.split('-')[0]
|
document.title = document.title.split('-')[0]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user