Actualizar 'components/project.js'

file-group-page
bat 3 years ago
parent f79e664f03
commit 0fb1ef4932

@ -1,20 +1,17 @@
export class Project extends HTMLElement { export class Project extends HTMLElement {
constructor() { constructor() {
super() super()
const path = this.getAttribute('path')
const shadow = this.attachShadow({mode: 'open'}) const shadow = this.attachShadow({mode: 'open'})
const textArea = document.createElement('textarea') const textArea = document.createElement('textarea')
const path = new URL(
window.location.hash.slice(1) || '/',
window.location
).pathname
const header = document.createElement('h1') const header = document.createElement('h1')
header.innerText = path header.innerText = path
textArea.value = localStorage.getItem( textArea.value = localStorage.getItem(
window.location.hash path
) ?? '' ) ?? ''
textArea.addEventListener('input', e => { textArea.addEventListener('input', e => {
localStorage.setItem( localStorage.setItem(
window.location.hash, path,
e.target.value e.target.value
) )
}) })
@ -29,7 +26,7 @@ export class Project extends HTMLElement {
style.textContent = ` style.textContent = `
textarea { textarea {
width: 80%; width: 80%;
height: 90dvh; height: 45vh;
} }
` `
this.shadowRoot.append(style) this.shadowRoot.append(style)

Loading…
Cancel
Save