dishui 0.0.97 → 0.0.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/.release-verified.json +2 -2
  2. package/dist/ai.js +17 -15
  3. package/dist/components/Card/Ticket.d.ts +52 -0
  4. package/dist/components/Card/Ticket2.js +218 -0
  5. package/dist/components/Card/Ticket2.js.map +1 -0
  6. package/dist/components/Card/index.d.ts +12 -0
  7. package/dist/components/Card/index.js +142 -139
  8. package/dist/components/Card/index.js.map +1 -1
  9. package/dist/components/ai/AgentRunCard/index.d.ts +38 -0
  10. package/dist/components/ai/AgentRunCard/index.js +100 -0
  11. package/dist/components/ai/AgentRunCard/index.js.map +1 -0
  12. package/dist/components/ai/IssueCard/index.d.ts +39 -0
  13. package/dist/components/ai/IssueCard/index.js +78 -0
  14. package/dist/components/ai/IssueCard/index.js.map +1 -0
  15. package/dist/components/ai/index.d.ts +4 -0
  16. package/dist/components/pro/Flow/constants.js +3 -3
  17. package/dist/components/pro/Flow/constants.js.map +1 -1
  18. package/dist/components/pro/Flow/context/FlowAIContext.d.ts +2 -0
  19. package/dist/components/pro/Flow/context/FlowAIContext.js +9 -4
  20. package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -1
  21. package/dist/components/pro/Flow/nodes/MediaContent.d.ts +3 -2
  22. package/dist/components/pro/Flow/nodes/MediaContent.js +16 -16
  23. package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
  24. package/dist/components/pro/Flow/nodes/MediaOverlay.js +25 -23
  25. package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
  26. package/dist/components/pro/Flow/nodes/shapes.js +3 -3
  27. package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
  28. package/dist/components/pro/Flow/panels/InspectorPanel.js +396 -384
  29. package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
  30. package/dist/components/pro/Flow/utils/themeColor.d.ts +2 -2
  31. package/dist/components/pro/Flow/utils/themeColor.js +2 -2
  32. package/dist/components/pro/Flow/utils/themeColor.js.map +1 -1
  33. package/dist/components/pro/Kanban/Kanban.d.ts +3 -0
  34. package/dist/components/pro/Kanban/Kanban.js +339 -0
  35. package/dist/components/pro/Kanban/Kanban.js.map +1 -0
  36. package/dist/components/pro/Kanban/Swimlanes.d.ts +3 -0
  37. package/dist/components/pro/Kanban/Swimlanes.js +60 -0
  38. package/dist/components/pro/Kanban/Swimlanes.js.map +1 -0
  39. package/dist/components/pro/Kanban/index.d.ts +5 -0
  40. package/dist/components/pro/Kanban/types.d.ts +103 -0
  41. package/dist/components/pro/Kanban/useKanbanDrag.d.ts +17 -0
  42. package/dist/components/pro/Kanban/useKanbanDrag.js +69 -0
  43. package/dist/components/pro/Kanban/useKanbanDrag.js.map +1 -0
  44. package/dist/components/pro/Kanban/utils.d.ts +13 -0
  45. package/dist/components/pro/Kanban/utils.js +48 -0
  46. package/dist/components/pro/Kanban/utils.js.map +1 -0
  47. package/dist/components/pro/RichTextEditor/AIRewrite.js +158 -127
  48. package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
  49. package/dist/components/pro/RichTextEditor/BlockHandle.d.ts +2 -0
  50. package/dist/components/pro/RichTextEditor/BlockHandle.js +156 -115
  51. package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
  52. package/dist/components/pro/RichTextEditor/RichTextEditor.js +136 -159
  53. package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
  54. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +44 -41
  55. package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
  56. package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js +59 -53
  57. package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
  58. package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js +48 -44
  59. package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
  60. package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js +67 -63
  61. package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
  62. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.d.ts +1 -0
  63. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +182 -129
  64. package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
  65. package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.d.ts +1 -0
  66. package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js +3 -3
  67. package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
  68. package/dist/components/pro/RichTextEditor/Toolbar/useAnchoredDropdown.d.ts +3 -0
  69. package/dist/components/pro/RichTextEditor/Toolbar/useAnchoredDropdown.js +31 -0
  70. package/dist/components/pro/RichTextEditor/Toolbar/useAnchoredDropdown.js.map +1 -0
  71. package/dist/components/pro/RichTextEditor/index.d.ts +1 -1
  72. package/dist/components/pro/RichTextEditor/types.d.ts +78 -11
  73. package/dist/components/pro/RichTextEditor/types.js +11 -0
  74. package/dist/components/pro/RichTextEditor/types.js.map +1 -1
  75. package/dist/dishui.css +1 -1
  76. package/dist/index-nostyled.d.ts +1 -1
  77. package/dist/index.d.ts +4 -2
  78. package/dist/index.js +128 -122
  79. package/dist/kanban.js +5 -0
  80. package/dist/utils/i18n.js +20 -0
  81. package/dist/utils/i18n.js.map +1 -1
  82. package/dist/utils/menu.js +1 -1
  83. package/dist/utils/menu.js.map +1 -1
  84. package/package.json +5 -1
