@prosekit/react 0.6.7 → 0.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/{create-component-D8vvwyIA.js → create-component.js} +3 -5
  2. package/dist/create-component.js.map +1 -0
  3. package/dist/{create-props-PUVFMh9y.d.ts → create-props.d.ts} +1 -1
  4. package/dist/create-props.d.ts.map +1 -0
  5. package/dist/{editor-context-DHjS00Fa.js → editor-context.js} +2 -3
  6. package/dist/editor-context.js.map +1 -0
  7. package/dist/prosekit-react-autocomplete.d.ts +1 -1
  8. package/dist/prosekit-react-autocomplete.js +2 -6
  9. package/dist/prosekit-react-autocomplete.js.map +1 -1
  10. package/dist/prosekit-react-block-handle.d.ts +1 -1
  11. package/dist/prosekit-react-block-handle.js +2 -5
  12. package/dist/prosekit-react-block-handle.js.map +1 -1
  13. package/dist/prosekit-react-drop-indicator.d.ts +1 -1
  14. package/dist/prosekit-react-drop-indicator.js +2 -3
  15. package/dist/prosekit-react-drop-indicator.js.map +1 -1
  16. package/dist/prosekit-react-inline-popover.d.ts +1 -1
  17. package/dist/prosekit-react-inline-popover.js +2 -3
  18. package/dist/prosekit-react-inline-popover.js.map +1 -1
  19. package/dist/prosekit-react-popover.d.ts +1 -1
  20. package/dist/prosekit-react-popover.js +2 -5
  21. package/dist/prosekit-react-popover.js.map +1 -1
  22. package/dist/prosekit-react-resizable.d.ts +1 -1
  23. package/dist/prosekit-react-resizable.js +2 -4
  24. package/dist/prosekit-react-resizable.js.map +1 -1
  25. package/dist/prosekit-react-table-handle.d.ts +1 -1
  26. package/dist/prosekit-react-table-handle.js +2 -11
  27. package/dist/prosekit-react-table-handle.js.map +1 -1
  28. package/dist/prosekit-react-tooltip.d.ts +1 -1
  29. package/dist/prosekit-react-tooltip.js +2 -5
  30. package/dist/prosekit-react-tooltip.js.map +1 -1
  31. package/dist/prosekit-react.d.ts +22 -22
  32. package/dist/prosekit-react.d.ts.map +1 -1
  33. package/dist/prosekit-react.js +109 -118
  34. package/dist/prosekit-react.js.map +1 -1
  35. package/package.json +8 -7
  36. package/src/components/autocomplete/autocomplete-empty.gen.ts +4 -4
  37. package/src/components/autocomplete/autocomplete-item.gen.ts +4 -4
  38. package/src/components/autocomplete/autocomplete-list.gen.ts +4 -4
  39. package/src/components/autocomplete/autocomplete-popover.gen.ts +4 -4
  40. package/src/components/autocomplete/index.gen.ts +4 -4
  41. package/src/components/block-handle/block-handle-add.gen.ts +4 -4
  42. package/src/components/block-handle/block-handle-draggable.gen.ts +4 -4
  43. package/src/components/block-handle/block-handle-popover.gen.ts +4 -4
  44. package/src/components/block-handle/index.gen.ts +3 -3
  45. package/src/components/create-component.ts +2 -3
  46. package/src/components/drop-indicator/drop-indicator.gen.ts +4 -4
  47. package/src/components/drop-indicator/index.gen.ts +1 -1
  48. package/src/components/inline-popover/index.gen.ts +1 -1
  49. package/src/components/inline-popover/inline-popover.gen.ts +4 -4
  50. package/src/components/popover/index.gen.ts +3 -3
  51. package/src/components/popover/popover-content.gen.ts +4 -4
  52. package/src/components/popover/popover-root.gen.ts +4 -4
  53. package/src/components/popover/popover-trigger.gen.ts +4 -4
  54. package/src/components/prosekit.ts +5 -9
  55. package/src/components/resizable/index.gen.ts +2 -2
  56. package/src/components/resizable/resizable-handle.gen.ts +4 -4
  57. package/src/components/resizable/resizable-root.gen.ts +4 -4
  58. package/src/components/table-handle/index.gen.ts +9 -9
  59. package/src/components/table-handle/table-handle-column-root.gen.ts +4 -4
  60. package/src/components/table-handle/table-handle-column-trigger.gen.ts +4 -4
  61. package/src/components/table-handle/table-handle-drag-preview.gen.ts +4 -4
  62. package/src/components/table-handle/table-handle-drop-indicator.gen.ts +4 -4
  63. package/src/components/table-handle/table-handle-popover-content.gen.ts +4 -4
  64. package/src/components/table-handle/table-handle-popover-item.gen.ts +4 -4
  65. package/src/components/table-handle/table-handle-root.gen.ts +4 -4
  66. package/src/components/table-handle/table-handle-row-root.gen.ts +4 -4
  67. package/src/components/table-handle/table-handle-row-trigger.gen.ts +4 -4
  68. package/src/components/tooltip/index.gen.ts +3 -3
  69. package/src/components/tooltip/tooltip-content.gen.ts +4 -4
  70. package/src/components/tooltip/tooltip-root.gen.ts +4 -4
  71. package/src/components/tooltip/tooltip-trigger.gen.ts +4 -4
  72. package/src/components/view-renderer.ts +27 -0
  73. package/src/extensions/react-mark-view.ts +29 -37
  74. package/src/extensions/react-node-view.ts +29 -37
  75. package/src/hooks/use-doc-change.ts +2 -2
  76. package/src/hooks/use-editor-derived-value.ts +1 -1
  77. package/src/hooks/use-editor.ts +1 -1
  78. package/src/hooks/use-extension.ts +3 -3
  79. package/src/hooks/use-keymap.ts +1 -1
  80. package/src/hooks/use-state-update.ts +2 -2
  81. package/src/index.ts +10 -10
  82. package/dist/create-component-D8vvwyIA.js.map +0 -1
  83. package/dist/create-props-PUVFMh9y.d.ts.map +0 -1
  84. package/dist/editor-context-DHjS00Fa.js.map +0 -1
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link DropIndicator} component.
19
19
  */
