Fixed some image manager behaviour

fixed:
- Double click not working after tab usage.
- Synced edit form with select button.
This commit is contained in:
Dan Brown 2020-07-25 11:47:12 +01:00
parent 8213ea9a71
commit a46b248cf4
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9

View File

@ -27,8 +27,8 @@ class ImageManager {
this.type = 'gallery'; this.type = 'gallery';
this.lastSelected = {}; this.lastSelected = {};
this.lastSelectedTime = 0; this.lastSelectedTime = 0;
this.callback = null;
this.resetState = () => { this.resetState = () => {
this.callback = null;
this.hasData = false; this.hasData = false;
this.page = 1; this.page = 1;
this.filter = 'all'; this.filter = 'all';
@ -143,14 +143,19 @@ class ImageManager {
this.resetState(); this.resetState();
this.resetListView(); this.resetListView();
this.resetSearchView(); this.resetSearchView();
this.formContainer.innerHTML = ''; this.resetEditForm();
this.setActiveFilterTab('all'); this.setActiveFilterTab('all');
this.selectButton.classList.add('hidden');
} }
resetSearchView() { resetSearchView() {
this.searchInput.value = ''; this.searchInput.value = '';
} }
resetEditForm() {
this.formContainer.innerHTML = '';
}
resetListView() { resetListView() {
showLoading(this.listContainer); showLoading(this.listContainer);
this.page = 1; this.page = 1;
@ -173,6 +178,8 @@ class ImageManager {
if (!alreadySelected) { if (!alreadySelected) {
event.target.classList.add('selected'); event.target.classList.add('selected');
this.loadImageEditForm(image.id); this.loadImageEditForm(image.id);
} else {
this.resetEditForm();
} }
this.selectButton.classList.toggle('hidden', alreadySelected); this.selectButton.classList.toggle('hidden', alreadySelected);