mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-12-13 05:53:55 +08:00
ef211a76ae
- Created new translation file for editor view. - Added simple logic to format for tinymce. - Aligned some of the custom labels we were using.
31 lines
836 B
JavaScript
31 lines
836 B
JavaScript
/**
|
|
* @param {Editor} editor
|
|
* @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) {
|
|
const imageUrl = image.thumbs.display || image.url;
|
|
let html = `<a href="${image.url}" target="_blank">`;
|
|
html += `<img src="${imageUrl}" alt="${image.name}">`;
|
|
html += '</a>';
|
|
editor.execCommand('mceInsertContent', false, html);
|
|
}, 'gallery');
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* @param {WysiwygConfigOptions} options
|
|
* @return {register}
|
|
*/
|
|
export function getPlugin(options) {
|
|
return register;
|
|
} |