|
|
|
|
@ -4,7 +4,6 @@ export class Layout extends HTMLElement {
|
|
|
|
|
this.attachShadow({mode: 'open'})
|
|
|
|
|
this.csp = "default-src 'self' 'unsafe-inline' 'unsafe-eval'"
|
|
|
|
|
this.header = document.createElement('m-header')
|
|
|
|
|
this.editing = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
connectedCallback() {
|
|
|
|
|
@ -45,14 +44,19 @@ export class Layout extends HTMLElement {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get path() {
|
|
|
|
|
return new URL(
|
|
|
|
|
window.location.hash.slice(1) || '/',
|
|
|
|
|
const hash = (
|
|
|
|
|
window.location.hash.slice(1) || '/'
|
|
|
|
|
)
|
|
|
|
|
return hash.startsWith('/') ? new URL(
|
|
|
|
|
hash,
|
|
|
|
|
window.location
|
|
|
|
|
).pathname.replace(/^%23/, '#')
|
|
|
|
|
).pathname : hash
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set editing(value) {
|
|
|
|
|
this._editing = value
|
|
|
|
|
sessionStorage.setItem(
|
|
|
|
|
'editing', value ? 'true' : 'false'
|
|
|
|
|
)
|
|
|
|
|
this.header.editing = this.editing
|
|
|
|
|
if (this.page) {
|
|
|
|
|
this.page.editing = this.editing
|
|
|
|
|
@ -60,6 +64,12 @@ export class Layout extends HTMLElement {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get editing() {
|
|
|
|
|
return this._editing
|
|
|
|
|
try {
|
|
|
|
|
return (
|
|
|
|
|
sessionStorage.getItem('editing') === 'true'
|
|
|
|
|
)
|
|
|
|
|
} catch (e) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|