mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-04 08:10:26 +00:00
Made it possible to configure draw.io/diagrams.net integration
Added new editor public event to hook into draw.io configuration step. Required change of embed url to trigger the configure step.
This commit is contained in:
parent
e49afdbd72
commit
d76bbb2954
2 changed files with 9 additions and 1 deletions
resources
|
@ -43,6 +43,8 @@ function drawReceive(event) {
|
||||||
drawEventSave(message);
|
drawEventSave(message);
|
||||||
} else if (message.event === 'export') {
|
} else if (message.event === 'export') {
|
||||||
drawEventExport(message);
|
drawEventExport(message);
|
||||||
|
} else if (message.event === 'configure') {
|
||||||
|
drawEventConfigure();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +65,12 @@ function drawEventInit() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function drawEventConfigure() {
|
||||||
|
const config = {};
|
||||||
|
window.$events.emitPublic(iFrame, 'editor-drawio::configure', {config});
|
||||||
|
drawPostMessage({action: 'configure', config});
|
||||||
|
}
|
||||||
|
|
||||||
function drawEventClose() {
|
function drawEventClose() {
|
||||||
window.removeEventListener('message', drawReceive);
|
window.removeEventListener('message', drawReceive);
|
||||||
if (iFrame) document.body.removeChild(iFrame);
|
if (iFrame) document.body.removeChild(iFrame);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div component="page-editor" class="page-editor flex-fill flex"
|
<div component="page-editor" class="page-editor flex-fill flex"
|
||||||
option:page-editor:drafts-enabled="{{ $draftsEnabled ? 'true' : 'false' }}"
|
option:page-editor:drafts-enabled="{{ $draftsEnabled ? 'true' : 'false' }}"
|
||||||
@if(config('services.drawio'))
|
@if(config('services.drawio'))
|
||||||
drawio-url="{{ is_string(config('services.drawio')) ? config('services.drawio') : 'https://embed.diagrams.net/?embed=1&proto=json&spin=1' }}"
|
drawio-url="{{ is_string(config('services.drawio')) ? config('services.drawio') : 'https://embed.diagrams.net/?embed=1&proto=json&spin=1&configure=1' }}"
|
||||||
@endif
|
@endif
|
||||||
@if($model->name === trans('entities.pages_initial_name'))
|
@if($model->name === trans('entities.pages_initial_name'))
|
||||||
option:page-editor:has-default-title="true"
|
option:page-editor:has-default-title="true"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue