mirror of
https://github.com/langgenius/dify.git
synced 2026-05-09 21:28:25 +08:00
fix: variable of sync display in prompt editor
This commit is contained in:
parent
2a46bf26b5
commit
ed9efba039
@ -113,6 +113,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'
|
||||
@ -21,6 +21,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