Commit 0c9c6bc 1 parent 291a98f commit 0c9c6bc Copy full SHA for 0c9c6bc
File tree 1 file changed +8
-0
lines changed
src/web/components/editor
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ import { SlateElement } from './render/Element';
6
6
import { SlateLeaf } from './render/Leaf' ;
7
7
import { TMemo } from '@shared/components/TMemo' ;
8
8
import { WebErrorBoundary } from '../WebErrorBoundary' ;
9
+ import _isArray from 'lodash/isArray' ;
10
+ import { Result } from 'antd' ;
9
11
10
12
export const Previewer : React . FC < {
11
13
value : TRPGEditorNode [ ] ;
@@ -14,6 +16,12 @@ export const Previewer: React.FC<{
14
16
const renderElement = useCallback ( ( props ) => < SlateElement { ...props } /> , [ ] ) ;
15
17
const renderLeaf = useCallback ( ( props ) => < SlateLeaf { ...props } /> , [ ] ) ;
16
18
19
+ if ( ! _isArray ( props . value ) ) {
20
+ return (
21
+ < Result status = "warning" title = "笔记数据异常, 请检查是否为旧版笔记" />
22
+ ) ;
23
+ }
24
+
17
25
return (
18
26
< WebErrorBoundary >
19
27
< Slate editor = { editor } value = { props . value } onChange = { ( value ) => { } } >
You can’t perform that action at this time.
0 commit comments