このコミットが含まれているのは:
@@ -9,7 +9,6 @@ import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import FieldError from '@/components/common/FieldError'
|
||||
import FormField from '@/components/common/FormField'
|
||||
import MainArea from '@/components/layout/MainArea'
|
||||
import { useUserSettings } from '@/components/users/UserSettingsProvider'
|
||||
import { toast } from '@/components/ui/use-toast'
|
||||
import { SITE_TITLE } from '@/config'
|
||||
import { apiPost } from '@/lib/api'
|
||||
@@ -23,27 +22,11 @@ import 'react-markdown-editor-lite/lib/index.css'
|
||||
import type { User, WikiPage } from '@/types'
|
||||
|
||||
const mdParser = new MarkdownIt
|
||||
const FIXED_WIKI_EDITOR_VIEW = { menu: true, md: true, html: true } as const
|
||||
|
||||
type EditorView = {
|
||||
menu: boolean
|
||||
md: boolean
|
||||
html: boolean }
|
||||
|
||||
const editorView = (
|
||||
mode: 'split' | 'write' | 'preview',
|
||||
): EditorView => {
|
||||
switch (mode)
|
||||
{
|
||||
case 'write':
|
||||
return { menu: true, md: true, html: false }
|
||||
|
||||
case 'preview':
|
||||
return { menu: true, md: false, html: true }
|
||||
|
||||
default:
|
||||
return { menu: true, md: true, html: true }
|
||||
}
|
||||
}
|
||||
// `wiki_editor_mode` is still kept in backend settings, but the common
|
||||
// settings screen does not expose it at present. Until that UI returns, the
|
||||
// editor stays on the fixed split view here.
|
||||
|
||||
type Props = { user: User | null }
|
||||
|
||||
@@ -52,7 +35,6 @@ type WikiFormField = 'title' | 'body'
|
||||
|
||||
const WikiNewPage: FC<Props> = ({ user }) => {
|
||||
const editable = canEditContent (user)
|
||||
const { settings } = useUserSettings ()
|
||||
|
||||
const location = useLocation ()
|
||||
const navigate = useNavigate ()
|
||||
@@ -115,7 +97,7 @@ const WikiNewPage: FC<Props> = ({ user }) => {
|
||||
{() => (
|
||||
<MdEditor value={body}
|
||||
style={{ height: '500px' }}
|
||||
config={{ view: editorView (settings.wikiEditorMode) }}
|
||||
config={{ view: FIXED_WIKI_EDITOR_VIEW }}
|
||||
renderHTML={text => mdParser.render (text)}
|
||||
onChange={({ text }) => setBody (text)}/>)}
|
||||
</FormField>
|
||||
|
||||
新しい課題から参照
ユーザをブロックする