20
20
  export interface DropIndicatorProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const DropIndicator: ForwardRefExoticComponent<
23
23
  DropIndicatorProps &
24
24
  RefAttributes<DropIndicatorElement> &
25
25
  HTMLAttributes<DropIndicatorElement>
26
26
  > = createComponent<
27
- DropIndicatorProps,
27
+ DropIndicatorProps,
28
28
  DropIndicatorElement
29
29
  >(
30
30
  'prosekit-drop-indicator',
@@ -1 +1 @@
1
- export { DropIndicator, type DropIndicatorProps } from './drop-indicator.gen'
1
+ export { DropIndicator, type DropIndicatorProps } from './drop-indicator.gen.ts'
@@ -1 +1 @@
1
- export { InlinePopover, type InlinePopoverProps } from './inline-popover.gen'
1
+ export { InlinePopover, type InlinePopoverProps } from './inline-popover.gen.ts'
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link InlinePopover} component.
19
19
  */
20
20
  export interface InlinePopoverProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const InlinePopover: ForwardRefExoticComponent<
23
23
  InlinePopoverProps &
24
24
  RefAttributes<InlinePopoverElement> &
25
25
  HTMLAttributes<InlinePopoverElement>
26
26
  > = createComponent<
27
- InlinePopoverProps,
27
+ InlinePopoverProps,
28
28
  InlinePopoverElement
29
29
  >(
30
30
  'prosekit-inline-popover',
@@ -1,5 +1,5 @@
1
- export { PopoverContent, type PopoverContentProps } from './popover-content.gen'
1
+ export { PopoverContent, type PopoverContentProps } from './popover-content.gen.ts'
2
2
 
3
- export { PopoverRoot, type PopoverRootProps } from './popover-root.gen'
3
+ export { PopoverRoot, type PopoverRootProps } from './popover-root.gen.ts'
4
4
 
5
- export { PopoverTrigger, type PopoverTriggerProps } from './popover-trigger.gen'
5
+ export { PopoverTrigger, type PopoverTriggerProps } from './popover-trigger.gen.ts'
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link PopoverContent} component.
19
19
  */
