]> BookStack Code Mirror - bookstack/blobdiff - resources/js/wysiwyg/plugins-imagemanager.js
Guest create page: name field autofocus
[bookstack] / resources / js / wysiwyg / plugins-imagemanager.js
index 225f271fdb9c2c7aef16d56e0aaf578685e222f8..6969a50e22264bb77e96c626dc93d04329edeb3e 100644 (file)
@@ -3,14 +3,15 @@
  * @param {String} url
  */
 function register(editor, url) {
-
     // Custom Image picker button
     editor.ui.registry.addButton('imagemanager-insert', {
         title: 'Insert image',
         icon: 'image',
         tooltip: 'Insert image',
         onAction() {
-            window.ImageManager.show(function (image) {
+            /** @type {ImageManager} **/
+            const imageManager = window.$components.first('image-manager');
+            imageManager.show(function (image) {
                 const imageUrl = image.thumbs.display || image.url;
                 let html = `<a href="${image.url}" target="_blank">`;
                 html += `<img src="${imageUrl}" alt="${image.name}">`;