reiji-h 2 лет назад
Родитель
Сommit
c737c07404

+ 3 - 2
packages/editor/src/components/playground/Playground.tsx

@@ -6,6 +6,7 @@ import { AcceptedUploadFileType } from '@growi/core';
 import { toast } from 'react-toastify';
 
 import { GlobalCodeMirrorEditorKey } from '../../consts';
+import type { EditorTheme, KeyMapMode } from '../../services';
 import { useCodeMirrorEditorIsolated } from '../../stores';
 import { CodeMirrorEditorMain } from '../CodeMirrorEditorMain';
 
@@ -15,8 +16,8 @@ import { Preview } from './Preview';
 export const Playground = (): JSX.Element => {
 
   const [markdownToPreview, setMarkdownToPreview] = useState('');
-  const [editorTheme, setEditorTheme] = useState('');
-  const [editorKeymap, setEditorKeymap] = useState('');
+  const [editorTheme, setEditorTheme] = useState<EditorTheme>('defaultlight');
+  const [editorKeymap, setEditorKeymap] = useState<KeyMapMode>('default');
 
   const { data: codeMirrorEditor } = useCodeMirrorEditorIsolated(GlobalCodeMirrorEditorKey.MAIN);
 

+ 6 - 4
packages/editor/src/components/playground/PlaygroundController.tsx

@@ -3,7 +3,9 @@ import { useCallback } from 'react';
 import { useForm } from 'react-hook-form';
 
 import { GlobalCodeMirrorEditorKey } from '../../consts';
-import { AllEditorTheme, AllKeyMap } from '../../services';
+import {
+  AllEditorTheme, AllKeyMap, EditorTheme, KeyMapMode,
+} from '../../services';
 import { useCodeMirrorEditorIsolated } from '../../stores';
 
 export const InitEditorValueRow = (): JSX.Element => {
@@ -71,7 +73,7 @@ export const SetCaretLineRow = (): JSX.Element => {
 
 
 type SetParamRowProps = {
-    update: (value: string) => void,
+    update: (value: any) => void,
     items: string[],
 }
 
@@ -106,8 +108,8 @@ const SetParamRow = (
 
 
 type PlaygroundControllerProps = {
-  setEditorTheme: (value: string) => void
-  setEditorKeymap: (value: string) => void
+  setEditorTheme: (value: EditorTheme) => void
+  setEditorKeymap: (value: KeyMapMode) => void
 };
 
 export const PlaygroundController = (props: PlaygroundControllerProps): JSX.Element => {