X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/492ffff0a488d3bd9b3759686a037edf6190844b..refs/pull/3918/head:/app/Entities/Tools/PageEditorData.php diff --git a/app/Entities/Tools/PageEditorData.php b/app/Entities/Tools/PageEditorData.php index 3e1164175..2342081bb 100644 --- a/app/Entities/Tools/PageEditorData.php +++ b/app/Entities/Tools/PageEditorData.php @@ -94,10 +94,7 @@ class PageEditorData */ protected function getEditorType(Page $page): string { - $emptyPage = empty($page->html) && empty($page->markdown); - $pageType = (!empty($page->html) && empty($page->markdown)) ? 'wysiwyg' : 'markdown'; - $systemDefault = setting('app-editor') === 'wysiwyg' ? 'wysiwyg' : 'markdown'; - $editorType = $emptyPage ? $systemDefault : $pageType; + $editorType = $page->editor ?: self::getSystemDefaultEditor(); // Use requested editor if valid and if we have permission $requestedType = explode('-', $this->requestedEditor)[0]; @@ -108,4 +105,11 @@ class PageEditorData return $editorType; } -} \ No newline at end of file + /** + * Get the configured system default editor. + */ + public static function getSystemDefaultEditor(): string + { + return setting('app-editor') === 'markdown' ? 'markdown' : 'wysiwyg'; + } +}