import React from 'react'; import { Node, mergeAttributes } from '@tiptap/core'; import { ReactNodeViewRenderer, NodeViewWrapper } from '@tiptap/react'; import type { NodeViewProps } from '@tiptap/react'; import { useCallback } from 'react'; import { Select } from '../../../index'; import { getCustomSlotAttribute } from '@douyinfe/semi-foundation/aiChatInput/utils'; import { strings } from '@douyinfe/semi-foundation/aiChatInput/constants'; function SelectSlotComponent(props: NodeViewProps) { const { node, updateAttributes } = props; const value: string = node.attrs.value ?? ''; const options: Array<{ value: string; label: string }> = JSON.parse(node.attrs.options || '[]'). map((option: string) => ({ value: option, label: option })); const handleChange = useCallback( (val: string | number | any[] | Record | undefined) => { if (typeof val === 'string') { updateAttributes({ value: val }); } }, [updateAttributes], ); return (