wwf
2 天以前 a430284aa21e3ae1f0d5654e55b2ad2852519cc2
app/components/base/prompt-editor/plugins/workflow-variable-block/index.tsx
@@ -9,7 +9,7 @@
} from 'lexical'
import { mergeRegister } from '@lexical/utils'
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
import type { GetVarType, WorkflowVariableBlockType } from '../../types'
import type { WorkflowVariableBlockType } from '../../types'
import {
  $createWorkflowVariableBlockNode,
  WorkflowVariableBlockNode,
@@ -25,13 +25,11 @@
  getWorkflowNode: (nodeId: string) => Node
  onInsert?: () => void
  onDelete?: () => void
  getVarType: GetVarType
}
const WorkflowVariableBlock = memo(({
  workflowNodesMap,
  onInsert,
  onDelete,
  getVarType,
}: WorkflowVariableBlockType) => {
  const [editor] = useLexicalComposerContext()
@@ -50,7 +48,7 @@
        INSERT_WORKFLOW_VARIABLE_BLOCK_COMMAND,
        (variables: string[]) => {
          editor.dispatchCommand(CLEAR_HIDE_MENU_TIMEOUT, undefined)
          const workflowVariableBlockNode = $createWorkflowVariableBlockNode(variables, workflowNodesMap, getVarType)
          const workflowVariableBlockNode = $createWorkflowVariableBlockNode(variables, workflowNodesMap)
          $insertNodes([workflowVariableBlockNode])
          if (onInsert)
@@ -71,7 +69,7 @@
        COMMAND_PRIORITY_EDITOR,
      ),
    )
  }, [editor, onInsert, onDelete, workflowNodesMap, getVarType])
  }, [editor, onInsert, onDelete, workflowNodesMap])
  return null
})