Added editor type change button

This commit is contained in:
Dan Brown 2022-04-17 15:01:29 +01:00
parent e8e38f1f7b
commit 0cc215f8c3
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
4 changed files with 15 additions and 2 deletions

View File

@ -97,6 +97,7 @@ class PageController extends Controller
'isDraft' => true, 'isDraft' => true,
'draftsEnabled' => $draftsEnabled, 'draftsEnabled' => $draftsEnabled,
'templates' => $templates, 'templates' => $templates,
'editor' => setting('app-editor') === 'wysiwyg' ? 'wysiwyg' : 'markdown',
]); ]);
} }
@ -224,6 +225,7 @@ class PageController extends Controller
'current' => $page, 'current' => $page,
'draftsEnabled' => $draftsEnabled, 'draftsEnabled' => $draftsEnabled,
'templates' => $templates, 'templates' => $templates,
'editor' => setting('app-editor') === 'wysiwyg' ? 'wysiwyg' : 'markdown',
]); ]);
} }

View File

@ -0,0 +1 @@
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M6.99 16H14v-2H6.99v-3L3 15l3.99 4ZM21 9l-3.99-4v3H10v2h7.01v3z"/></svg>

After

Width:  |  Height:  |  Size: 141 B

View File

@ -196,6 +196,8 @@ return [
'pages_edit_draft_save_at' => 'Draft saved at ', 'pages_edit_draft_save_at' => 'Draft saved at ',
'pages_edit_delete_draft' => 'Delete Draft', 'pages_edit_delete_draft' => 'Delete Draft',
'pages_edit_discard_draft' => 'Discard Draft', 'pages_edit_discard_draft' => 'Discard Draft',
'pages_edit_switch_to_markdown' => 'Switch to Markdown editor',
'pages_edit_switch_to_wysiwyg' => 'Switch to WYSIWYG editor',
'pages_edit_set_changelog' => 'Set Changelog', 'pages_edit_set_changelog' => 'Set Changelog',
'pages_edit_enter_changelog_desc' => 'Enter a brief description of the changes you\'ve made', 'pages_edit_enter_changelog_desc' => 'Enter a brief description of the changes you\'ve made',
'pages_edit_enter_changelog' => 'Enter Changelog', 'pages_edit_enter_changelog' => 'Enter Changelog',

View File

@ -42,6 +42,14 @@
<li refs="page-editor@discardDraftWrap" class="{{ ($model->isDraft ?? false) ? '' : 'hidden' }}"> <li refs="page-editor@discardDraftWrap" class="{{ ($model->isDraft ?? false) ? '' : 'hidden' }}">
<button refs="page-editor@discardDraft" type="button" class="text-neg">@icon('cancel'){{ trans('entities.pages_edit_discard_draft') }}</button> <button refs="page-editor@discardDraft" type="button" class="text-neg">@icon('cancel'){{ trans('entities.pages_edit_discard_draft') }}</button>
</li> </li>
@if(userCan('editor-change'))
<li>
<button refs="page-editor@swapEditor" type="button">
@icon('swap-horizontal')
{{ $editor === 'wysiwyg' ? trans('entities.pages_edit_switch_to_markdown') : trans('entities.pages_edit_switch_to_wysiwyg') }}
</button>
</li>
@endif
</ul> </ul>
</div> </div>
</div> </div>
@ -78,12 +86,12 @@
<div class="edit-area flex-fill flex"> <div class="edit-area flex-fill flex">
{{--WYSIWYG Editor--}} {{--WYSIWYG Editor--}}
@if(setting('app-editor') === 'wysiwyg') @if($editor === 'wysiwyg')
@include('pages.parts.wysiwyg-editor', ['model' => $model]) @include('pages.parts.wysiwyg-editor', ['model' => $model])
@endif @endif
{{--Markdown Editor--}} {{--Markdown Editor--}}
@if(setting('app-editor') === 'markdown') @if($editor === 'markdown')
@include('pages.parts.markdown-editor', ['model' => $model]) @include('pages.parts.markdown-editor', ['model' => $model])
@endif @endif