20
20
  export interface PopoverContentProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const PopoverContent: ForwardRefExoticComponent<
23
23
  PopoverContentProps &
24
24
  RefAttributes<PopoverContentElement> &
25
25
  HTMLAttributes<PopoverContentElement>
26
26
  > = createComponent<
27
- PopoverContentProps,
27
+ PopoverContentProps,
28
28
  PopoverContentElement
29
29
  >(
30
30
  'prosekit-popover-content',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link PopoverRoot} component.
19
19
  */
20
20
  export interface PopoverRootProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const PopoverRoot: ForwardRefExoticComponent<
23
23
  PopoverRootProps &
24
24
  RefAttributes<PopoverRootElement> &
25
25
  HTMLAttributes<PopoverRootElement>
26
26
  > = createComponent<
27
- PopoverRootProps,
27
+ PopoverRootProps,
28
28
  PopoverRootElement
29
29
  >(
30
30
  'prosekit-popover-root',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link PopoverTrigger} component.
19
19
  */
20
20
  export interface PopoverTriggerProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const PopoverTrigger: ForwardRefExoticComponent<
23
23
  PopoverTriggerProps &
24
24
  RefAttributes<PopoverTriggerElement> &
25
25
  HTMLAttributes<PopoverTriggerElement>
26
26
  > = createComponent<
27
- PopoverTriggerProps,
27
+ PopoverTriggerProps,
28
28
  PopoverTriggerElement
29
29
  >(
30
30
  'prosekit-popover-trigger',
@@ -1,10 +1,9 @@
1
1
  import type { Editor } from '@prosekit/core'
2
- import { ProsemirrorAdapterProvider } from '@prosemirror-adapter/react'
3
2
  import { createElement, type ComponentType, type ReactNode } from 'react'
4
3
 
5
- import { EditorContextProvider } from '../contexts/editor-context'
6
- import { ReactMarkViewConsumer } from '../extensions/react-mark-view'
7
- import { ReactNodeViewConsumer } from '../extensions/react-node-view'
4
+ import { EditorContextProvider } from '../contexts/editor-context.ts'
5
+
6
+ import { ViewRenderer } from './view-renderer.ts'
8
7
 
9
8
  export interface ProseKitProps {
10
9
  editor: Editor
@@ -23,11 +22,8 @@ export const ProseKit: ComponentType<ProseKitProps> = (props) => {
23
22
  EditorContextProvider,
24
23
  { value: editor },
25
24
  createElement(
26
- ProsemirrorAdapterProvider,
27
- null,
28
- createElement(ReactNodeViewConsumer),
29
- createElement(ReactMarkViewConsumer),
30
- children,
25
+ ViewRenderer,
26
+ { editor, children },
31
27
  ),
32
28
  )
33
29
  }
@@ -1,3 +1,3 @@
1
- export { ResizableHandle, type ResizableHandleProps } from './resizable-handle.gen'
1
+ export { ResizableHandle, type ResizableHandleProps } from './resizable-handle.gen.ts'
2
2
 
3
- export { ResizableRoot, type ResizableRootProps } from './resizable-root.gen'
3
+ export { ResizableRoot, type ResizableRootProps } from './resizable-root.gen.ts'
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link ResizableHandle} component.
19
19
  */
20
20
  export interface ResizableHandleProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const ResizableHandle: ForwardRefExoticComponent<
23
23
  ResizableHandleProps &
24
24
  RefAttributes<ResizableHandleElement> &
25
25
  HTMLAttributes<ResizableHandleElement>
26
26
  > = createComponent<
27
- ResizableHandleProps,
27
+ ResizableHandleProps,
28
28
  ResizableHandleElement
29
29
  >(
30
30
  'prosekit-resizable-handle',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link ResizableRoot} component.
19
19
  */
20
20
  export interface ResizableRootProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const ResizableRoot: ForwardRefExoticComponent<
