mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-29 23:22:34 +01:00
Added drawing icon and made drawio disablable
This commit is contained in:
parent
0c383eee5b
commit
56264551e7
@ -152,7 +152,7 @@ class ImageRepo
|
|||||||
public function saveDrawing(string $base64Uri, int $uploadedTo)
|
public function saveDrawing(string $base64Uri, int $uploadedTo)
|
||||||
{
|
{
|
||||||
$name = 'Drawing-' . user()->getShortName(40) . '-' . strval(time()) . '.png';
|
$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;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,12 @@ return [
|
|||||||
| to have a conventional place to find your various credentials.
|
| 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),
|
'disable_services' => env('DISABLE_EXTERNAL_SERVICES', false),
|
||||||
|
'drawio' => env('DRAWIO', !env('DISABLE_EXTERNAL_SERVICES', false)),
|
||||||
|
|
||||||
|
|
||||||
'callback_url' => env('APP_URL', false),
|
'callback_url' => env('APP_URL', false),
|
||||||
|
|
||||||
'mailgun' => [
|
'mailgun' => [
|
||||||
|
107
public/system_images/drawing.svg
Normal file
107
public/system_images/drawing.svg
Normal file
@ -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>
|
After Width: | Height: | Size: 3.7 KiB |
@ -218,7 +218,6 @@ function codePlugin() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
codePlugin();
|
|
||||||
|
|
||||||
function drawIoPlugin() {
|
function drawIoPlugin() {
|
||||||
|
|
||||||
@ -334,8 +333,8 @@ function drawIoPlugin() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.addButton('drawio', {
|
editor.addButton('drawio', {
|
||||||
text: 'Drawing',
|
tooltip: 'Drawing',
|
||||||
icon: false,
|
image: window.baseUrl('/system_images/drawing.svg'),
|
||||||
cmd: 'drawio'
|
cmd: 'drawio'
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -358,7 +357,6 @@ function drawIoPlugin() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
drawIoPlugin();
|
|
||||||
|
|
||||||
window.tinymce.PluginManager.add('customhr', function (editor) {
|
window.tinymce.PluginManager.add('customhr', function (editor) {
|
||||||
editor.addCommand('InsertHorizontalRule', function () {
|
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 = {
|
module.exports = {
|
||||||
selector: '#html-editor',
|
selector: '#html-editor',
|
||||||
@ -402,9 +407,9 @@ module.exports = {
|
|||||||
extended_valid_elements: 'pre[*],svg[*],div[drawio-diagram]',
|
extended_valid_elements: 'pre[*],svg[*],div[drawio-diagram]',
|
||||||
automatic_uploads: false,
|
automatic_uploads: false,
|
||||||
valid_children: "-div[p|h1|h2|h3|h4|h5|h6|blockquote],+div[pre],+div[img]",
|
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',
|
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;}",
|
content_style: "body {padding-left: 15px !important; padding-right: 15px !important; margin:0!important; margin-left:auto!important;margin-right:auto!important;}",
|
||||||
style_formats: [
|
style_formats: [
|
||||||
{title: "Header Large", format: "h2"},
|
{title: "Header Large", format: "h2"},
|
||||||
|
@ -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() }}
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user