From 36cae9c4554a27ddcac8b1a1f13d89f0bc81bc7d Mon Sep 17 00:00:00 2001 From: bat Date: Sat, 25 Mar 2023 21:30:24 +0000 Subject: [PATCH] toggle editing --- components/layout.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/layout.js b/components/layout.js index 4665841..cf125d0 100644 --- a/components/layout.js +++ b/components/layout.js @@ -3,6 +3,12 @@ export class Layout extends HTMLElement { super() this.attachShadow({mode: 'open'}) this.header = document.createElement('m-header') + this.editing = false + this.header.editing = this.editing + this.header.addEventListener('click-edit', () => { + this.editing = !this.editing + this.header.editing = this.editing + }) this.shadowRoot.appendChild(this.header) this.load() addEventListener('hashchange', () => { @@ -39,9 +45,6 @@ export class Layout extends HTMLElement { } get path() { - return new URL( - window.location.hash.slice(1) || '/', - window.location - ).pathname + return '/hello' } } \ No newline at end of file