23
23
  ResizableRootProps &
24
24
  RefAttributes<ResizableRootElement> &
25
25
  HTMLAttributes<ResizableRootElement>
26
26
  > = createComponent<
27
- ResizableRootProps,
27
+ ResizableRootProps,
28
28
  ResizableRootElement
29
29
  >(
30
30
  'prosekit-resizable-root',
@@ -1,17 +1,17 @@
1
- export { TableHandleColumnRoot, type TableHandleColumnRootProps } from './table-handle-column-root.gen'
1
+ export { TableHandleColumnRoot, type TableHandleColumnRootProps } from './table-handle-column-root.gen.ts'
2
2
 
3
- export { TableHandleColumnTrigger, type TableHandleColumnTriggerProps } from './table-handle-column-trigger.gen'
3
+ export { TableHandleColumnTrigger, type TableHandleColumnTriggerProps } from './table-handle-column-trigger.gen.ts'
4
4
 
5
- export { TableHandleDragPreview, type TableHandleDragPreviewProps } from './table-handle-drag-preview.gen'
5
+ export { TableHandleDragPreview, type TableHandleDragPreviewProps } from './table-handle-drag-preview.gen.ts'
6
6
 
7
- export { TableHandleDropIndicator, type TableHandleDropIndicatorProps } from './table-handle-drop-indicator.gen'
7
+ export { TableHandleDropIndicator, type TableHandleDropIndicatorProps } from './table-handle-drop-indicator.gen.ts'
8
8
 
9
- export { TableHandlePopoverContent, type TableHandlePopoverContentProps } from './table-handle-popover-content.gen'
9
+ export { TableHandlePopoverContent, type TableHandlePopoverContentProps } from './table-handle-popover-content.gen.ts'
10
10
 
11
- export { TableHandlePopoverItem, type TableHandlePopoverItemProps } from './table-handle-popover-item.gen'
11
+ export { TableHandlePopoverItem, type TableHandlePopoverItemProps } from './table-handle-popover-item.gen.ts'
12
12
 
13
- export { TableHandleRoot, type TableHandleRootProps } from './table-handle-root.gen'
13
+ export { TableHandleRoot, type TableHandleRootProps } from './table-handle-root.gen.ts'
14
14
 
15
- export { TableHandleRowRoot, type TableHandleRowRootProps } from './table-handle-row-root.gen'
15
+ export { TableHandleRowRoot, type TableHandleRowRootProps } from './table-handle-row-root.gen.ts'
16
16
 
17
- export { TableHandleRowTrigger, type TableHandleRowTriggerProps } from './table-handle-row-trigger.gen'
17
+ export { TableHandleRowTrigger, type TableHandleRowTriggerProps } from './table-handle-row-trigger.gen.ts'
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandleColumnRoot} component.
19
19
  */
20
20
  export interface TableHandleColumnRootProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandleColumnRoot: ForwardRefExoticComponent<
23
23
  TableHandleColumnRootProps &
24
24
  RefAttributes<TableHandleColumnRootElement> &
25
25
  HTMLAttributes<TableHandleColumnRootElement>
26
26
  > = createComponent<
27
- TableHandleColumnRootProps,
27
+ TableHandleColumnRootProps,
28
28
  TableHandleColumnRootElement
29
29
  >(
30
30
  'prosekit-table-handle-column-root',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandleColumnTrigger} component.
19
19
  */
20
20
  export interface TableHandleColumnTriggerProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandleColumnTrigger: ForwardRefExoticComponent<
23
23
  TableHandleColumnTriggerProps &
24
24
  RefAttributes<TableHandleColumnTriggerElement> &
25
25
  HTMLAttributes<TableHandleColumnTriggerElement>
26
26
  > = createComponent<
27
- TableHandleColumnTriggerProps,
27
+ TableHandleColumnTriggerProps,
28
28
  TableHandleColumnTriggerElement
29
29
  >(
30
30
  'prosekit-table-handle-column-trigger',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandleDragPreview} component.
19
19
  */
20
20
  export interface TableHandleDragPreviewProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandleDragPreview: ForwardRefExoticComponent<