@@ -1 +1 @@
1
- {"version":3,"file":"BlockHandle.js","names":[],"sources":["../../../../src/components/pro/RichTextEditor/BlockHandle.tsx"],"sourcesContent":["import React, { useState, useEffect, useLayoutEffect, useRef, useCallback } from 'react';\nimport type { Editor } from '@tiptap/react';\nimport type { JSONContent } from '@tiptap/core';\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model';\nimport { NodeSelection, Selection } from '@tiptap/pm/state';\n\ninterface BlockHandleProps {\n editor: Editor;\n}\n\ninterface BlockInfo {\n pos: number;\n size: number;\n domTop: number;\n domBottom: number;\n}\n\nconst BlockHandle: React.FC<BlockHandleProps> = ({ editor }) => {\n const [visible, setVisible] = useState(false);\n const [handleTop, setHandleTop] = useState(0);\n const [showMenu, setShowMenu] = useState(false);\n const [menuMode, setMenuMode] = useState<'add' | 'actions'>('add');\n const [menuPos, setMenuPos] = useState({ left: 4, top: 0 });\n const target = useRef<{ pos: number; node: ProseMirrorNode } | null>(null);\n const dragCleanup = useRef<(() => void) | null>(null);\n const suppressClick = useRef(false);\n const [currentBlockIndex, setCurrentBlockIndex] = useState(-1);\n const [isDragging, setIsDragging] = useState(false);\n const [dropIndicator, setDropIndicator] = useState<{ top: number } | null>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const handleRef = useRef<HTMLDivElement>(null);\n const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hoveringHandle = useRef(false);\n\n const cancelHide = useCallback(() => {\n if (hideTimer.current) {\n clearTimeout(hideTimer.current);\n hideTimer.current = null;\n }\n }, []);\n\n const scheduleHide = useCallback(() => {\n cancelHide();\n hideTimer.current = setTimeout(() => {\n if (!hoveringHandle.current && !showMenu && !isDragging && !handleRef.current?.contains(document.activeElement) && !menuRef.current?.contains(document.activeElement)) {\n setVisible(false);\n }\n }, 200);\n }, [cancelHide, showMenu, isDragging]);\n\n const getBlocks = useCallback((): BlockInfo[] => {\n if (editor.isDestroyed) return [];\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!wrapperEl) return [];\n const wrapperRect = wrapperEl.getBoundingClientRect();\n const scrollTop = wrapperEl.scrollTop;\n const blocks: BlockInfo[] = [];\n\n editor.state.doc.forEach((node, offset) => {\n const domNode = editor.view.nodeDOM(offset) as HTMLElement | null;\n if (domNode instanceof HTMLElement) {\n const rect = domNode.getBoundingClientRect();\n blocks.push({\n pos: offset,\n size: node.nodeSize,\n domTop: rect.top - wrapperRect.top - wrapperEl.clientTop + scrollTop,\n domBottom: rect.bottom - wrapperRect.top - wrapperEl.clientTop + scrollTop,\n });\n }\n });\n return blocks;\n }, [editor]);\n\n const findBlockByClientY = useCallback((clientY: number): number => {\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!wrapperEl) return -1;\n const wrapperRect = wrapperEl.getBoundingClientRect();\n const y = clientY - wrapperRect.top - wrapperEl.clientTop + wrapperEl.scrollTop;\n return getBlocks().findIndex((block) => y >= block.domTop && y <= block.domBottom);\n }, [editor, getBlocks]);\n\n const findDropSlot = useCallback((clientY: number): { slotIndex: number; indicatorTop: number } | null => {\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!wrapperEl) return null;\n const wrapperRect = wrapperEl.getBoundingClientRect();\n const y = clientY - wrapperRect.top - wrapperEl.clientTop + wrapperEl.scrollTop;\n\n const blocks = getBlocks();\n if (blocks.length === 0) return null;\n\n let bestSlot = 0;\n let bestDist = Infinity;\n let bestTop = blocks[0].domTop;\n\n for (let i = 0; i <= blocks.length; i++) {\n const edgeY = i < blocks.length ? blocks[i].domTop : blocks[blocks.length - 1].domBottom;\n const dist = Math.abs(y - edgeY);\n if (dist < bestDist) {\n bestDist = dist;\n bestSlot = i;\n bestTop = edgeY;\n }\n }\n\n return { slotIndex: bestSlot, indicatorTop: bestTop };\n }, [editor, getBlocks]);\n\n useEffect(() => {\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!wrapperEl) return;\n\n const handleMouseMove = (e: MouseEvent) => {\n if (isDragging || dragCleanup.current || showMenu || hoveringHandle.current || !editor.isEditable || editor.view.composing) return;\n if (handleRef.current?.contains(e.target as Node) || menuRef.current?.contains(e.target as Node)) return;\n\n const idx = findBlockByClientY(e.clientY);\n if (idx < 0) { scheduleHide(); return; }\n\n const blocks = getBlocks();\n if (idx >= blocks.length) return;\n\n // Keep the handle reachable when the top of a long block has scrolled away.\n const viewportTop = Math.max(0, -wrapperEl.getBoundingClientRect().top);\n setHandleTop(Math.max(blocks[idx].domTop, wrapperEl.scrollTop + viewportTop + 4));\n setCurrentBlockIndex(idx);\n const node = editor.state.doc.nodeAt(blocks[idx].pos);\n target.current = node ? { pos: blocks[idx].pos, node } : null;\n cancelHide();\n setVisible(true);\n };\n\n const handleMouseLeave = () => {\n if (!isDragging) scheduleHide();\n };\n\n wrapperEl.addEventListener('mousemove', handleMouseMove);\n wrapperEl.addEventListener('mouseleave', handleMouseLeave);\n return () => {\n wrapperEl.removeEventListener('mousemove', handleMouseMove);\n wrapperEl.removeEventListener('mouseleave', handleMouseLeave);\n cancelHide();\n };\n }, [editor, cancelHide, scheduleHide, isDragging, showMenu, findBlockByClientY, getBlocks]);\n\n useEffect(() => {\n if (!showMenu) return;\n const handler = (e: MouseEvent) => {\n if (menuRef.current && !menuRef.current.contains(e.target as Node) && !handleRef.current?.contains(e.target as Node)) {\n hoveringHandle.current = false;\n setShowMenu(false);\n }\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, [showMenu]);\n\n const getTarget = useCallback(() => {\n const block = target.current;\n if (editor.isDestroyed || !editor.isEditable || editor.view.composing || !block || editor.state.doc.nodeAt(block.pos) !== block.node) return null;\n return block;\n }, [editor]);\n\n const addBlockBelow = useCallback((content: JSONContent) => {\n const block = getTarget();\n if (!block) return;\n const insertPos = block.pos + block.node.nodeSize;\n editor.chain().focus().insertContentAt(insertPos, content).command(({ tr }) => {\n tr.setSelection(Selection.near(tr.doc.resolve(insertPos + 1)));\n return true;\n }).run();\n setShowMenu(false);\n }, [editor, getTarget]);\n\n const moveBlock = useCallback((slotIndex: number) => {\n const block = getTarget();\n const blocks = getBlocks();\n if (!block || slotIndex < 0 || slotIndex > blocks.length) return;\n const index = blocks.findIndex((item) => item.pos === block.pos);\n if (index < 0 || slotIndex === index || slotIndex === index + 1) return;\n const insertBefore = blocks[slotIndex]?.pos ?? editor.state.doc.content.size;\n const tr = editor.state.tr.delete(block.pos, block.pos + block.node.nodeSize);\n const destination = tr.mapping.map(insertBefore);\n tr.insert(destination, block.node);\n tr.setSelection(NodeSelection.isSelectable(block.node)\n ? NodeSelection.create(tr.doc, destination)\n : Selection.near(tr.doc.resolve(destination)));\n editor.view.dispatch(tr.scrollIntoView());\n editor.view.focus();\n }, [editor, getTarget, getBlocks]);\n\n useEffect(() => {\n // Invalidate instead of trusting an index after external edits, undo or collaboration.\n const reset = () => {\n dragCleanup.current?.();\n target.current = null;\n hoveringHandle.current = false;\n setVisible(false);\n setShowMenu(false);\n cancelHide();\n };\n const transaction = ({ transaction: tr }: { transaction: import('@tiptap/pm/state').Transaction }) => {\n if (tr.docChanged || !editor.isEditable) reset();\n };\n const scroll = (event: Event) => {\n if (!(event.target instanceof Node) || !menuRef.current?.contains(event.target)) reset();\n };\n editor.on('transaction', transaction);\n const dom = editor.view.dom;\n dom.addEventListener('compositionstart', reset);\n window.addEventListener('scroll', scroll, true);\n window.addEventListener('resize', reset);\n window.addEventListener('blur', reset);\n return () => {\n editor.off('transaction', transaction);\n dom.removeEventListener('compositionstart', reset);\n window.removeEventListener('scroll', scroll, true);\n window.removeEventListener('resize', reset);\n window.removeEventListener('blur', reset);\n dragCleanup.current?.();\n cancelHide();\n };\n }, [editor, cancelHide]);\n\n useLayoutEffect(() => {\n if (!showMenu) return;\n const menu = menuRef.current;\n const handle = handleRef.current;\n const wrapper = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!menu || !handle || !wrapper) return;\n const rect = wrapper.getBoundingClientRect();\n const anchor = handle.getBoundingClientRect();\n const left = Math.max(8, rect.left + wrapper.clientLeft);\n const right = Math.min(window.innerWidth - 8, rect.right);\n const top = Math.max(8, rect.top + wrapper.clientTop);\n const bottom = Math.min(window.innerHeight - 8, rect.bottom);\n const below = bottom - anchor.bottom - 4;\n const above = anchor.top - top - 4;\n const flip = below < menu.scrollHeight && above > below;\n menu.style.maxHeight = `${Math.max(0, Math.min(320, flip ? above : below))}px`;\n menu.style.minWidth = '0';\n menu.style.width = `${Math.max(0, Math.min(220, right - left))}px`;\n setMenuPos({\n left: Math.max(left, Math.min(anchor.left, right - menu.offsetWidth)) - rect.left - wrapper.clientLeft + wrapper.scrollLeft,\n top: (flip ? anchor.top - menu.offsetHeight - 4 : anchor.bottom + 4) - rect.top - wrapper.clientTop + wrapper.scrollTop,\n });\n const firstItem = menuMode === 'actions' ? 'button:not(:disabled)' : 'button';\n menu.querySelector<HTMLButtonElement>(firstItem)?.focus({ preventScroll: true });\n }, [editor, showMenu, menuMode]);\n\n const handleDragStart = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (e.button !== 0 || !getTarget()) return;\n dragCleanup.current?.();\n suppressClick.current = false;\n const startX = e.clientX;\n const startY = e.clientY;\n let moved = false;\n\n const handleDragMove = (ev: MouseEvent) => {\n if (!moved && Math.hypot(ev.clientX - startX, ev.clientY - startY) < 5) return;\n moved = true;\n suppressClick.current = true;\n setShowMenu(false);\n setIsDragging(true);\n const slot = findDropSlot(ev.clientY);\n if (slot) {\n setDropIndicator({ top: slot.indicatorTop });\n }\n };\n\n const cleanup = () => {\n document.removeEventListener('mousemove', handleDragMove);\n document.removeEventListener('mouseup', handleDragEnd);\n document.removeEventListener('keydown', cancel, true);\n dragCleanup.current = null;\n setIsDragging(false);\n setDropIndicator(null);\n };\n const cancel = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return;\n event.preventDefault();\n event.stopImmediatePropagation();\n suppressClick.current = true;\n cleanup();\n };\n const handleDragEnd = (ev: MouseEvent) => {\n cleanup();\n if (!moved) return;\n const rect = editor.view.dom.closest('.rte-editor-wrapper')?.getBoundingClientRect();\n if (!rect || ev.clientX < rect.left || ev.clientX > rect.right || ev.clientY < rect.top || ev.clientY > rect.bottom) return;\n const slot = findDropSlot(ev.clientY);\n if (slot) moveBlock(slot.slotIndex);\n };\n\n dragCleanup.current = cleanup;\n document.addEventListener('mousemove', handleDragMove);\n document.addEventListener('mouseup', handleDragEnd);\n document.addEventListener('keydown', cancel, true);\n }, [editor, getTarget, moveBlock, findDropSlot]);\n\n const paragraph = { type: 'paragraph' };\n const addItems: { label: string; content: JSONContent }[] = [\n { label: 'Text', content: paragraph },\n ...([1, 2, 3] as const).map((level) => ({ label: `Heading ${level}`, content: { type: 'heading', attrs: { level } } })),\n { label: 'Bullet List', content: { type: 'bulletList', content: [{ type: 'listItem', content: [paragraph] }] } },\n { label: 'Numbered List', content: { type: 'orderedList', content: [{ type: 'listItem', content: [paragraph] }] } },\n { label: 'Task List', content: { type: 'taskList', content: [{ type: 'taskItem', attrs: { checked: false }, content: [paragraph] }] } },\n { label: 'Blockquote', content: { type: 'blockquote', content: [paragraph] } },\n { label: 'Code Block', content: { type: 'codeBlock' } },\n { label: 'Divider', content: { type: 'horizontalRule' } },\n { label: 'Table 3×3', content: { type: 'table', content: Array.from({ length: 3 }, (_, row) => ({\n type: 'tableRow', content: Array.from({ length: 3 }, () => ({ type: row === 0 ? 'tableHeader' : 'tableCell', content: [paragraph] })),\n })) } },\n ];\n const menuItems: { label: string; content?: JSONContent; disabled?: boolean }[] = menuMode === 'add'\n ? addItems.filter((item) => editor.schema.nodes[item.content.type!])\n : [\n { label: 'Duplicate' },\n { label: 'Delete' },\n { label: 'Move up', disabled: currentBlockIndex <= 0 },\n { label: 'Move down', disabled: currentBlockIndex >= editor.state.doc.childCount - 1 },\n ];\n\n const executeMenuItem = (item: typeof menuItems[number]) => {\n if (item.disabled) return;\n const block = getTarget();\n if (!block) return;\n if (item.content) addBlockBelow(item.content);\n else if (item.label === 'Duplicate') {\n const pos = block.pos + block.node.nodeSize;\n const tr = editor.state.tr.insert(pos, block.node);\n tr.setSelection(Selection.near(tr.doc.resolve(pos + 1)));\n editor.view.dispatch(tr.scrollIntoView());\n editor.view.focus();\n } else if (item.label === 'Delete') {\n editor.chain().focus().deleteRange({ from: block.pos, to: block.pos + block.node.nodeSize }).run();\n } else if (item.label === 'Move up') moveBlock(currentBlockIndex - 1);\n else if (item.label === 'Move down') moveBlock(currentBlockIndex + 2);\n };\n\n if (!visible && !showMenu && !isDragging) return null;\n\n return (\n <>\n <div\n ref={handleRef}\n className=\"rte-block-handle\"\n style={{ top: handleTop }}\n onFocus={cancelHide}\n onBlur={scheduleHide}\n onMouseEnter={() => { hoveringHandle.current = true; cancelHide(); }}\n onMouseLeave={() => { hoveringHandle.current = false; if (!isDragging) scheduleHide(); }}\n onMouseDown={(e) => { e.stopPropagation(); e.preventDefault(); }}\n >\n <button\n type=\"button\"\n className=\"rte-block-handle__btn rte-block-handle__btn--add\"\n onMouseDown={(e) => { e.stopPropagation(); e.preventDefault(); }}\n onClick={(e) => { e.stopPropagation(); if (getTarget()) { setMenuMode('add'); setShowMenu(!showMenu || menuMode !== 'add'); } }}\n aria-label=\"Add block\"\n aria-haspopup=\"menu\"\n aria-expanded={showMenu && menuMode === 'add'}\n title=\"Add block\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" /><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" /></svg>\n </button>\n <button\n type=\"button\"\n className={`rte-block-handle__btn rte-block-handle__btn--drag ${isDragging ? 'rte-block-handle__btn--dragging' : ''}`}\n title=\"Drag to reorder or click for block actions\"\n aria-label=\"Block actions\"\n aria-haspopup=\"menu\"\n aria-expanded={showMenu && menuMode === 'actions'}\n onMouseDown={handleDragStart}\n onClick={(e) => {\n e.stopPropagation();\n if (suppressClick.current) { suppressClick.current = false; return; }\n if (getTarget()) { setMenuMode('actions'); setShowMenu(!showMenu || menuMode !== 'actions'); }\n }}\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"9\" cy=\"6\" r=\"1.5\" /><circle cx=\"15\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"12\" r=\"1.5\" /><circle cx=\"15\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"18\" r=\"1.5\" /><circle cx=\"15\" cy=\"18\" r=\"1.5\" />\n </svg>\n </button>\n </div>\n\n {showMenu && (\n <div\n ref={menuRef}\n className=\"rte-block-handle__menu\"\n role=\"menu\"\n aria-label={menuMode === 'add' ? 'Add block' : 'Block actions'}\n style={{ ...menuPos, overflowY: 'auto' }}\n onMouseEnter={() => { hoveringHandle.current = true; cancelHide(); }}\n onMouseLeave={() => { hoveringHandle.current = false; }}\n onMouseDown={(e) => { e.stopPropagation(); e.preventDefault(); }}\n onKeyDown={(e) => {\n if (e.nativeEvent.isComposing || e.keyCode === 229) return;\n if (e.key === 'Escape' || e.key === 'Tab') {\n if (e.key === 'Escape') e.preventDefault();\n e.stopPropagation();\n hoveringHandle.current = false;\n setShowMenu(false);\n handleRef.current?.querySelector<HTMLButtonElement>(menuMode === 'add' ? '.rte-block-handle__btn--add' : '.rte-block-handle__btn--drag')?.focus({ preventScroll: true });\n return;\n }\n if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(e.key)) return;\n e.preventDefault();\n e.stopPropagation();\n const buttons = Array.from(e.currentTarget.querySelectorAll<HTMLButtonElement>('button:not(:disabled)'));\n const index = buttons.indexOf(document.activeElement as HTMLButtonElement);\n const next = e.key === 'Home' ? 0 : e.key === 'End' ? buttons.length - 1 : (index + (e.key === 'ArrowDown' ? 1 : -1) + buttons.length) % buttons.length;\n buttons[next]?.focus({ preventScroll: true });\n const item = buttons[next];\n if (item && item.offsetTop < e.currentTarget.scrollTop) e.currentTarget.scrollTop = item.offsetTop;\n else if (item && item.offsetTop + item.offsetHeight > e.currentTarget.scrollTop + e.currentTarget.clientHeight) {\n e.currentTarget.scrollTop = item.offsetTop + item.offsetHeight - e.currentTarget.clientHeight;\n }\n }}\n >\n {menuItems.map((item) => (\n <button\n key={item.label}\n type=\"button\"\n role=\"menuitem\"\n disabled={item.disabled}\n style={item.disabled ? { opacity: 0.45, cursor: 'default' } : undefined}\n className=\"rte-block-handle__menu-item\"\n onMouseDown={(e) => e.stopPropagation()}\n onClick={(e) => { e.stopPropagation(); executeMenuItem(item); setShowMenu(false); hoveringHandle.current = false; }}\n >\n {item.label}\n </button>\n ))}\n </div>\n )}\n\n {isDragging && dropIndicator && (\n <div className=\"rte-block-handle__drop-indicator\" style={{ top: dropIndicator.top }} />\n )}\n </>\n );\n};\n\nexport default BlockHandle;\n"],"mappings":";;;;AAiBA,IAAM,KAA2C,EAAE,gBAAa;CAC9D,IAAM,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,CAAC,GAAW,KAAgB,EAAS,CAAC,GACtC,CAAC,GAAU,KAAe,EAAS,EAAK,GACxC,CAAC,GAAU,KAAe,EAA4B,KAAK,GAC3D,CAAC,GAAS,KAAc,EAAS;EAAE,MAAM;EAAG,KAAK;CAAE,CAAC,GACpD,IAAS,EAAsD,IAAI,GACnE,IAAc,EAA4B,IAAI,GAC9C,IAAgB,EAAO,EAAK,GAC5B,CAAC,GAAmB,KAAwB,EAAS,EAAE,GACvD,CAAC,GAAY,KAAiB,EAAS,EAAK,GAC5C,CAAC,GAAe,KAAoB,EAAiC,IAAI,GACzE,IAAU,EAAuB,IAAI,GACrC,IAAY,EAAuB,IAAI,GACvC,IAAY,EAA6C,IAAI,GAC7D,IAAiB,EAAO,EAAK,GAE7B,IAAa,QAAkB;EACnC,AAEE,EAAU,aADV,aAAa,EAAU,OAAO,GACV;CAExB,GAAG,CAAC,CAAC,GAEC,IAAe,QAAkB;EAErC,AADA,EAAW,GACX,EAAU,UAAU,iBAAiB;GACnC,AAAI,CAAC,EAAe,WAAW,CAAC,KAAY,CAAC,KAAc,CAAC,EAAU,SAAS,SAAS,SAAS,aAAa,KAAK,CAAC,EAAQ,SAAS,SAAS,SAAS,aAAa,KAClK,EA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EAAQ,EAAK,EAAE,MAAM,EAAE,eAAe,GAAK,CAAC;IAC5C,IAAM,IAAO,EAAQ;IACrB,AAAI,KAAQ,EAAK,YAAY,EAAE,cAAc,YAAW,EAAE,cAAc,YAAY,EAAK,YAChF,KAAQ,EAAK,YAAY,EAAK,eAAe,EAAE,cAAc,YAAY,EAAE,cAAc,iBAChG,EAAE,cAAc,YAAY,EAAK,YAAY,EAAK,eAAe,EAAE,cAAc;GAErF;GAEC,UAAA,EAAU,KAAK,MACd,kBAAC,UAAD;IAEE,MAAK;IACL,MAAK;IACL,UAAU,EAAK;IACf,OAAO,EAAK,WAAW;KAAE,SAAS;KAAM,QAAQ;IAAU,IAAI,KAAA;IAC9D,WAAU;IACV,cAAc,MAAM,EAAE,gBAAgB;IACtC,UAAU,MAAM;KAAkE,AAAhE,EAAE,gBAAgB,GAAG,EAAgB,CAAI,GAAG,EAAY,EAAK,GAAG,EAAe,UAAU;IAAO;IAEjH,UAAA,EAAK;GACA,GAVD,EAAK,KAUJ,CACT;EACE,CAAA;EAGN,KAAc,KACb,kBAAC,OAAD;GAAK,WAAU;GAAmC,OAAO,EAAE,KAAK,EAAc,IAAI;EAAI,CAAA;CAExF,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"BlockHandle.js","names":[],"sources":["../../../../src/components/pro/RichTextEditor/BlockHandle.tsx"],"sourcesContent":["import React, { useState, useEffect, useLayoutEffect, useRef, useCallback } from 'react';\nimport type { Editor } from '@tiptap/react';\nimport type { JSONContent } from '@tiptap/core';\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model';\nimport { NodeSelection, Selection } from '@tiptap/pm/state';\n\ninterface BlockHandleProps {\n editor: Editor;\n /** Keep the left control rail visible instead of revealing it only on hover. */\n persistent?: boolean;\n}\n\ninterface BlockInfo {\n pos: number;\n size: number;\n domTop: number;\n domBottom: number;\n}\n\nconst BlockHandle: React.FC<BlockHandleProps> = ({ editor, persistent = false }) => {\n const [visible, setVisible] = useState(false);\n const [handleTop, setHandleTop] = useState(0);\n const [showMenu, setShowMenu] = useState(false);\n const [menuMode, setMenuMode] = useState<'add' | 'actions'>('add');\n const [menuPos, setMenuPos] = useState({ left: 4, top: 0 });\n const target = useRef<{ pos: number; node: ProseMirrorNode } | null>(null);\n const dragCleanup = useRef<(() => void) | null>(null);\n const suppressClick = useRef(false);\n const [currentBlockIndex, setCurrentBlockIndex] = useState(-1);\n const [isDragging, setIsDragging] = useState(false);\n const [dropIndicator, setDropIndicator] = useState<{ top: number } | null>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const handleRef = useRef<HTMLDivElement>(null);\n const hideTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const hoveringHandle = useRef(false);\n\n const cancelHide = useCallback(() => {\n if (hideTimer.current) {\n clearTimeout(hideTimer.current);\n hideTimer.current = null;\n }\n }, []);\n\n const scheduleHide = useCallback(() => {\n cancelHide();\n hideTimer.current = setTimeout(() => {\n if (!hoveringHandle.current && !showMenu && !isDragging && !handleRef.current?.contains(document.activeElement) && !menuRef.current?.contains(document.activeElement)) {\n setVisible(false);\n }\n }, 200);\n }, [cancelHide, showMenu, isDragging]);\n\n const getBlocks = useCallback((): BlockInfo[] => {\n if (editor.isDestroyed) return [];\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!wrapperEl) return [];\n const wrapperRect = wrapperEl.getBoundingClientRect();\n const scrollTop = wrapperEl.scrollTop;\n const blocks: BlockInfo[] = [];\n\n editor.state.doc.forEach((node, offset) => {\n const domNode = editor.view.nodeDOM(offset) as HTMLElement | null;\n if (domNode instanceof HTMLElement) {\n const rect = domNode.getBoundingClientRect();\n blocks.push({\n pos: offset,\n size: node.nodeSize,\n domTop: rect.top - wrapperRect.top - wrapperEl.clientTop + scrollTop,\n domBottom: rect.bottom - wrapperRect.top - wrapperEl.clientTop + scrollTop,\n });\n }\n });\n return blocks;\n }, [editor]);\n\n const findBlockByClientY = useCallback((clientY: number): number => {\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!wrapperEl) return -1;\n const wrapperRect = wrapperEl.getBoundingClientRect();\n const y = clientY - wrapperRect.top - wrapperEl.clientTop + wrapperEl.scrollTop;\n return getBlocks().findIndex((block) => y >= block.domTop && y <= block.domBottom);\n }, [editor, getBlocks]);\n\n const selectBlockAtClientY = useCallback((clientY: number): boolean => {\n const blocks = getBlocks();\n const idx = findBlockByClientY(clientY);\n if (idx < 0 || idx >= blocks.length) return false;\n const block = blocks[idx];\n const node = editor.state.doc.nodeAt(block.pos);\n if (!node) return false;\n target.current = { pos: block.pos, node };\n setCurrentBlockIndex(idx);\n setHandleTop(block.domTop);\n setVisible(true);\n return true;\n }, [editor, findBlockByClientY, getBlocks]);\n\n const findDropSlot = useCallback((clientY: number): { slotIndex: number; indicatorTop: number } | null => {\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!wrapperEl) return null;\n const wrapperRect = wrapperEl.getBoundingClientRect();\n const y = clientY - wrapperRect.top - wrapperEl.clientTop + wrapperEl.scrollTop;\n\n const blocks = getBlocks();\n if (blocks.length === 0) return null;\n\n // When the pointer is over a row, use the drag direction to choose that\n // row's near edge. This makes dropping a lower row anywhere on the first\n // row reliably place it first instead of accidentally placing it second.\n const source = target.current;\n const sourceIndex = source ? blocks.findIndex((block) => block.pos === source.pos) : -1;\n const hoveredIndex = blocks.findIndex((block) => y >= block.domTop && y <= block.domBottom);\n if (sourceIndex > hoveredIndex && hoveredIndex >= 0) {\n return { slotIndex: hoveredIndex, indicatorTop: blocks[hoveredIndex].domTop };\n }\n\n let bestSlot = 0;\n let bestDist = Infinity;\n let bestTop = blocks[0].domTop;\n\n for (let i = 0; i <= blocks.length; i++) {\n const edgeY = i < blocks.length ? blocks[i].domTop : blocks[blocks.length - 1].domBottom;\n const dist = Math.abs(y - edgeY);\n if (dist < bestDist) {\n bestDist = dist;\n bestSlot = i;\n bestTop = edgeY;\n }\n }\n\n return { slotIndex: bestSlot, indicatorTop: bestTop };\n }, [editor, getBlocks]);\n\n useEffect(() => {\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!wrapperEl) return;\n\n const handleMouseMove = (e: MouseEvent) => {\n if (isDragging || dragCleanup.current || showMenu || hoveringHandle.current || !editor.isEditable || editor.view.composing) return;\n if (handleRef.current?.contains(e.target as Node) || menuRef.current?.contains(e.target as Node)) return;\n\n const idx = findBlockByClientY(e.clientY);\n if (idx < 0) { scheduleHide(); return; }\n\n const blocks = getBlocks();\n if (idx >= blocks.length || !selectBlockAtClientY(e.clientY)) return;\n\n // Keep the handle reachable when the top of a long block has scrolled away.\n const viewportTop = Math.max(0, -wrapperEl.getBoundingClientRect().top);\n setHandleTop(Math.max(blocks[idx].domTop, wrapperEl.scrollTop + viewportTop + 4));\n cancelHide();\n };\n\n const handleMouseLeave = () => {\n if (!isDragging) scheduleHide();\n };\n\n const handleTouchStart = (e: TouchEvent) => {\n if (!editor.isEditable || editor.view.composing) return;\n const touch = e.touches[0];\n if (!touch) return;\n selectBlockAtClientY(touch.clientY);\n };\n\n wrapperEl.addEventListener('mousemove', handleMouseMove);\n wrapperEl.addEventListener('mouseleave', handleMouseLeave);\n wrapperEl.addEventListener('touchstart', handleTouchStart);\n const initialFrame = persistent\n ? requestAnimationFrame(() => {\n const blocks = getBlocks();\n const node = blocks[0] ? editor.state.doc.nodeAt(blocks[0].pos) : null;\n if (blocks[0] && node) {\n target.current = { pos: blocks[0].pos, node };\n setCurrentBlockIndex(0);\n setHandleTop(blocks[0].domTop);\n setVisible(true);\n }\n })\n : null;\n return () => {\n wrapperEl.removeEventListener('mousemove', handleMouseMove);\n wrapperEl.removeEventListener('mouseleave', handleMouseLeave);\n wrapperEl.removeEventListener('touchstart', handleTouchStart);\n if (initialFrame !== null) cancelAnimationFrame(initialFrame);\n cancelHide();\n };\n }, [editor, cancelHide, scheduleHide, isDragging, showMenu, findBlockByClientY, getBlocks, selectBlockAtClientY, persistent]);\n\n useEffect(() => {\n if (!showMenu) return;\n const handler = (e: MouseEvent) => {\n if (menuRef.current && !menuRef.current.contains(e.target as Node) && !handleRef.current?.contains(e.target as Node)) {\n hoveringHandle.current = false;\n setShowMenu(false);\n }\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, [showMenu]);\n\n const getTarget = useCallback(() => {\n const block = target.current;\n if (editor.isDestroyed || !editor.isEditable || editor.view.composing || !block || editor.state.doc.nodeAt(block.pos) !== block.node) return null;\n return block;\n }, [editor]);\n\n const addBlockBelow = useCallback((content: JSONContent) => {\n const block = getTarget();\n if (!block) return;\n const insertPos = block.pos + block.node.nodeSize;\n editor.chain().focus().insertContentAt(insertPos, content).command(({ tr }) => {\n tr.setSelection(Selection.near(tr.doc.resolve(insertPos + 1)));\n return true;\n }).run();\n setShowMenu(false);\n }, [editor, getTarget]);\n\n const moveBlock = useCallback((slotIndex: number) => {\n const block = getTarget();\n const blocks = getBlocks();\n if (!block || slotIndex < 0 || slotIndex > blocks.length) return;\n const index = blocks.findIndex((item) => item.pos === block.pos);\n if (index < 0 || slotIndex === index || slotIndex === index + 1) return;\n const insertBefore = blocks[slotIndex]?.pos ?? editor.state.doc.content.size;\n const tr = editor.state.tr.delete(block.pos, block.pos + block.node.nodeSize);\n const destination = tr.mapping.map(insertBefore);\n tr.insert(destination, block.node);\n tr.setSelection(NodeSelection.isSelectable(block.node)\n ? NodeSelection.create(tr.doc, destination)\n : Selection.near(tr.doc.resolve(destination)));\n editor.view.dispatch(tr.scrollIntoView());\n editor.view.focus();\n }, [editor, getTarget, getBlocks]);\n\n useEffect(() => {\n // Invalidate instead of trusting an index after external edits, undo or collaboration.\n const reset = () => {\n dragCleanup.current?.();\n target.current = null;\n hoveringHandle.current = false;\n setVisible(persistent);\n setShowMenu(false);\n cancelHide();\n };\n const transaction = ({ transaction: tr }: { transaction: import('@tiptap/pm/state').Transaction }) => {\n if (tr.docChanged || !editor.isEditable) reset();\n };\n const scroll = (event: Event) => {\n if (!(event.target instanceof Node) || !menuRef.current?.contains(event.target)) reset();\n };\n editor.on('transaction', transaction);\n const dom = editor.view.dom;\n dom.addEventListener('compositionstart', reset);\n window.addEventListener('scroll', scroll, true);\n window.addEventListener('resize', reset);\n window.addEventListener('blur', reset);\n return () => {\n editor.off('transaction', transaction);\n dom.removeEventListener('compositionstart', reset);\n window.removeEventListener('scroll', scroll, true);\n window.removeEventListener('resize', reset);\n window.removeEventListener('blur', reset);\n dragCleanup.current?.();\n cancelHide();\n };\n }, [editor, cancelHide, persistent]);\n\n useLayoutEffect(() => {\n if (!showMenu) return;\n const menu = menuRef.current;\n const handle = handleRef.current;\n const wrapper = editor.view.dom.closest('.rte-editor-wrapper') as HTMLElement | null;\n if (!menu || !handle || !wrapper) return;\n const rect = wrapper.getBoundingClientRect();\n const anchor = handle.getBoundingClientRect();\n const left = Math.max(8, rect.left + wrapper.clientLeft);\n const right = Math.min(window.innerWidth - 8, rect.right);\n const top = Math.max(8, rect.top + wrapper.clientTop);\n const bottom = Math.min(window.innerHeight - 8, rect.bottom);\n const below = bottom - anchor.bottom - 4;\n const above = anchor.top - top - 4;\n const flip = below < menu.scrollHeight && above > below;\n menu.style.maxHeight = `${Math.max(0, Math.min(320, flip ? above : below))}px`;\n menu.style.minWidth = '0';\n menu.style.width = `${Math.max(0, Math.min(220, right - left))}px`;\n setMenuPos({\n left: Math.max(left, Math.min(anchor.left, right - menu.offsetWidth)) - rect.left - wrapper.clientLeft + wrapper.scrollLeft,\n top: (flip ? anchor.top - menu.offsetHeight - 4 : anchor.bottom + 4) - rect.top - wrapper.clientTop + wrapper.scrollTop,\n });\n const firstItem = menuMode === 'actions' ? 'button:not(:disabled)' : 'button';\n menu.querySelector<HTMLButtonElement>(firstItem)?.focus({ preventScroll: true });\n }, [editor, showMenu, menuMode]);\n\n const handleDragStart = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // Re-resolve from the pointer at drag start. The visible rail can outlive a\n // previous hover, so relying on its cached target may move the wrong block.\n if (e.button !== 0 || !selectBlockAtClientY(e.clientY) || !getTarget()) return;\n dragCleanup.current?.();\n suppressClick.current = false;\n const startX = e.clientX;\n const startY = e.clientY;\n let moved = false;\n\n const handleDragMove = (ev: MouseEvent) => {\n if (!moved && Math.hypot(ev.clientX - startX, ev.clientY - startY) < 5) return;\n moved = true;\n suppressClick.current = true;\n setShowMenu(false);\n setIsDragging(true);\n const slot = findDropSlot(ev.clientY);\n if (slot) {\n setDropIndicator({ top: slot.indicatorTop });\n }\n };\n\n const cleanup = () => {\n document.removeEventListener('mousemove', handleDragMove);\n document.removeEventListener('mouseup', handleDragEnd);\n document.removeEventListener('keydown', cancel, true);\n dragCleanup.current = null;\n setIsDragging(false);\n setDropIndicator(null);\n };\n const cancel = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return;\n event.preventDefault();\n event.stopImmediatePropagation();\n suppressClick.current = true;\n cleanup();\n };\n const handleDragEnd = (ev: MouseEvent) => {\n cleanup();\n if (!moved) return;\n const rect = editor.view.dom.closest('.rte-editor-wrapper')?.getBoundingClientRect();\n if (!rect || ev.clientX < rect.left || ev.clientX > rect.right || ev.clientY < rect.top || ev.clientY > rect.bottom) return;\n const slot = findDropSlot(ev.clientY);\n if (slot) moveBlock(slot.slotIndex);\n };\n\n dragCleanup.current = cleanup;\n document.addEventListener('mousemove', handleDragMove);\n document.addEventListener('mouseup', handleDragEnd);\n document.addEventListener('keydown', cancel, true);\n }, [editor, getTarget, moveBlock, findDropSlot, selectBlockAtClientY]);\n\n const paragraph = { type: 'paragraph' };\n const addItems: { label: string; content: JSONContent }[] = [\n { label: 'Text', content: paragraph },\n ...([1, 2, 3] as const).map((level) => ({ label: `Heading ${level}`, content: { type: 'heading', attrs: { level } } })),\n { label: 'Bullet List', content: { type: 'bulletList', content: [{ type: 'listItem', content: [paragraph] }] } },\n { label: 'Numbered List', content: { type: 'orderedList', content: [{ type: 'listItem', content: [paragraph] }] } },\n { label: 'Task List', content: { type: 'taskList', content: [{ type: 'taskItem', attrs: { checked: false }, content: [paragraph] }] } },\n { label: 'Blockquote', content: { type: 'blockquote', content: [paragraph] } },\n { label: 'Code Block', content: { type: 'codeBlock' } },\n { label: 'Divider', content: { type: 'horizontalRule' } },\n { label: 'Table 3×3', content: { type: 'table', content: Array.from({ length: 3 }, (_, row) => ({\n type: 'tableRow', content: Array.from({ length: 3 }, () => ({ type: row === 0 ? 'tableHeader' : 'tableCell', content: [paragraph] })),\n })) } },\n ];\n const menuItems: { label: string; content?: JSONContent; disabled?: boolean }[] = menuMode === 'add'\n ? addItems.filter((item) => editor.schema.nodes[item.content.type!])\n : [\n { label: 'Duplicate' },\n { label: 'Delete' },\n { label: 'Move up', disabled: currentBlockIndex <= 0 },\n { label: 'Move down', disabled: currentBlockIndex >= editor.state.doc.childCount - 1 },\n ];\n\n const executeMenuItem = (item: typeof menuItems[number]) => {\n if (item.disabled) return;\n const block = getTarget();\n if (!block) return;\n if (item.content) addBlockBelow(item.content);\n else if (item.label === 'Duplicate') {\n const pos = block.pos + block.node.nodeSize;\n const tr = editor.state.tr.insert(pos, block.node);\n tr.setSelection(Selection.near(tr.doc.resolve(pos + 1)));\n editor.view.dispatch(tr.scrollIntoView());\n editor.view.focus();\n } else if (item.label === 'Delete') {\n editor.chain().focus().deleteRange({ from: block.pos, to: block.pos + block.node.nodeSize }).run();\n } else if (item.label === 'Move up') moveBlock(currentBlockIndex - 1);\n else if (item.label === 'Move down') moveBlock(currentBlockIndex + 2);\n };\n\n if (!visible && !showMenu && !isDragging) return null;\n\n return (\n <>\n <div\n ref={handleRef}\n className={`rte-block-handle ${persistent ? 'rte-block-handle--persistent' : ''}`}\n style={{ top: handleTop }}\n onFocus={cancelHide}\n onBlur={scheduleHide}\n onMouseEnter={() => { hoveringHandle.current = true; cancelHide(); }}\n onMouseLeave={() => { hoveringHandle.current = false; if (!isDragging) scheduleHide(); }}\n onMouseDown={(e) => { e.stopPropagation(); e.preventDefault(); }}\n >\n <button\n type=\"button\"\n className=\"rte-block-handle__btn rte-block-handle__btn--add\"\n onMouseDown={(e) => { e.stopPropagation(); e.preventDefault(); }}\n onTouchStart={(e) => {\n e.stopPropagation();\n suppressClick.current = true;\n if (getTarget()) { setMenuMode('add'); setShowMenu(!showMenu || menuMode !== 'add'); }\n }}\n onClick={(e) => {\n e.stopPropagation();\n if (suppressClick.current) { suppressClick.current = false; return; }\n if (getTarget()) { setMenuMode('add'); setShowMenu(!showMenu || menuMode !== 'add'); }\n }}\n aria-label=\"Add block\"\n aria-haspopup=\"menu\"\n aria-expanded={showMenu && menuMode === 'add'}\n title=\"Add block\"\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\" /><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\" /></svg>\n </button>\n <button\n type=\"button\"\n className={`rte-block-handle__btn rte-block-handle__btn--drag ${isDragging ? 'rte-block-handle__btn--dragging' : ''}`}\n title=\"Drag to reorder or click for block actions\"\n aria-label=\"Block actions\"\n aria-haspopup=\"menu\"\n aria-expanded={showMenu && menuMode === 'actions'}\n onMouseDown={handleDragStart}\n onTouchStart={(e) => {\n e.stopPropagation();\n suppressClick.current = true;\n setMenuMode('actions');\n setShowMenu(!showMenu || menuMode !== 'actions');\n }}\n onClick={(e) => {\n e.stopPropagation();\n if (suppressClick.current) { suppressClick.current = false; return; }\n if (getTarget()) { setMenuMode('actions'); setShowMenu(!showMenu || menuMode !== 'actions'); }\n }}\n >\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"9\" cy=\"6\" r=\"1.5\" /><circle cx=\"15\" cy=\"6\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"12\" r=\"1.5\" /><circle cx=\"15\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"9\" cy=\"18\" r=\"1.5\" /><circle cx=\"15\" cy=\"18\" r=\"1.5\" />\n </svg>\n </button>\n </div>\n\n {showMenu && (\n <div\n ref={menuRef}\n className=\"rte-block-handle__menu\"\n role=\"menu\"\n aria-label={menuMode === 'add' ? 'Add block' : 'Block actions'}\n style={{ ...menuPos, overflowY: 'auto' }}\n onMouseEnter={() => { hoveringHandle.current = true; cancelHide(); }}\n onMouseLeave={() => { hoveringHandle.current = false; }}\n onMouseDown={(e) => { e.stopPropagation(); e.preventDefault(); }}\n onKeyDown={(e) => {\n if (e.nativeEvent.isComposing || e.keyCode === 229) return;\n if (e.key === 'Escape' || e.key === 'Tab') {\n if (e.key === 'Escape') e.preventDefault();\n e.stopPropagation();\n hoveringHandle.current = false;\n setShowMenu(false);\n handleRef.current?.querySelector<HTMLButtonElement>(menuMode === 'add' ? '.rte-block-handle__btn--add' : '.rte-block-handle__btn--drag')?.focus({ preventScroll: true });\n return;\n }\n if (!['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(e.key)) return;\n e.preventDefault();\n e.stopPropagation();\n const buttons = Array.from(e.currentTarget.querySelectorAll<HTMLButtonElement>('button:not(:disabled)'));\n const index = buttons.indexOf(document.activeElement as HTMLButtonElement);\n const next = e.key === 'Home' ? 0 : e.key === 'End' ? buttons.length - 1 : (index + (e.key === 'ArrowDown' ? 1 : -1) + buttons.length) % buttons.length;\n buttons[next]?.focus({ preventScroll: true });\n const item = buttons[next];\n if (item && item.offsetTop < e.currentTarget.scrollTop) e.currentTarget.scrollTop = item.offsetTop;\n else if (item && item.offsetTop + item.offsetHeight > e.currentTarget.scrollTop + e.currentTarget.clientHeight) {\n e.currentTarget.scrollTop = item.offsetTop + item.offsetHeight - e.currentTarget.clientHeight;\n }\n }}\n >\n {menuItems.map((item) => (\n <button\n key={item.label}\n type=\"button\"\n role=\"menuitem\"\n disabled={item.disabled}\n style={item.disabled ? { opacity: 0.45, cursor: 'default' } : undefined}\n className=\"rte-block-handle__menu-item\"\n onMouseDown={(e) => e.stopPropagation()}\n onClick={(e) => { e.stopPropagation(); executeMenuItem(item); setShowMenu(false); hoveringHandle.current = false; }}\n >\n {item.label}\n </button>\n ))}\n </div>\n )}\n\n {isDragging && dropIndicator && (\n <div className=\"rte-block-handle__drop-indicator\" style={{ top: dropIndicator.top }} />\n )}\n </>\n );\n};\n\nexport default BlockHandle;\n"],"mappings":";;;;AAmBA,IAAM,KAA2C,EAAE,WAAQ,gBAAa,SAAY;CAClF,IAAM,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,CAAC,GAAW,KAAgB,EAAS,CAAC,GACtC,CAAC,GAAU,KAAe,EAAS,EAAK,GACxC,CAAC,GAAU,KAAe,EAA4B,KAAK,GAC3D,CAAC,GAAS,KAAc,EAAS;EAAE,MAAM;EAAG,KAAK;CAAE,CAAC,GACpD,IAAS,EAAsD,IAAI,GACnE,IAAc,EAA4B,IAAI,GAC9C,IAAgB,EAAO,EAAK,GAC5B,CAAC,GAAmB,KAAwB,EAAS,EAAE,GACvD,CAAC,GAAY,KAAiB,EAAS,EAAK,GAC5C,CAAC,GAAe,KAAoB,EAAiC,IAAI,GACzE,IAAU,EAAuB,IAAI,GACrC,IAAY,EAAuB,IAAI,GACvC,IAAY,EAA6C,IAAI,GAC7D,IAAiB,EAAO,EAAK,GAE7B,IAAa,QAAkB;EACnC,AAEE,EAAU,aADV,aAAa,EAAU,OAAO,GACV;CAExB,GAAG,CAAC,CAAC,GAEC,IAAe,QAAkB;EAErC,AADA,EAAW,GACX,EAAU,UAAU,iBAAiB;GACnC,AAAI,CAAC,EAAe,WAAW,CAAC,KAAY,CAAC,KAAc,CAAC,EAAU,SAAS,SAAS,SAAS,aAAa,KAAK,CAAC,EAAQ,SAAS,SAAS,SAAS,aAAa,KAClK,EAAW,EAAK;EAEpB,GAAG,GAAG;CACR,GAAG;EAAC;EAAY;EAAU;CAAU,CAAC,GAE/B,IAAY,QAA+B;EAC/C,IAAI,EAAO,aAAa,OAA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AAK,KAAS,EAAE,QAAQ,cAAc,IAAI,MAAM,EAAQ,UAAU,EAAQ;IACjJ,EAAQ,EAAK,EAAE,MAAM,EAAE,eAAe,GAAK,CAAC;IAC5C,IAAM,IAAO,EAAQ;IACrB,AAAI,KAAQ,EAAK,YAAY,EAAE,cAAc,YAAW,EAAE,cAAc,YAAY,EAAK,YAChF,KAAQ,EAAK,YAAY,EAAK,eAAe,EAAE,cAAc,YAAY,EAAE,cAAc,iBAChG,EAAE,cAAc,YAAY,EAAK,YAAY,EAAK,eAAe,EAAE,cAAc;GAErF;GAEC,UAAA,EAAU,KAAK,MACd,kBAAC,UAAD;IAEE,MAAK;IACL,MAAK;IACL,UAAU,EAAK;IACf,OAAO,EAAK,WAAW;KAAE,SAAS;KAAM,QAAQ;IAAU,IAAI,KAAA;IAC9D,WAAU;IACV,cAAc,MAAM,EAAE,gBAAgB;IACtC,UAAU,MAAM;KAAkE,AAAhE,EAAE,gBAAgB,GAAG,EAAgB,CAAI,GAAG,EAAY,EAAK,GAAG,EAAe,UAAU;IAAO;IAEjH,UAAA,EAAK;GACA,GAVD,EAAK,KAUJ,CACT;EACE,CAAA;EAGN,KAAc,KACb,kBAAC,OAAD;GAAK,WAAU;GAAmC,OAAO,EAAE,KAAK,EAAc,IAAI;EAAI,CAAA;CAExF,EAAA,CAAA;AAEN"}
@@ -1,55 +1,55 @@
1
1
  import { cn as e } from "../../../utils/cn.js";
2
2
  import { MarkdownBlockExtension as t } from "./extensions/MarkdownBlock.js";
3
3
  import { FloatingDialogExtension as n } from "./extensions/FloatingDialog.js";
4
- import r from "./Toolbar/Toolbar.js";
5
- import i from "./AIRewrite.js";
6
- import a from "./ContextMenu.js";
7
- import o from "./CommentPanel.js";
8
- import s from "./CommentDialog.js";
9
- import c from "./CommentPopover.js";
10
- import l from "./SlashMenu.js";
11
- import ee from "./BubbleToolbar.js";
12
- import te from "./BlockHandle.js";
13
- import { CodeBlockExtension as ne } from "./extensions/CodeBlockView.js";
14
- import re from "./extensions/FontSize.js";
15
- import { ResizableImage as ie } from "./extensions/ResizableImage.js";
16
- import { CommentMark as ae } from "./extensions/CommentMark.js";
4
+ import ee from "./Toolbar/Toolbar.js";
5
+ import te from "./AIRewrite.js";
6
+ import ne from "./ContextMenu.js";
7
+ import re from "./CommentPanel.js";
8
+ import ie from "./CommentDialog.js";
9
+ import r from "./CommentPopover.js";
10
+ import i from "./SlashMenu.js";
11
+ import a from "./BubbleToolbar.js";
12
+ import o from "./BlockHandle.js";
13
+ import { CodeBlockExtension as s } from "./extensions/CodeBlockView.js";
14
+ import c from "./extensions/FontSize.js";
15
+ import { ResizableImage as l } from "./extensions/ResizableImage.js";
16
+ import { CommentMark as u } from "./extensions/CommentMark.js";
17
17
  /* empty css */
18
- import { useCallback as u, useEffect as d, useRef as oe, useState as f } from "react";
19
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
20
- import { EditorContent as se, useEditor as ce } from "@tiptap/react";
21
- import le from "@tiptap/starter-kit";
22
- import ue from "@tiptap/extension-underline";
23
- import { TextStyle as de } from "@tiptap/extension-text-style";
24
- import fe from "@tiptap/extension-color";
25
- import pe from "@tiptap/extension-highlight";
26
- import me from "@tiptap/extension-text-align";
27
- import he from "@tiptap/extension-link";
28
- import { Table as ge } from "@tiptap/extension-table";
29
- import _e from "@tiptap/extension-table-row";
30
- import ve from "@tiptap/extension-table-cell";
31
- import h from "@tiptap/extension-table-header";
32
- import g from "@tiptap/extension-placeholder";
33
- import _ from "@tiptap/extension-task-list";
34
- import v from "@tiptap/extension-task-item";
35
- import y from "@tiptap/extension-subscript";
36
- import b from "@tiptap/extension-superscript";
37
- import x from "@tiptap/extension-typography";
38
- import S from "@tiptap/extension-font-family";
18
+ import { useCallback as d, useEffect as f, useRef as ae, useState as p } from "react";
19
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
20
+ import { EditorContent as oe, useEditor as se } from "@tiptap/react";
21
+ import ce from "@tiptap/starter-kit";
22
+ import le from "@tiptap/extension-underline";
23
+ import { TextStyle as ue } from "@tiptap/extension-text-style";
24
+ import de from "@tiptap/extension-color";
25
+ import fe from "@tiptap/extension-highlight";
26
+ import pe from "@tiptap/extension-text-align";
27
+ import me from "@tiptap/extension-link";
28
+ import { Table as he } from "@tiptap/extension-table";
29
+ import g from "@tiptap/extension-table-row";
30
+ import _ from "@tiptap/extension-table-cell";
31
+ import v from "@tiptap/extension-table-header";
32
+ import y from "@tiptap/extension-placeholder";
33
+ import b from "@tiptap/extension-task-list";
34
+ import x from "@tiptap/extension-task-item";
35
+ import S from "@tiptap/extension-subscript";
36
+ import C from "@tiptap/extension-superscript";
37
+ import w from "@tiptap/extension-typography";
38
+ import T from "@tiptap/extension-font-family";
39
39
  //#region src/components/pro/RichTextEditor/RichTextEditor.tsx
40
- function C() {
40
+ function E() {
41
41
  return `c_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
42
42
  }
43
- var w = ({ content: w, value: T, onChange: E, onChangeJSON: D, placeholder: O = "Start writing...", editable: k = !0, aiConfig: A, toolbarConfig: j, minHeight: M = "200px", maxHeight: N, className: P = "", autofocus: F = !1, labels: I, editorRef: L, notionMode: R = !1, showComments: ye = !1, commentThreads: be, onCommentThreadsChange: xe, currentUser: z }) => {
44
- let [Se, Ce] = f(!1), [we, B] = f(!1), [Te, Ee] = f(""), [De, Oe] = f({
43
+ var D = ({ content: D, value: O, onChange: k, onChangeJSON: A, placeholder: j = "Start writing...", editable: M = !0, aiConfig: N, onRequestAIConfig: P, toolbarConfig: F, minHeight: I = "200px", maxHeight: L, className: R = "", autofocus: ge = !1, labels: z, editorRef: B, showComments: _e = !1, commentThreads: ve, onCommentThreadsChange: ye, currentUser: V }) => {
44
+ let [be, xe] = p(!1), [Se, H] = p(!1), [Ce, we] = p(""), [Te, Ee] = p({
45
45
  from: 0,
46
46
  to: 0
47
- }), [V, H] = f(R), [U, W] = f(ye), [ke, Ae] = f([]), [je, G] = f(!1), [K, Me] = f({
47
+ }), [U, W] = p(_e), [De, Oe] = p([]), [ke, G] = p(!1), [K, Ae] = p({
48
48
  from: 0,
49
49
  to: 0
50
- }), q = oe(null), J = be ?? ke, Y = xe ?? Ae, X = ce({
50
+ }), q = ae(null), J = ve ?? De, Y = ye ?? Oe, X = se({
51
51
  extensions: [
52
- le.configure({
52
+ ce.configure({
53
53
  codeBlock: !1,
54
54
  heading: { levels: [
55
55
  1,
@@ -62,73 +62,73 @@ var w = ({ content: w, value: T, onChange: E, onChangeJSON: D, placeholder: O =
62
62
  link: !1,
63
63
  underline: !1
64
64
  }),
65
+ le,
65
66
  ue,
66
67
  de,
67
- fe,
68
- pe.configure({ multicolor: !0 }),
69
- me.configure({ types: ["heading", "paragraph"] }),
70
- he.configure({
68
+ fe.configure({ multicolor: !0 }),
69
+ pe.configure({ types: ["heading", "paragraph"] }),
70
+ me.configure({
71
71
  openOnClick: !1,
72
72
  autolink: !0,
73
73
  HTMLAttributes: { class: "rte-link" }
74
74
  }),
75
- ie.configure({
75
+ l.configure({
76
76
  inline: !1,
77
77
  allowBase64: !0
78
78
  }),
79
- ge.configure({ resizable: !0 }),
80
- _e,
81
- ve,
82
- h,
83
- g.configure({ placeholder: O }),
84
- ne,
79
+ he.configure({ resizable: !0 }),
80
+ g,
85
81
  _,
86
- v.configure({ nested: !0 }),
87
- y,
82
+ v,
83
+ y.configure({ placeholder: j }),
84
+ s,
88
85
  b,
89
- x,
86
+ x.configure({ nested: !0 }),
90
87
  S,
91
- re,
88
+ C,
89
+ w,
90
+ T,
91
+ c,
92
92
  n,
93
93
  t,
94
- ae
94
+ u
95
95
  ],
96
- content: T || w || "",
97
- editable: k,
98
- autofocus: F ? "end" : !1,
96
+ content: O || D || "",
97
+ editable: M,
98
+ autofocus: ge ? "end" : !1,
99
99
  onUpdate: ({ editor: e }) => {
100
- E?.(e.getHTML()), D?.(e.getJSON());
100
+ k?.(e.getHTML()), A?.(e.getJSON());
101
101
  }
102
102
  });
103
- d(() => {
104
- L && X && (L.current = X);
105
- }, [X, L]), d(() => {
106
- X && T !== void 0 && T !== X.getHTML() && X.commands.setContent(T, { emitUpdate: !1 });
107
- }, [X, T]), d(() => {
108
- X && X.setEditable(k);
109
- }, [X, k]);
110
- let Z = u(() => {
103
+ f(() => {
104
+ B && X && (B.current = X);
105
+ }, [X, B]), f(() => {
106
+ X && O !== void 0 && O !== X.getHTML() && X.commands.setContent(O, { emitUpdate: !1 });
107
+ }, [X, O]), f(() => {
108
+ X && X.setEditable(M);
109
+ }, [X, M]);
110
+ let Z = d(() => {
111
111
  if (!X) return;
112
112
  let { from: e, to: t } = X.state.selection, n = e === t ? "" : X.state.doc.textBetween(e, t, " ");
113
- Ee(n), Oe({
113
+ we(n), Ee({
114
114
  from: e,
115
115
  to: t
116
- }), B(!0);
117
- }, [X]), Q = u(() => {
116
+ }), H(!0);
117
+ }, [X]), Q = d(() => {
118
118
  if (!X) return;
119
119
  let { from: e, to: t } = X.state.selection;
120
- e !== t && (Me({
120
+ e !== t && (Ae({
121
121
  from: e,
122
122
  to: t
123
123
  }), G(!0));
124
- }, [X]), Ne = u((e) => {
124
+ }, [X]), $ = d((e) => {
125
125
  if (!X) return;
126
- let t = C(), n = {
126
+ let t = E(), n = {
127
127
  id: t,
128
128
  resolved: !1,
129
129
  comments: [{
130
- id: C(),
131
- author: z || "User",
130
+ id: E(),
131
+ author: V || "User",
132
132
  text: e,
133
133
  createdAt: Date.now()
134
134
  }],
@@ -140,135 +140,112 @@ var w = ({ content: w, value: T, onChange: E, onChangeJSON: D, placeholder: O =
140
140
  K,
141
141
  J,
142
142
  Y,
143
- z
144
- ]), Pe = u((e) => {
143
+ V
144
+ ]), je = d((e) => {
145
145
  q.current?.scrollToThread(e);
146
146
  }, []);
147
147
  if (!X) return null;
148
- let Fe = typeof M == "number" ? `${M}px` : M, Ie = N ? typeof N == "number" ? `${N}px` : N : void 0, Le = e("rte-container", Se && "rte-container--format-painter", V && "rte-container--notion", P), Re = J.filter((e) => !e.resolved).length, $ = /* @__PURE__ */ m("div", {
149
- className: "rte-mode-toggle",
150
- children: [
151
- /* @__PURE__ */ p("button", {
152
- type: "button",
153
- className: `rte-mode-toggle__btn ${V ? "" : "rte-mode-toggle__btn--active"}`,
154
- onClick: () => H(!1),
155
- title: "Classic mode",
156
- children: "Classic"
157
- }),
158
- /* @__PURE__ */ p("button", {
159
- type: "button",
160
- className: `rte-mode-toggle__btn ${V ? "rte-mode-toggle__btn--active" : ""}`,
161
- onClick: () => H(!0),
162
- title: "Notion-style mode",
163
- children: "Notion"
164
- }),
165
- /* @__PURE__ */ p("div", {
166
- className: "rte-toolbar__divider",
167
- style: {
168
- height: 20,
169
- margin: "0 4px"
170
- }
171
- }),
172
- /* @__PURE__ */ m("button", {
173
- type: "button",
174
- className: `rte-toolbar__btn rte-toolbar__comment-btn ${U ? "rte-toolbar__btn--active" : ""}`,
175
- onClick: () => W(!U),
176
- title: "Toggle comments",
177
- children: [/* @__PURE__ */ p("svg", {
178
- width: "16",
179
- height: "16",
180
- viewBox: "0 0 24 24",
181
- fill: "none",
182
- stroke: "currentColor",
183
- strokeWidth: "2",
184
- strokeLinecap: "round",
185
- strokeLinejoin: "round",
186
- children: /* @__PURE__ */ p("path", { d: "M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z" })
187
- }), Re > 0 && /* @__PURE__ */ p("span", { className: "rte-toolbar__comment-badge" })]
188
- })
189
- ]
190
- });
191
- return /* @__PURE__ */ m("div", {
192
- className: Le,
148
+ let Me = typeof I == "number" ? `${I}px` : I, Ne = L ? typeof L == "number" ? `${L}px` : L : void 0, Pe = e("rte-container", be && "rte-container--format-painter", R), Fe = J.filter((e) => !e.resolved).length, Ie = F?.buttons?.comments ?? !0 ? /* @__PURE__ */ m("div", {
149
+ className: "rte-toolbar__end",
150
+ children: /* @__PURE__ */ h("button", {
151
+ type: "button",
152
+ className: `rte-toolbar__btn rte-toolbar__comment-btn ${U ? "rte-toolbar__btn--active" : ""}`,
153
+ onClick: () => W(!U),
154
+ title: "Toggle comments",
155
+ children: [/* @__PURE__ */ m("svg", {
156
+ width: "16",
157
+ height: "16",
158
+ viewBox: "0 0 24 24",
159
+ fill: "none",
160
+ stroke: "currentColor",
161
+ strokeWidth: "2",
162
+ strokeLinecap: "round",
163
+ strokeLinejoin: "round",
164
+ children: /* @__PURE__ */ m("path", { d: "M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z" })
165
+ }), Fe > 0 && /* @__PURE__ */ m("span", { className: "rte-toolbar__comment-badge" })]
166
+ })
167
+ }) : null;
168
+ return /* @__PURE__ */ h("div", {
169
+ className: Pe,
193
170
  style: {
194
- minHeight: Fe,
195
- maxHeight: Ie
171
+ minHeight: Me,
172
+ maxHeight: Ne
196
173
  },
197
174
  children: [
198
- k && !V && /* @__PURE__ */ p(r, {
175
+ M && /* @__PURE__ */ m(ee, {
199
176
  editor: X,
200
- config: j,
201
- labels: I,
202
- hasAI: !!A,
177
+ config: F,
178
+ labels: z,
179
+ hasAI: !!N,
203
180
  onAIClick: Z,
204
- onFormatPainterChange: Ce,
205
- children: $
206
- }),
207
- k && V && /* @__PURE__ */ p("div", {
208
- className: "rte-notion-topbar",
209
- children: $
181
+ onRequestAIConfig: P,
182
+ onFormatPainterChange: xe,
183
+ children: Ie
210
184
  }),
211
- /* @__PURE__ */ m("div", {
185
+ /* @__PURE__ */ h("div", {
212
186
  style: {
213
187
  display: "flex",
214
188
  flex: 1,
215
189
  overflow: "hidden"
216
190
  },
217
- children: [/* @__PURE__ */ m("div", {
191
+ children: [/* @__PURE__ */ h("div", {
218
192
  className: "rte-editor-wrapper",
219
193
  style: { flex: 1 },
220
194
  children: [
221
- /* @__PURE__ */ p(se, {
195
+ /* @__PURE__ */ m(oe, {
222
196
  editor: X,
223
197
  className: "rte-editor-content"
224
198
  }),
225
- k && /* @__PURE__ */ p(a, {
199
+ M && /* @__PURE__ */ m(ne, {
226
200
  editor: X,
227
- labels: I,
228
- onAIClick: A ? Z : void 0
201
+ labels: z,
202
+ onAIClick: N ? Z : void 0
229
203
  }),
230
- k && /* @__PURE__ */ p(l, { editor: X }),
231
- k && V && /* @__PURE__ */ p(ee, {
204
+ M && /* @__PURE__ */ m(i, { editor: X }),
205
+ M && /* @__PURE__ */ m(a, {
232
206
  editor: X,
233
207
  onAddComment: Q
234
208
  }),
235
- k && V && /* @__PURE__ */ p(te, { editor: X }),
236
- /* @__PURE__ */ p(c, {
209
+ M && /* @__PURE__ */ m(o, {
210
+ editor: X,
211
+ persistent: !0
212
+ }),
213
+ /* @__PURE__ */ m(r, {
237
214
  editor: X,
238
215
  threads: J,
239
216
  onThreadsChange: Y,
240
217
  showPanel: U,
241
218
  onOpenPanel: () => W(!0),
242
- onScrollToThread: Pe,
243
- currentUser: z
219
+ onScrollToThread: je,
220
+ currentUser: V
244
221
  })
245
222
  ]
246
- }), U && /* @__PURE__ */ p(o, {
223
+ }), U && /* @__PURE__ */ m(re, {
247
224
  ref: q,
248
225
  editor: X,
249
226
  threads: J,
250
227
  onThreadsChange: Y,
251
228
  onRequestAddComment: Q,
252
- currentUser: z
229
+ currentUser: V
253
230
  })]
254
231
  }),
255
- A && we && /* @__PURE__ */ p(i, {
232
+ N && Se && /* @__PURE__ */ m(te, {
256
233
  editor: X,
257
- aiConfig: A,
258
- labels: I,
259
- initialSelection: Te,
260
- selectionRange: De,
261
- onClose: () => B(!1)
234
+ aiConfig: N,
235
+ labels: z,
236
+ initialSelection: Ce,
237
+ selectionRange: Te,
238
+ onClose: () => H(!1)
262
239
  }),
263
- /* @__PURE__ */ p(s, {
264
- open: je,
265
- onSubmit: Ne,
240
+ /* @__PURE__ */ m(ie, {
241
+ open: ke,
242
+ onSubmit: $,
266
243
  onClose: () => G(!1)
267
244
  })
268
245
  ]
269
246
  });
270
247
  };
271
248
  //#endregion
272
- export { w as default };
249
+ export { D as default };
273
250
 
274
251
  //# sourceMappingURL=RichTextEditor.js.map