NOW MANAGED ON CODEBERG
Added drawing icon and made drawio disablable
Dan Brown56264551e7a6
diff --git a/app/Repos/ImageRepo.php b/app/Repos/ImageRepo.phpindex 3918d5f67..97839c27f 100644--- a/app/Repos/ImageRepo.php+++ b/app/Repos/ImageRepo.php@@ -152,7 +152,7 @@ class ImageRepopublic 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.phpindex 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.svgnew file mode 100644index 000000000..9a9231a18--- /dev/null+++ b/public/system_images/drawing.svg@@ -0,0 +1,107 @@+<?xml version="1.0" encoding="UTF-8" standalone="no"?>+<!-- Created with Inkscape (http://www.inkscape.org/) -->++<svg+ xmlns:dc="http://purl.org/dc/elements/1.1/"+ xmlns:cc="http://creativecommons.org/ns#"+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+ xmlns:svg="http://www.w3.org/2000/svg"+ xmlns="http://www.w3.org/2000/svg"+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"+ width="410.44821"+ height="419.86591"+ viewBox="0 0 108.59775 111.08952"+ version="1.1"+ id="svg8"+ inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"+ sodipodi:docname="drawing.svg">+ <defs+ id="defs2" />+ <sodipodi:namedview+ id="base"+ pagecolor="#ffffff"+ bordercolor="#666666"+ borderopacity="1.0"+ inkscape:pageopacity="0.0"+ inkscape:pageshadow="2"+ inkscape:zoom="0.98994949"+ inkscape:cx="314.26392"+ inkscape:cy="340.27949"+ inkscape:document-units="mm"+ inkscape:current-layer="layer1"+ showgrid="false"+ units="px"+ inkscape:window-width="2560"+ inkscape:window-height="1386"+ inkscape:window-x="0"+ inkscape:window-y="0"+ inkscape:window-maximized="1" />+ <metadata+ id="metadata5">+ <rdf:RDF>+ <cc:Work+ rdf:about="">+ <dc:format>image/svg+xml</dc:format>+ <dc:type+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />+ <dc:title></dc:title>+ </cc:Work>+ </rdf:RDF>+ </metadata>+ <g+ inkscape:label="Layer 1"+ inkscape:groupmode="layer"+ id="layer1"+ transform="translate(-14.87623,-172.69189)">+ <path+ style="opacity:1;fill:#000016;fill-opacity:1;stroke:#000000;stroke-width:2.76340532;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ d="m 86.878856,250.68964 -11.880088,9.48754 11.880088,9.48722 z"+ id="rect872"+ inkscape:connector-curvature="0"+ sodipodi:nodetypes="cccc" />+ <circle+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ id="path815"+ cx="36.348648"+ cy="196.87526"+ r="18.972418" />+ <rect+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:4;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ id="rect817"+ width="44.366741"+ height="44.366741"+ x="77.107246"+ y="174.69189" />+ <rect+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:3.96875;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ id="rect836"+ width="44.366741"+ height="44.366741"+ x="17.773417"+ y="237.4303" />+ <rect+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:3.96875;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ id="rect838"+ width="19.777945"+ height="0.13363476"+ x="56.260235"+ y="196.77391" />+ <rect+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:4.0334897;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ id="rect838-6"+ width="39.624786"+ height="0.068895064"+ x="220.46501"+ y="-99.424637"+ transform="rotate(90)" />+ <rect+ style="opacity:1;fill:none;fill-opacity:1;stroke:#000000;stroke-width:4.02711964;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"+ id="rect838-6-7"+ width="36.156651"+ height="0.075265162"+ x="-99.381981"+ y="-260.21466"+ transform="scale(-1)" />+ </g>+</svg>diff --git a/resources/assets/js/pages/page-form.js b/resources/assets/js/pages/page-form.jsindex 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.phpindex f450452ce..936f49790 100644--- a/resources/views/pages/form.blade.php+++ b/resources/views/pages/form.blade.php@@ -1,5 +1,11 @@-<div class="page-editor flex-fill flex" id="page-editor" drafts-enabled="{{ $draftsEnabled ? 'true' : 'false' }}" editor-type="{{ setting('app-editor') }}" page-id="{{ $model->id or 0 }}" page-new-draft="{{ $model->draft or 0 }}" page-update-draft="{{ $model->isDraft or 0 }}">+<div class="page-editor flex-fill flex" id="page-editor"+ drafts-enabled="{{ $draftsEnabled ? 'true' : 'false' }}"+ drawio-enabled="{{ config('services.drawio') ? 'true' : 'false' }}"+ editor-type="{{ setting('app-editor') }}"+ page-id="{{ $model->id or 0 }}"+ page-new-draft="{{ $model->draft or 0 }}"+ page-update-draft="{{ $model->isDraft or 0 }}">{{ csrf_field() }}