mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 17:08:03 +08:00
fix: prompt-editor
This commit is contained in:
@ -3,13 +3,12 @@ import {
|
||||
useEffect,
|
||||
} from 'react'
|
||||
import {
|
||||
$getNodeByKey,
|
||||
$getPreviousSelection,
|
||||
$insertNodes,
|
||||
COMMAND_PRIORITY_EDITOR,
|
||||
createCommand,
|
||||
} from 'lexical'
|
||||
import { mergeRegister } from '@lexical/utils'
|
||||
import { } from '@lexical/react/LexicalTypeaheadMenuPlugin'
|
||||
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
||||
import type { WorkflowVariableBlockType } from '../../types'
|
||||
import {
|
||||
@ -42,13 +41,6 @@ const WorkflowVariableBlock = memo(({
|
||||
INSERT_WORKFLOW_VARIABLE_BLOCK_COMMAND,
|
||||
(variables: string[]) => {
|
||||
const workflowVariableBlockNode = $createWorkflowVariableBlockNode(variables, getWorkflowNode)
|
||||
const prevNodeKey = ($getPreviousSelection() as any)?.anchor?.key
|
||||
|
||||
if (prevNodeKey) {
|
||||
const prevNode = $getNodeByKey(prevNodeKey)
|
||||
|
||||
prevNode?.remove()
|
||||
}
|
||||
|
||||
$insertNodes([workflowVariableBlockNode])
|
||||
if (onInsert)
|
||||
|
||||
Reference in New Issue
Block a user