dishui 0.0.72 → 0.0.73
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/components/Button/index.d.ts +4 -4
- package/dist/components/Button/index.js +18 -17
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Card/Metric.d.ts +17 -0
- package/dist/components/Card/Metric2.js +50 -0
- package/dist/components/Card/Metric2.js.map +1 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/Card/index.js +118 -117
- package/dist/components/Card/index.js.map +1 -1
- package/dist/components/Group/index.d.ts +2 -0
- package/dist/components/GroupButton/index.d.ts +16 -0
- package/dist/components/GroupButton/index.js +41 -0
- package/dist/components/GroupButton/index.js.map +1 -0
- package/dist/components/GroupedTable/index.d.ts +38 -0
- package/dist/components/GroupedTable/index.js +92 -0
- package/dist/components/GroupedTable/index.js.map +1 -0
- package/dist/components/Layout/index.d.ts +4 -2
- package/dist/components/Layout/index.js +1 -1
- package/dist/components/Layout/index.js.map +1 -1
- package/dist/components/NavigationList/index.d.ts +17 -0
- package/dist/components/NavigationList/index.js +48 -0
- package/dist/components/NavigationList/index.js.map +1 -0
- package/dist/components/Section/index.d.ts +28 -0
- package/dist/components/Section/index.js +58 -0
- package/dist/components/Section/index.js.map +1 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/index.js +83 -82
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SidebarToggleButton/index.d.ts +16 -1
- package/dist/components/SidebarToggleButton/index.js +90 -30
- package/dist/components/SidebarToggleButton/index.js.map +1 -1
- package/dist/components/Skeleton/index.d.ts +7 -0
- package/dist/components/Skeleton/index.js +21 -0
- package/dist/components/Skeleton/index.js.map +1 -0
- package/dist/components/Tree/Tree.js +5 -2
- package/dist/components/Tree/Tree.js.map +1 -1
- package/dist/components/pro/RichTextEditor/AIRewrite.js +114 -72
- package/dist/components/pro/RichTextEditor/AIRewrite.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BlockHandle.js +315 -196
- package/dist/components/pro/RichTextEditor/BlockHandle.js.map +1 -1
- package/dist/components/pro/RichTextEditor/BubbleToolbar.d.ts +1 -1
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js +69 -33
- package/dist/components/pro/RichTextEditor/BubbleToolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPanel.d.ts +2 -1
- package/dist/components/pro/RichTextEditor/CommentPanel.js +100 -81
- package/dist/components/pro/RichTextEditor/CommentPanel.js.map +1 -1
- package/dist/components/pro/RichTextEditor/CommentPopover.d.ts +2 -1
- package/dist/components/pro/RichTextEditor/CommentPopover.js +92 -68
- package/dist/components/pro/RichTextEditor/CommentPopover.js.map +1 -1
- package/dist/components/pro/RichTextEditor/RichTextEditor.js +24 -22
- package/dist/components/pro/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/components/pro/RichTextEditor/SearchReplace.d.ts +7 -0
- package/dist/components/pro/RichTextEditor/SlashMenu.js +136 -73
- package/dist/components/pro/RichTextEditor/SlashMenu.js.map +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.d.ts +1 -1
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js +346 -313
- package/dist/components/pro/RichTextEditor/Toolbar/Toolbar.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js +114 -146
- package/dist/components/pro/RichTextEditor/extensions/CodeBlockView.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js +2 -2
- package/dist/components/pro/RichTextEditor/extensions/CommentMark.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js +178 -163
- package/dist/components/pro/RichTextEditor/extensions/FloatingDialog.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js +8 -5
- package/dist/components/pro/RichTextEditor/extensions/FontSize.js.map +1 -1
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.d.ts +6 -0
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js +85 -74
- package/dist/components/pro/RichTextEditor/extensions/MarkdownBlock.js.map +1 -1
- package/dist/components/pro/RichTextEditor/searchUtils.d.ts +23 -0
- package/dist/contexts/AppContext.js +47 -45
- package/dist/contexts/AppContext.js.map +1 -1
- package/dist/dishui.css +1 -1
- package/dist/index-nostyled.d.ts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +119 -114
- package/dist/layouts/MainLayout.js +9 -10
- package/dist/layouts/MainLayout.js.map +1 -1
- package/dist/layouts/Sidebar.d.ts +9 -0
- package/dist/layouts/Sidebar.js +99 -80
- package/dist/layouts/Sidebar.js.map +1 -1
- package/dist/layouts/headbar/Headbar.d.ts +1 -1
- package/dist/layouts/headbar/Headbar.js +2 -2
- package/dist/layouts/headbar/Headbar.js.map +1 -1
- package/dist/lite.d.ts +19 -1
- package/dist/lite.js +17 -8
- package/dist/styles/themeStyles.js +6 -6
- package/dist/styles/themeStyles.js.map +1 -1
- package/dist/utils/i18n.d.ts +3 -0
- package/dist/utils/i18n.js +78 -0
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/menu.js +23 -6
- package/dist/utils/menu.js.map +1 -1
- package/package.json +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingDialog.js","names":[],"sources":["../../../../../src/components/pro/RichTextEditor/extensions/FloatingDialog.tsx"],"sourcesContent":["import React, { useState, useRef, useCallback, useEffect } from 'react';\nimport { cn } from '../../../../utils/cn';\nimport { Node, mergeAttributes } from '@tiptap/react';\nimport { NodeViewWrapper, NodeViewContent, ReactNodeViewRenderer } from '@tiptap/react';\nimport type { NodeViewProps } from '@tiptap/react';\n\ntype DialogLayout = 'block' | 'wrap-left' | 'wrap-right' | 'float';\n\ninterface DialogAttrs {\n x: number;\n y: number;\n width: number;\n height: number;\n borderColor: string;\n bgColor: string;\n title: string;\n layout: DialogLayout;\n zIndex: number;\n}\n\nconst DIALOG_COLORS = [\n { label: 'Blue', border: '#3b82f6', bg: '#eff6ff' },\n { label: 'Green', border: '#22c55e', bg: '#f0fdf4' },\n { label: 'Orange', border: '#f97316', bg: '#fff7ed' },\n { label: 'Red', border: '#ef4444', bg: '#fef2f2' },\n { label: 'Purple', border: '#8b5cf6', bg: '#faf5ff' },\n { label: 'Gray', border: '#6b7280', bg: '#f9fafb' },\n];\n\nconst LAYOUT_OPTIONS: { key: DialogLayout; label: string; icon: React.ReactNode }[] = [\n {\n key: 'block', label: 'Block',\n icon: <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" /><line x1=\"3\" y1=\"3\" x2=\"21\" y2=\"3\" /><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\" /></svg>,\n },\n {\n key: 'wrap-left', label: 'Wrap Left',\n icon: <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><rect x=\"2\" y=\"4\" width=\"10\" height=\"8\" rx=\"1\" /><line x1=\"15\" y1=\"5\" x2=\"22\" y2=\"5\" /><line x1=\"15\" y1=\"8\" x2=\"22\" y2=\"8\" /><line x1=\"15\" y1=\"11\" x2=\"22\" y2=\"11\" /><line x1=\"2\" y1=\"15\" x2=\"22\" y2=\"15\" /><line x1=\"2\" y1=\"18\" x2=\"22\" y2=\"18\" /></svg>,\n },\n {\n key: 'wrap-right', label: 'Wrap Right',\n icon: <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><rect x=\"12\" y=\"4\" width=\"10\" height=\"8\" rx=\"1\" /><line x1=\"2\" y1=\"5\" x2=\"9\" y2=\"5\" /><line x1=\"2\" y1=\"8\" x2=\"9\" y2=\"8\" /><line x1=\"2\" y1=\"11\" x2=\"9\" y2=\"11\" /><line x1=\"2\" y1=\"15\" x2=\"22\" y2=\"15\" /><line x1=\"2\" y1=\"18\" x2=\"22\" y2=\"18\" /></svg>,\n },\n {\n key: 'float', label: 'Float',\n icon: <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" /><path d=\"M2 2h4M18 2h4M2 22h4M18 22h4\" strokeDasharray=\"2 2\" /><line x1=\"2\" y1=\"12\" x2=\"6\" y2=\"12\" strokeDasharray=\"2 2\" /><line x1=\"18\" y1=\"12\" x2=\"22\" y2=\"12\" strokeDasharray=\"2 2\" /></svg>,\n },\n];\n\n/** Scan the document and return all zIndex values of float-layout floatingDialog nodes */\nfunction collectFloatZIndices(editor: NodeViewProps['editor']): number[] {\n const indices: number[] = [];\n editor.state.doc.descendants((node) => {\n if (node.type.name === 'floatingDialog' && node.attrs.layout === 'float') {\n indices.push(node.attrs.zIndex ?? 10);\n }\n });\n return indices;\n}\n\nconst FloatingDialogView: React.FC<NodeViewProps> = ({\n node,\n editor,\n updateAttributes,\n deleteNode,\n selected,\n}) => {\n const attrs = node.attrs as DialogAttrs;\n const layout = attrs.layout || 'block';\n const isFloat = layout === 'float';\n const zIndex = attrs.zIndex ?? 10;\n\n const [editingTitle, setEditingTitle] = useState(false);\n const [localTitle, setLocalTitle] = useState(attrs.title);\n const [showColorPicker, setShowColorPicker] = useState(false);\n const [showLayoutPicker, setShowLayoutPicker] = useState(false);\n const dragStart = useRef({ mx: 0, my: 0, x: 0, y: 0 });\n const resizeStart = useRef({ mx: 0, my: 0, w: 0, h: 0 });\n const colorRef = useRef<HTMLDivElement>(null);\n const layoutRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setLocalTitle(attrs.title);\n }, [attrs.title]);\n\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (colorRef.current && !colorRef.current.contains(e.target as globalThis.Node)) {\n setShowColorPicker(false);\n }\n if (layoutRef.current && !layoutRef.current.contains(e.target as globalThis.Node)) {\n setShowLayoutPicker(false);\n }\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, []);\n\n const onDragStart = useCallback((e: React.MouseEvent) => {\n if (!isFloat) return;\n e.preventDefault();\n e.stopPropagation();\n dragStart.current = { mx: e.clientX, my: e.clientY, x: attrs.x, y: attrs.y };\n\n const onMove = (ev: MouseEvent) => {\n const dx = ev.clientX - dragStart.current.mx;\n const dy = ev.clientY - dragStart.current.my;\n updateAttributes({\n x: dragStart.current.x + dx,\n y: dragStart.current.y + dy,\n });\n };\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n };\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n }, [isFloat, attrs.x, attrs.y, updateAttributes]);\n\n const onResizeStart = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n resizeStart.current = { mx: e.clientX, my: e.clientY, w: attrs.width, h: attrs.height };\n\n const onMove = (ev: MouseEvent) => {\n const dw = ev.clientX - resizeStart.current.mx;\n const dh = ev.clientY - resizeStart.current.my;\n updateAttributes({\n width: Math.max(160, resizeStart.current.w + dw),\n height: Math.max(80, resizeStart.current.h + dh),\n });\n };\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n };\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n }, [attrs.width, attrs.height, updateAttributes]);\n\n const saveTitle = useCallback(() => {\n updateAttributes({ title: localTitle });\n setEditingTitle(false);\n }, [localTitle, updateAttributes]);\n\n const bringForward = useCallback(() => {\n const all = collectFloatZIndices(editor);\n const maxZ = Math.max(...all);\n if (zIndex < maxZ) {\n updateAttributes({ zIndex: maxZ + 1 });\n }\n }, [editor, zIndex, updateAttributes]);\n\n const sendBackward = useCallback(() => {\n const all = collectFloatZIndices(editor);\n const minZ = Math.min(...all);\n if (zIndex > minZ) {\n updateAttributes({ zIndex: minZ - 1 });\n } else if (zIndex > 1) {\n updateAttributes({ zIndex: zIndex - 1 });\n }\n }, [editor, zIndex, updateAttributes]);\n\n const wrapperClass = cn(\n 'rte-float-dialog',\n `rte-float-dialog--${layout}`,\n selected && 'rte-float-dialog--selected',\n );\n\n const wrapperStyle: React.CSSProperties = isFloat\n ? { position: 'absolute', left: attrs.x, top: attrs.y, zIndex }\n : {};\n\n const boxStyle: React.CSSProperties = {\n width: layout === 'block' ? '100%' : attrs.width,\n minHeight: attrs.height,\n borderColor: attrs.borderColor,\n backgroundColor: attrs.bgColor,\n };\n\n const layoutIcon = LAYOUT_OPTIONS.find((l) => l.key === layout)?.icon;\n\n return (\n <NodeViewWrapper className={wrapperClass} style={wrapperStyle}>\n <div className=\"rte-float-dialog__box\" style={boxStyle}>\n {/* Title bar */}\n <div\n className=\"rte-float-dialog__titlebar\"\n style={{ borderBottomColor: attrs.borderColor }}\n onMouseDown={onDragStart}\n contentEditable={false}\n >\n {isFloat && (\n <span className=\"rte-float-dialog__drag-icon\">\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"9\" cy=\"5\" r=\"1.5\" /><circle cx=\"15\" cy=\"5\" 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=\"19\" r=\"1.5\" /><circle cx=\"15\" cy=\"19\" r=\"1.5\" />\n </svg>\n </span>\n )}\n\n {editingTitle ? (\n <input\n className=\"rte-float-dialog__title-input\"\n value={localTitle}\n onChange={(e) => setLocalTitle(e.target.value)}\n placeholder=\"Title...\"\n onMouseDown={(e) => e.stopPropagation()}\n onBlur={saveTitle}\n onKeyDown={(e) => { if (e.key === 'Enter' || e.key === 'Escape') saveTitle(); }}\n autoFocus\n />\n ) : (\n <span className=\"rte-float-dialog__title\" onDoubleClick={() => setEditingTitle(true)}>\n {attrs.title || 'Dialog'}\n </span>\n )}\n\n <div className=\"rte-float-dialog__actions\">\n {/* Z-order controls — only for float layout */}\n {isFloat && (\n <div className=\"rte-float-dialog__zorder\">\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn\"\n onClick={(e) => { e.stopPropagation(); bringForward(); }}\n title=\"Bring to Front\"\n onMouseDown={(e) => e.stopPropagation()}\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <rect x=\"8\" y=\"2\" width=\"13\" height=\"13\" rx=\"2\" />\n <rect x=\"3\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" opacity=\"0.4\" />\n </svg>\n </button>\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn\"\n onClick={(e) => { e.stopPropagation(); sendBackward(); }}\n title=\"Send to Back\"\n onMouseDown={(e) => e.stopPropagation()}\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <rect x=\"3\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" />\n <rect x=\"8\" y=\"2\" width=\"13\" height=\"13\" rx=\"2\" opacity=\"0.4\" />\n </svg>\n </button>\n </div>\n )}\n\n {/* Layout picker */}\n <div ref={layoutRef} style={{ position: 'relative' }}>\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn\"\n onClick={(e) => { e.stopPropagation(); setShowLayoutPicker(!showLayoutPicker); }}\n title={`Layout: ${layout}`}\n onMouseDown={(e) => e.stopPropagation()}\n >\n {layoutIcon}\n </button>\n {showLayoutPicker && (\n <div className=\"rte-float-dialog__layout-dropdown\" onMouseDown={(e) => e.stopPropagation()}>\n {LAYOUT_OPTIONS.map((opt) => (\n <button\n key={opt.key}\n type=\"button\"\n className={`rte-float-dialog__layout-option ${layout === opt.key ? 'rte-float-dialog__layout-option--active' : ''}`}\n onClick={() => { updateAttributes({ layout: opt.key }); setShowLayoutPicker(false); }}\n title={opt.label}\n >\n {opt.icon}\n <span>{opt.label}</span>\n </button>\n ))}\n </div>\n )}\n </div>\n\n {/* Color picker */}\n <div ref={colorRef} style={{ position: 'relative' }}>\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn\"\n onClick={(e) => { e.stopPropagation(); setShowColorPicker(!showColorPicker); }}\n title=\"Color\"\n onMouseDown={(e) => e.stopPropagation()}\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill={attrs.borderColor} stroke={attrs.borderColor} strokeWidth=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"8\" />\n </svg>\n </button>\n {showColorPicker && (\n <div className=\"rte-float-dialog__color-dropdown\" onMouseDown={(e) => e.stopPropagation()}>\n {DIALOG_COLORS.map((c) => (\n <button\n key={c.label}\n type=\"button\"\n className=\"rte-float-dialog__color-swatch\"\n style={{ backgroundColor: c.border }}\n onClick={() => { updateAttributes({ borderColor: c.border, bgColor: c.bg }); setShowColorPicker(false); }}\n title={c.label}\n />\n ))}\n </div>\n )}\n </div>\n\n {/* Delete */}\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn rte-float-dialog__action-btn--danger\"\n onClick={(e) => { e.stopPropagation(); deleteNode(); }}\n title=\"Delete\"\n onMouseDown={(e) => e.stopPropagation()}\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" /><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </div>\n </div>\n\n {/* Rich text body — Tiptap editable content */}\n <NodeViewContent className=\"rte-float-dialog__body\" />\n\n {/* Resize handle */}\n <div className=\"rte-float-dialog__resize-handle\" onMouseDown={onResizeStart} contentEditable={false}>\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"currentColor\">\n <circle cx=\"8\" cy=\"8\" r=\"1.2\" /><circle cx=\"4\" cy=\"8\" r=\"1.2\" /><circle cx=\"8\" cy=\"4\" r=\"1.2\" />\n </svg>\n </div>\n </div>\n </NodeViewWrapper>\n );\n};\n\n/** Scan document for the highest zIndex among existing float dialogs */\nexport function getNextFloatZIndex(editor: { state: { doc: { descendants: (cb: (node: { type: { name: string }; attrs: Record<string, unknown> }) => void) => void } } }): number {\n let maxZ = 9;\n editor.state.doc.descendants((node) => {\n if (node.type.name === 'floatingDialog' && node.attrs.layout === 'float') {\n const z = (node.attrs.zIndex as number) ?? 10;\n if (z > maxZ) maxZ = z;\n }\n });\n return maxZ + 1;\n}\n\nexport const FloatingDialogExtension = Node.create({\n name: 'floatingDialog',\n group: 'block',\n content: 'block+',\n draggable: true,\n isolating: true,\n defining: true,\n\n addAttributes() {\n return {\n title: { default: 'Note' },\n x: { default: 20 },\n y: { default: 0 },\n width: { default: 280 },\n height: { default: 120 },\n borderColor: { default: '#3b82f6' },\n bgColor: { default: '#eff6ff' },\n layout: { default: 'block' },\n zIndex: { default: 10 },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[data-type=\"floating-dialog\"]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', mergeAttributes(HTMLAttributes, { 'data-type': 'floating-dialog' }), 0];\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(FloatingDialogView);\n },\n});\n\nexport default FloatingDialogExtension;\n"],"mappings":";;;;;AAoBA,IAAM,IAAgB;CACpB;EAAE,OAAO;EAAQ,QAAQ;EAAW,IAAI;CAAU;CAClD;EAAE,OAAO;EAAS,QAAQ;EAAW,IAAI;CAAU;CACnD;EAAE,OAAO;EAAU,QAAQ;EAAW,IAAI;CAAU;CACpD;EAAE,OAAO;EAAO,QAAQ;EAAW,IAAI;CAAU;CACjD;EAAE,OAAO;EAAU,QAAQ;EAAW,IAAI;CAAU;CACpD;EAAE,OAAO;EAAQ,QAAQ;EAAW,IAAI;CAAU;AACpD,GAEM,IAAgF;CACpF;EACE,KAA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A;OAAC,kBAAC,UAAD;QAAQ,IAAG;QAAI,IAAG;QAAI,GAAE;OAAO,CAAA;MAC5F;;IACF,CAAA;GACF;;CACU,CAAA;AAErB;AAGA,SAAgB,EAAmB,GAA+I;CAChL,IAAI,IAAO;CAOX,OANA,EAAO,MAAM,IAAI,aAAa,MAAS;EACrC,IAAI,EAAK,KAAK,SAAS,oBAAoB,EAAK,MAAM,WAAW,SAAS;GACxE,IAAM,IAAK,EAAK,MAAM,UAAqB;GAC3C,AAAI,IAAI,MAAM,IAAO;EACvB;CACF,CAAC,GACM,IAAO;AAChB;AAEA,IAAa,IAA0B,EAAK,OAAO;CACjD,MAAM;CACN,OAAO;CACP,SAAS;CACT,WAAW;CACX,WAAW;CACX,UAAU;CAEV,gBAAgB;EACd,OAAO;GACL,OAAO,EAAE,SAAS,OAAO;GACzB,GAAG,EAAE,SAAS,GAAG;GACjB,GAAG,EAAE,SAAS,EAAE;GAChB,OAAO,EAAE,SAAS,IAAI;GACtB,QAAQ,EAAE,SAAS,IAAI;GACvB,aAAa,EAAE,SAAS,UAAU;GAClC,SAAS,EAAE,SAAS,UAAU;GAC9B,QAAQ,EAAE,SAAS,QAAQ;GAC3B,QAAQ,EAAE,SAAS,GAAG;EACxB;CACF;CAEA,YAAY;EACV,OAAO,CAAC,EAAE,KAAK,qCAAmC,CAAC;CACrD;CAEA,WAAW,EAAE,qBAAkB;EAC7B,OAAO;GAAC;GAAO,EAAgB,GAAgB,EAAE,aAAa,kBAAkB,CAAC;GAAG;EAAC;CACvF;CAEA,cAAc;EACZ,OAAO,EAAsB,CAAkB;CACjD;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"FloatingDialog.js","names":[],"sources":["../../../../../src/components/pro/RichTextEditor/extensions/FloatingDialog.tsx"],"sourcesContent":["import React, { useState, useRef, useCallback, useEffect } from 'react';\nimport { cn } from '../../../../utils/cn';\nimport { Node, mergeAttributes } from '@tiptap/react';\nimport { NodeViewWrapper, NodeViewContent, ReactNodeViewRenderer } from '@tiptap/react';\nimport type { NodeViewProps } from '@tiptap/react';\nimport { useNodeEditable } from './MarkdownBlock';\n\ntype DialogLayout = 'block' | 'wrap-left' | 'wrap-right' | 'float';\n\ninterface DialogAttrs {\n x: number;\n y: number;\n width: number;\n height: number;\n borderColor: string;\n bgColor: string;\n title: string;\n layout: DialogLayout;\n zIndex: number;\n}\n\nconst DIALOG_COLORS = [\n { label: 'Blue', border: '#3b82f6', bg: '#eff6ff' },\n { label: 'Green', border: '#22c55e', bg: '#f0fdf4' },\n { label: 'Orange', border: '#f97316', bg: '#fff7ed' },\n { label: 'Red', border: '#ef4444', bg: '#fef2f2' },\n { label: 'Purple', border: '#8b5cf6', bg: '#faf5ff' },\n { label: 'Gray', border: '#6b7280', bg: '#f9fafb' },\n];\n\nconst LAYOUT_OPTIONS: { key: DialogLayout; label: string; icon: React.ReactNode }[] = [\n {\n key: 'block', label: 'Block',\n icon: <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\" /><line x1=\"3\" y1=\"3\" x2=\"21\" y2=\"3\" /><line x1=\"3\" y1=\"21\" x2=\"21\" y2=\"21\" /></svg>,\n },\n {\n key: 'wrap-left', label: 'Wrap Left',\n icon: <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><rect x=\"2\" y=\"4\" width=\"10\" height=\"8\" rx=\"1\" /><line x1=\"15\" y1=\"5\" x2=\"22\" y2=\"5\" /><line x1=\"15\" y1=\"8\" x2=\"22\" y2=\"8\" /><line x1=\"15\" y1=\"11\" x2=\"22\" y2=\"11\" /><line x1=\"2\" y1=\"15\" x2=\"22\" y2=\"15\" /><line x1=\"2\" y1=\"18\" x2=\"22\" y2=\"18\" /></svg>,\n },\n {\n key: 'wrap-right', label: 'Wrap Right',\n icon: <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><rect x=\"12\" y=\"4\" width=\"10\" height=\"8\" rx=\"1\" /><line x1=\"2\" y1=\"5\" x2=\"9\" y2=\"5\" /><line x1=\"2\" y1=\"8\" x2=\"9\" y2=\"8\" /><line x1=\"2\" y1=\"11\" x2=\"9\" y2=\"11\" /><line x1=\"2\" y1=\"15\" x2=\"22\" y2=\"15\" /><line x1=\"2\" y1=\"18\" x2=\"22\" y2=\"18\" /></svg>,\n },\n {\n key: 'float', label: 'Float',\n icon: <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\"><rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\" /><path d=\"M2 2h4M18 2h4M2 22h4M18 22h4\" strokeDasharray=\"2 2\" /><line x1=\"2\" y1=\"12\" x2=\"6\" y2=\"12\" strokeDasharray=\"2 2\" /><line x1=\"18\" y1=\"12\" x2=\"22\" y2=\"12\" strokeDasharray=\"2 2\" /></svg>,\n },\n];\n\n/** Scan the document and return all zIndex values of float-layout floatingDialog nodes */\nfunction collectFloatZIndices(editor: NodeViewProps['editor']): number[] {\n const indices: number[] = [];\n editor.state.doc.descendants((node) => {\n if (node.type.name === 'floatingDialog' && node.attrs.layout === 'float') {\n indices.push(node.attrs.zIndex ?? 10);\n }\n });\n return indices;\n}\n\nconst FloatingDialogView: React.FC<NodeViewProps> = ({\n node,\n editor,\n updateAttributes: writeAttributes,\n deleteNode,\n selected,\n}) => {\n const editable = useNodeEditable(editor);\n const updateAttributes = useCallback((attributes: Record<string, unknown>) => {\n if (!editor.isDestroyed && editor.isEditable) writeAttributes(attributes);\n }, [editor, writeAttributes]);\n const gestureCleanup = useRef<(() => void) | null>(null);\n const attrs = node.attrs as DialogAttrs;\n const layout = attrs.layout || 'block';\n const isFloat = layout === 'float';\n const zIndex = attrs.zIndex ?? 10;\n\n const [editingTitle, setEditingTitle] = useState(false);\n const [localTitle, setLocalTitle] = useState(attrs.title);\n const [showColorPicker, setShowColorPicker] = useState(false);\n const [showLayoutPicker, setShowLayoutPicker] = useState(false);\n const dragStart = useRef({ mx: 0, my: 0, x: 0, y: 0 });\n const resizeStart = useRef({ mx: 0, my: 0, w: 0, h: 0 });\n const colorRef = useRef<HTMLDivElement>(null);\n const layoutRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n setLocalTitle(attrs.title);\n }, [attrs.title]);\n\n useEffect(() => {\n if (!editable) {\n gestureCleanup.current?.();\n setEditingTitle(false);\n setLocalTitle(attrs.title);\n setShowColorPicker(false);\n setShowLayoutPicker(false);\n }\n }, [editable, attrs.title]);\n\n useEffect(() => {\n const cleanup = () => gestureCleanup.current?.();\n editor.on('destroy', cleanup);\n window.addEventListener('blur', cleanup);\n return () => {\n cleanup();\n editor.off('destroy', cleanup);\n window.removeEventListener('blur', cleanup);\n };\n }, [editor]);\n\n useEffect(() => {\n const handler = (e: MouseEvent) => {\n if (colorRef.current && !colorRef.current.contains(e.target as globalThis.Node)) {\n setShowColorPicker(false);\n }\n if (layoutRef.current && !layoutRef.current.contains(e.target as globalThis.Node)) {\n setShowLayoutPicker(false);\n }\n };\n document.addEventListener('mousedown', handler);\n return () => document.removeEventListener('mousedown', handler);\n }, []);\n\n const onDragStart = useCallback((e: React.MouseEvent) => {\n if (!isFloat || editor.isDestroyed || !editor.isEditable || e.button !== 0) return;\n gestureCleanup.current?.();\n e.preventDefault();\n e.stopPropagation();\n dragStart.current = { mx: e.clientX, my: e.clientY, x: attrs.x, y: attrs.y };\n\n const onMove = (ev: MouseEvent) => {\n const dx = ev.clientX - dragStart.current.mx;\n const dy = ev.clientY - dragStart.current.my;\n updateAttributes({\n x: dragStart.current.x + dx,\n y: dragStart.current.y + dy,\n });\n };\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n };\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n gestureCleanup.current = onUp;\n }, [editor, isFloat, attrs.x, attrs.y, updateAttributes]);\n\n const onResizeStart = useCallback((e: React.MouseEvent) => {\n if (editor.isDestroyed || !editor.isEditable || e.button !== 0) return;\n gestureCleanup.current?.();\n e.preventDefault();\n e.stopPropagation();\n resizeStart.current = { mx: e.clientX, my: e.clientY, w: attrs.width, h: attrs.height };\n\n const onMove = (ev: MouseEvent) => {\n const dw = ev.clientX - resizeStart.current.mx;\n const dh = ev.clientY - resizeStart.current.my;\n updateAttributes({\n width: Math.max(160, resizeStart.current.w + dw),\n height: Math.max(80, resizeStart.current.h + dh),\n });\n };\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n };\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n gestureCleanup.current = onUp;\n }, [editor, attrs.width, attrs.height, updateAttributes]);\n\n const saveTitle = useCallback(() => {\n updateAttributes({ title: localTitle });\n setEditingTitle(false);\n }, [localTitle, updateAttributes]);\n\n const bringForward = useCallback(() => {\n const all = collectFloatZIndices(editor);\n const maxZ = Math.max(...all);\n if (zIndex < maxZ) {\n updateAttributes({ zIndex: maxZ + 1 });\n }\n }, [editor, zIndex, updateAttributes]);\n\n const sendBackward = useCallback(() => {\n const all = collectFloatZIndices(editor);\n const minZ = Math.min(...all);\n if (zIndex > minZ) {\n updateAttributes({ zIndex: minZ - 1 });\n } else if (zIndex > 1) {\n updateAttributes({ zIndex: zIndex - 1 });\n }\n }, [editor, zIndex, updateAttributes]);\n\n const wrapperClass = cn(\n 'rte-float-dialog',\n `rte-float-dialog--${layout}`,\n selected && 'rte-float-dialog--selected',\n );\n\n const wrapperStyle: React.CSSProperties = isFloat\n ? { position: 'absolute', left: attrs.x, top: attrs.y, zIndex }\n : {};\n\n const boxStyle: React.CSSProperties = {\n width: layout === 'block' ? '100%' : attrs.width,\n minHeight: attrs.height,\n borderColor: attrs.borderColor,\n backgroundColor: attrs.bgColor,\n };\n\n const layoutIcon = LAYOUT_OPTIONS.find((l) => l.key === layout)?.icon;\n\n return (\n <NodeViewWrapper className={wrapperClass} style={wrapperStyle}>\n <div className=\"rte-float-dialog__box\" style={boxStyle}>\n {/* Title bar */}\n <div\n className=\"rte-float-dialog__titlebar\"\n style={{ borderBottomColor: attrs.borderColor }}\n onMouseDown={onDragStart}\n contentEditable={false}\n >\n {isFloat && (\n <span className=\"rte-float-dialog__drag-icon\">\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <circle cx=\"9\" cy=\"5\" r=\"1.5\" /><circle cx=\"15\" cy=\"5\" 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=\"19\" r=\"1.5\" /><circle cx=\"15\" cy=\"19\" r=\"1.5\" />\n </svg>\n </span>\n )}\n\n {editingTitle && editable ? (\n <input\n className=\"rte-float-dialog__title-input\"\n value={localTitle}\n onChange={(e) => setLocalTitle(e.target.value)}\n placeholder=\"Title...\"\n onMouseDown={(e) => e.stopPropagation()}\n onBlur={saveTitle}\n onKeyDown={(e) => { if (e.key === 'Enter' || e.key === 'Escape') saveTitle(); }}\n autoFocus\n />\n ) : (\n <span className=\"rte-float-dialog__title\" onDoubleClick={() => { if (!editor.isDestroyed && editor.isEditable) setEditingTitle(true); }}>\n {attrs.title || 'Dialog'}\n </span>\n )}\n\n {editable && <div className=\"rte-float-dialog__actions\">\n {/* Z-order controls — only for float layout */}\n {isFloat && (\n <div className=\"rte-float-dialog__zorder\">\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn\"\n onClick={(e) => { e.stopPropagation(); bringForward(); }}\n title=\"Bring to Front\"\n onMouseDown={(e) => e.stopPropagation()}\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <rect x=\"8\" y=\"2\" width=\"13\" height=\"13\" rx=\"2\" />\n <rect x=\"3\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" opacity=\"0.4\" />\n </svg>\n </button>\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn\"\n onClick={(e) => { e.stopPropagation(); sendBackward(); }}\n title=\"Send to Back\"\n onMouseDown={(e) => e.stopPropagation()}\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <rect x=\"3\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" />\n <rect x=\"8\" y=\"2\" width=\"13\" height=\"13\" rx=\"2\" opacity=\"0.4\" />\n </svg>\n </button>\n </div>\n )}\n\n {/* Layout picker */}\n <div ref={layoutRef} style={{ position: 'relative' }}>\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn\"\n onClick={(e) => { e.stopPropagation(); setShowLayoutPicker(!showLayoutPicker); }}\n title={`Layout: ${layout}`}\n onMouseDown={(e) => e.stopPropagation()}\n >\n {layoutIcon}\n </button>\n {showLayoutPicker && (\n <div className=\"rte-float-dialog__layout-dropdown\" onMouseDown={(e) => e.stopPropagation()}>\n {LAYOUT_OPTIONS.map((opt) => (\n <button\n key={opt.key}\n type=\"button\"\n className={`rte-float-dialog__layout-option ${layout === opt.key ? 'rte-float-dialog__layout-option--active' : ''}`}\n onClick={() => { updateAttributes({ layout: opt.key }); setShowLayoutPicker(false); }}\n title={opt.label}\n >\n {opt.icon}\n <span>{opt.label}</span>\n </button>\n ))}\n </div>\n )}\n </div>\n\n {/* Color picker */}\n <div ref={colorRef} style={{ position: 'relative' }}>\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn\"\n onClick={(e) => { e.stopPropagation(); setShowColorPicker(!showColorPicker); }}\n title=\"Color\"\n onMouseDown={(e) => e.stopPropagation()}\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill={attrs.borderColor} stroke={attrs.borderColor} strokeWidth=\"2\">\n <circle cx=\"12\" cy=\"12\" r=\"8\" />\n </svg>\n </button>\n {showColorPicker && (\n <div className=\"rte-float-dialog__color-dropdown\" onMouseDown={(e) => e.stopPropagation()}>\n {DIALOG_COLORS.map((c) => (\n <button\n key={c.label}\n type=\"button\"\n className=\"rte-float-dialog__color-swatch\"\n style={{ backgroundColor: c.border }}\n onClick={() => { updateAttributes({ borderColor: c.border, bgColor: c.bg }); setShowColorPicker(false); }}\n title={c.label}\n />\n ))}\n </div>\n )}\n </div>\n\n {/* Delete */}\n <button\n type=\"button\"\n className=\"rte-float-dialog__action-btn rte-float-dialog__action-btn--danger\"\n onClick={(e) => { e.stopPropagation(); if (!editor.isDestroyed && editor.isEditable) deleteNode(); }}\n title=\"Delete\"\n onMouseDown={(e) => e.stopPropagation()}\n >\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\" /><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\" />\n </svg>\n </button>\n </div>}\n </div>\n\n {/* Rich text body — Tiptap editable content */}\n <NodeViewContent className=\"rte-float-dialog__body\" />\n\n {/* Resize handle */}\n {editable && <div className=\"rte-float-dialog__resize-handle\" onMouseDown={onResizeStart} contentEditable={false}>\n <svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"currentColor\">\n <circle cx=\"8\" cy=\"8\" r=\"1.2\" /><circle cx=\"4\" cy=\"8\" r=\"1.2\" /><circle cx=\"8\" cy=\"4\" r=\"1.2\" />\n </svg>\n </div>}\n </div>\n </NodeViewWrapper>\n );\n};\n\n/** Scan document for the highest zIndex among existing float dialogs */\nexport function getNextFloatZIndex(editor: { state: { doc: { descendants: (cb: (node: { type: { name: string }; attrs: Record<string, unknown> }) => void) => void } } }): number {\n let maxZ = 9;\n editor.state.doc.descendants((node) => {\n if (node.type.name === 'floatingDialog' && node.attrs.layout === 'float') {\n const z = (node.attrs.zIndex as number) ?? 10;\n if (z > maxZ) maxZ = z;\n }\n });\n return maxZ + 1;\n}\n\nexport const FloatingDialogExtension = Node.create({\n name: 'floatingDialog',\n group: 'block',\n content: 'block+',\n draggable: true,\n isolating: true,\n defining: true,\n\n addAttributes() {\n return {\n title: { default: 'Note' },\n x: { default: 20 },\n y: { default: 0 },\n width: { default: 280 },\n height: { default: 120 },\n borderColor: { default: '#3b82f6' },\n bgColor: { default: '#eff6ff' },\n layout: { default: 'block' },\n zIndex: { default: 10 },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[data-type=\"floating-dialog\"]' }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', mergeAttributes(HTMLAttributes, { 'data-type': 'floating-dialog' }), 0];\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(FloatingDialogView);\n },\n});\n\nexport default FloatingDialogExtension;\n"],"mappings":";;;;;;AAqBA,IAAM,IAAgB;CACpB;EAAE,OAAO;EAAQ,QAAQ;EAAW,IAAI;CAAU;CAClD;EAAE,OAAO;EAAS,QAAQ;EAAW,IAAI;CAAU;CACnD;EAAE,OAAO;EAAU,QAAQ;EAAW,IAAI;CAAU;CACpD;EAAE,OAAO;EAAO,QAAQ;EAAW,IAAI;CAAU;CACjD;EAAE,OAAO;EAAU,QAAQ;EAAW,IAAI;CAAU;CACpD;EAAE,OAAO;EAAQ,QAAQ;EAAW,IAAI;CAAU;AACpD,GAEM,IAAgF;CACpF;EACE,KAAK;EAAS,OAAO;EACrB,MAAM,kBAAC,OAAD;GAAK,OAAM;GAAK,QAAO;GAAK,SAAQ;GAAY,MAAK;GAAO,QAAO;GAAe,aAAY;GAA9F,UAAA;IAAkG,kBAAC,QAAD;KAAM,GAAE;KAAI,GAAE;KAAI,OAAM;KAAK,QAAO;KAAK,IAAG;IAAK,CAAA;IAAC,kBAAC,QAAD;KAAM,IAAG;KAAI,IAAG;KAAI,IAAG;KAAK,IAAG;IAAK,CAAA;IAAC,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AAE,SAAS,UAAU;GAClC,SAAS,EAAE,SAAS,UAAU;GAC9B,QAAQ,EAAE,SAAS,QAAQ;GAC3B,QAAQ,EAAE,SAAS,GAAG;EACxB;CACF;CAEA,YAAY;EACV,OAAO,CAAC,EAAE,KAAK,qCAAmC,CAAC;CACrD;CAEA,WAAW,EAAE,qBAAkB;EAC7B,OAAO;GAAC;GAAO,EAAgB,GAAgB,EAAE,aAAa,kBAAkB,CAAC;GAAG;EAAC;CACvF;CAEA,cAAc;EACZ,OAAO,EAAsB,CAAkB;CACjD;AACF,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Extension as e } from "@tiptap/react";
|
|
2
2
|
//#region src/components/pro/RichTextEditor/extensions/FontSize.ts
|
|
3
|
-
|
|
3
|
+
function t(e) {
|
|
4
|
+
return typeof e == "string" && /^(?:0|(?:\d+(?:\.\d+)?|\.\d+)(?:px|pt|pc|em|rem|ex|ch|%|vw|vh|vmin|vmax)|xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|smaller|larger|inherit|initial|unset|revert)$/i.test(e);
|
|
5
|
+
}
|
|
6
|
+
var n = e.create({
|
|
4
7
|
name: "fontSize",
|
|
5
8
|
addOptions() {
|
|
6
9
|
return { types: ["textStyle"] };
|
|
@@ -11,18 +14,18 @@ var t = e.create({
|
|
|
11
14
|
attributes: { fontSize: {
|
|
12
15
|
default: null,
|
|
13
16
|
parseHTML: (e) => e.style.fontSize?.replace(/['"]+/g, "") || null,
|
|
14
|
-
renderHTML: (e) => e.fontSize ? { style: `font-size: ${e.fontSize}` } : {}
|
|
17
|
+
renderHTML: (e) => t(e.fontSize) ? { style: `font-size: ${e.fontSize}` } : {}
|
|
15
18
|
} }
|
|
16
19
|
}];
|
|
17
20
|
},
|
|
18
21
|
addCommands() {
|
|
19
22
|
return {
|
|
20
|
-
setFontSize: (e) => ({ chain:
|
|
21
|
-
unsetFontSize: () => ({ chain: e }) => e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
|
|
23
|
+
setFontSize: (e) => ({ chain: n, editor: r }) => !r.isEditable || !t(e) ? !1 : n().setMark("textStyle", { fontSize: e }).run(),
|
|
24
|
+
unsetFontSize: () => ({ chain: e, editor: t }) => t.isEditable ? e().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run() : !1
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
});
|
|
25
28
|
//#endregion
|
|
26
|
-
export {
|
|
29
|
+
export { n as default };
|
|
27
30
|
|
|
28
31
|
//# sourceMappingURL=FontSize.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontSize.js","names":[],"sources":["../../../../../src/components/pro/RichTextEditor/extensions/FontSize.ts"],"sourcesContent":["import { Extension } from '@tiptap/react';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/react' {\n interface Commands<ReturnType> {\n fontSize: {\n setFontSize: (size: string) => ReturnType;\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nconst FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) => element.style.fontSize?.replace(/['\"]+/g, '') || null,\n renderHTML: (attributes) => {\n if (!attributes.fontSize) return {};\n return { style: `font-size: ${attributes.fontSize}` };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize: string) =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain }) => {\n return chain().setMark('textStyle', { fontSize: null }).removeEmptyTextStyle().run();\n },\n };\n },\n});\n\nexport default FontSize;\n"],"mappings":";;AAeA,IAAM,IAAW,EAAU,OAAwB;CACjD,MAAM;CAEN,aAAa;EACX,OAAO,EACL,OAAO,CAAC,WAAW,EACrB;CACF;CAEA,sBAAsB;EACpB,OAAO,CACL;GACE,OAAO,KAAK,QAAQ;GACpB,YAAY,EACV,UAAU;IACR,SAAS;IACT,YAAY,MAAY,EAAQ,MAAM,UAAU,QAAQ,UAAU,EAAE,KAAK;IACzE,aAAa,MACN,EAAW,
|
|
1
|
+
{"version":3,"file":"FontSize.js","names":[],"sources":["../../../../../src/components/pro/RichTextEditor/extensions/FontSize.ts"],"sourcesContent":["import { Extension } from '@tiptap/react';\n\nexport type FontSizeOptions = {\n types: string[];\n};\n\ndeclare module '@tiptap/react' {\n interface Commands<ReturnType> {\n fontSize: {\n setFontSize: (size: string) => ReturnType;\n unsetFontSize: () => ReturnType;\n };\n }\n}\n\nfunction isFontSize(value: unknown): value is string {\n return typeof value === 'string' && /^(?:0|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:px|pt|pc|em|rem|ex|ch|%|vw|vh|vmin|vmax)|xx-small|x-small|small|medium|large|x-large|xx-large|xxx-large|smaller|larger|inherit|initial|unset|revert)$/i.test(value);\n}\n\nconst FontSize = Extension.create<FontSizeOptions>({\n name: 'fontSize',\n\n addOptions() {\n return {\n types: ['textStyle'],\n };\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n fontSize: {\n default: null,\n parseHTML: (element) => element.style.fontSize?.replace(/['\"]+/g, '') || null,\n renderHTML: (attributes) => {\n if (!isFontSize(attributes.fontSize)) return {};\n return { style: `font-size: ${attributes.fontSize}` };\n },\n },\n },\n },\n ];\n },\n\n addCommands() {\n return {\n setFontSize:\n (fontSize: string) =>\n ({ chain, editor }) => {\n if (!editor.isEditable || !isFontSize(fontSize)) return false;\n return chain().setMark('textStyle', { fontSize }).run();\n },\n unsetFontSize:\n () =>\n ({ chain, editor }) => {\n if (!editor.isEditable) return false;\n return chain().setMark('textStyle', { fontSize: null }).removeEmptyTextStyle().run();\n },\n };\n },\n});\n\nexport default FontSize;\n"],"mappings":";;AAeA,SAAS,EAAW,GAAiC;CACnD,OAAO,OAAO,KAAU,YAAY,yLAAyL,KAAK,CAAK;AACzO;AAEA,IAAM,IAAW,EAAU,OAAwB;CACjD,MAAM;CAEN,aAAa;EACX,OAAO,EACL,OAAO,CAAC,WAAW,EACrB;CACF;CAEA,sBAAsB;EACpB,OAAO,CACL;GACE,OAAO,KAAK,QAAQ;GACpB,YAAY,EACV,UAAU;IACR,SAAS;IACT,YAAY,MAAY,EAAQ,MAAM,UAAU,QAAQ,UAAU,EAAE,KAAK;IACzE,aAAa,MACN,EAAW,EAAW,QAAQ,IAC5B,EAAE,OAAO,cAAc,EAAW,WAAW,IADP,CAAC;GAGlD,EACF;EACF,CACF;CACF;CAEA,cAAc;EACZ,OAAO;GACL,cACG,OACA,EAAE,UAAO,gBACJ,CAAC,EAAO,cAAc,CAAC,EAAW,CAAQ,IAAU,KACjD,EAAM,CAAC,CAAC,QAAQ,aAAa,EAAE,YAAS,CAAC,CAAC,CAAC,IAAI;GAE1D,sBAEG,EAAE,UAAO,gBACH,EAAO,aACL,EAAM,CAAC,CAAC,QAAQ,aAAa,EAAE,UAAU,KAAK,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,IAAI,IADpD;EAGrC;CACF;AACF,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { Node } from '@tiptap/react';
|
|
3
|
+
import type { NodeViewProps } from '@tiptap/react';
|
|
4
|
+
export declare function useNodeEditable(editor: NodeViewProps['editor']): boolean;
|
|
5
|
+
export declare const MermaidRenderer: React.FC<{
|
|
6
|
+
code: string;
|
|
7
|
+
}>;
|
|
2
8
|
export declare const MarkdownBlockExtension: Node<any, any>;
|
|
3
9
|
export default MarkdownBlockExtension;
|
|
@@ -1,56 +1,62 @@
|
|
|
1
|
-
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Prism as
|
|
4
|
-
import { oneLight as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import d from "rehype-raw";
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r, useSyncExternalStore as i } from "react";
|
|
2
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
3
|
+
import { Prism as s } from "react-syntax-highlighter";
|
|
4
|
+
import { oneLight as c } from "react-syntax-highlighter/dist/esm/styles/prism";
|
|
5
|
+
import l from "react-markdown";
|
|
6
|
+
import u from "remark-gfm";
|
|
7
|
+
import d from "rehype-katex";
|
|
9
8
|
import f from "remark-math";
|
|
10
9
|
import p from "mermaid";
|
|
11
10
|
import "katex/dist/katex.min.css";
|
|
12
11
|
import { Node as m, NodeViewWrapper as h, ReactNodeViewRenderer as g, mergeAttributes as _ } from "@tiptap/react";
|
|
13
12
|
//#region src/components/pro/RichTextEditor/extensions/MarkdownBlock.tsx
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
function v(t) {
|
|
14
|
+
let n = e((e) => (t.on("update", e), t.on("transaction", e), t.on("destroy", e), () => {
|
|
15
|
+
t.off("update", e), t.off("transaction", e), t.off("destroy", e);
|
|
16
|
+
}), [t]);
|
|
17
|
+
return i(n, () => !t.isDestroyed && t.isEditable, () => !1);
|
|
18
|
+
}
|
|
19
|
+
var y = Promise.resolve();
|
|
20
|
+
function b(e, t) {
|
|
21
|
+
let n = y.then(() => (p.initialize({
|
|
17
22
|
startOnLoad: !1,
|
|
18
23
|
theme: "default",
|
|
19
|
-
securityLevel: "
|
|
24
|
+
securityLevel: "strict",
|
|
25
|
+
suppressErrorRendering: !0,
|
|
20
26
|
fontFamily: "inherit",
|
|
21
27
|
flowchart: {
|
|
22
28
|
useMaxWidth: !0,
|
|
23
|
-
htmlLabels: !
|
|
29
|
+
htmlLabels: !1
|
|
24
30
|
}
|
|
25
|
-
}),
|
|
31
|
+
}), p.mermaidAPI.render(e, t)));
|
|
32
|
+
return y = n.catch(() => void 0), n;
|
|
26
33
|
}
|
|
27
|
-
var
|
|
34
|
+
var x = ({ code: e }) => {
|
|
28
35
|
let r = n(null);
|
|
29
36
|
return t(() => {
|
|
30
|
-
if (!
|
|
31
|
-
y();
|
|
37
|
+
if (!r.current || (r.current.replaceChildren(), !e.trim())) return;
|
|
32
38
|
let t = !1;
|
|
33
39
|
return (async () => {
|
|
34
40
|
try {
|
|
35
|
-
let n = `mermaid-md-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
36
|
-
!t && r.current && (r.current.innerHTML =
|
|
41
|
+
let { svg: n } = await b(`mermaid-md-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`, e);
|
|
42
|
+
!t && r.current && (r.current.innerHTML = n);
|
|
37
43
|
} catch (e) {
|
|
38
|
-
!t && r.current && (r.current.
|
|
44
|
+
!t && r.current && (r.current.textContent = String(e));
|
|
39
45
|
}
|
|
40
46
|
})(), () => {
|
|
41
47
|
t = !0;
|
|
42
48
|
};
|
|
43
|
-
}, [e]), /* @__PURE__ */
|
|
49
|
+
}, [e]), /* @__PURE__ */ a("div", {
|
|
44
50
|
ref: r,
|
|
45
51
|
className: "rte-mermaid-container"
|
|
46
52
|
});
|
|
47
|
-
},
|
|
48
|
-
remarkPlugins: [
|
|
49
|
-
rehypePlugins: [
|
|
53
|
+
}, S = ({ content: e }) => /* @__PURE__ */ a(l, {
|
|
54
|
+
remarkPlugins: [u, f],
|
|
55
|
+
rehypePlugins: [d],
|
|
50
56
|
components: { code({ className: e, children: t, ...n }) {
|
|
51
|
-
let r = /language-(\w+)/.exec(e || "")?.[1],
|
|
52
|
-
return r === "mermaid" ? /* @__PURE__ */
|
|
53
|
-
style:
|
|
57
|
+
let r = /language-(\w+)/.exec(e || "")?.[1], i = String(t).replace(/\n$/, "");
|
|
58
|
+
return r === "mermaid" ? /* @__PURE__ */ a(x, { code: i }) : r ? /* @__PURE__ */ a(s, {
|
|
59
|
+
style: c,
|
|
54
60
|
language: r,
|
|
55
61
|
PreTag: "div",
|
|
56
62
|
customStyle: {
|
|
@@ -59,45 +65,52 @@ var b = ({ code: e }) => {
|
|
|
59
65
|
padding: "1em",
|
|
60
66
|
margin: "0.5em 0"
|
|
61
67
|
},
|
|
62
|
-
children:
|
|
63
|
-
}) : /* @__PURE__ */
|
|
68
|
+
children: i
|
|
69
|
+
}) : /* @__PURE__ */ a("code", {
|
|
64
70
|
className: e,
|
|
65
71
|
...n,
|
|
66
72
|
children: t
|
|
67
73
|
});
|
|
68
74
|
} },
|
|
69
75
|
children: e
|
|
70
|
-
}),
|
|
71
|
-
let [
|
|
76
|
+
}), C = ({ node: i, editor: s, updateAttributes: c, selected: l }) => {
|
|
77
|
+
let u = v(s), [d, f] = r(!1), [p, m] = r(i.attrs.content || ""), g = n(null);
|
|
72
78
|
t(() => {
|
|
73
|
-
|
|
74
|
-
}, [
|
|
75
|
-
|
|
76
|
-
}, [
|
|
77
|
-
let
|
|
79
|
+
m(i.attrs.content || ""), f(!1);
|
|
80
|
+
}, [i.attrs.content, u]), t(() => {
|
|
81
|
+
d && g.current && (g.current.focus(), _(g.current));
|
|
82
|
+
}, [d]);
|
|
83
|
+
let _ = (e) => {
|
|
78
84
|
e.style.height = "auto", e.style.height = e.scrollHeight + "px";
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
}, []),
|
|
82
|
-
s({ content:
|
|
83
|
-
}, [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
}, y = e((e) => {
|
|
86
|
+
m(e.target.value), _(e.target);
|
|
87
|
+
}, []), b = e(() => {
|
|
88
|
+
!s.isDestroyed && s.isEditable && c({ content: p }), f(!1);
|
|
89
|
+
}, [
|
|
90
|
+
s,
|
|
91
|
+
p,
|
|
92
|
+
c
|
|
93
|
+
]), x = e((e) => {
|
|
94
|
+
e.key === "Escape" && b();
|
|
95
|
+
}, [b]), C = p || "# Markdown Block\n\nWrite your **markdown** here.\n\n```mermaid\ngraph LR\n A[Start] --> B[End]\n```\n";
|
|
96
|
+
return /* @__PURE__ */ o(h, {
|
|
97
|
+
contentEditable: !1,
|
|
98
|
+
className: `rte-markdown-block ${l ? "rte-markdown-block--selected" : ""}`,
|
|
99
|
+
children: [/* @__PURE__ */ o("div", {
|
|
89
100
|
className: "rte-markdown-block__header",
|
|
90
|
-
children: [/* @__PURE__ */
|
|
101
|
+
children: [/* @__PURE__ */ a("span", {
|
|
91
102
|
className: "rte-markdown-block__label",
|
|
92
103
|
children: "Markdown"
|
|
93
|
-
}), /* @__PURE__ */
|
|
104
|
+
}), /* @__PURE__ */ o("button", {
|
|
94
105
|
type: "button",
|
|
95
|
-
className: `rte-markdown-block__toggle ${
|
|
106
|
+
className: `rte-markdown-block__toggle ${d ? "rte-markdown-block__toggle--active" : ""}`,
|
|
107
|
+
disabled: !u,
|
|
108
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
96
109
|
onClick: () => {
|
|
97
|
-
|
|
110
|
+
!s.isDestroyed && s.isEditable && (d && c({ content: p }), f(!d));
|
|
98
111
|
},
|
|
99
|
-
title:
|
|
100
|
-
children: [
|
|
112
|
+
title: d ? "Preview" : "Edit",
|
|
113
|
+
children: [d ? /* @__PURE__ */ o("svg", {
|
|
101
114
|
width: "14",
|
|
102
115
|
height: "14",
|
|
103
116
|
viewBox: "0 0 24 24",
|
|
@@ -106,12 +119,12 @@ var b = ({ code: e }) => {
|
|
|
106
119
|
strokeWidth: "2",
|
|
107
120
|
strokeLinecap: "round",
|
|
108
121
|
strokeLinejoin: "round",
|
|
109
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ a("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }), /* @__PURE__ */ a("circle", {
|
|
110
123
|
cx: "12",
|
|
111
124
|
cy: "12",
|
|
112
125
|
r: "3"
|
|
113
126
|
})]
|
|
114
|
-
}) : /* @__PURE__ */
|
|
127
|
+
}) : /* @__PURE__ */ o("svg", {
|
|
115
128
|
width: "14",
|
|
116
129
|
height: "14",
|
|
117
130
|
viewBox: "0 0 24 24",
|
|
@@ -120,31 +133,33 @@ var b = ({ code: e }) => {
|
|
|
120
133
|
strokeWidth: "2",
|
|
121
134
|
strokeLinecap: "round",
|
|
122
135
|
strokeLinejoin: "round",
|
|
123
|
-
children: [/* @__PURE__ */
|
|
124
|
-
}), /* @__PURE__ */
|
|
136
|
+
children: [/* @__PURE__ */ a("path", { d: "M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7" }), /* @__PURE__ */ a("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" })]
|
|
137
|
+
}), /* @__PURE__ */ a("span", { children: d ? "Preview" : "Edit" })]
|
|
125
138
|
})]
|
|
126
|
-
}), /* @__PURE__ */
|
|
139
|
+
}), /* @__PURE__ */ a("div", {
|
|
127
140
|
className: "rte-markdown-block__body",
|
|
128
|
-
children:
|
|
129
|
-
ref:
|
|
141
|
+
children: d && u ? /* @__PURE__ */ a("textarea", {
|
|
142
|
+
ref: g,
|
|
130
143
|
className: "rte-markdown-block__editor",
|
|
131
|
-
value:
|
|
132
|
-
onChange:
|
|
133
|
-
onBlur:
|
|
134
|
-
onKeyDown:
|
|
144
|
+
value: p,
|
|
145
|
+
onChange: y,
|
|
146
|
+
onBlur: b,
|
|
147
|
+
onKeyDown: x,
|
|
135
148
|
placeholder: "Enter Markdown content...",
|
|
136
149
|
rows: 5
|
|
137
|
-
}) : /* @__PURE__ */
|
|
150
|
+
}) : /* @__PURE__ */ a("div", {
|
|
138
151
|
className: "rte-markdown-block__preview prose",
|
|
139
|
-
onDoubleClick: () =>
|
|
140
|
-
|
|
152
|
+
onDoubleClick: () => {
|
|
153
|
+
!s.isDestroyed && s.isEditable && f(!0);
|
|
154
|
+
},
|
|
155
|
+
children: C.trim() ? /* @__PURE__ */ a(S, { content: C }) : /* @__PURE__ */ a("p", {
|
|
141
156
|
className: "rte-markdown-block__placeholder",
|
|
142
157
|
children: "Double-click to edit Markdown content..."
|
|
143
158
|
})
|
|
144
159
|
})
|
|
145
160
|
})]
|
|
146
161
|
});
|
|
147
|
-
},
|
|
162
|
+
}, w = m.create({
|
|
148
163
|
name: "markdownBlock",
|
|
149
164
|
group: "block",
|
|
150
165
|
atom: !0,
|
|
@@ -156,17 +171,13 @@ var b = ({ code: e }) => {
|
|
|
156
171
|
return [{ tag: "div[data-type=\"markdown-block\"]" }];
|
|
157
172
|
},
|
|
158
173
|
renderHTML({ HTMLAttributes: e }) {
|
|
159
|
-
return [
|
|
160
|
-
"div",
|
|
161
|
-
_(e, { "data-type": "markdown-block" }),
|
|
162
|
-
0
|
|
163
|
-
];
|
|
174
|
+
return ["div", _(e, { "data-type": "markdown-block" })];
|
|
164
175
|
},
|
|
165
176
|
addNodeView() {
|
|
166
|
-
return g(
|
|
177
|
+
return g(C);
|
|
167
178
|
}
|
|
168
179
|
});
|
|
169
180
|
//#endregion
|
|
170
|
-
export {
|
|
181
|
+
export { w as MarkdownBlockExtension, w as default, x as MermaidRenderer, v as useNodeEditable };
|
|
171
182
|
|
|
172
183
|
//# sourceMappingURL=MarkdownBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownBlock.js","names":[],"sources":["../../../../../src/components/pro/RichTextEditor/extensions/MarkdownBlock.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { Node, mergeAttributes } from '@tiptap/react';\nimport { NodeViewWrapper, ReactNodeViewRenderer } from '@tiptap/react';\nimport type { NodeViewProps } from '@tiptap/react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\nimport rehypeKatex from 'rehype-katex';\nimport rehypeRaw from 'rehype-raw';\nimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism';\nimport mermaid from 'mermaid';\nimport 'katex/dist/katex.min.css';\n\nlet mermaidInitialized = false;\n\nfunction initMermaid() {\n if (!mermaidInitialized) {\n mermaid.initialize({\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'loose',\n fontFamily: 'inherit',\n flowchart: { useMaxWidth: true, htmlLabels: true },\n });\n mermaidInitialized = true;\n }\n}\n\nconst MermaidRenderer: React.FC<{ code: string }> = ({ code }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!code.trim() || !containerRef.current) return;\n initMermaid();\n\n let cancelled = false;\n const render = async () => {\n try {\n const id = `mermaid-md-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;\n const { svg } = await mermaid.render(id, code);\n if (!cancelled && containerRef.current) {\n containerRef.current.innerHTML = svg;\n }\n } catch (err) {\n if (!cancelled && containerRef.current) {\n containerRef.current.innerHTML = `<pre style=\"color:red;font-size:12px;\">${String(err)}</pre>`;\n }\n }\n };\n render();\n return () => { cancelled = true; };\n }, [code]);\n\n return <div ref={containerRef} className=\"rte-mermaid-container\" />;\n};\n\nconst MarkdownPreview: React.FC<{ content: string }> = ({ content }) => {\n return (\n <ReactMarkdown\n remarkPlugins={[remarkGfm, remarkMath]}\n rehypePlugins={[rehypeKatex, rehypeRaw]}\n components={{\n code({ className, children, ...props }) {\n const match = /language-(\\w+)/.exec(className || '');\n const lang = match?.[1];\n const text = String(children).replace(/\\n$/, '');\n\n if (lang === 'mermaid') {\n return <MermaidRenderer code={text} />;\n }\n\n if (lang) {\n return (\n <SyntaxHighlighter\n style={oneLight as Record<string, React.CSSProperties>}\n language={lang}\n PreTag=\"div\"\n customStyle={{\n borderRadius: '0.5rem',\n fontSize: '0.875em',\n padding: '1em',\n margin: '0.5em 0',\n }}\n >\n {text}\n </SyntaxHighlighter>\n );\n }\n return <code className={className} {...props}>{children}</code>;\n },\n }}\n >\n {content}\n </ReactMarkdown>\n );\n};\n\nconst MarkdownBlockView: React.FC<NodeViewProps> = ({\n node,\n updateAttributes,\n selected,\n}) => {\n const [isEditing, setIsEditing] = useState(false);\n const [localContent, setLocalContent] = useState(node.attrs.content || '');\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n setLocalContent(node.attrs.content || '');\n }, [node.attrs.content]);\n\n useEffect(() => {\n if (isEditing && textareaRef.current) {\n textareaRef.current.focus();\n adjustTextareaHeight(textareaRef.current);\n }\n }, [isEditing]);\n\n const adjustTextareaHeight = (el: HTMLTextAreaElement) => {\n el.style.height = 'auto';\n el.style.height = el.scrollHeight + 'px';\n };\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setLocalContent(e.target.value);\n adjustTextareaHeight(e.target);\n }, []);\n\n const handleBlur = useCallback(() => {\n updateAttributes({ content: localContent });\n setIsEditing(false);\n }, [localContent, updateAttributes]);\n\n const handleKeyDown = useCallback((e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n updateAttributes({ content: localContent });\n setIsEditing(false);\n }\n }, [localContent, updateAttributes]);\n\n const defaultContent = `# Markdown Block\n\nWrite your **markdown** here.\n\n\\`\\`\\`mermaid\ngraph LR\n A[Start] --> B[End]\n\\`\\`\\`\n`;\n\n const displayContent = localContent || defaultContent;\n\n return (\n <NodeViewWrapper className={`rte-markdown-block ${selected ? 'rte-markdown-block--selected' : ''}`}>\n <div className=\"rte-markdown-block__header\">\n <span className=\"rte-markdown-block__label\">Markdown</span>\n <button\n type=\"button\"\n className={`rte-markdown-block__toggle ${isEditing ? 'rte-markdown-block__toggle--active' : ''}`}\n onClick={() => {\n if (isEditing) {\n updateAttributes({ content: localContent });\n }\n setIsEditing(!isEditing);\n }}\n title={isEditing ? 'Preview' : 'Edit'}\n >\n {isEditing ? (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ) : (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7\" />\n <path d=\"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z\" />\n </svg>\n )}\n <span>{isEditing ? 'Preview' : 'Edit'}</span>\n </button>\n </div>\n\n <div className=\"rte-markdown-block__body\">\n {isEditing ? (\n <textarea\n ref={textareaRef}\n className=\"rte-markdown-block__editor\"\n value={localContent}\n onChange={handleChange}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder=\"Enter Markdown content...\"\n rows={5}\n />\n ) : (\n <div\n className=\"rte-markdown-block__preview prose\"\n onDoubleClick={() => setIsEditing(true)}\n >\n {displayContent.trim() ? (\n <MarkdownPreview content={displayContent} />\n ) : (\n <p className=\"rte-markdown-block__placeholder\">\n Double-click to edit Markdown content...\n </p>\n )}\n </div>\n )}\n </div>\n </NodeViewWrapper>\n );\n};\n\nexport const MarkdownBlockExtension = Node.create({\n name: 'markdownBlock',\n group: 'block',\n atom: true,\n draggable: true,\n\n addAttributes() {\n return {\n content: {\n default: '',\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-type=\"markdown-block\"]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', mergeAttributes(HTMLAttributes, { 'data-type': 'markdown-block' }), 0];\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(MarkdownBlockView);\n },\n});\n\nexport default MarkdownBlockExtension;\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAI,IAAqB;AAEzB,SAAS,IAAc;CACrB,AAQE,OAPA,EAAQ,WAAW;EACjB,aAAa;EACb,OAAO;EACP,eAAe;EACf,YAAY;EACZ,WAAW;GAAE,aAAa;GAAM,YAAY;EAAK;CACnD,CAAC,GACoB;AAEzB;A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,EAAgB,GAAgB,EAAE,aAAa,iBAAiB,CAAC;GAAG;EAAC;CACtF;CAEA,cAAc;EACZ,OAAO,EAAsB,CAAiB;CAChD;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"MarkdownBlock.js","names":[],"sources":["../../../../../src/components/pro/RichTextEditor/extensions/MarkdownBlock.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef, useCallback, useSyncExternalStore } from 'react';\nimport { Node, mergeAttributes } from '@tiptap/react';\nimport { NodeViewWrapper, ReactNodeViewRenderer } from '@tiptap/react';\nimport type { NodeViewProps } from '@tiptap/react';\nimport ReactMarkdown from 'react-markdown';\nimport remarkGfm from 'remark-gfm';\nimport remarkMath from 'remark-math';\nimport rehypeKatex from 'rehype-katex';\n\nimport { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';\nimport { oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism';\nimport mermaid from 'mermaid';\nimport 'katex/dist/katex.min.css';\n\nexport function useNodeEditable(editor: NodeViewProps['editor']) {\n const subscribe = useCallback((notify: () => void) => {\n // setEditable emits update, not transaction, in Tiptap 3.\n editor.on('update', notify);\n editor.on('transaction', notify);\n editor.on('destroy', notify);\n return () => {\n editor.off('update', notify);\n editor.off('transaction', notify);\n editor.off('destroy', notify);\n };\n }, [editor]);\n return useSyncExternalStore(subscribe, () => !editor.isDestroyed && editor.isEditable, () => false);\n}\n\nlet renderQueue: Promise<unknown> = Promise.resolve();\n\nfunction renderMermaid(id: string, code: string) {\n const result = renderQueue.then(() => {\n // Capture strict config when rendering starts, not before Mermaid's global queue runs.\n mermaid.initialize({\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'strict',\n suppressErrorRendering: true,\n fontFamily: 'inherit',\n flowchart: { useMaxWidth: true, htmlLabels: false },\n });\n return mermaid.mermaidAPI.render(id, code);\n });\n renderQueue = result.catch(() => undefined);\n return result;\n}\n\nexport const MermaidRenderer: React.FC<{ code: string }> = ({ code }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!containerRef.current) return;\n containerRef.current.replaceChildren();\n if (!code.trim()) return;\n\n let cancelled = false;\n const render = async () => {\n try {\n const id = `mermaid-md-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;\n const { svg } = await renderMermaid(id, code);\n if (!cancelled && containerRef.current) {\n containerRef.current.innerHTML = svg;\n }\n } catch (err) {\n if (!cancelled && containerRef.current) {\n containerRef.current.textContent = String(err);\n }\n }\n };\n render();\n return () => { cancelled = true; };\n }, [code]);\n\n return <div ref={containerRef} className=\"rte-mermaid-container\" />;\n};\n\nconst MarkdownPreview: React.FC<{ content: string }> = ({ content }) => {\n return (\n <ReactMarkdown\n remarkPlugins={[remarkGfm, remarkMath]}\n rehypePlugins={[rehypeKatex]}\n components={{\n code({ className, children, ...props }) {\n const match = /language-(\\w+)/.exec(className || '');\n const lang = match?.[1];\n const text = String(children).replace(/\\n$/, '');\n\n if (lang === 'mermaid') {\n return <MermaidRenderer code={text} />;\n }\n\n if (lang) {\n return (\n <SyntaxHighlighter\n style={oneLight as Record<string, React.CSSProperties>}\n language={lang}\n PreTag=\"div\"\n customStyle={{\n borderRadius: '0.5rem',\n fontSize: '0.875em',\n padding: '1em',\n margin: '0.5em 0',\n }}\n >\n {text}\n </SyntaxHighlighter>\n );\n }\n return <code className={className} {...props}>{children}</code>;\n },\n }}\n >\n {content}\n </ReactMarkdown>\n );\n};\n\nconst MarkdownBlockView: React.FC<NodeViewProps> = ({\n node,\n editor,\n updateAttributes,\n selected,\n}) => {\n const editable = useNodeEditable(editor);\n const [isEditing, setIsEditing] = useState(false);\n const [localContent, setLocalContent] = useState(node.attrs.content || '');\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n setLocalContent(node.attrs.content || '');\n setIsEditing(false);\n }, [node.attrs.content, editable]);\n\n useEffect(() => {\n if (isEditing && textareaRef.current) {\n textareaRef.current.focus();\n adjustTextareaHeight(textareaRef.current);\n }\n }, [isEditing]);\n\n const adjustTextareaHeight = (el: HTMLTextAreaElement) => {\n el.style.height = 'auto';\n el.style.height = el.scrollHeight + 'px';\n };\n\n const handleChange = useCallback((e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setLocalContent(e.target.value);\n adjustTextareaHeight(e.target);\n }, []);\n\n const handleBlur = useCallback(() => {\n if (!editor.isDestroyed && editor.isEditable) updateAttributes({ content: localContent });\n setIsEditing(false);\n }, [editor, localContent, updateAttributes]);\n\n const handleKeyDown = useCallback((e: React.KeyboardEvent) => {\n if (e.key === 'Escape') {\n handleBlur();\n }\n }, [handleBlur]);\n\n const defaultContent = `# Markdown Block\n\nWrite your **markdown** here.\n\n\\`\\`\\`mermaid\ngraph LR\n A[Start] --> B[End]\n\\`\\`\\`\n`;\n\n const displayContent = localContent || defaultContent;\n\n return (\n <NodeViewWrapper contentEditable={false} className={`rte-markdown-block ${selected ? 'rte-markdown-block--selected' : ''}`}>\n <div className=\"rte-markdown-block__header\">\n <span className=\"rte-markdown-block__label\">Markdown</span>\n <button\n type=\"button\"\n className={`rte-markdown-block__toggle ${isEditing ? 'rte-markdown-block__toggle--active' : ''}`}\n disabled={!editable}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n if (editor.isDestroyed || !editor.isEditable) return;\n if (isEditing) {\n updateAttributes({ content: localContent });\n }\n setIsEditing(!isEditing);\n }}\n title={isEditing ? 'Preview' : 'Edit'}\n >\n {isEditing ? (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n ) : (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7\" />\n <path d=\"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z\" />\n </svg>\n )}\n <span>{isEditing ? 'Preview' : 'Edit'}</span>\n </button>\n </div>\n\n <div className=\"rte-markdown-block__body\">\n {isEditing && editable ? (\n <textarea\n ref={textareaRef}\n className=\"rte-markdown-block__editor\"\n value={localContent}\n onChange={handleChange}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n placeholder=\"Enter Markdown content...\"\n rows={5}\n />\n ) : (\n <div\n className=\"rte-markdown-block__preview prose\"\n onDoubleClick={() => { if (!editor.isDestroyed && editor.isEditable) setIsEditing(true); }}\n >\n {displayContent.trim() ? (\n <MarkdownPreview content={displayContent} />\n ) : (\n <p className=\"rte-markdown-block__placeholder\">\n Double-click to edit Markdown content...\n </p>\n )}\n </div>\n )}\n </div>\n </NodeViewWrapper>\n );\n};\n\nexport const MarkdownBlockExtension = Node.create({\n name: 'markdownBlock',\n group: 'block',\n atom: true,\n draggable: true,\n\n addAttributes() {\n return {\n content: {\n default: '',\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-type=\"markdown-block\"]',\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['div', mergeAttributes(HTMLAttributes, { 'data-type': 'markdown-block' })];\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(MarkdownBlockView);\n },\n});\n\nexport default MarkdownBlockExtension;\n"],"mappings":";;;;;;;;;;;;AAcA,SAAgB,EAAgB,GAAiC;CAC/D,IAAM,IAAY,GAAa,OAE7B,EAAO,GAAG,UAAU,CAAM,GAC1B,EAAO,GAAG,eAAe,CAAM,GAC/B,EAAO,GAAG,WAAW,CAAM,SACd;EAGX,AAFA,EAAO,IAAI,UAAU,CAAM,GAC3B,EAAO,IAAI,eAAe,CAAM,GAChC,EAAO,IAAI,WAAW,CAAM;CAC9B,IACC,CAAC,CAAM,CAAC;CAC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;IACX,aAAY;IACZ,MAAM;GACP,CAAA,IAED,kBAAC,OAAD;IACE,WAAU;IACV,qBAAqB;KAAE,AAAI,CAAC,EAAO,eAAe,EAAO,cAAY,EAAa,EAAI;IAAG;IAExF,UAAA,EAAe,KAAK,IACnB,kBAAC,GAAD,EAAiB,SAAS,EAAiB,CAAA,IAE3C,kBAAC,KAAD;KAAG,WAAU;KAAkC,UAAA;IAE5C,CAAA;GAEF,CAAA;EAEJ,CAAA,CACU;;AAErB,GAEa,IAAyB,EAAK,OAAO;CAChD,MAAM;CACN,OAAO;CACP,MAAM;CACN,WAAW;CAEX,gBAAgB;EACd,OAAO,EACL,SAAS,EACP,SAAS,GACX,EACF;CACF;CAEA,YAAY;EACV,OAAO,CACL,EACE,KAAK,oCACP,CACF;CACF;CAEA,WAAW,EAAE,qBAAkB;EAC7B,OAAO,CAAC,OAAO,EAAgB,GAAgB,EAAE,aAAa,iBAAiB,CAAC,CAAC;CACnF;CAEA,cAAc;EACZ,OAAO,EAAsB,CAAiB;CAChD;AACF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { Node } from '@tiptap/pm/model';
|
|
3
|
+
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
4
|
+
export interface SearchMatch {
|
|
5
|
+
from: number;
|
|
6
|
+
to: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SearchState {
|
|
9
|
+
query: string;
|
|
10
|
+
caseSensitive: boolean;
|
|
11
|
+
matches: SearchMatch[];
|
|
12
|
+
active: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function bindSearchShortcuts(editor: Editor, options: {
|
|
15
|
+
contains: (target: globalThis.Node) => boolean;
|
|
16
|
+
isOpen: () => boolean;
|
|
17
|
+
open: () => void;
|
|
18
|
+
close: () => void;
|
|
19
|
+
}): () => void;
|
|
20
|
+
export declare function findSearchMatches(doc: Node, query: string, caseSensitive?: boolean): SearchMatch[];
|
|
21
|
+
export declare function createSearchPlugin(key: PluginKey<SearchState>): Plugin<SearchState>;
|
|
22
|
+
export declare function navigateSearch(editor: Editor, key: PluginKey<SearchState>, direction: number): void;
|
|
23
|
+
export declare function replaceSearch(editor: Editor, key: PluginKey<SearchState>, replacement: string, all?: boolean): boolean;
|