mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-31 15:24:31 +03:00
Started work on drawing revisions
Improved sidebar and selection styling of image manager. Allowed image manager imageType to be changed on open. Created models for image revisions.
This commit is contained in:
@ -221,8 +221,6 @@ function codePlugin() {
|
||||
|
||||
function drawIoPlugin() {
|
||||
|
||||
const drawIoUrl = 'https://www.draw.io/?embed=1&ui=atlas&spin=1&proto=json';
|
||||
let iframe = null;
|
||||
let pageEditor = null;
|
||||
let currentNode = null;
|
||||
|
||||
@ -230,6 +228,20 @@ function drawIoPlugin() {
|
||||
return node.hasAttribute('drawio-diagram');
|
||||
}
|
||||
|
||||
function showDrawingManager(mceEditor, selectedNode = null) {
|
||||
// TODO - Handle how image manager links in.
|
||||
// Show image manager
|
||||
window.ImageManager.show(function (image) {
|
||||
|
||||
|
||||
// // Replace the actively selected content with the linked image
|
||||
// let html = `<a href="${image.url}" target="_blank">`;
|
||||
// html += `<img src="${image.thumbs.display}" alt="${image.name}">`;
|
||||
// html += '</a>';
|
||||
// win.tinyMCE.activeEditor.execCommand('mceInsertContent', false, html);
|
||||
}, 'drawio');
|
||||
}
|
||||
|
||||
function showDrawingEditor(mceEditor, selectedNode = null) {
|
||||
pageEditor = mceEditor;
|
||||
currentNode = selectedNode;
|
||||
@ -287,7 +299,12 @@ function drawIoPlugin() {
|
||||
window.tinymce.PluginManager.add('drawio', function(editor, url) {
|
||||
|
||||
editor.addCommand('drawio', () => {
|
||||
showDrawingEditor(editor);
|
||||
let selectedNode = editor.selection.getNode();
|
||||
if (isDrawing(selectedNode)) {
|
||||
showDrawingManager(editor, selectedNode);
|
||||
} else {
|
||||
showDrawingEditor(editor);
|
||||
}
|
||||
});
|
||||
|
||||
editor.addButton('drawio', {
|
||||
@ -443,7 +460,7 @@ class WysiwygEditor {
|
||||
html += `<img src="${image.thumbs.display}" alt="${image.name}">`;
|
||||
html += '</a>';
|
||||
win.tinyMCE.activeEditor.execCommand('mceInsertContent', false, html);
|
||||
});
|
||||
}, 'gallery');
|
||||
}
|
||||
|
||||
},
|
||||
|
Reference in New Issue
Block a user