|
|
@ -21,6 +21,7 @@ export class Header extends HTMLElement { |
|
|
textEn = { |
|
|
textEn = { |
|
|
download: 'Download', |
|
|
download: 'Download', |
|
|
rename: 'Move/Rename', |
|
|
rename: 'Move/Rename', |
|
|
|
|
|
duplicate: 'Duplicate', |
|
|
delete: 'Delete', |
|
|
delete: 'Delete', |
|
|
confirmDelete: f => ( |
|
|
confirmDelete: f => ( |
|
|
`Are you sure you want to delete ${f}?` |
|
|
`Are you sure you want to delete ${f}?` |
|
|
@ -36,6 +37,7 @@ export class Header extends HTMLElement { |
|
|
textEs = { |
|
|
textEs = { |
|
|
download: 'Descargar', |
|
|
download: 'Descargar', |
|
|
rename: 'Mover/Renombrar', |
|
|
rename: 'Mover/Renombrar', |
|
|
|
|
|
duplicate: 'Duplicar', |
|
|
delete: 'Borrar', |
|
|
delete: 'Borrar', |
|
|
confirmDelete: f => ( |
|
|
confirmDelete: f => ( |
|
|
`¿Desea borrar ${f}?` |
|
|
`¿Desea borrar ${f}?` |
|
|
@ -253,6 +255,45 @@ export class Header extends HTMLElement { |
|
|
dialog.footerEl.appendChild(bGroup) |
|
|
dialog.footerEl.appendChild(bGroup) |
|
|
dialog.open() |
|
|
dialog.open() |
|
|
}) |
|
|
}) |
|
|
|
|
|
this.pageMenu.add(this.text.duplicate, () => { |
|
|
|
|
|
const dialog = document.createElement( |
|
|
|
|
|
'm-dialog' |
|
|
|
|
|
) |
|
|
|
|
|
this.dialogWrap.replaceChildren(dialog) |
|
|
|
|
|
const input = document.createElement('input') |
|
|
|
|
|
input.value = this.path |
|
|
|
|
|
input.style.minWidth = '300px' |
|
|
|
|
|
dialog.bodyEl.appendChild(input) |
|
|
|
|
|
let errorEl |
|
|
|
|
|
const bGroup = document.createElement( |
|
|
|
|
|
'm-forms-button-group' |
|
|
|
|
|
) |
|
|
|
|
|
bGroup.addPrimary(this.text.duplicate, () => { |
|
|
|
|
|
const newPath = input.value |
|
|
|
|
|
const v = localStorage.getItem(newPath) |
|
|
|
|
|
if (v !== null || newPath === this.path) { |
|
|
|
|
|
if (!errorEl) { |
|
|
|
|
|
errorEl = document.createElement('p') |
|
|
|
|
|
errorEl.style.color = 'red' |
|
|
|
|
|
const errText = this.text.alreadyExists |
|
|
|
|
|
errorEl.innerText = errText |
|
|
|
|
|
dialog.bodyEl.appendChild(errorEl) |
|
|
|
|
|
} |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
localStorage.setItem( |
|
|
|
|
|
newPath, |
|
|
|
|
|
localStorage.getItem(this.path) |
|
|
|
|
|
) |
|
|
|
|
|
dialog.close() |
|
|
|
|
|
location.hash = newPath |
|
|
|
|
|
}) |
|
|
|
|
|
bGroup.addCancel(this.text.cancel, () => { |
|
|
|
|
|
dialog.close() |
|
|
|
|
|
}) |
|
|
|
|
|
dialog.footerEl.appendChild(bGroup) |
|
|
|
|
|
dialog.open() |
|
|
|
|
|
}) |
|
|
this.pageMenu.add(this.text.delete, () => { |
|
|
this.pageMenu.add(this.text.delete, () => { |
|
|
const dialog = document.createElement( |
|
|
const dialog = document.createElement( |
|
|
'm-dialog' |
|
|
'm-dialog' |
|
|
|