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:
@ -73,7 +73,9 @@ function file_picker_callback(callback, value, meta) {
|
||||
|
||||
// field_name, url, type, win
|
||||
if (meta.filetype === 'file') {
|
||||
window.EntitySelectorPopup.show(entity => {
|
||||
/** @type {EntitySelectorPopup} **/
|
||||
const selector = window.$components.first('entity-selector-popup');
|
||||
selector.show(entity => {
|
||||
callback(entity.link, {
|
||||
text: entity.name,
|
||||
title: entity.name,
|
||||
@ -83,7 +85,9 @@ function file_picker_callback(callback, value, meta) {
|
||||
|
||||
if (meta.filetype === 'image') {
|
||||
// Show image manager
|
||||
window.ImageManager.show(function (image) {
|
||||
/** @type {ImageManager} **/
|
||||
const imageManager = window.$components.first('image-manager');
|
||||
imageManager.show(function (image) {
|
||||
callback(image.url, {alt: image.name});
|
||||
}, 'gallery');
|
||||
}
|
||||
|
@ -15,8 +15,10 @@ function isDrawing(node) {
|
||||
function showDrawingManager(mceEditor, selectedNode = null) {
|
||||
pageEditor = mceEditor;
|
||||
currentNode = selectedNode;
|
||||
// Show image manager
|
||||
window.ImageManager.show(function (image) {
|
||||
|
||||
/** @type {ImageManager} **/
|
||||
const imageManager = window.$components.first('image-manager');
|
||||
imageManager.show(function (image) {
|
||||
if (selectedNode) {
|
||||
const imgElem = selectedNode.querySelector('img');
|
||||
pageEditor.undoManager.transact(function () {
|
||||
|
@ -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}">`;
|
||||
|
Reference in New Issue
Block a user