diff --git a/app/Repos/ImageRepo.php b/app/Repos/ImageRepo.php index 3918d5f67..97839c27f 100644 --- a/app/Repos/ImageRepo.php +++ b/app/Repos/ImageRepo.php @@ -152,7 +152,7 @@ class ImageRepo public function saveDrawing(string $base64Uri, int $uploadedTo) { $name = 'Drawing-' . user()->getShortName(40) . '-' . strval(time()) . '.png'; - $image = $this->imageService->saveNewFromBase64Uri($base64Uri, $name, 'drawing', $uploadedTo); + $image = $this->imageService->saveNewFromBase64Uri($base64Uri, $name, 'drawio', $uploadedTo); return $image; } diff --git a/config/services.php b/config/services.php index ba9be69de..8695ea91c 100644 --- a/config/services.php +++ b/config/services.php @@ -13,7 +13,12 @@ return [ | to have a conventional place to find your various credentials. | */ + + // Single option to disable non-auth external services such as Gravatar and Draw.io 'disable_services' => env('DISABLE_EXTERNAL_SERVICES', false), + 'drawio' => env('DRAWIO', !env('DISABLE_EXTERNAL_SERVICES', false)), + + 'callback_url' => env('APP_URL', false), 'mailgun' => [ diff --git a/public/system_images/drawing.svg b/public/system_images/drawing.svg new file mode 100644 index 000000000..9a9231a18 --- /dev/null +++ b/public/system_images/drawing.svg @@ -0,0 +1,107 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/resources/assets/js/pages/page-form.js b/resources/assets/js/pages/page-form.js index 8e70d2db5..15e438b17 100644 --- a/resources/assets/js/pages/page-form.js +++ b/resources/assets/js/pages/page-form.js @@ -218,7 +218,6 @@ function codePlugin() { }); } -codePlugin(); function drawIoPlugin() { @@ -334,8 +333,8 @@ function drawIoPlugin() { }); editor.addButton('drawio', { - text: 'Drawing', - icon: false, + tooltip: 'Drawing', + image: window.baseUrl('/system_images/drawing.svg'), cmd: 'drawio' }); @@ -358,7 +357,6 @@ function drawIoPlugin() { }); } -drawIoPlugin(); window.tinymce.PluginManager.add('customhr', function (editor) { editor.addCommand('InsertHorizontalRule', function () { @@ -382,7 +380,14 @@ window.tinymce.PluginManager.add('customhr', function (editor) { }); }); +let plugins = "image table textcolor paste link autolink fullscreen imagetools code customhr autosave lists codeeditor"; +// Load custom plugins +codePlugin(); +if (document.querySelector('[drawio-enabled]').getAttribute('drawio-enabled') === 'true') { + drawIoPlugin(); + plugins += ' drawio'; +} module.exports = { selector: '#html-editor', @@ -402,9 +407,9 @@ module.exports = { extended_valid_elements: 'pre[*],svg[*],div[drawio-diagram]', automatic_uploads: false, valid_children: "-div[p|h1|h2|h3|h4|h5|h6|blockquote],+div[pre],+div[img]", - plugins: "image table textcolor paste link autolink fullscreen imagetools code customhr autosave lists codeeditor drawio", + plugins: plugins, imagetools_toolbar: 'imageoptions', - toolbar: "undo redo | styleselect | bold italic underline strikethrough superscript subscript | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image-insert link hr | removeformat code fullscreen drawio", + toolbar: "undo redo | styleselect | bold italic underline strikethrough superscript subscript | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image-insert link hr drawio | removeformat code fullscreen", content_style: "body {padding-left: 15px !important; padding-right: 15px !important; margin:0!important; margin-left:auto!important;margin-right:auto!important;}", style_formats: [ {title: "Header Large", format: "h2"}, diff --git a/resources/views/pages/form.blade.php b/resources/views/pages/form.blade.php index f450452ce..936f49790 100644 --- a/resources/views/pages/form.blade.php +++ b/resources/views/pages/form.blade.php @@ -1,5 +1,11 @@ -
+
{{ csrf_field() }}