perf: remove unuse code (#2227)

This commit is contained in:
Archer
2024-07-31 15:43:58 +08:00
committed by GitHub
parent 8c7f4a3a30
commit 2fdca621e6
14 changed files with 27 additions and 90 deletions

View File

@@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import { $getRoot, EditorState, type LexicalEditor } from 'lexical';
import { useCallback, useTransition } from 'react';
import { useCallback } from 'react';
import { editorStateToText } from '../../Textarea/PromptEditor/utils';
import { EditorVariablePickerType } from '../../Textarea/PromptEditor/type';
import Editor from './Editor';
@@ -30,18 +30,14 @@ const HttpInput = ({
}) => {
const [currentValue, setCurrentValue] = React.useState(value);
const [, startSts] = useTransition();
const onChangeInput = useCallback((editorState: EditorState, editor: LexicalEditor) => {
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
setCurrentValue(text);
onChange?.(text);
}, []);
const onBlurInput = useCallback((editor: LexicalEditor) => {
startSts(() => {
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
onBlur?.(text);
});
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
onBlur?.(text);
}, []);
return (