mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Editors: Added lexical editor for testing
Started basic playground for testing lexical as a new WYSIWYG editor. Moved out tinymce to be under wysiwyg-tinymce instead so lexical is the default, but TinyMce code remains.
This commit is contained in:
29
resources/js/wysiwyg-tinymce/plugins-imagemanager.js
Normal file
29
resources/js/wysiwyg-tinymce/plugins-imagemanager.js
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @param {Editor} editor
|
||||
*/
|
||||
function register(editor) {
|
||||
// Custom Image picker button
|
||||
editor.ui.registry.addButton('imagemanager-insert', {
|
||||
title: 'Insert image',
|
||||
icon: 'image',
|
||||
tooltip: 'Insert image',
|
||||
onAction() {
|
||||
/** @type {ImageManager} * */
|
||||
const imageManager = window.$components.first('image-manager');
|
||||
imageManager.show(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');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {register}
|
||||
*/
|
||||
export function getPlugin() {
|
||||
return register;
|
||||
}
|
Reference in New Issue
Block a user