mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 08:25:07 +00:00
4.7.1-alpha (#1120)
Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
@@ -36,7 +36,7 @@ export default function Editor({
|
||||
hasVariablePlugin?: boolean;
|
||||
hasDropDownPlugin?: boolean;
|
||||
variables: EditorVariablePickerType[];
|
||||
onChange?: (editorState: EditorState) => void;
|
||||
onChange?: (editorState: EditorState, editor: LexicalEditor) => void;
|
||||
onBlur?: (editor: LexicalEditor) => void;
|
||||
value?: string;
|
||||
currentValue?: string;
|
||||
@@ -119,9 +119,9 @@ export default function Editor({
|
||||
<HistoryPlugin />
|
||||
<FocusPlugin focus={focus} setFocus={setFocus} />
|
||||
<OnChangePlugin
|
||||
onChange={(e) => {
|
||||
onChange={(editorState: EditorState, editor: LexicalEditor) => {
|
||||
startSts(() => {
|
||||
onChange?.(e);
|
||||
onChange?.(editorState, editor);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
@@ -32,15 +32,13 @@ const HttpInput = ({
|
||||
|
||||
const [, startSts] = useTransition();
|
||||
|
||||
const onChangeInput = useCallback((editorState: EditorState) => {
|
||||
const text = editorState.read(() => $getRoot().getTextContent());
|
||||
const formatValue = text.replaceAll('\n\n', '\n').replaceAll('}}{{', '}} {{');
|
||||
setCurrentValue(formatValue);
|
||||
onChange?.(formatValue);
|
||||
const onChangeInput = useCallback((editorState: EditorState, editor: LexicalEditor) => {
|
||||
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
|
||||
onChange?.(text);
|
||||
}, []);
|
||||
const onBlurInput = useCallback((editor: LexicalEditor) => {
|
||||
startSts(() => {
|
||||
const text = editorStateToText(editor).replaceAll('\n\n', '\n').replaceAll('}}{{', '}} {{');
|
||||
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
|
||||
onBlur?.(text);
|
||||
});
|
||||
}, []);
|
||||
|
Reference in New Issue
Block a user