Skip to content

Commit

Permalink
fix: prompt editor new line (langgenius#6310)
Browse files Browse the repository at this point in the history
  • Loading branch information
zxhlyh authored Jul 16, 2024
1 parent d66d714 commit 23e8043
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/app/components/base/prompt-editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ const PromptEditor: FC<PromptEditorProps> = ({
}

const handleEditorChange = (editorState: EditorState) => {
const text = editorState.read(() => $getRoot().getTextContent())
const text = editorState.read(() => {
return $getRoot().getChildren().map(p => p.getTextContent()).join('\n')
})
if (onChange)
onChange(text.replaceAll('\n\n', '\n'))
onChange(text)
}

useEffect(() => {
Expand Down

0 comments on commit 23e8043

Please sign in to comment.