]> 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 da842849d97bc9b4c45f243086340949d474639a..a44fffc1b437776af3d723e445eef617db7757b9 100644 (file)
@@ -4,7 +4,6 @@ import {Component} from "./component";
 export class ImageManager extends Component {
 
     setup() {
-
         // Options
         this.uploadedTo = this.$opts.uploadedTo;
 
@@ -33,8 +32,6 @@ export class ImageManager extends Component {
         this.resetState();
 
         this.setupListeners();
-
-        window.ImageManager = this;
     }
 
     setupListeners() {
@@ -97,7 +94,7 @@ export class ImageManager extends Component {
 
         this.callback = callback;
         this.type = type;
-        this.popupEl.components.popup.show();
+        this.getPopup().show();
         this.dropzoneContainer.classList.toggle('hidden', type !== 'gallery');
 
         if (!this.hasData) {
@@ -107,7 +104,14 @@ export class ImageManager extends Component {
     }
 
     hide() {
-        this.popupEl.components.popup.hide();
+        this.getPopup().hide();
+    }
+
+    /**
+     * @returns {Popup}
+     */
+    getPopup() {
+        return window.$components.firstOnElement(this.popupEl, 'popup');
     }
 
     async loadGallery() {