]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/image-manager.js
Guest create page: name field autofocus
[bookstack] / resources / js / components / image-manager.js
index 1222096d456bfe0d50263433c78d3bb8d3b552bb..a44fffc1b437776af3d723e445eef617db7757b9 100644 (file)
@@ -1,13 +1,9 @@
 import {onChildEvent, onSelect, removeLoading, showLoading} from "../services/dom";
+import {Component} from "./component";
 
-/**
- * ImageManager
- * @extends {Component}
- */
-class ImageManager {
+export class ImageManager extends Component {
 
     setup() {
-
         // Options
         this.uploadedTo = this.$opts.uploadedTo;
 
@@ -36,8 +32,6 @@ class ImageManager {
         this.resetState();
 
         this.setupListeners();
-
-        window.ImageManager = this;
     }
 
     setupListeners() {
@@ -100,7 +94,7 @@ class ImageManager {
 
         this.callback = callback;
         this.type = type;
-        this.popupEl.components.popup.show();
+        this.getPopup().show();
         this.dropzoneContainer.classList.toggle('hidden', type !== 'gallery');
 
         if (!this.hasData) {
@@ -110,7 +104,14 @@ class ImageManager {
     }
 
     hide() {
-        this.popupEl.components.popup.hide();
+        this.getPopup().hide();
+    }
+
+    /**
+     * @returns {Popup}
+     */
+    getPopup() {
+        return window.$components.firstOnElement(this.popupEl, 'popup');
     }
 
     async loadGallery() {
@@ -210,6 +211,4 @@ class ImageManager {
         window.$components.init(this.formContainer);
     }
 
-}
-
-export default ImageManager;
\ No newline at end of file
+}
\ No newline at end of file