mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-28 21:22:30 +00:00
Merge pull request #3391 from BookStackApp/drawio_config_event
Made it possible to configure draw.io/diagrams.net integration
This commit is contained in:
commit
0dfe5cb66b
@ -43,6 +43,8 @@ function drawReceive(event) {
|
||||
drawEventSave(message);
|
||||
} else if (message.event === 'export') {
|
||||
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() {
|
||||
window.removeEventListener('message', drawReceive);
|
||||
if (iFrame) document.body.removeChild(iFrame);
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div component="page-editor" class="page-editor flex-fill flex"
|
||||
option:page-editor:drafts-enabled="{{ $draftsEnabled ? 'true' : 'false' }}"
|
||||
@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
|
||||
@if($model->name === trans('entities.pages_initial_name'))
|
||||
option:page-editor:has-default-title="true"
|
||||
|
@ -71,7 +71,7 @@ class DrawioTest extends TestCase
|
||||
$editor = $this->getEditor();
|
||||
|
||||
$resp = $this->actingAs($editor)->get($page->getUrl('/edit'));
|
||||
$resp->assertSee('drawio-url="https://embed.diagrams.net/?embed=1&proto=json&spin=1"', false);
|
||||
$resp->assertSee('drawio-url="https://embed.diagrams.net/?embed=1&proto=json&spin=1&configure=1"', false);
|
||||
|
||||
config()->set('services.drawio', false);
|
||||
$resp = $this->actingAs($editor)->get($page->getUrl('/edit'));
|
||||
|
Loading…
Reference in New Issue
Block a user