Actualizar 'components/project.js'

file-group-page
bat 3 years ago
parent a4b05fc757
commit ce795855b2

@ -1,27 +1,28 @@
export class Project extends HTMLElement {
constructor() {
super()
const path = this.getAttribute('path')
const shadow = this.attachShadow({mode: 'open'})
const textArea = document.createElement('textarea')
const header = document.createElement('h1')
header.innerText = path
textArea.value = localStorage.getItem(
path
) ?? ''
textArea.addEventListener('input', e => {
this.textArea = document.createElement('textarea')
this.header = document.createElement('h1')
this.textArea.addEventListener('input', e => {
const path = this.getAttribute('path')
localStorage.setItem(
path,
e.target.value
)
})
const div = document.createElement('div')
div.appendChild(header)
div.appendChild(textArea)
div.appendChild(this.header)
div.appendChild(this.textArea)
shadow.appendChild(div)
}
connectedCallback() {
const path = this.getAttribute('path')
this.header.innerText = path
this.textArea.value = localStorage.getItem(
path
) ?? ''
const style = document.createElement('style')
style.textContent = `
textarea {

Loading…
Cancel
Save