1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Removed use of image-manager/entity-selector window globals

This commit is contained in:
Dan Brown
2022-11-16 15:21:22 +00:00
parent 3b8ee3954e
commit 25c23a2e5f
5 changed files with 22 additions and 12 deletions

View 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}">`;