Subir archivos a 'components'

file-group-page
bat 3 years ago
parent 81e31fafe7
commit f699f2a3f7

@ -227,21 +227,26 @@ export class Header extends HTMLElement {
const confirmBtn = document.createElement('button')
confirmBtn.innerText = this.text.rename
confirmBtn.style.marginLeft = '3px'
let errorEl
confirmBtn.addEventListener('click', () => {
const newPath = input.value
const exists = localStorage.getItem(newPath)
if (exists ?? true === true) {
const v = localStorage.getItem(newPath)
if (v !== null || newPath === this.path) {
if (!errorEl) {
errorEl = document.createElement('p')
errorEl.style.color = 'red'
errorEl.innerText = this.text.alreadyExists
dialog.bodyEl.appendChild(errorEl)
}
return
}
if (newPath !== this.path) {
localStorage.setItem(
newPath,
localStorage.getItem(this.path)
)
localStorage.removeItem(this.path)
dialog.close()
vlocation.hash = newPath
}
localStorage.setItem(
newPath,
localStorage.getItem(this.path)
)
localStorage.removeItem(this.path)
dialog.close()
location.hash = newPath
})
dialog.footerEl.replaceChildren(
cancelBtn, confirmBtn
@ -266,7 +271,7 @@ export class Header extends HTMLElement {
confirmBtn.style.marginLeft = '3px'
confirmBtn.addEventListener('click', () => {
localStorage.removeItem(this.path)
vlocation.hash = '/'
location.hash = '/'
dialog.close()
})
dialog.footerEl.replaceChildren(
@ -330,15 +335,8 @@ export class Header extends HTMLElement {
confirmBtn.style.marginLeft = '3px'
confirmBtn.addEventListener('click', () => {
const newPath = this.encodePath(input.value)
const exists = localStorage.getItem(newPath)
if (exists ?? true === true) {
return
}
if (newPath !== this.path) {
localStorage.setItem(newPath, '')
}
location.hash = newPath
dialog.close()
vlocation.hash = newPath
})
dialog.footerEl.replaceChildren(
cancelBtn, confirmBtn

Loading…
Cancel
Save