Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5f7edb5fe8
@ -38,16 +38,25 @@ class MultipleFilesWidget {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// If there is something in the field, we need to restore our state
|
||||||
|
if (this.element.field.value) {
|
||||||
|
this.rebuildListFromField()
|
||||||
|
}
|
||||||
|
|
||||||
// Set up listening for restore
|
// Set up listening for restore
|
||||||
this.element.field.addEventListener('change', evt => {
|
this.element.field.addEventListener('change', evt => {
|
||||||
let idList = evt.srcElement.value.split(",")
|
this.rebuildListFromField()
|
||||||
for (let id of idList) {
|
|
||||||
this.addFile(id, id, this.setFileDone.bind(this))
|
|
||||||
}
|
|
||||||
this.viewFileList()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rebuildListFromField() {
|
||||||
|
let idList = this.element.field.value.split(",")
|
||||||
|
for (let id of idList) {
|
||||||
|
this.addFile(id, `Saved upload (id ${id})`, this.setFileDone.bind(this))
|
||||||
|
}
|
||||||
|
this.viewFileList()
|
||||||
|
}
|
||||||
|
|
||||||
addFile(id, name, stateFunc) {
|
addFile(id, name, stateFunc) {
|
||||||
let li = document.createElement('li')
|
let li = document.createElement('li')
|
||||||
li.className = 'filewidget--file'
|
li.className = 'filewidget--file'
|
||||||
|
Loading…
Reference in New Issue
Block a user