mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-09 10:22:51 +03:00
Switched to database-based tracking for page editor
- Works better to avoid bad assumptions when showing the editor based upon content type. - Also updated some previous tests to cleaner format.
This commit is contained in:
@@ -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,12 @@ class PageEditorData
|
||||
return $editorType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configured system default editor.
|
||||
*/
|
||||
public static function getSystemDefaultEditor(): string
|
||||
{
|
||||
return setting('app-editor') === 'markdown' ? 'markdown' : 'wysiwyg';
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user