mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-10 21:53:34 +08:00
Image manager: fix upload control for drawing, updated styles
- Tightened image manager styles to address things that looked akward. - Prevented visiblity/use of upload controls for drawings. - Updated dropzone to use error handling from validation messages.
This commit is contained in:
@ -18,6 +18,8 @@ export class ImageManager extends Component {
|
||||
this.listContainer = this.$refs.listContainer;
|
||||
this.filterTabs = this.$manyRefs.filterTabs;
|
||||
this.selectButton = this.$refs.selectButton;
|
||||
this.uploadButton = this.$refs.uploadButton;
|
||||
this.uploadHint = this.$refs.uploadHint;
|
||||
this.formContainer = this.$refs.formContainer;
|
||||
this.formContainerPlaceholder = this.$refs.formContainerPlaceholder;
|
||||
this.dropzoneContainer = this.$refs.dropzoneContainer;
|
||||
@ -35,11 +37,6 @@ export class ImageManager extends Component {
|
||||
this.resetState();
|
||||
|
||||
this.setupListeners();
|
||||
|
||||
window.setTimeout(() => {
|
||||
this.show(() => {
|
||||
}, 'gallery');
|
||||
}, 500);
|
||||
}
|
||||
|
||||
setupListeners() {
|
||||
@ -60,18 +57,14 @@ export class ImageManager extends Component {
|
||||
this.resetListView();
|
||||
this.resetSearchView();
|
||||
this.loadGallery();
|
||||
this.cancelSearch.classList.remove('active');
|
||||
});
|
||||
|
||||
this.searchInput.addEventListener('input', () => {
|
||||
this.cancelSearch.classList.toggle('active', this.searchInput.value.trim());
|
||||
});
|
||||
|
||||
onChildEvent(this.listContainer, '.load-more', 'click', async event => {
|
||||
showLoading(event.target);
|
||||
onChildEvent(this.listContainer, '.load-more button', 'click', async event => {
|
||||
const wrapper = event.target.closest('.load-more');
|
||||
showLoading(wrapper);
|
||||
this.page += 1;
|
||||
await this.loadGallery();
|
||||
event.target.remove();
|
||||
wrapper.remove();
|
||||
});
|
||||
|
||||
this.listContainer.addEventListener('event-emit-select-image', this.onImageSelectEvent.bind(this));
|
||||
@ -106,7 +99,15 @@ export class ImageManager extends Component {
|
||||
this.callback = callback;
|
||||
this.type = type;
|
||||
this.getPopup().show();
|
||||
this.dropzoneContainer.classList.toggle('hidden', type !== 'gallery');
|
||||
|
||||
const hideUploads = type !== 'gallery';
|
||||
this.dropzoneContainer.classList.toggle('hidden', hideUploads);
|
||||
this.uploadButton.classList.toggle('hidden', hideUploads);
|
||||
this.uploadHint.classList.toggle('hidden', hideUploads);
|
||||
|
||||
/** @var {Dropzone} * */
|
||||
const dropzone = window.$components.firstOnElement(this.container, 'dropzone');
|
||||
dropzone.toggleActive(!hideUploads);
|
||||
|
||||
if (!this.hasData) {
|
||||
this.loadGallery();
|
||||
|
Reference in New Issue
Block a user