dishui 0.0.65 → 0.0.66
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.
- package/dist/_virtual/_rolldown/runtime.js +10 -11
- package/dist/chart.js +12 -46
- package/dist/code-editor.js +16 -43
- package/dist/components/Badge/index.js +10 -15
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Button/index.js +62 -89
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Card/index.d.ts +76 -0
- package/dist/components/Card/index.js +178 -69
- package/dist/components/Card/index.js.map +1 -1
- package/dist/components/Chart/Chart.js +25 -25
- package/dist/components/Chart/Chart.js.map +1 -1
- package/dist/components/Checkbox/index.js +57 -65
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/ChoicePicker/index.d.ts +44 -0
- package/dist/components/ChoicePicker/index.js +81 -0
- package/dist/components/ChoicePicker/index.js.map +1 -0
- package/dist/components/Column/index.d.ts +28 -0
- package/dist/components/Column/index.js +30 -0
- package/dist/components/Column/index.js.map +1 -0
- package/dist/components/DateTimeInput/index.d.ts +44 -0
- package/dist/components/DateTimeInput/index.js +48 -0
- package/dist/components/DateTimeInput/index.js.map +1 -0
- package/dist/components/Demo/index.js +107 -107
- package/dist/components/Demo/index.js.map +1 -1
- package/dist/components/Divider/index.d.ts +20 -0
- package/dist/components/Divider/index.js +30 -0
- package/dist/components/Divider/index.js.map +1 -0
- package/dist/components/EmptyState/index.js +24 -24
- package/dist/components/EmptyState/index.js.map +1 -1
- package/dist/components/FileUploader/DropZone.js +134 -136
- package/dist/components/FileUploader/DropZone.js.map +1 -1
- package/dist/components/FileUploader/FileItem.js +159 -163
- package/dist/components/FileUploader/FileItem.js.map +1 -1
- package/dist/components/FileUploader/FileUploader.js +126 -127
- package/dist/components/FileUploader/FileUploader.js.map +1 -1
- package/dist/components/FileUploader/UploadQueue.js +62 -62
- package/dist/components/FileUploader/UploadQueue.js.map +1 -1
- package/dist/components/FloatWindow/index.d.ts +28 -0
- package/dist/components/GridLayout/index.d.ts +42 -0
- package/dist/components/Icon/index.d.ts +24 -0
- package/dist/components/Icon/index.js +26 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Image/index.d.ts +33 -0
- package/dist/components/Image/index.js +44 -0
- package/dist/components/Image/index.js.map +1 -0
- package/dist/components/Input/index.js +196 -197
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Label/index.js +62 -74
- package/dist/components/Label/index.js.map +1 -1
- package/dist/components/Layout/index.js +134 -139
- package/dist/components/Layout/index.js.map +1 -1
- package/dist/components/List/index.js +45 -58
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Markdown/Markdown.js +106 -107
- package/dist/components/Markdown/Markdown.js.map +1 -1
- package/dist/components/Markdown/codeThemes.js +24 -33
- package/dist/components/Markdown/codeThemes.js.map +1 -1
- package/dist/components/Markdown/markdownComponents.js +203 -208
- package/dist/components/Markdown/markdownComponents.js.map +1 -1
- package/dist/components/Markdown/parseCodeBlockMeta.js +22 -22
- package/dist/components/Markdown/parseCodeBlockMeta.js.map +1 -1
- package/dist/components/Markdown/useMarkdownSource.js +46 -46
- package/dist/components/Markdown/useMarkdownSource.js.map +1 -1
- package/dist/components/Markdown/useMarkmapRenderer.js +35 -36
- package/dist/components/Markdown/useMarkmapRenderer.js.map +1 -1
- package/dist/components/Markdown/useMermaidRenderer.js +41 -42
- package/dist/components/Markdown/useMermaidRenderer.js.map +1 -1
- package/dist/components/Modal/index.js +82 -82
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/MultipleChoice/index.d.ts +44 -0
- package/dist/components/MultipleChoice/index.js +52 -0
- package/dist/components/MultipleChoice/index.js.map +1 -0
- package/dist/components/Notification/index.d.ts +17 -0
- package/dist/components/Page/index.js +40 -71
- package/dist/components/Page/index.js.map +1 -1
- package/dist/components/PageHeader/index.js +28 -28
- package/dist/components/PageHeader/index.js.map +1 -1
- package/dist/components/ProtectedRoute/index.js +8 -9
- package/dist/components/ProtectedRoute/index.js.map +1 -1
- package/dist/components/Row/index.d.ts +28 -0
- package/dist/components/Row/index.js +30 -0
- package/dist/components/Row/index.js.map +1 -0
- package/dist/components/Select/index.js +251 -254
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SidebarToggleButton/index.js +56 -59
- package/dist/components/SidebarToggleButton/index.js.map +1 -1
- package/dist/components/Slider/index.d.ts +39 -0
- package/dist/components/Slider/index.js +52 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/StatCard/index.d.ts +29 -1
- package/dist/components/StatCard/index.js +189 -86
- package/dist/components/StatCard/index.js.map +1 -1
- package/dist/components/Switch/index.d.ts +34 -0
- package/dist/components/Switch/index.js +55 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Tab/index.d.ts +40 -0
- package/dist/components/Table/index.js +109 -121
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/index.js +28 -38
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Text/index.d.ts +43 -0
- package/dist/components/Text/index.js +55 -0
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +23 -0
- package/dist/components/Tooltip/index.js +34 -0
- package/dist/components/Tooltip/index.js.map +1 -0
- package/dist/components/Tree/Tree.js +205 -205
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/pro/ArticleContextMenu/index.js +86 -87
- package/dist/components/pro/ArticleContextMenu/index.js.map +1 -1
- package/dist/components/pro/ArticleControl/ArticleControl2.js +250 -250
- package/dist/components/pro/ArticleControl/ArticleControl2.js.map +1 -1
- package/dist/components/pro/ArticleControl/buildHeadingTree.js +31 -32
- package/dist/components/pro/ArticleControl/buildHeadingTree.js.map +1 -1
- package/dist/components/pro/ArticleControl/useArticleToc.js +100 -102
- package/dist/components/pro/ArticleControl/useArticleToc.js.map +1 -1
- package/dist/components/pro/Calendar/Calendar.d.ts +10 -0
- package/dist/components/pro/Calendar/hooks/useCalendarDrag.d.ts +47 -0
- package/dist/components/pro/Calendar/hooks/useCalendarState.d.ts +56 -0
- package/dist/components/pro/Calendar/index.d.ts +7 -0
- package/dist/components/pro/Calendar/types.d.ts +151 -0
- package/dist/components/pro/Calendar/utils.d.ts +94 -0
- package/dist/components/pro/Chat/Chat.d.ts +6 -0
- package/dist/components/pro/Chat/index.d.ts +2 -0
- package/dist/components/pro/Chat/types.d.ts +84 -0
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js +287 -327
- package/dist/components/pro/CodeEditor/editors/CodeEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js +167 -224
- package/dist/components/pro/CodeEditor/editors/MarkdownEditor.js.map +1 -1
- package/dist/components/pro/CodeEditor/editors/markdownExtensions.js +594 -613
- package/dist/components/pro/CodeEditor/editors/markdownExtensions.js.map +1 -1
- package/dist/components/pro/CodeEditor/extensions/contextMenu.js +54 -55
- package/dist/components/pro/CodeEditor/extensions/contextMenu.js.map +1 -1
- package/dist/components/pro/CodeEditor/extensions/index.js +152 -160
- package/dist/components/pro/CodeEditor/extensions/index.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/index.js +7 -15
- package/dist/components/pro/CodeEditor/langs/index.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/javascript.js +11 -48
- package/dist/components/pro/CodeEditor/langs/javascript.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/python.js +4 -40
- package/dist/components/pro/CodeEditor/langs/python.js.map +1 -1
- package/dist/components/pro/CodeEditor/langs/snippets.js +118 -147
- package/dist/components/pro/CodeEditor/langs/snippets.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/FootnotePanel.js +153 -153
- package/dist/components/pro/CodeEditor/panels/FootnotePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js +180 -190
- package/dist/components/pro/CodeEditor/panels/HistoryPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/OutlinePanel.js +130 -137
- package/dist/components/pro/CodeEditor/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js +228 -242
- package/dist/components/pro/CodeEditor/panels/TableOfContentsPanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/panels/VariablePanel.js +208 -248
- package/dist/components/pro/CodeEditor/panels/VariablePanel.js.map +1 -1
- package/dist/components/pro/CodeEditor/themes.js +513 -483
- package/dist/components/pro/CodeEditor/themes.js.map +1 -1
- package/dist/components/pro/CodeEditor/types.d.ts +1 -1
- package/dist/components/pro/CodeEditor/utils.js +171 -175
- package/dist/components/pro/CodeEditor/utils.js.map +1 -1
- package/dist/components/pro/DataTable/DataTable.js +305 -306
- package/dist/components/pro/DataTable/DataTable.js.map +1 -1
- package/dist/components/pro/DataTable/Filters.js +299 -314
- package/dist/components/pro/DataTable/Filters.js.map +1 -1
- package/dist/components/pro/DataTable/PivotPanel.js +203 -204
- package/dist/components/pro/DataTable/PivotPanel.js.map +1 -1
- package/dist/components/pro/DataTable/PivotView.js +142 -144
- package/dist/components/pro/DataTable/PivotView.js.map +1 -1
- package/dist/components/pro/DataTable/components/BulkActions.js +42 -42
- package/dist/components/pro/DataTable/components/BulkActions.js.map +1 -1
- package/dist/components/pro/DataTable/components/ColumnSelector.js +84 -84
- package/dist/components/pro/DataTable/components/ColumnSelector.js.map +1 -1
- package/dist/components/pro/DataTable/components/FilterBar.js +58 -58
- package/dist/components/pro/DataTable/components/FilterBar.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableBody.js +93 -94
- package/dist/components/pro/DataTable/components/TableBody.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableHeader.js +78 -78
- package/dist/components/pro/DataTable/components/TableHeader.js.map +1 -1
- package/dist/components/pro/DataTable/components/TablePagination.js +77 -77
- package/dist/components/pro/DataTable/components/TablePagination.js.map +1 -1
- package/dist/components/pro/DataTable/components/TableToolbar.js +40 -40
- package/dist/components/pro/DataTable/components/TableToolbar.js.map +1 -1
- package/dist/components/pro/DataTable/extension.js +5 -5
- package/dist/components/pro/DataTable/extension.js.map +1 -1
- package/dist/components/pro/DataTable/pivotEngine.js +84 -92
- package/dist/components/pro/DataTable/pivotEngine.js.map +1 -1
- package/dist/components/pro/DataTable/pivotExtension.js +93 -93
- package/dist/components/pro/DataTable/pivotExtension.js.map +1 -1
- package/dist/components/pro/DataTable/rowDetailExtension.js +30 -30
- package/dist/components/pro/DataTable/rowDetailExtension.js.map +1 -1
- package/dist/components/pro/DataTable/tanstack-table.js +45 -62
- package/dist/components/pro/DataTable/tanstack-table.js.map +1 -1
- package/dist/components/pro/DataTable/treeDataUtils.js +37 -48
- package/dist/components/pro/DataTable/treeDataUtils.js.map +1 -1
- package/dist/components/pro/DataTable/useColumnDragReorder.js +68 -68
- package/dist/components/pro/DataTable/useColumnDragReorder.js.map +1 -1
- package/dist/components/pro/DataTable/utils.js +156 -168
- package/dist/components/pro/DataTable/utils.js.map +1 -1
- package/dist/components/pro/FileExplorer/Breadcrumb.js +180 -180
- package/dist/components/pro/FileExplorer/Breadcrumb.js.map +1 -1
- package/dist/components/pro/FileExplorer/CreateDialog.js +78 -78
- package/dist/components/pro/FileExplorer/CreateDialog.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileExplorer.js +202 -205
- package/dist/components/pro/FileExplorer/FileExplorer.js.map +1 -1
- package/dist/components/pro/FileExplorer/FileIcon.js +189 -189
- package/dist/components/pro/FileExplorer/FileIcon.js.map +1 -1
- package/dist/components/pro/FileExplorer/GridView.js +100 -100
- package/dist/components/pro/FileExplorer/GridView.js.map +1 -1
- package/dist/components/pro/FileExplorer/ListView.js +209 -209
- package/dist/components/pro/FileExplorer/ListView.js.map +1 -1
- package/dist/components/pro/FileExplorer/Toolbar.js +199 -199
- package/dist/components/pro/FileExplorer/Toolbar.js.map +1 -1
- package/dist/components/pro/Flow/Flow.js +920 -948
- package/dist/components/pro/Flow/Flow.js.map +1 -1
- package/dist/components/pro/Flow/FlowCanvas.js +1626 -1662
- package/dist/components/pro/Flow/FlowCanvas.js.map +1 -1
- package/dist/components/pro/Flow/archify/build.js +85 -94
- package/dist/components/pro/Flow/archify/build.js.map +1 -1
- package/dist/components/pro/Flow/archify/convert.js +512 -519
- package/dist/components/pro/Flow/archify/convert.js.map +1 -1
- package/dist/components/pro/Flow/archify/palette.js +87 -104
- package/dist/components/pro/Flow/archify/palette.js.map +1 -1
- package/dist/components/pro/Flow/archify/presets.js +34 -37
- package/dist/components/pro/Flow/archify/presets.js.map +1 -1
- package/dist/components/pro/Flow/archify/spec.js +7 -7
- package/dist/components/pro/Flow/archify/spec.js.map +1 -1
- package/dist/components/pro/Flow/canvas/AlignmentGuides.js +25 -25
- package/dist/components/pro/Flow/canvas/AlignmentGuides.js.map +1 -1
- package/dist/components/pro/Flow/canvas/GridRenderer.js +54 -55
- package/dist/components/pro/Flow/canvas/GridRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js +54 -58
- package/dist/components/pro/Flow/canvas/MiniMapRenderer.js.map +1 -1
- package/dist/components/pro/Flow/canvas/PixiApp.js +105 -102
- package/dist/components/pro/Flow/canvas/PixiApp.js.map +1 -1
- package/dist/components/pro/Flow/canvas/SelectionOverlay.js +38 -38
- package/dist/components/pro/Flow/canvas/SelectionOverlay.js.map +1 -1
- package/dist/components/pro/Flow/canvas/ViewportContainer.js +117 -117
- package/dist/components/pro/Flow/canvas/ViewportContainer.js.map +1 -1
- package/dist/components/pro/Flow/constants.js +266 -278
- package/dist/components/pro/Flow/constants.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowAIContext.js +27 -28
- package/dist/components/pro/Flow/context/FlowAIContext.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowContext.js +60 -61
- package/dist/components/pro/Flow/context/FlowContext.js.map +1 -1
- package/dist/components/pro/Flow/context/FlowUIContext.js +115 -117
- package/dist/components/pro/Flow/context/FlowUIContext.js.map +1 -1
- package/dist/components/pro/Flow/edges/EdgeRenderer.js +135 -138
- package/dist/components/pro/Flow/edges/EdgeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/edges/edgeMarkers.js +11 -14
- package/dist/components/pro/Flow/edges/edgeMarkers.js.map +1 -1
- package/dist/components/pro/Flow/edges/edgePaths.js +351 -367
- package/dist/components/pro/Flow/edges/edgePaths.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useAlignmentGuides.js +49 -52
- package/dist/components/pro/Flow/hooks/useAlignmentGuides.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useClipboard.js +154 -154
- package/dist/components/pro/Flow/hooks/useClipboard.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useCompactMode.js +17 -17
- package/dist/components/pro/Flow/hooks/useCompactMode.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDeleteSelection.js +40 -40
- package/dist/components/pro/Flow/hooks/useDeleteSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js +51 -51
- package/dist/components/pro/Flow/hooks/useDraggablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useEdgeMutations.js +157 -157
- package/dist/components/pro/Flow/hooks/useEdgeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js +190 -201
- package/dist/components/pro/Flow/hooks/useFlowImportExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js +32 -38
- package/dist/components/pro/Flow/hooks/useKeyboardShortcuts.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLayoutActions.js +172 -180
- package/dist/components/pro/Flow/hooks/useLayoutActions.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useLineMutations.js +57 -57
- package/dist/components/pro/Flow/hooks/useLineMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useMindMap.js +229 -238
- package/dist/components/pro/Flow/hooks/useMindMap.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useNodeMutations.js +102 -102
- package/dist/components/pro/Flow/hooks/useNodeMutations.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePdfExport.js +55 -56
- package/dist/components/pro/Flow/hooks/usePdfExport.js.map +1 -1
- package/dist/components/pro/Flow/hooks/usePixiApp.js +55 -57
- package/dist/components/pro/Flow/hooks/usePixiApp.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useResizablePanel.js +31 -31
- package/dist/components/pro/Flow/hooks/useResizablePanel.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useSelection.js +69 -69
- package/dist/components/pro/Flow/hooks/useSelection.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useUndoRedo.js +27 -27
- package/dist/components/pro/Flow/hooks/useUndoRedo.js.map +1 -1
- package/dist/components/pro/Flow/hooks/useViewport.js +28 -28
- package/dist/components/pro/Flow/hooks/useViewport.js.map +1 -1
- package/dist/components/pro/Flow/lines/FreehandTool.js +63 -63
- package/dist/components/pro/Flow/lines/FreehandTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/GeometricLineTool.js +80 -80
- package/dist/components/pro/Flow/lines/GeometricLineTool.js.map +1 -1
- package/dist/components/pro/Flow/lines/LineRenderer.js +88 -88
- package/dist/components/pro/Flow/lines/LineRenderer.js.map +1 -1
- package/dist/components/pro/Flow/lines/lineSmoothing.js +32 -34
- package/dist/components/pro/Flow/lines/lineSmoothing.js.map +1 -1
- package/dist/components/pro/Flow/nodes/DataNodeView.js +236 -242
- package/dist/components/pro/Flow/nodes/DataNodeView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaContent.js +236 -246
- package/dist/components/pro/Flow/nodes/MediaContent.js.map +1 -1
- package/dist/components/pro/Flow/nodes/MediaOverlay.js +63 -63
- package/dist/components/pro/Flow/nodes/MediaOverlay.js.map +1 -1
- package/dist/components/pro/Flow/nodes/Model3DView.js +111 -113
- package/dist/components/pro/Flow/nodes/Model3DView.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeHandles.js +74 -80
- package/dist/components/pro/Flow/nodes/NodeHandles.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeRenderer.js +303 -314
- package/dist/components/pro/Flow/nodes/NodeRenderer.js.map +1 -1
- package/dist/components/pro/Flow/nodes/NodeText.js +25 -29
- package/dist/components/pro/Flow/nodes/NodeText.js.map +1 -1
- package/dist/components/pro/Flow/nodes/aiClient.js +124 -137
- package/dist/components/pro/Flow/nodes/aiClient.js.map +1 -1
- package/dist/components/pro/Flow/nodes/animAnchors.js +42 -49
- package/dist/components/pro/Flow/nodes/animAnchors.js.map +1 -1
- package/dist/components/pro/Flow/nodes/dataUtils.js +246 -267
- package/dist/components/pro/Flow/nodes/dataUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/nodeUtils.js +23 -28
- package/dist/components/pro/Flow/nodes/nodeUtils.js.map +1 -1
- package/dist/components/pro/Flow/nodes/shapes.js +556 -589
- package/dist/components/pro/Flow/nodes/shapes.js.map +1 -1
- package/dist/components/pro/Flow/nodes/svgIconTexture.js +37 -39
- package/dist/components/pro/Flow/nodes/svgIconTexture.js.map +1 -1
- package/dist/components/pro/Flow/nodes/svgIcons.js +684 -689
- package/dist/components/pro/Flow/nodes/svgIcons.js.map +1 -1
- package/dist/components/pro/Flow/panels/AIPanel.js +464 -491
- package/dist/components/pro/Flow/panels/AIPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/Breadcrumb.js +41 -41
- package/dist/components/pro/Flow/panels/Breadcrumb.js.map +1 -1
- package/dist/components/pro/Flow/panels/ContextMenu.js +37 -37
- package/dist/components/pro/Flow/panels/ContextMenu.js.map +1 -1
- package/dist/components/pro/Flow/panels/DataInspectorSection.js +428 -432
- package/dist/components/pro/Flow/panels/DataInspectorSection.js.map +1 -1
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js +61 -62
- package/dist/components/pro/Flow/panels/ExpandableTextarea.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js +114 -114
- package/dist/components/pro/Flow/panels/FlowPanelGroup.js.map +1 -1
- package/dist/components/pro/Flow/panels/FlowToolbar.js +347 -391
- package/dist/components/pro/Flow/panels/FlowToolbar.js.map +1 -1
- package/dist/components/pro/Flow/panels/InspectorPanel.js +1792 -1798
- package/dist/components/pro/Flow/panels/InspectorPanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/OutlinePanel.js +242 -248
- package/dist/components/pro/Flow/panels/OutlinePanel.js.map +1 -1
- package/dist/components/pro/Flow/panels/PresentationMode.js +137 -140
- package/dist/components/pro/Flow/panels/PresentationMode.js.map +1 -1
- package/dist/components/pro/Flow/panels/ProjectTitle.js +46 -46
- package/dist/components/pro/Flow/panels/ProjectTitle.js.map +1 -1
- package/dist/components/pro/Flow/panels/ShapePalette.js +557 -572
- package/dist/components/pro/Flow/panels/ShapePalette.js.map +1 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.d.ts +0 -1
- package/dist/components/pro/Flow/panels/toolbarIcons.js +508 -557
- package/dist/components/pro/Flow/panels/toolbarIcons.js.map +1 -1
- package/dist/components/pro/Flow/types.js +26 -26
- package/dist/components/pro/Flow/types.js.map +1 -1
- package/dist/components/pro/Flow/utils/dashedLine.js +113 -117
- package/dist/components/pro/Flow/utils/dashedLine.js.map +1 -1
- package/dist/components/pro/Flow/utils/gradient.js +55 -55
- package/dist/components/pro/Flow/utils/gradient.js.map +1 -1
- package/dist/components/pro/Flow/utils/pdfExport.js +50 -89
- package/dist/components/pro/Flow/utils/pdfExport.js.map +1 -1
- package/dist/components/pro/Flow/utils/themeColor.js +185 -195
- package/dist/components/pro/Flow/utils/themeColor.js.map +1 -1
- package/dist/components/pro/Gantt/Gantt.d.ts +7 -0
- package/dist/components/pro/Gantt/hooks/useGanttDrag.d.ts +31 -0
- package/dist/components/pro/Gantt/hooks/useGanttState.d.ts +58 -0
- package/dist/components/pro/Gantt/index.d.ts +6 -0
- package/dist/components/pro/Gantt/types.d.ts +478 -0
- package/dist/components/pro/Gantt/utils.d.ts +124 -0
- package/dist/components/pro/Resizable/Resizable.d.ts +30 -0
- package/dist/components/pro/Resizable/index.d.ts +2 -0
- package/dist/components/pro/RichTextEditor/AIRewrite.js +323 -334
- package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BlockHandle.js +314 -316
- package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js +97 -97
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentDialog.js +88 -88
- package/dist/components/pro/RichTextEditor/CommentDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPanel.js +240 -240
- package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPopover.js +234 -234
- package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
- package/dist/components/pro/RichTextEditor/ContextMenu.js +251 -252
- package/dist/components/pro/RichTextEditor/ContextMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/RichTextEditor.js +267 -271
- package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/components/pro/RichTextEditor/SlashMenu.js +214 -214
- package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js +44 -75
- package/dist/components/pro/RichTextEditor/Toolbar/ColorPicker.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js +261 -261
- package/dist/components/pro/RichTextEditor/Toolbar/FloatingDialogMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js +172 -526
- package/dist/components/pro/RichTextEditor/Toolbar/MarkdownTemplates.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js +112 -114
- package/dist/components/pro/RichTextEditor/Toolbar/SelectDropdown.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js +194 -194
- package/dist/components/pro/RichTextEditor/Toolbar/TableOpsMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +970 -973
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js +11 -12
- package/dist/components/pro/RichTextEditor/Toolbar/ToolbarButton.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js +310 -344
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js +38 -39
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js +620 -625
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js +25 -25
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js +167 -176
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
- package/dist/components/pro/RichTextEditor/types.js +75 -75
- package/dist/components/pro/RichTextEditor/types.js.map +1 -1
- package/dist/contexts/AppContext.d.ts +1 -1
- package/dist/contexts/AppContext.js +216 -221
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/data-table.js +15 -41
- package/dist/data-table.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/flow.js +27 -83
- package/dist/hooks/useClickOutside.js +18 -18
- package/dist/hooks/useClickOutside.js.map +1 -1
- package/dist/hooks/useContainerElement.js +9 -9
- package/dist/hooks/useContainerElement.js.map +1 -1
- package/dist/hooks/useControllableState.js +33 -35
- package/dist/hooks/useControllableState.js.map +1 -1
- package/dist/hooks/useCopyToClipboard.js +16 -16
- package/dist/hooks/useCopyToClipboard.js.map +1 -1
- package/dist/hooks/useDebounce.js +14 -14
- package/dist/hooks/useDebounce.js.map +1 -1
- package/dist/hooks/useDraggable.js +50 -50
- package/dist/hooks/useDraggable.js.map +1 -1
- package/dist/hooks/useTableColumns.js +39 -41
- package/dist/hooks/useTableColumns.js.map +1 -1
- package/dist/hooks/useTableData.js +67 -68
- package/dist/hooks/useTableData.js.map +1 -1
- package/dist/index-nostyled.d.ts +8 -0
- package/dist/index.d.ts +27 -1
- package/dist/index.js +105 -241
- package/dist/layouts/MainLayout.js +56 -56
- package/dist/layouts/MainLayout.js.map +1 -1
- package/dist/layouts/Navbar.js +214 -214
- package/dist/layouts/Navbar.js.map +1 -1
- package/dist/layouts/Sidebar.js +184 -186
- package/dist/layouts/Sidebar.js.map +1 -1
- package/dist/layouts/headbar/Headbar.js +25 -25
- package/dist/layouts/headbar/Headbar.js.map +1 -1
- package/dist/layouts/headbar/HeadbarLangSwitcher.js +39 -39
- package/dist/layouts/headbar/HeadbarLangSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarSearch.js +120 -120
- package/dist/layouts/headbar/HeadbarSearch.js.map +1 -1
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js +27 -27
- package/dist/layouts/headbar/HeadbarThemeSwitcher.js.map +1 -1
- package/dist/layouts/headbar/HeadbarTitle.js +26 -26
- package/dist/layouts/headbar/HeadbarTitle.js.map +1 -1
- package/dist/lite.js +9 -24
- package/dist/markdown.js +4 -9
- package/dist/pages/components/Calendar/index.d.ts +3 -0
- package/dist/pages/components/Calendar/index.en.d.ts +3 -0
- package/dist/pages/components/Calendar/index.zh.d.ts +3 -0
- package/dist/pages/components/Chat/index.d.ts +3 -0
- package/dist/pages/components/Chat/index.en.d.ts +3 -0
- package/dist/pages/components/Chat/index.zh.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.en.d.ts +3 -0
- package/dist/pages/components/FloatWindow/index.zh.d.ts +3 -0
- package/dist/pages/components/Gantt/index.d.ts +3 -0
- package/dist/pages/components/Gantt/index.en.d.ts +3 -0
- package/dist/pages/components/Gantt/index.zh.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.en.d.ts +3 -0
- package/dist/pages/components/GridLayout/index.zh.d.ts +3 -0
- package/dist/pages/components/Notification/index.d.ts +3 -0
- package/dist/pages/components/Notification/index.en.d.ts +3 -0
- package/dist/pages/components/Notification/index.zh.d.ts +3 -0
- package/dist/pages/components/Resizable/index.d.ts +3 -0
- package/dist/pages/components/Resizable/index.en.d.ts +3 -0
- package/dist/pages/components/Resizable/index.zh.d.ts +3 -0
- package/dist/pages/components/Tab/index.d.ts +3 -0
- package/dist/pages/components/Tab/index.en.d.ts +3 -0
- package/dist/pages/components/Tab/index.zh.d.ts +3 -0
- package/dist/styles/themeStyles.js +87 -86
- package/dist/styles/themeStyles.js.map +1 -1
- package/dist/utils/cn.d.ts +13 -0
- package/dist/utils/cn.js +16 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/i18n.js +690 -602
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/menu.js +94 -94
- package/dist/utils/menu.js.map +1 -1
- package/dist/utils/rehype-code-meta.js +14 -14
- package/dist/utils/rehype-code-meta.js.map +1 -1
- package/dist/utils/remark-code-meta.js +9 -9
- package/dist/utils/remark-code-meta.js.map +1 -1
- package/dist/utils/routerBuilder.js +59 -60
- package/dist/utils/routerBuilder.js.map +1 -1
- package/dist/utils/selection.js +28 -29
- package/dist/utils/selection.js.map +1 -1
- package/dist/utils/themes.js +275 -255
- package/dist/utils/themes.js.map +1 -1
- package/package.json +19 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockHandle.js","names":[],"sources":["../../../../src/components/pro/RichTextEditor/BlockHandle.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport type { Editor } from '@tiptap/react';\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 [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) {\n setVisible(false);\n }\n }, 200);\n }, [cancelHide, showMenu, isDragging]);\n\n const getBlocks = useCallback((): BlockInfo[] => {\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) {\n const rect = domNode.getBoundingClientRect();\n blocks.push({\n pos: offset,\n size: node.nodeSize,\n domTop: rect.top - wrapperRect.top + scrollTop,\n domBottom: rect.bottom - wrapperRect.top + 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.scrollTop;\n\n const blocks = getBlocks();\n for (let i = 0; i < blocks.length; i++) {\n const mid = (blocks[i].domTop + blocks[i].domBottom) / 2;\n if (y < mid) return i;\n }\n return blocks.length - 1;\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.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 }, [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) return;\n\n const idx = findBlockByClientY(e.clientY);\n if (idx < 0) return;\n\n const blocks = getBlocks();\n if (idx >= blocks.length) return;\n\n setHandleTop(blocks[idx].domTop);\n setCurrentBlockIndex(idx);\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, 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)) {\n setShowMenu(false);\n }\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, [showMenu]);\n\n const addBlockBelow = useCallback(() => {\n const blocks = getBlocks();\n if (currentBlockIndex < 0 || currentBlockIndex >= blocks.length) return;\n const block = blocks[currentBlockIndex];\n const insertPos = block.pos + block.size;\n try {\n editor.chain().focus().insertContentAt(insertPos, { type: 'paragraph' }).run();\n editor.commands.focus(insertPos + 1);\n } catch { /* noop */ }\n setShowMenu(false);\n }, [editor, currentBlockIndex, getBlocks]);\n\n const handleDragStart = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const dragIdx = currentBlockIndex;\n const blocks = getBlocks();\n if (dragIdx < 0 || dragIdx >= blocks.length) return;\n\n setIsDragging(true);\n\n const handleDragMove = (ev: MouseEvent) => {\n const slot = findDropSlot(ev.clientY);\n if (slot) {\n setDropIndicator({ top: slot.indicatorTop });\n }\n };\n\n const handleDragEnd = (ev: MouseEvent) => {\n document.removeEventListener('mousemove', handleDragMove);\n document.removeEventListener('mouseup', handleDragEnd);\n setIsDragging(false);\n setDropIndicator(null);\n\n const freshBlocks = getBlocks();\n if (dragIdx >= freshBlocks.length) return;\n\n const slot = findDropSlot(ev.clientY);\n if (!slot) return;\n\n let targetSlot = slot.slotIndex;\n\n // No-op: dropping at the same position or one below (no actual move)\n if (targetSlot === dragIdx || targetSlot === dragIdx + 1) return;\n\n const sourceBlock = freshBlocks[dragIdx];\n const sourceNode = editor.state.doc.nodeAt(sourceBlock.pos);\n if (!sourceNode) return;\n\n // Compute the insert position (before which block, or at end)\n let insertBefore: number;\n if (targetSlot < freshBlocks.length) {\n insertBefore = freshBlocks[targetSlot].pos;\n } else {\n const last = freshBlocks[freshBlocks.length - 1];\n insertBefore = last.pos + last.size;\n }\n\n const sourceFrom = sourceBlock.pos;\n const sourceTo = sourceBlock.pos + sourceBlock.size;\n const content = editor.state.doc.slice(sourceFrom, sourceTo).content;\n\n const { tr } = editor.state;\n\n if (targetSlot <= dragIdx) {\n // Moving up: delete source first (it's after target), then insert\n tr.delete(sourceFrom, sourceTo);\n const mapped = tr.mapping.map(insertBefore);\n tr.insert(mapped, content);\n } else {\n // Moving down: insert first (target is after source), then delete\n tr.insert(insertBefore, content);\n tr.delete(\n tr.mapping.map(sourceFrom),\n tr.mapping.map(sourceTo)\n );\n }\n\n editor.view.dispatch(tr);\n };\n\n document.addEventListener('mousemove', handleDragMove);\n document.addEventListener('mouseup', handleDragEnd);\n }, [editor, currentBlockIndex, getBlocks, findDropSlot]);\n\n const menuItems = [\n { label: 'Text', action: () => { addBlockBelow(); } },\n { label: 'Heading 1', action: () => { addBlockBelow(); editor.chain().focus().toggleHeading({ level: 1 }).run(); } },\n { label: 'Heading 2', action: () => { addBlockBelow(); editor.chain().focus().toggleHeading({ level: 2 }).run(); } },\n { label: 'Heading 3', action: () => { addBlockBelow(); editor.chain().focus().toggleHeading({ level: 3 }).run(); } },\n { label: 'Bullet List', action: () => { addBlockBelow(); editor.chain().focus().toggleBulletList().run(); } },\n { label: 'Numbered List', action: () => { addBlockBelow(); editor.chain().focus().toggleOrderedList().run(); } },\n { label: 'Task List', action: () => { addBlockBelow(); editor.chain().focus().toggleTaskList().run(); } },\n { label: 'Blockquote', action: () => { addBlockBelow(); editor.chain().focus().toggleBlockquote().run(); } },\n { label: 'Code Block', action: () => { addBlockBelow(); editor.chain().focus().toggleNode('codeBlock', 'paragraph').run(); } },\n { label: 'Divider', action: () => { addBlockBelow(); editor.chain().focus().setHorizontalRule().run(); } },\n { label: 'Table 3×3', action: () => { addBlockBelow(); editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(); } },\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 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(); setShowMenu(!showMenu); }}\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\"\n onMouseDown={handleDragStart}\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 style={{ top: handleTop + 28 }}\n onMouseDown={(e) => e.stopPropagation()}\n >\n {menuItems.map((item) => (\n <button\n key={item.label}\n type=\"button\"\n className=\"rte-block-handle__menu-item\"\n onMouseDown={(e) => e.stopPropagation()}\n onClick={(e) => { e.stopPropagation(); item.action(); setShowMenu(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":";;AAcA,IAAM,IAAA,CAA2C,EAAE,QAAA,EAAA,MAAa;AAC9D,QAAM,CAAC,GAAS,CAAA,IAAc,EAAS,EAAK,GACtC,CA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AAQ,IAAG;AAAA,cAAI,IAAG;AAAA,cAAK,GAAE;AAAA,YAAO,CAAA;AAAA,YAAC,gBAAA,EAAC,UAAD;AAAA,cAAQ,IAAG;AAAA,cAAK,IAAG;AAAA,cAAK,GAAE;AAAA,YAAO,CAAA;AAAA,YAClE,gBAAA,EAAC,UAAD;AAAA,cAAQ,IAAG;AAAA,cAAI,IAAG;AAAA,cAAK,GAAE;AAAA,YAAO,CAAA;AAAA,YAAC,gBAAA,EAAC,UAAD;AAAA,cAAQ,IAAG;AAAA,cAAK,IAAG;AAAA,cAAK,GAAE;AAAA,YAAO,CAAA;AAAA,UAC/D;AAAA;MACC,CAAA,CACL;AAAA;IAEJ,KACC,gBAAA,EAAC,OAAD;AAAA,MACE,KAAK;AAAA,MACL,WAAU;AAAA,MACV,OAAO,EAAE,KAAK,IAAY,GAAG;AAAA,MAC7B,aAAA,CAAc,MAAM,EAAE,gBAAgB;AAAA,MAErC,UAAA,EAAU,IAAA,CAAK,MACd,gBAAA,EAAC,UAAD;AAAA,QAEE,MAAK;AAAA,QACL,WAAU;AAAA,QACV,aAAA,CAAc,MAAM,EAAE,gBAAgB;AAAA,QACtC,SAAA,CAAU,MAAM;AAAE,UAAA,EAAE,gBAAgB,GAAG,EAAK,OAAO,GAAG,EAAY,EAAK;AAAA,QAAG;AAAA,QAEzE,UAAA,EAAK;AAAA,MACA,GAPD,EAAK,KAOJ,CACT;AAAA,IACE,CAAA;AAAA,IAGN,KAAc,KACb,gBAAA,EAAC,OAAD;AAAA,MAAK,WAAU;AAAA,MAAmC,OAAO,EAAE,KAAK,EAAc,IAAI;AAAA,IAAI,CAAA;AAAA,EAExF,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"BlockHandle.js","names":[],"sources":["../../../../src/components/pro/RichTextEditor/BlockHandle.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport type { Editor } from '@tiptap/react';\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 [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) {\n setVisible(false);\n }\n }, 200);\n }, [cancelHide, showMenu, isDragging]);\n\n const getBlocks = useCallback((): BlockInfo[] => {\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) {\n const rect = domNode.getBoundingClientRect();\n blocks.push({\n pos: offset,\n size: node.nodeSize,\n domTop: rect.top - wrapperRect.top + scrollTop,\n domBottom: rect.bottom - wrapperRect.top + 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.scrollTop;\n\n const blocks = getBlocks();\n for (let i = 0; i < blocks.length; i++) {\n const mid = (blocks[i].domTop + blocks[i].domBottom) / 2;\n if (y < mid) return i;\n }\n return blocks.length - 1;\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.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 }, [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) return;\n\n const idx = findBlockByClientY(e.clientY);\n if (idx < 0) return;\n\n const blocks = getBlocks();\n if (idx >= blocks.length) return;\n\n setHandleTop(blocks[idx].domTop);\n setCurrentBlockIndex(idx);\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, 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)) {\n setShowMenu(false);\n }\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, [showMenu]);\n\n const addBlockBelow = useCallback(() => {\n const blocks = getBlocks();\n if (currentBlockIndex < 0 || currentBlockIndex >= blocks.length) return;\n const block = blocks[currentBlockIndex];\n const insertPos = block.pos + block.size;\n try {\n editor.chain().focus().insertContentAt(insertPos, { type: 'paragraph' }).run();\n editor.commands.focus(insertPos + 1);\n } catch { /* noop */ }\n setShowMenu(false);\n }, [editor, currentBlockIndex, getBlocks]);\n\n const handleDragStart = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n const dragIdx = currentBlockIndex;\n const blocks = getBlocks();\n if (dragIdx < 0 || dragIdx >= blocks.length) return;\n\n setIsDragging(true);\n\n const handleDragMove = (ev: MouseEvent) => {\n const slot = findDropSlot(ev.clientY);\n if (slot) {\n setDropIndicator({ top: slot.indicatorTop });\n }\n };\n\n const handleDragEnd = (ev: MouseEvent) => {\n document.removeEventListener('mousemove', handleDragMove);\n document.removeEventListener('mouseup', handleDragEnd);\n setIsDragging(false);\n setDropIndicator(null);\n\n const freshBlocks = getBlocks();\n if (dragIdx >= freshBlocks.length) return;\n\n const slot = findDropSlot(ev.clientY);\n if (!slot) return;\n\n let targetSlot = slot.slotIndex;\n\n // No-op: dropping at the same position or one below (no actual move)\n if (targetSlot === dragIdx || targetSlot === dragIdx + 1) return;\n\n const sourceBlock = freshBlocks[dragIdx];\n const sourceNode = editor.state.doc.nodeAt(sourceBlock.pos);\n if (!sourceNode) return;\n\n // Compute the insert position (before which block, or at end)\n let insertBefore: number;\n if (targetSlot < freshBlocks.length) {\n insertBefore = freshBlocks[targetSlot].pos;\n } else {\n const last = freshBlocks[freshBlocks.length - 1];\n insertBefore = last.pos + last.size;\n }\n\n const sourceFrom = sourceBlock.pos;\n const sourceTo = sourceBlock.pos + sourceBlock.size;\n const content = editor.state.doc.slice(sourceFrom, sourceTo).content;\n\n const { tr } = editor.state;\n\n if (targetSlot <= dragIdx) {\n // Moving up: delete source first (it's after target), then insert\n tr.delete(sourceFrom, sourceTo);\n const mapped = tr.mapping.map(insertBefore);\n tr.insert(mapped, content);\n } else {\n // Moving down: insert first (target is after source), then delete\n tr.insert(insertBefore, content);\n tr.delete(\n tr.mapping.map(sourceFrom),\n tr.mapping.map(sourceTo)\n );\n }\n\n editor.view.dispatch(tr);\n };\n\n document.addEventListener('mousemove', handleDragMove);\n document.addEventListener('mouseup', handleDragEnd);\n }, [editor, currentBlockIndex, getBlocks, findDropSlot]);\n\n const menuItems = [\n { label: 'Text', action: () => { addBlockBelow(); } },\n { label: 'Heading 1', action: () => { addBlockBelow(); editor.chain().focus().toggleHeading({ level: 1 }).run(); } },\n { label: 'Heading 2', action: () => { addBlockBelow(); editor.chain().focus().toggleHeading({ level: 2 }).run(); } },\n { label: 'Heading 3', action: () => { addBlockBelow(); editor.chain().focus().toggleHeading({ level: 3 }).run(); } },\n { label: 'Bullet List', action: () => { addBlockBelow(); editor.chain().focus().toggleBulletList().run(); } },\n { label: 'Numbered List', action: () => { addBlockBelow(); editor.chain().focus().toggleOrderedList().run(); } },\n { label: 'Task List', action: () => { addBlockBelow(); editor.chain().focus().toggleTaskList().run(); } },\n { label: 'Blockquote', action: () => { addBlockBelow(); editor.chain().focus().toggleBlockquote().run(); } },\n { label: 'Code Block', action: () => { addBlockBelow(); editor.chain().focus().toggleNode('codeBlock', 'paragraph').run(); } },\n { label: 'Divider', action: () => { addBlockBelow(); editor.chain().focus().setHorizontalRule().run(); } },\n { label: 'Table 3×3', action: () => { addBlockBelow(); editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(); } },\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 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(); setShowMenu(!showMenu); }}\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\"\n onMouseDown={handleDragStart}\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 style={{ top: handleTop + 28 }}\n onMouseDown={(e) => e.stopPropagation()}\n >\n {menuItems.map((item) => (\n <button\n key={item.label}\n type=\"button\"\n className=\"rte-block-handle__menu-item\"\n onMouseDown={(e) => e.stopPropagation()}\n onClick={(e) => { e.stopPropagation(); item.action(); setShowMenu(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":";;;AAc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|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
};
|
|
96
|
-
export {
|
|
97
|
-
z as default
|
|
1
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/pro/RichTextEditor/BubbleToolbar.tsx
|
|
4
|
+
var o = ({ editor: o, onAddComment: s }) => {
|
|
5
|
+
let [c, l] = n(!1), [u, d] = n({
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0
|
|
8
|
+
}), f = t(null);
|
|
9
|
+
if (e(() => {
|
|
10
|
+
let e = () => {
|
|
11
|
+
let { from: e, to: t } = o.state.selection;
|
|
12
|
+
if (e === t || !o.isFocused) {
|
|
13
|
+
l(!1);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
let n = o.view.coordsAtPos(e), r = o.view.coordsAtPos(t), i = o.view.dom.closest(".rte-editor-wrapper");
|
|
17
|
+
if (!i) return;
|
|
18
|
+
let a = i.getBoundingClientRect(), s = (n.left + r.left) / 2 - a.left, c = Math.min(n.top, r.top) - a.top - 44;
|
|
19
|
+
d({
|
|
20
|
+
x: s,
|
|
21
|
+
y: c
|
|
22
|
+
}), l(!0);
|
|
23
|
+
};
|
|
24
|
+
return o.on("selectionUpdate", e), o.on("blur", () => l(!1)), () => {
|
|
25
|
+
o.off("selectionUpdate", e);
|
|
26
|
+
};
|
|
27
|
+
}, [o]), !c) return null;
|
|
28
|
+
let p = (e, t, n, r) => /* @__PURE__ */ i("button", {
|
|
29
|
+
type: "button",
|
|
30
|
+
className: `rte-bubble__btn ${n ? "rte-bubble__btn--active" : ""}`,
|
|
31
|
+
onClick: e,
|
|
32
|
+
title: t,
|
|
33
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
34
|
+
children: r
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ a("div", {
|
|
37
|
+
ref: f,
|
|
38
|
+
className: "rte-bubble",
|
|
39
|
+
style: {
|
|
40
|
+
left: u.x,
|
|
41
|
+
top: u.y
|
|
42
|
+
},
|
|
43
|
+
children: [
|
|
44
|
+
p(() => o.chain().focus().toggleBold().run(), "Bold", o.isActive("bold"), /* @__PURE__ */ i("strong", {
|
|
45
|
+
style: { fontSize: 13 },
|
|
46
|
+
children: "B"
|
|
47
|
+
})),
|
|
48
|
+
p(() => o.chain().focus().toggleItalic().run(), "Italic", o.isActive("italic"), /* @__PURE__ */ i("em", {
|
|
49
|
+
style: { fontSize: 13 },
|
|
50
|
+
children: "I"
|
|
51
|
+
})),
|
|
52
|
+
p(() => o.chain().focus().toggleUnderline().run(), "Underline", o.isActive("underline"), /* @__PURE__ */ i("span", {
|
|
53
|
+
style: {
|
|
54
|
+
fontSize: 13,
|
|
55
|
+
textDecoration: "underline"
|
|
56
|
+
},
|
|
57
|
+
children: "U"
|
|
58
|
+
})),
|
|
59
|
+
p(() => o.chain().focus().toggleStrike().run(), "Strike", o.isActive("strike"), /* @__PURE__ */ i("span", {
|
|
60
|
+
style: {
|
|
61
|
+
fontSize: 13,
|
|
62
|
+
textDecoration: "line-through"
|
|
63
|
+
},
|
|
64
|
+
children: "S"
|
|
65
|
+
})),
|
|
66
|
+
p(() => o.chain().focus().toggleCode().run(), "Code", o.isActive("code"), /* @__PURE__ */ i("span", {
|
|
67
|
+
style: {
|
|
68
|
+
fontSize: 11,
|
|
69
|
+
fontFamily: "monospace"
|
|
70
|
+
},
|
|
71
|
+
children: "</>"
|
|
72
|
+
})),
|
|
73
|
+
p(() => {
|
|
74
|
+
let e = window.prompt("URL:");
|
|
75
|
+
e && o.chain().focus().setLink({ href: e }).run();
|
|
76
|
+
}, "Link", o.isActive("link"), /* @__PURE__ */ a("svg", {
|
|
77
|
+
width: "14",
|
|
78
|
+
height: "14",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
fill: "none",
|
|
81
|
+
stroke: "currentColor",
|
|
82
|
+
strokeWidth: "2",
|
|
83
|
+
children: [/* @__PURE__ */ i("path", { d: "M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ i("path", { d: "M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71" })]
|
|
84
|
+
})),
|
|
85
|
+
s && /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("div", { className: "rte-bubble__divider" }), p(s, "Comment", !1, /* @__PURE__ */ i("svg", {
|
|
86
|
+
width: "14",
|
|
87
|
+
height: "14",
|
|
88
|
+
viewBox: "0 0 24 24",
|
|
89
|
+
fill: "none",
|
|
90
|
+
stroke: "currentColor",
|
|
91
|
+
strokeWidth: "2",
|
|
92
|
+
children: /* @__PURE__ */ i("path", { d: "M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z" })
|
|
93
|
+
}))] })
|
|
94
|
+
]
|
|
95
|
+
});
|
|
98
96
|
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { o as default };
|
|
99
99
|
|
|
100
100
|
//# sourceMappingURL=BubbleToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BubbleToolbar.js","names":[],"sources":["../../../../src/components/pro/RichTextEditor/BubbleToolbar.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\nimport type { Editor } from '@tiptap/react';\n\ninterface BubbleToolbarProps {\n editor: Editor;\n onAddComment?: () => void;\n}\n\nconst BubbleToolbar: React.FC<BubbleToolbarProps> = ({ editor, onAddComment }) => {\n const [visible, setVisible] = useState(false);\n const [pos, setPos] = useState({ x: 0, y: 0 });\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const update = () => {\n const { from, to } = editor.state.selection;\n if (from === to || !editor.isFocused) {\n setVisible(false);\n return;\n }\n const coords = editor.view.coordsAtPos(from);\n const endCoords = editor.view.coordsAtPos(to);\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper');\n if (!wrapperEl) return;\n const rect = wrapperEl.getBoundingClientRect();\n\n const centerX = (coords.left + endCoords.left) / 2 - rect.left;\n const topY = Math.min(coords.top, endCoords.top) - rect.top - 44;\n\n setPos({ x: centerX, y: topY });\n setVisible(true);\n };\n\n editor.on('selectionUpdate', update);\n editor.on('blur', () => setVisible(false));\n return () => {\n editor.off('selectionUpdate', update);\n };\n }, [editor]);\n\n if (!visible) return null;\n\n const btn = (onClick: () => void, title: string, isActive: boolean, children: React.ReactNode) => (\n <button\n type=\"button\"\n className={`rte-bubble__btn ${isActive ? 'rte-bubble__btn--active' : ''}`}\n onClick={onClick}\n title={title}\n onMouseDown={(e) => e.preventDefault()}\n >\n {children}\n </button>\n );\n\n return (\n <div ref={ref} className=\"rte-bubble\" style={{ left: pos.x, top: pos.y }}>\n {btn(() => editor.chain().focus().toggleBold().run(), 'Bold', editor.isActive('bold'),\n <strong style={{ fontSize: 13 }}>B</strong>)}\n {btn(() => editor.chain().focus().toggleItalic().run(), 'Italic', editor.isActive('italic'),\n <em style={{ fontSize: 13 }}>I</em>)}\n {btn(() => editor.chain().focus().toggleUnderline().run(), 'Underline', editor.isActive('underline'),\n <span style={{ fontSize: 13, textDecoration: 'underline' }}>U</span>)}\n {btn(() => editor.chain().focus().toggleStrike().run(), 'Strike', editor.isActive('strike'),\n <span style={{ fontSize: 13, textDecoration: 'line-through' }}>S</span>)}\n {btn(() => editor.chain().focus().toggleCode().run(), 'Code', editor.isActive('code'),\n <span style={{ fontSize: 11, fontFamily: 'monospace' }}></></span>)}\n {btn(() => {\n const url = window.prompt('URL:');\n if (url) editor.chain().focus().setLink({ href: url }).run();\n }, 'Link', editor.isActive('link'),\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71\" /><path d=\"M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71\" /></svg>)}\n {onAddComment && (\n <>\n <div className=\"rte-bubble__divider\" />\n {btn(onAddComment, 'Comment', false,\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z\" /></svg>)}\n </>\n )}\n </div>\n );\n};\n\nexport default BubbleToolbar;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BubbleToolbar.js","names":[],"sources":["../../../../src/components/pro/RichTextEditor/BubbleToolbar.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\nimport type { Editor } from '@tiptap/react';\n\ninterface BubbleToolbarProps {\n editor: Editor;\n onAddComment?: () => void;\n}\n\nconst BubbleToolbar: React.FC<BubbleToolbarProps> = ({ editor, onAddComment }) => {\n const [visible, setVisible] = useState(false);\n const [pos, setPos] = useState({ x: 0, y: 0 });\n const ref = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const update = () => {\n const { from, to } = editor.state.selection;\n if (from === to || !editor.isFocused) {\n setVisible(false);\n return;\n }\n const coords = editor.view.coordsAtPos(from);\n const endCoords = editor.view.coordsAtPos(to);\n const wrapperEl = editor.view.dom.closest('.rte-editor-wrapper');\n if (!wrapperEl) return;\n const rect = wrapperEl.getBoundingClientRect();\n\n const centerX = (coords.left + endCoords.left) / 2 - rect.left;\n const topY = Math.min(coords.top, endCoords.top) - rect.top - 44;\n\n setPos({ x: centerX, y: topY });\n setVisible(true);\n };\n\n editor.on('selectionUpdate', update);\n editor.on('blur', () => setVisible(false));\n return () => {\n editor.off('selectionUpdate', update);\n };\n }, [editor]);\n\n if (!visible) return null;\n\n const btn = (onClick: () => void, title: string, isActive: boolean, children: React.ReactNode) => (\n <button\n type=\"button\"\n className={`rte-bubble__btn ${isActive ? 'rte-bubble__btn--active' : ''}`}\n onClick={onClick}\n title={title}\n onMouseDown={(e) => e.preventDefault()}\n >\n {children}\n </button>\n );\n\n return (\n <div ref={ref} className=\"rte-bubble\" style={{ left: pos.x, top: pos.y }}>\n {btn(() => editor.chain().focus().toggleBold().run(), 'Bold', editor.isActive('bold'),\n <strong style={{ fontSize: 13 }}>B</strong>)}\n {btn(() => editor.chain().focus().toggleItalic().run(), 'Italic', editor.isActive('italic'),\n <em style={{ fontSize: 13 }}>I</em>)}\n {btn(() => editor.chain().focus().toggleUnderline().run(), 'Underline', editor.isActive('underline'),\n <span style={{ fontSize: 13, textDecoration: 'underline' }}>U</span>)}\n {btn(() => editor.chain().focus().toggleStrike().run(), 'Strike', editor.isActive('strike'),\n <span style={{ fontSize: 13, textDecoration: 'line-through' }}>S</span>)}\n {btn(() => editor.chain().focus().toggleCode().run(), 'Code', editor.isActive('code'),\n <span style={{ fontSize: 11, fontFamily: 'monospace' }}></></span>)}\n {btn(() => {\n const url = window.prompt('URL:');\n if (url) editor.chain().focus().setLink({ href: url }).run();\n }, 'Link', editor.isActive('link'),\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71\" /><path d=\"M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71\" /></svg>)}\n {onAddComment && (\n <>\n <div className=\"rte-bubble__divider\" />\n {btn(onAddComment, 'Comment', false,\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><path d=\"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z\" /></svg>)}\n </>\n )}\n </div>\n );\n};\n\nexport default BubbleToolbar;\n"],"mappings":";;;AAQA,IAAM,KAA+C,EAAE,WAAQ,sBAAmB;CAChF,IAAM,CAAC,GAAS,KAAc,EAAS,EAAK,GACtC,CAAC,GAAK,KAAU,EAAS;EAAE,GAAG;EAAG,GAAG;CAAE,CAAC,GACvC,IAAM,EAAuB,IAAI;CA6BvC,IA3BA,QAAgB;EACd,IAAM,UAAe;GACnB,IAAM,EAAE,SAAM,UAAO,EAAO,MAAM;GAClC,IAAI,MAAS,KAAM,CAAC,EAAO,WAAW;IACpC,EAAW,EAAK;IAChB;GACF;GACA,IAAM,IAAS,EAAO,KAAK,YAAY,CAAI,GACrC,IAAY,EAAO,KAAK,YAAY,CAAE,GACtC,IAAY,EAAO,KAAK,IAAI,QAAQ,qBAAqB;GAC/D,IAAI,CAAC,GAAW;GAChB,IAAM,IAAO,EAAU,sBAAsB,GAEvC,KAAW,E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-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
};
|
|
87
|
-
export {
|
|
88
|
-
y as default
|
|
1
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/pro/RichTextEditor/CommentDialog.tsx
|
|
4
|
+
var a = ({ open: a, onSubmit: o, onClose: s }) => {
|
|
5
|
+
let [c, l] = n(""), u = t(null);
|
|
6
|
+
if (e(() => {
|
|
7
|
+
a && (l(""), setTimeout(() => u.current?.focus(), 50));
|
|
8
|
+
}, [a]), e(() => {
|
|
9
|
+
if (!a) return;
|
|
10
|
+
let e = (e) => {
|
|
11
|
+
e.key === "Escape" && s();
|
|
12
|
+
};
|
|
13
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
14
|
+
}, [a, s]), !a) return null;
|
|
15
|
+
let d = () => {
|
|
16
|
+
c.trim() && (o(c.trim()), l(""));
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ r("div", {
|
|
19
|
+
className: "rte-dialog-overlay",
|
|
20
|
+
onClick: s,
|
|
21
|
+
children: /* @__PURE__ */ i("div", {
|
|
22
|
+
className: "rte-dialog",
|
|
23
|
+
onClick: (e) => e.stopPropagation(),
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ i("div", {
|
|
26
|
+
className: "rte-dialog__header",
|
|
27
|
+
children: [/* @__PURE__ */ r("span", {
|
|
28
|
+
className: "rte-dialog__title",
|
|
29
|
+
children: "Add Comment"
|
|
30
|
+
}), /* @__PURE__ */ r("button", {
|
|
31
|
+
type: "button",
|
|
32
|
+
className: "rte-dialog__close",
|
|
33
|
+
onClick: s,
|
|
34
|
+
children: /* @__PURE__ */ i("svg", {
|
|
35
|
+
width: "16",
|
|
36
|
+
height: "16",
|
|
37
|
+
viewBox: "0 0 24 24",
|
|
38
|
+
fill: "none",
|
|
39
|
+
stroke: "currentColor",
|
|
40
|
+
strokeWidth: "2",
|
|
41
|
+
children: [/* @__PURE__ */ r("line", {
|
|
42
|
+
x1: "18",
|
|
43
|
+
y1: "6",
|
|
44
|
+
x2: "6",
|
|
45
|
+
y2: "18"
|
|
46
|
+
}), /* @__PURE__ */ r("line", {
|
|
47
|
+
x1: "6",
|
|
48
|
+
y1: "6",
|
|
49
|
+
x2: "18",
|
|
50
|
+
y2: "18"
|
|
51
|
+
})]
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ r("div", {
|
|
56
|
+
className: "rte-dialog__body",
|
|
57
|
+
children: /* @__PURE__ */ r("textarea", {
|
|
58
|
+
ref: u,
|
|
59
|
+
className: "rte-dialog__textarea",
|
|
60
|
+
value: c,
|
|
61
|
+
onChange: (e) => l(e.target.value),
|
|
62
|
+
onKeyDown: (e) => {
|
|
63
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), d());
|
|
64
|
+
},
|
|
65
|
+
placeholder: "Write your comment...",
|
|
66
|
+
rows: 3
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ i("div", {
|
|
70
|
+
className: "rte-dialog__footer",
|
|
71
|
+
children: [/* @__PURE__ */ r("button", {
|
|
72
|
+
type: "button",
|
|
73
|
+
className: "rte-dialog__btn rte-dialog__btn--cancel",
|
|
74
|
+
onClick: s,
|
|
75
|
+
children: "Cancel"
|
|
76
|
+
}), /* @__PURE__ */ r("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
className: "rte-dialog__btn rte-dialog__btn--submit",
|
|
79
|
+
onClick: d,
|
|
80
|
+
disabled: !c.trim(),
|
|
81
|
+
children: "Add Comment"
|
|
82
|
+
})]
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
});
|
|
89
87
|
};
|
|
88
|
+
//#endregion
|
|
89
|
+
export { a as default };
|
|
90
90
|
|
|
91
91
|
//# sourceMappingURL=CommentDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentDialog.js","names":[],"sources":["../../../../src/components/pro/RichTextEditor/CommentDialog.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\n\ninterface CommentDialogProps {\n open: boolean;\n onSubmit: (text: string) => void;\n onClose: () => void;\n}\n\nconst CommentDialog: React.FC<CommentDialogProps> = ({ open, onSubmit, onClose }) => {\n const [text, setText] = useState('');\n const inputRef = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n if (open) {\n setText('');\n setTimeout(() => inputRef.current?.focus(), 50);\n }\n }, [open]);\n\n useEffect(() => {\n if (!open) return;\n const handleKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onClose();\n };\n document.addEventListener('keydown', handleKey);\n return () => document.removeEventListener('keydown', handleKey);\n }, [open, onClose]);\n\n if (!open) return null;\n\n const handleSubmit = () => {\n if (text.trim()) {\n onSubmit(text.trim());\n setText('');\n }\n };\n\n return (\n <div className=\"rte-dialog-overlay\" onClick={onClose}>\n <div className=\"rte-dialog\" onClick={(e) => e.stopPropagation()}>\n <div className=\"rte-dialog__header\">\n <span className=\"rte-dialog__title\">Add Comment</span>\n <button type=\"button\" className=\"rte-dialog__close\" onClick={onClose}>\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" /><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" /></svg>\n </button>\n </div>\n <div className=\"rte-dialog__body\">\n <textarea\n ref={inputRef}\n className=\"rte-dialog__textarea\"\n value={text}\n onChange={(e) => setText(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleSubmit(); }\n }}\n placeholder=\"Write your comment...\"\n rows={3}\n />\n </div>\n <div className=\"rte-dialog__footer\">\n <button type=\"button\" className=\"rte-dialog__btn rte-dialog__btn--cancel\" onClick={onClose}>Cancel</button>\n <button type=\"button\" className=\"rte-dialog__btn rte-dialog__btn--submit\" onClick={handleSubmit} disabled={!text.trim()}>Add Comment</button>\n </div>\n </div>\n </div>\n );\n};\n\nexport default CommentDialog;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CommentDialog.js","names":[],"sources":["../../../../src/components/pro/RichTextEditor/CommentDialog.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect } from 'react';\n\ninterface CommentDialogProps {\n open: boolean;\n onSubmit: (text: string) => void;\n onClose: () => void;\n}\n\nconst CommentDialog: React.FC<CommentDialogProps> = ({ open, onSubmit, onClose }) => {\n const [text, setText] = useState('');\n const inputRef = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n if (open) {\n setText('');\n setTimeout(() => inputRef.current?.focus(), 50);\n }\n }, [open]);\n\n useEffect(() => {\n if (!open) return;\n const handleKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onClose();\n };\n document.addEventListener('keydown', handleKey);\n return () => document.removeEventListener('keydown', handleKey);\n }, [open, onClose]);\n\n if (!open) return null;\n\n const handleSubmit = () => {\n if (text.trim()) {\n onSubmit(text.trim());\n setText('');\n }\n };\n\n return (\n <div className=\"rte-dialog-overlay\" onClick={onClose}>\n <div className=\"rte-dialog\" onClick={(e) => e.stopPropagation()}>\n <div className=\"rte-dialog__header\">\n <span className=\"rte-dialog__title\">Add Comment</span>\n <button type=\"button\" className=\"rte-dialog__close\" onClick={onClose}>\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" /><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" /></svg>\n </button>\n </div>\n <div className=\"rte-dialog__body\">\n <textarea\n ref={inputRef}\n className=\"rte-dialog__textarea\"\n value={text}\n onChange={(e) => setText(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleSubmit(); }\n }}\n placeholder=\"Write your comment...\"\n rows={3}\n />\n </div>\n <div className=\"rte-dialog__footer\">\n <button type=\"button\" className=\"rte-dialog__btn rte-dialog__btn--cancel\" onClick={onClose}>Cancel</button>\n <button type=\"button\" className=\"rte-dialog__btn rte-dialog__btn--submit\" onClick={handleSubmit} disabled={!text.trim()}>Add Comment</button>\n </div>\n </div>\n </div>\n );\n};\n\nexport default CommentDialog;\n"],"mappings":";;;AAQA,IAAM,KAA+C,EA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