mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
perf: remove unuse code (#2227)
This commit is contained in:
@@ -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 (
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { useState, useRef, useTransition, useEffect } from 'react';
|
||||
import { useState, useRef, useTransition } from 'react';
|
||||
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
||||
import { PlainTextPlugin } from '@lexical/react/LexicalPlainTextPlugin';
|
||||
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
||||
|
@@ -6,7 +6,7 @@ import MyModal from '../../MyModal';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import { EditorState, type LexicalEditor } from 'lexical';
|
||||
import { EditorVariableLabelPickerType, EditorVariablePickerType } from './type.d';
|
||||
import { useCallback, useTransition } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
const PromptEditor = ({
|
||||
showOpenModal = true,
|
||||
@@ -36,7 +36,6 @@ const PromptEditor = ({
|
||||
isFlow?: boolean;
|
||||
}) => {
|
||||
const { isOpen, onOpen, onClose } = useDisclosure();
|
||||
const [, startSts] = useTransition();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const onChangeInput = useCallback((editorState: EditorState, editor: LexicalEditor) => {
|
||||
@@ -44,10 +43,8 @@ const PromptEditor = ({
|
||||
onChange?.(text);
|
||||
}, []);
|
||||
const onBlurInput = useCallback((editor: LexicalEditor) => {
|
||||
startSts(() => {
|
||||
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
|
||||
onBlur?.(text);
|
||||
});
|
||||
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
|
||||
onBlur?.(text);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user