]> BookStack Code Mirror - bookstack/blob - resources/views/pages/form.blade.php
Merge branch 'master' into patch-5
[bookstack] / resources / views / pages / form.blade.php
1
2 <div class="page-editor flex-fill flex" id="page-editor"
3      drafts-enabled="{{ $draftsEnabled ? 'true' : 'false' }}"
4      drawio-enabled="{{ config('services.drawio') ? 'true' : 'false' }}"
5      editor-type="{{ setting('app-editor') }}"
6      page-id="{{ $model->id ?? 0 }}"
7      text-direction="{{ config('app.rtl') ? 'rtl' : 'ltr' }}"
8      page-new-draft="{{ $model->draft ?? 0 }}"
9      page-update-draft="{{ $model->isDraft ?? 0 }}">
10
11     {{ csrf_field() }}
12
13     {{--Header Bar--}}
14     <div class="primary-background-light toolbar page-edit-toolbar">
15         <div class="grid third no-break v-center">
16
17             <div class="action-buttons text-left px-m py-xs">
18                 <a href="{{ back()->getTargetUrl() }}" class="text-button text-primary">@icon('back')<span class="hide-under-l">{{ trans('common.back') }}</span></a>
19                 <a onclick="$('body>header').slideToggle();" class="text-button text-primary">@icon('swap-vertical')<span class="hide-under-l">{{ trans('entities.pages_edit_toggle_header') }}</span></a>
20             </div>
21
22             <div class="text-center px-m py-xs">
23                 <div v-show="draftsEnabled" dropdown dropdown-move-menu class="dropdown-container draft-display text">
24                     <a dropdown-toggle  class="text-primary text-button"><span class="faded-text" v-text="draftText"></span>&nbsp; @icon('more')</a>
25                     @icon('check-circle', ['class' => 'text-pos draft-notification svg-icon', ':class' => '{visible: draftUpdated}'])
26                     <ul class="dropdown-menu">
27                         <li>
28                             <a @click="saveDraft()" class="text-pos">@icon('save'){{ trans('entities.pages_edit_save_draft') }}</a>
29                         </li>
30                         <li v-if="isNewDraft">
31                             <a href="{{ $model->getUrl('/delete') }}" class="text-neg">@icon('delete'){{ trans('entities.pages_edit_delete_draft') }}</a>
32                         </li>
33                         <li v-if="isUpdateDraft">
34                             <a type="button" @click="discardDraft" class="text-neg">@icon('cancel'){{ trans('entities.pages_edit_discard_draft') }}</a>
35                         </li>
36                     </ul>
37                 </div>
38             </div>
39
40             <div class="action-buttons px-m py-xs" v-cloak>
41                 <div dropdown dropdown-move-menu class="dropdown-container">
42                     <a dropdown-toggle class="text-primary text-button">@icon('edit') <span v-text="changeSummaryShort"></span></a>
43                     <ul class="wide dropdown-menu">
44                         <li class="px-l py-m">
45                             <p class="text-muted pb-s">{{ trans('entities.pages_edit_enter_changelog_desc') }}</p>
46                             <input name="summary" id="summary-input" type="text" placeholder="{{ trans('entities.pages_edit_enter_changelog') }}" v-model="changeSummary" />
47                         </li>
48                     </ul>
49                     <span>{{-- Prevents button jumping on menu show --}}</span>
50                 </div>
51
52                 <button type="submit" id="save-button" class="float-left text-primary text-button text-pos-hover hide-under-m">@icon('save')<span>{{ trans('entities.pages_save') }}</span></button>
53             </div>
54         </div>
55     </div>
56
57     {{--Title input--}}
58     <div class="title-input page-title clearfix" v-pre>
59         <div class="input">
60             @include('form.text', ['name' => 'name', 'placeholder' => trans('entities.pages_title')])
61         </div>
62     </div>
63
64     {{--Editors--}}
65     <div class="edit-area flex-fill flex">
66
67         {{--WYSIWYG Editor--}}
68         @if(setting('app-editor') === 'wysiwyg')
69             <div wysiwyg-editor class="flex-fill flex">
70                 <textarea id="html-editor"  name="html" rows="5" v-pre
71                     @if($errors->has('html')) class="text-neg" @endif>@if(isset($model) || old('html')){{htmlspecialchars( old('html') ? old('html') : $model->html)}}@endif</textarea>
72             </div>
73
74             @if($errors->has('html'))
75                 <div class="text-neg text-small">{{ $errors->first('html') }}</div>
76             @endif
77         @endif
78
79         {{--Markdown Editor--}}
80         @if(setting('app-editor') === 'markdown')
81             <div v-pre id="markdown-editor" markdown-editor class="flex-fill flex code-fill">
82
83                 <div class="markdown-editor-wrap active">
84                     <div class="editor-toolbar">
85                         <span class="float left editor-toolbar-label">{{ trans('entities.pages_md_editor') }}</span>
86                         <div class="float right buttons">
87                             @if(config('services.drawio'))
88                                 <button class="text-button" type="button" data-action="insertDrawing">@icon('drawing'){{ trans('entities.pages_md_insert_drawing') }}</button>
89                                 &nbsp;|&nbsp
90                             @endif
91                             <button class="text-button" type="button" data-action="insertImage">@icon('image'){{ trans('entities.pages_md_insert_image') }}</button>
92                             &nbsp;|&nbsp;
93                             <button class="text-button" type="button" data-action="insertLink">@icon('link'){{ trans('entities.pages_md_insert_link') }}</button>
94                         </div>
95                     </div>
96
97                     <div markdown-input class="flex flex-fill">
98                         <textarea  id="markdown-editor-input"  name="markdown" rows="5"
99                             @if($errors->has('markdown')) class="text-neg" @endif>@if(isset($model) || old('markdown')){{htmlspecialchars( old('markdown') ? old('markdown') : ($model->markdown === '' ? $model->html : $model->markdown))}}@endif</textarea>
100                     </div>
101
102                 </div>
103
104                 <div class="markdown-editor-wrap">
105                     <div class="editor-toolbar">
106                         <div class="editor-toolbar-label">{{ trans('entities.pages_md_preview') }}</div>
107                     </div>
108                     <div class="markdown-display page-content">
109                     </div>
110                 </div>
111                 <input type="hidden" name="html"/>
112
113             </div>
114
115
116
117             @if($errors->has('markdown'))
118                 <div class="text-neg text-small">{{ $errors->first('markdown') }}</div>
119             @endif
120         @endif
121
122     </div>
123
124     <button type="submit" id="save-button-mobile" title="{{ trans('entities.pages_save') }}" class="text-primary text-button hide-over-m page-save-mobile-button">@icon('save')</button>
125 </div>