Skip to content

Commit 28585e7

Browse files
committed
type: fix type error. (#676) #665
1 parent 968017b commit 28585e7

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

core/src/Editor.nohighlight.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const InternalMDEditor = React.forwardRef<RefMDEditor, MDEditorProps>(
136136
[props.extraCommands],
137137
);
138138

139-
const textareaDomRef = useRef<HTMLDivElement>();
139+
const textareaDomRef = useRef<HTMLDivElement>(undefined);
140140
const active = useRef<'text' | 'preview'>('preview');
141141
const initScroll = useRef(false);
142142

core/src/Editor.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const InternalMDEditor = React.forwardRef<RefMDEditor, MDEditorProps>(
136136
[props.extraCommands],
137137
);
138138

139-
const textareaDomRef = useRef<HTMLDivElement>();
139+
const textareaDomRef = useRef<HTMLDivElement>(undefined);
140140
const active = useRef<'text' | 'preview'>('preview');
141141
const initScroll = useRef(false);
142142

core/src/Types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CSSProperties } from 'react';
1+
import type { CSSProperties, JSX } from 'react';
22
import type { MarkdownPreviewProps } from '@uiw/react-markdown-preview/nohighlight';
33
import type { ITextAreaProps } from './components/TextArea/index.nohighlight';
44
import type { ICommand, TextState } from './commands';

core/src/components/DragBar/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface IDragBarProps extends IProps {
1212
const DragBar: React.FC<IDragBarProps> = (props) => {
1313
const { prefixCls, onChange } = props || {};
1414
const $dom = useRef<HTMLDivElement>(null);
15-
const dragRef = useRef<{ height: number; dragY: number }>();
15+
const dragRef = useRef<{ height: number; dragY: number }>(undefined);
1616
const heightRef = useRef(props.height);
1717

1818
useEffect(() => {

core/src/components/TextArea/Textarea.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function Textarea(props: TextAreaProps) {
2323
...otherStore
2424
} = useContext(EditorContext);
2525
const textRef = React.useRef<HTMLTextAreaElement>(null);
26-
const executeRef = React.useRef<TextAreaCommandOrchestrator>();
26+
const executeRef = React.useRef<TextAreaCommandOrchestrator>(undefined);
2727
const statesRef = React.useRef<ExecuteCommandState>({ fullscreen, preview });
2828

2929
useEffect(() => {

core/src/components/TextArea/index.nohighlight.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, Fragment, useContext } from 'react';
1+
import React, { useEffect, Fragment, useContext, JSX } from 'react';
22
import { EditorContext, ContextStore, ExecuteCommandState } from '../../Context';
33
import shortcuts from './shortcuts';
44
import Textarea, { TextAreaProps } from './Textarea';
@@ -43,7 +43,7 @@ export default function TextArea(props: ITextAreaProps) {
4343
const { prefixCls, className, onScroll, renderTextarea, ...otherProps } = props || {};
4444
const { markdown, scrollTop, commands, extraCommands, dispatch } = useContext(EditorContext);
4545
const textRef = React.useRef<HTMLTextAreaElement>(null);
46-
const executeRef = React.useRef<TextAreaCommandOrchestrator>();
46+
const executeRef = React.useRef<TextAreaCommandOrchestrator>(undefined);
4747
const warp = React.createRef<HTMLDivElement>();
4848
useEffect(() => {
4949
const state: ContextStore = {};

core/src/components/TextArea/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, Fragment, useContext } from 'react';
1+
import React, { useEffect, Fragment, useContext, JSX } from 'react';
22
import { EditorContext, ContextStore, ExecuteCommandState } from '../../Context';
33
import shortcuts from './shortcuts';
44
import Markdown from './Markdown';
@@ -45,7 +45,7 @@ export default function TextArea(props: ITextAreaProps) {
4545
const { markdown, scrollTop, commands, minHeight, highlightEnable, extraCommands, dispatch } =
4646
useContext(EditorContext);
4747
const textRef = React.useRef<HTMLTextAreaElement>(null);
48-
const executeRef = React.useRef<TextAreaCommandOrchestrator>();
48+
const executeRef = React.useRef<TextAreaCommandOrchestrator>(undefined);
4949
const warp = React.createRef<HTMLDivElement>();
5050
useEffect(() => {
5151
const state: ContextStore = {};

core/src/components/Toolbar/Child.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useContext, useMemo } from 'react';
1+
import React, { useContext, useMemo, JSX } from 'react';
22
import './Child.less';
33
import Toolbar, { type IToolbarProps } from './';
44
import { EditorContext } from '../../Context';

0 commit comments

Comments
 (0)