23
23
  TableHandleDragPreviewProps &
24
24
  RefAttributes<TableHandleDragPreviewElement> &
25
25
  HTMLAttributes<TableHandleDragPreviewElement>
26
26
  > = createComponent<
27
- TableHandleDragPreviewProps,
27
+ TableHandleDragPreviewProps,
28
28
  TableHandleDragPreviewElement
29
29
  >(
30
30
  'prosekit-table-handle-drag-preview',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandleDropIndicator} component.
19
19
  */
20
20
  export interface TableHandleDropIndicatorProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandleDropIndicator: ForwardRefExoticComponent<
23
23
  TableHandleDropIndicatorProps &
24
24
  RefAttributes<TableHandleDropIndicatorElement> &
25
25
  HTMLAttributes<TableHandleDropIndicatorElement>
26
26
  > = createComponent<
27
- TableHandleDropIndicatorProps,
27
+ TableHandleDropIndicatorProps,
28
28
  TableHandleDropIndicatorElement
29
29
  >(
30
30
  'prosekit-table-handle-drop-indicator',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandlePopoverContent} component.
19
19
  */
20
20
  export interface TableHandlePopoverContentProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandlePopoverContent: ForwardRefExoticComponent<
23
23
  TableHandlePopoverContentProps &
24
24
  RefAttributes<TableHandlePopoverContentElement> &
25
25
  HTMLAttributes<TableHandlePopoverContentElement>
26
26
  > = createComponent<
27
- TableHandlePopoverContentProps,
27
+ TableHandlePopoverContentProps,
28
28
  TableHandlePopoverContentElement
29
29
  >(
30
30
  'prosekit-table-handle-popover-content',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandlePopoverItem} component.
19
19
  */
20
20
  export interface TableHandlePopoverItemProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandlePopoverItem: ForwardRefExoticComponent<
23
23
  TableHandlePopoverItemProps &
24
24
  RefAttributes<TableHandlePopoverItemElement> &
25
25
  HTMLAttributes<TableHandlePopoverItemElement>
26
26
  > = createComponent<
27
- TableHandlePopoverItemProps,
27
+ TableHandlePopoverItemProps,
28
28
  TableHandlePopoverItemElement
29
29
  >(
30
30
  'prosekit-table-handle-popover-item',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandleRoot} component.
19
19
  */
20
20
  export interface TableHandleRootProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandleRoot: ForwardRefExoticComponent<
23
23
  TableHandleRootProps &
24
24
  RefAttributes<TableHandleRootElement> &
25
25
  HTMLAttributes<TableHandleRootElement>
26
26
  > = createComponent<
27
- TableHandleRootProps,
27
+ TableHandleRootProps,
28
28
  TableHandleRootElement
29
29
  >(
30
30
  'prosekit-table-handle-root',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandleRowRoot} component.
19
19
  */
20
20
  export interface TableHandleRowRootProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandleRowRoot: ForwardRefExoticComponent<
23
23
  TableHandleRowRootProps &
24
24
  RefAttributes<TableHandleRowRootElement> &
25
25
  HTMLAttributes<TableHandleRowRootElement>
26
26
  > = createComponent<
27
- TableHandleRowRootProps,
27
+ TableHandleRowRootProps,
28
28
  TableHandleRowRootElement
29
29
  >(
30
30
  'prosekit-table-handle-row-root',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TableHandleRowTrigger} component.
19
19
  */
20
20
  export interface TableHandleRowTriggerProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TableHandleRowTrigger: ForwardRefExoticComponent<
23
23
  TableHandleRowTriggerProps &
24
24
  RefAttributes<TableHandleRowTriggerElement> &
25
25
  HTMLAttributes<TableHandleRowTriggerElement>
26
26
  > = createComponent<
27
- TableHandleRowTriggerProps,
27
+ TableHandleRowTriggerProps,
28
28
  TableHandleRowTriggerElement
