mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-27 00:17:31 +00:00
feat: get node variables in prompt editor (#2087)
* feat: get node variables in prompt editor * fix * fix build * merge * fix build * delete default parent * fix * fix
This commit is contained in:
@@ -5,7 +5,7 @@ import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
||||
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
|
||||
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
||||
import LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary';
|
||||
import VariablePickerPlugin from './plugins/VariablePickerPlugin';
|
||||
import VariableLabelPickerPlugin from './plugins/VariableLabelPickerPlugin';
|
||||
import { Box } from '@chakra-ui/react';
|
||||
import styles from './index.module.scss';
|
||||
import VariablePlugin from './plugins/VariablePlugin';
|
||||
@@ -18,6 +18,8 @@ import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import FocusPlugin from './plugins/FocusPlugin';
|
||||
import { textToEditorState } from './utils';
|
||||
import { MaxLengthPlugin } from './plugins/MaxLengthPlugin';
|
||||
import { VariableLabelNode } from './plugins/VariableLabelPlugin/node';
|
||||
import VariableLabelPlugin from './plugins/VariableLabelPlugin';
|
||||
|
||||
export default function Editor({
|
||||
h = 200,
|
||||
@@ -51,7 +53,7 @@ export default function Editor({
|
||||
|
||||
const initialConfig = {
|
||||
namespace: 'promptEditor',
|
||||
nodes: [VariableNode],
|
||||
nodes: [VariableNode, VariableLabelNode],
|
||||
editorState: textToEditorState(value),
|
||||
onError: (error: Error) => {
|
||||
throw error;
|
||||
@@ -127,8 +129,9 @@ export default function Editor({
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<VariablePickerPlugin variables={variables} />
|
||||
<VariableLabelPickerPlugin variables={variables} />
|
||||
<VariablePlugin variables={variables} />
|
||||
<VariableLabelPlugin variables={variables} />
|
||||
<OnBlurPlugin onBlur={onBlur} />
|
||||
</LexicalComposer>
|
||||
{showResize && (
|
||||
|
Reference in New Issue
Block a user