1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added support for changing the draw.io instance URL

- Allowed DRAWIO env option to be passed as URL to point to instance.
- Updated tests to check URL gets passed to pages correctly.
- Update default URL to be the default theme.

For #826
This commit is contained in:
Dan Brown
2020-04-05 17:27:16 +01:00
parent ea9e9565ef
commit 5f61620cc2
8 changed files with 116 additions and 76 deletions

View File

@ -238,7 +238,7 @@ function codePlugin() {
});
}
function drawIoPlugin() {
function drawIoPlugin(drawioUrl) {
let pageEditor = null;
let currentNode = null;
@ -266,7 +266,7 @@ function drawIoPlugin() {
function showDrawingEditor(mceEditor, selectedNode = null) {
pageEditor = mceEditor;
currentNode = selectedNode;
DrawIO.show(drawingInit, updateContent);
DrawIO.show(drawioUrl, drawingInit, updateContent);
}
async function updateContent(pngData) {
@ -423,10 +423,14 @@ class WysiwygEditor {
loadPlugins() {
codePlugin();
customHrPlugin();
if (document.querySelector('[drawio-enabled]').getAttribute('drawio-enabled') === 'true') {
drawIoPlugin();
const drawioUrlElem = document.querySelector('[drawio-url]');
if (drawioUrlElem) {
const url = drawioUrlElem.getAttribute('drawio-url');
drawIoPlugin(url);
this.plugins += ' drawio';
}
if (this.textDirection === 'rtl') {
this.plugins += ' directionality'
}