From 763e2dc28d717e03ae9e1ce60295c2fa309e527f Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Wed, 18 Dec 2024 19:53:59 +0800 Subject: [PATCH] type: fix type error. (#676) #665 --- core/src/Editor.nohighlight.tsx | 2 +- core/src/Editor.tsx | 2 +- core/src/components/DragBar/index.tsx | 2 +- core/src/components/TextArea/Textarea.tsx | 2 +- core/src/components/TextArea/index.nohighlight.tsx | 2 +- core/src/components/TextArea/index.tsx | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/Editor.nohighlight.tsx b/core/src/Editor.nohighlight.tsx index a678412c8..3086d3726 100644 --- a/core/src/Editor.nohighlight.tsx +++ b/core/src/Editor.nohighlight.tsx @@ -136,7 +136,7 @@ const InternalMDEditor = React.forwardRef<RefMDEditor, MDEditorProps>( [props.extraCommands], ); - const textareaDomRef = useRef<HTMLDivElement>(undefined); + const textareaDomRef = useRef<HTMLDivElement>(); const active = useRef<'text' | 'preview'>('preview'); const initScroll = useRef(false); diff --git a/core/src/Editor.tsx b/core/src/Editor.tsx index 79b403dc6..831d93835 100644 --- a/core/src/Editor.tsx +++ b/core/src/Editor.tsx @@ -136,7 +136,7 @@ const InternalMDEditor = React.forwardRef<RefMDEditor, MDEditorProps>( [props.extraCommands], ); - const textareaDomRef = useRef<HTMLDivElement>(undefined); + const textareaDomRef = useRef<HTMLDivElement>(); const active = useRef<'text' | 'preview'>('preview'); const initScroll = useRef(false); diff --git a/core/src/components/DragBar/index.tsx b/core/src/components/DragBar/index.tsx index 9acaabf3e..5d64cc03a 100644 --- a/core/src/components/DragBar/index.tsx +++ b/core/src/components/DragBar/index.tsx @@ -12,7 +12,7 @@ export interface IDragBarProps extends IProps { const DragBar: React.FC<IDragBarProps> = (props) => { const { prefixCls, onChange } = props || {}; const $dom = useRef<HTMLDivElement>(null); - const dragRef = useRef<{ height: number; dragY: number }>(undefined); + const dragRef = useRef<{ height: number; dragY: number }>(); const heightRef = useRef(props.height); useEffect(() => { diff --git a/core/src/components/TextArea/Textarea.tsx b/core/src/components/TextArea/Textarea.tsx index b9f502119..eefb41586 100644 --- a/core/src/components/TextArea/Textarea.tsx +++ b/core/src/components/TextArea/Textarea.tsx @@ -23,7 +23,7 @@ export default function Textarea(props: TextAreaProps) { ...otherStore } = useContext(EditorContext); const textRef = React.useRef<HTMLTextAreaElement>(null); - const executeRef = React.useRef<TextAreaCommandOrchestrator>(undefined); + const executeRef = React.useRef<TextAreaCommandOrchestrator>(); const statesRef = React.useRef<ExecuteCommandState>({ fullscreen, preview }); useEffect(() => { diff --git a/core/src/components/TextArea/index.nohighlight.tsx b/core/src/components/TextArea/index.nohighlight.tsx index 8daa9b159..c2044a636 100644 --- a/core/src/components/TextArea/index.nohighlight.tsx +++ b/core/src/components/TextArea/index.nohighlight.tsx @@ -43,7 +43,7 @@ export default function TextArea(props: ITextAreaProps) { const { prefixCls, className, onScroll, renderTextarea, ...otherProps } = props || {}; const { markdown, scrollTop, commands, extraCommands, dispatch } = useContext(EditorContext); const textRef = React.useRef<HTMLTextAreaElement>(null); - const executeRef = React.useRef<TextAreaCommandOrchestrator>(undefined); + const executeRef = React.useRef<TextAreaCommandOrchestrator>(); const warp = React.createRef<HTMLDivElement>(); useEffect(() => { const state: ContextStore = {}; diff --git a/core/src/components/TextArea/index.tsx b/core/src/components/TextArea/index.tsx index a48d2c04f..1600006c0 100644 --- a/core/src/components/TextArea/index.tsx +++ b/core/src/components/TextArea/index.tsx @@ -45,7 +45,7 @@ export default function TextArea(props: ITextAreaProps) { const { markdown, scrollTop, commands, minHeight, highlightEnable, extraCommands, dispatch } = useContext(EditorContext); const textRef = React.useRef<HTMLTextAreaElement>(null); - const executeRef = React.useRef<TextAreaCommandOrchestrator>(undefined); + const executeRef = React.useRef<TextAreaCommandOrchestrator>(); const warp = React.createRef<HTMLDivElement>(); useEffect(() => { const state: ContextStore = {};