X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/921131f99949960f448b2cfbb0ad78edc8d4f24a..refs/pull/4467/head:/resources/js/wysiwyg/plugins-imagemanager.js diff --git a/resources/js/wysiwyg/plugins-imagemanager.js b/resources/js/wysiwyg/plugins-imagemanager.js index d3b03e38c..37b5bfafd 100644 --- a/resources/js/wysiwyg/plugins-imagemanager.js +++ b/resources/js/wysiwyg/plugins-imagemanager.js @@ -1,31 +1,29 @@ /** * @param {Editor} editor - * @param {String} url */ -function register(editor, url) { - +function register(editor) { // Custom Image picker button editor.ui.registry.addButton('imagemanager-insert', { - title: 'Insert an image', + title: 'Insert image', icon: 'image', - tooltip: 'Insert an image', + tooltip: 'Insert image', onAction() { - window.ImageManager.show(function (image) { + /** @type {ImageManager} * */ + const imageManager = window.$components.first('image-manager'); + imageManager.show(image => { const imageUrl = image.thumbs.display || image.url; let html = ``; html += `${image.name}`; html += ''; editor.execCommand('mceInsertContent', false, html); }, 'gallery'); - } + }, }); } - /** - * @param {WysiwygConfigOptions} options * @return {register} */ -export function getPlugin(options) { +export function getPlugin() { return register; -} \ No newline at end of file +}