]> BookStack Code Mirror - bookstack/blob - resources/views/pages/parts/markdown-editor.blade.php
TypeScript: Updated compile target, addressed issues
[bookstack] / resources / views / pages / parts / markdown-editor.blade.php
1 <div id="markdown-editor" component="markdown-editor"
2      option:markdown-editor:page-id="{{ $model->id ?? 0 }}"
3      option:markdown-editor:text-direction="{{ $locale->htmlDirection() }}"
4      option:markdown-editor:image-upload-error-text="{{ trans('errors.image_upload_error') }}"
5      option:markdown-editor:server-upload-limit-text="{{ trans('errors.server_upload_limit') }}"
6      class="flex-fill flex code-fill">
7
8     <div class="markdown-editor-wrap active flex-container-column">
9         <div class="editor-toolbar flex-container-row items-stretch justify-space-between">
10             <div class="editor-toolbar-label text-mono bold px-m py-xs flex-container-row items-center flex">
11                 <span>{{ trans('entities.pages_md_editor') }}</span>
12             </div>
13             <div component="dropdown" class="buttons flex-container-row items-stretch">
14                 @if(config('services.drawio'))
15                     <button class="text-button" type="button" data-action="insertDrawing" title="{{ trans('entities.pages_md_insert_drawing') }}">@icon('drawing')</button>
16                 @endif
17                 <button class="text-button" type="button" data-action="insertImage" title="{{ trans('entities.pages_md_insert_image') }}">@icon('image')</button>
18                 <button class="text-button" type="button" data-action="insertLink" title="{{ trans('entities.pages_md_insert_link') }}">@icon('link')</button>
19                 <button class="text-button" type="button" data-action="fullscreen" title="{{ trans('common.fullscreen') }}">@icon('fullscreen')</button>
20                 <button refs="dropdown@toggle" class="text-button" type="button" title="{{ trans('common.more') }}">@icon('more')</button>
21                 <div refs="dropdown@menu markdown-editor@setting-container" class="dropdown-menu" role="menu">
22                     <div class="px-m">
23                         @include('form.custom-checkbox', ['name' => 'md-showPreview', 'label' => trans('entities.pages_md_show_preview'), 'value' => true, 'checked' => true])
24                     </div>
25                     <hr class="m-none">
26                     <div class="px-m">
27                         @include('form.custom-checkbox', ['name' => 'md-scrollSync', 'label' => trans('entities.pages_md_sync_scroll'), 'value' => true, 'checked' => true])
28                     </div>
29                     <hr class="m-none">
30                     <div class="px-m">
31                         @include('form.custom-checkbox', ['name' => 'md-plainEditor', 'label' => trans('entities.pages_md_plain_editor'), 'value' => true, 'checked' => false])
32                     </div>
33                 </div>
34             </div>
35         </div>
36
37         <div class="flex flex-fill" dir="ltr">
38             <textarea id="markdown-editor-input"
39                       refs="markdown-editor@input"
40                       @if($errors->has('markdown')) class="text-neg" @endif
41                       name="markdown"
42                       rows="5">@if(isset($model) || old('markdown')){{ old('markdown') ?? ($model->markdown === '' ? $model->html : $model->markdown) }}@endif</textarea>
43         </div>
44
45     </div>
46
47     <div refs="markdown-editor@display-wrap" class="markdown-editor-wrap flex-container-row items-stretch" style="display: none">
48         <div refs="markdown-editor@divider" class="markdown-panel-divider flex-fill"></div>
49         <div class="flex-container-column flex flex-fill">
50             <div class="editor-toolbar">
51                 <div class="editor-toolbar-label text-mono bold px-m py-xs">{{ trans('entities.pages_md_preview') }}</div>
52             </div>
53             <iframe src="about:blank"
54                     refs="markdown-editor@display"
55                     class="markdown-display flex flex-fill"
56                     sandbox="allow-same-origin"></iframe>
57         </div>
58     </div>
59 </div>
60
61
62
63 @if($errors->has('markdown'))
64     <div class="text-neg text-small">{{ $errors->first('markdown') }}</div>
65 @endif