29
29
  >(
30
30
  'prosekit-table-handle-row-trigger',
@@ -1,5 +1,5 @@
1
- export { TooltipContent, type TooltipContentProps } from './tooltip-content.gen'
1
+ export { TooltipContent, type TooltipContentProps } from './tooltip-content.gen.ts'
2
2
 
3
- export { TooltipRoot, type TooltipRootProps } from './tooltip-root.gen'
3
+ export { TooltipRoot, type TooltipRootProps } from './tooltip-root.gen.ts'
4
4
 
5
- export { TooltipTrigger, type TooltipTriggerProps } from './tooltip-trigger.gen'
5
+ export { TooltipTrigger, type TooltipTriggerProps } from './tooltip-trigger.gen.ts'
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TooltipContent} component.
19
19
  */
20
20
  export interface TooltipContentProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TooltipContent: ForwardRefExoticComponent<
23
23
  TooltipContentProps &
24
24
  RefAttributes<TooltipContentElement> &
25
25
  HTMLAttributes<TooltipContentElement>
26
26
  > = createComponent<
27
- TooltipContentProps,
27
+ TooltipContentProps,
28
28
  TooltipContentElement
29
29
  >(
30
30
  'prosekit-tooltip-content',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TooltipRoot} component.
19
19
  */
20
20
  export interface TooltipRootProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TooltipRoot: ForwardRefExoticComponent<
23
23
  TooltipRootProps &
24
24
  RefAttributes<TooltipRootElement> &
25
25
  HTMLAttributes<TooltipRootElement>
26
26
  > = createComponent<
27
- TooltipRootProps,
27
+ TooltipRootProps,
28
28
  TooltipRootElement
29
29
  >(
30
30
  'prosekit-tooltip-root',
@@ -11,20 +11,20 @@ import type {
11
11
  RefAttributes,
12
12
  } from 'react'
13
13
 
14
- import { createComponent } from '../create-component'
15
- import type { CreateProps } from '../create-props'
14
+ import { createComponent } from '../create-component.ts'
15
+ import type { CreateProps } from '../create-props.ts'
16
16
 
17
17
  /**
18
18
  * Props for the {@link TooltipTrigger} component.
19
19
  */
20
20
  export interface TooltipTriggerProps extends Partial<CreateProps<Props, Events>> {}
21
-
21
+
22
22
  export const TooltipTrigger: ForwardRefExoticComponent<
23
23
  TooltipTriggerProps &
24
24
  RefAttributes<TooltipTriggerElement> &
25
25
  HTMLAttributes<TooltipTriggerElement>
26
26
  > = createComponent<
27
- TooltipTriggerProps,
27
+ TooltipTriggerProps,
28
28
  TooltipTriggerElement
29
29
  >(
30
30
  'prosekit-tooltip-trigger',
@@ -0,0 +1,27 @@
1
+ import { union, type Editor } from '@prosekit/core'
2
+ import { useReactRenderer } from '@prosemirror-adapter/react'
3
+ import { createElement, Fragment, useMemo, type ComponentType, type ReactNode } from 'react'
4
+
5
+ import { defineReactMarkViewFactory } from '../extensions/react-mark-view.ts'
6
+ import { defineReactNodeViewFactory } from '../extensions/react-node-view.ts'
7
+ import { useEditorExtension } from '../hooks/use-editor-extension.ts'
8
+
9
+ interface ViewRendererProps {
10
+ editor: Editor
11
+ children: ReactNode
12
+ }
13
+
14
+ export const ViewRenderer: ComponentType<ViewRendererProps> = ({ editor, children }): ReactNode => {
15
+ const { renderReactRenderer, removeReactRenderer, render } = useReactRenderer()
16
+
17
+ const extension = useMemo(() => {
18
+ return union([
19
+ defineReactMarkViewFactory(renderReactRenderer, removeReactRenderer),
20
+ defineReactNodeViewFactory(renderReactRenderer, removeReactRenderer),
21
+ ])
22
+ }, [renderReactRenderer, removeReactRenderer])
23
+
24
+ useEditorExtension(editor, extension)
25
+
26
+ return createElement(Fragment, null, createElement(Fragment, null, children), createElement(Fragment, null, render()))
27
+ }