mirror of
https://github.com/langgenius/dify.git
synced 2026-04-15 09:57:03 +08:00
fix: variable of sync display in prompt editor
This commit is contained in:
parent
9c7a2196ed
commit
53fe1c9039
@ -86,6 +86,12 @@ const ValueSyncPlugin: FC<{ value?: string }> = ({ value }) => {
|
||||
|
||||
const editorState = editor.parseEditorState(textToEditorState(incomingValue))
|
||||
editor.setEditorState(editorState)
|
||||
editor.update(() => {
|
||||
$getRoot().getAllTextNodes().forEach((node) => {
|
||||
if (node instanceof CustomTextNode)
|
||||
node.markDirty()
|
||||
})
|
||||
})
|
||||
}, [editor, value])
|
||||
|
||||
return null
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
||||
import { $insertNodes } from 'lexical'
|
||||
import { $getRoot, $insertNodes } from 'lexical'
|
||||
import { useEventEmitterContextContext } from '@/context/event-emitter'
|
||||
import { textToEditorState } from '../utils'
|
||||
import { CustomTextNode } from './custom-text/node'
|
||||
@ -20,6 +20,12 @@ const UpdateBlock = ({
|
||||
if (v.type === PROMPT_EDITOR_UPDATE_VALUE_BY_EVENT_EMITTER && v.instanceId === instanceId) {
|
||||
const editorState = editor.parseEditorState(textToEditorState(v.payload))
|
||||
editor.setEditorState(editorState)
|
||||
editor.update(() => {
|
||||
$getRoot().getAllTextNodes().forEach((node) => {
|
||||
if (node instanceof CustomTextNode)
|
||||
node.markDirty()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user