@prosekit/solid 0.6.6 → 0.6.8
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/{create-component-B7NzEJxP.js → create-component.js} +3 -4
- package/dist/create-component.js.map +1 -0
- package/dist/{create-props-CFK4CtjG.d.ts → create-props.d.ts} +1 -1
- package/dist/create-props.d.ts.map +1 -0
- package/dist/{editor-context-CAdqwRwB.js → editor-context.js} +2 -3
- package/dist/editor-context.js.map +1 -0
- package/dist/prosekit-solid-autocomplete.d.ts +2 -2
- package/dist/prosekit-solid-autocomplete.js +2 -6
- package/dist/prosekit-solid-autocomplete.js.map +1 -1
- package/dist/prosekit-solid-block-handle.d.ts +2 -2
- package/dist/prosekit-solid-block-handle.js +2 -5
- package/dist/prosekit-solid-block-handle.js.map +1 -1
- package/dist/prosekit-solid-drop-indicator.d.ts +2 -2
- package/dist/prosekit-solid-drop-indicator.js +2 -3
- package/dist/prosekit-solid-drop-indicator.js.map +1 -1
- package/dist/prosekit-solid-inline-popover.d.ts +2 -2
- package/dist/prosekit-solid-inline-popover.js +2 -3
- package/dist/prosekit-solid-inline-popover.js.map +1 -1
- package/dist/prosekit-solid-popover.d.ts +2 -2
- package/dist/prosekit-solid-popover.js +2 -5
- package/dist/prosekit-solid-popover.js.map +1 -1
- package/dist/prosekit-solid-resizable.d.ts +2 -2
- package/dist/prosekit-solid-resizable.js +2 -4
- package/dist/prosekit-solid-resizable.js.map +1 -1
- package/dist/prosekit-solid-table-handle.d.ts +2 -2
- package/dist/prosekit-solid-table-handle.js +2 -11
- package/dist/prosekit-solid-table-handle.js.map +1 -1
- package/dist/prosekit-solid-tooltip.d.ts +2 -2
- package/dist/prosekit-solid-tooltip.js +2 -5
- package/dist/prosekit-solid-tooltip.js.map +1 -1
- package/dist/prosekit-solid.d.ts +18 -18
- package/dist/prosekit-solid.d.ts.map +1 -1
- package/dist/prosekit-solid.js +115 -140
- package/dist/prosekit-solid.js.map +1 -1
- package/dist/{types-Bx9mKDTJ.d.ts → types.d.ts} +1 -1
- package/dist/types.d.ts.map +1 -0
- package/package.json +7 -6
- package/src/components/autocomplete/autocomplete-empty.gen.ts +3 -3
- package/src/components/autocomplete/autocomplete-item.gen.ts +3 -3
- package/src/components/autocomplete/autocomplete-list.gen.ts +3 -3
- package/src/components/autocomplete/autocomplete-popover.gen.ts +3 -3
- package/src/components/autocomplete/index.gen.ts +4 -4
- package/src/components/block-handle/block-handle-add.gen.ts +3 -3
- package/src/components/block-handle/block-handle-draggable.gen.ts +3 -3
- package/src/components/block-handle/block-handle-popover.gen.ts +3 -3
- package/src/components/block-handle/index.gen.ts +3 -3
- package/src/components/create-component.ts +2 -2
- package/src/components/drop-indicator/drop-indicator.gen.ts +3 -3
- package/src/components/drop-indicator/index.gen.ts +1 -1
- package/src/components/inline-popover/index.gen.ts +1 -1
- package/src/components/inline-popover/inline-popover.gen.ts +3 -3
- package/src/components/popover/index.gen.ts +3 -3
- package/src/components/popover/popover-content.gen.ts +3 -3
- package/src/components/popover/popover-root.gen.ts +3 -3
- package/src/components/popover/popover-trigger.gen.ts +3 -3
- package/src/components/prosekit.ts +7 -7
- package/src/components/resizable/index.gen.ts +2 -2
- package/src/components/resizable/resizable-handle.gen.ts +3 -3
- package/src/components/resizable/resizable-root.gen.ts +3 -3
- package/src/components/table-handle/index.gen.ts +9 -9
- package/src/components/table-handle/table-handle-column-root.gen.ts +3 -3
- package/src/components/table-handle/table-handle-column-trigger.gen.ts +3 -3
- package/src/components/table-handle/table-handle-drag-preview.gen.ts +3 -3
- package/src/components/table-handle/table-handle-drop-indicator.gen.ts +3 -3
- package/src/components/table-handle/table-handle-popover-content.gen.ts +3 -3
- package/src/components/table-handle/table-handle-popover-item.gen.ts +3 -3
- package/src/components/table-handle/table-handle-root.gen.ts +3 -3
- package/src/components/table-handle/table-handle-row-root.gen.ts +3 -3
- package/src/components/table-handle/table-handle-row-trigger.gen.ts +3 -3
- package/src/components/tooltip/index.gen.ts +3 -3
- package/src/components/tooltip/tooltip-content.gen.ts +3 -3
- package/src/components/tooltip/tooltip-root.gen.ts +3 -3
- package/src/components/tooltip/tooltip-trigger.gen.ts +3 -3
- package/src/components/view-renderer.ts +24 -0
- package/src/extensions/helpers.ts +4 -0
- package/src/extensions/solid-mark-view.ts +29 -49
- package/src/extensions/solid-node-view.ts +29 -64
- package/src/hooks/use-doc-change.ts +1 -1
- package/src/hooks/use-editor-derived-value.ts +3 -3
- package/src/hooks/use-editor-extension.ts +3 -3
- package/src/hooks/use-editor.ts +1 -1
- package/src/hooks/use-extension.ts +3 -3
- package/src/hooks/use-keymap.ts +1 -1
- package/src/hooks/use-state-update.ts +1 -1
- package/src/index.ts +10 -10
- package/dist/create-component-B7NzEJxP.js.map +0 -1
- package/dist/create-props-CFK4CtjG.d.ts.map +0 -1
- package/dist/editor-context-CAdqwRwB.js.map +0 -1
- package/dist/types-Bx9mKDTJ.d.ts.map +0 -1
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/popover'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link PopoverContent} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/popover'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link PopoverRoot} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/popover'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link PopoverTrigger} component.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Editor } from '@prosekit/core'
|
|
2
|
-
import { ProsemirrorAdapterProvider } from '@prosemirror-adapter/solid'
|
|
3
2
|
import { createComponent, type Component, type ParentProps } from 'solid-js'
|
|
4
3
|
|
|
5
|
-
import { EditorContextProvider } from '../contexts/editor-context'
|
|
6
|
-
|
|
7
|
-
import {
|
|
4
|
+
import { EditorContextProvider } from '../contexts/editor-context.ts'
|
|
5
|
+
|
|
6
|
+
import { ViewRenderer } from './view-renderer.ts'
|
|
8
7
|
|
|
9
8
|
export type ProseKitProps = ParentProps<{
|
|
10
9
|
editor: Editor
|
|
@@ -21,10 +20,11 @@ export const ProseKit: Component<ProseKitProps> = (props) => {
|
|
|
21
20
|
return props.editor
|
|
22
21
|
},
|
|
23
22
|
get children() {
|
|
24
|
-
return createComponent(
|
|
23
|
+
return createComponent(ViewRenderer, {
|
|
24
|
+
get editor() {
|
|
25
|
+
return props.editor
|
|
26
|
+
},
|
|
25
27
|
get children() {
|
|
26
|
-
consumeSolidNodeViews()
|
|
27
|
-
consumeSolidMarkViews()
|
|
28
28
|
return props.children
|
|
29
29
|
},
|
|
30
30
|
})
|
|
@@ -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'
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/resizable'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link ResizableHandle} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/resizable'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link ResizableRoot} component.
|
|
@@ -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'
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandleColumnRoot} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandleColumnTrigger} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandleDragPreview} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandleDropIndicator} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandlePopoverContent} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandlePopoverItem} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandleRoot} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandleRowRoot} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/table-handle'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TableHandleRowTrigger} component.
|
|
@@ -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'
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/tooltip'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TooltipContent} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/tooltip'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TooltipRoot} component.
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
} from '@prosekit/web/tooltip'
|
|
8
8
|
import type { Component } from 'solid-js'
|
|
9
9
|
|
|
10
|
-
import type { PropsWithElement } from '../../types'
|
|
11
|
-
import { createComponent } from '../create-component'
|
|
12
|
-
import type { CreateProps } from '../create-props'
|
|
10
|
+
import type { PropsWithElement } from '../../types.ts'
|
|
11
|
+
import { createComponent } from '../create-component.ts'
|
|
12
|
+
import type { CreateProps } from '../create-props.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Props for the {@link TooltipTrigger} component.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { union, type Editor } from '@prosekit/core'
|
|
2
|
+
import { useSolidRenderer } from '@prosemirror-adapter/solid'
|
|
3
|
+
import type { Component, JSX, ParentProps } from 'solid-js'
|
|
4
|
+
|
|
5
|
+
import { defineSolidMarkViewFactory } from '../extensions/solid-mark-view.ts'
|
|
6
|
+
import { defineSolidNodeViewFactory } from '../extensions/solid-node-view.ts'
|
|
7
|
+
import { useEditorExtension } from '../hooks/use-editor-extension.ts'
|
|
8
|
+
|
|
9
|
+
type ViewRendererProps = ParentProps<{
|
|
10
|
+
editor: Editor
|
|
11
|
+
}>
|
|
12
|
+
|
|
13
|
+
export const ViewRenderer: Component<ViewRendererProps> = (props): JSX.Element => {
|
|
14
|
+
const { renderSolidRenderer, removeSolidRenderer, render } = useSolidRenderer()
|
|
15
|
+
|
|
16
|
+
const extension = union([
|
|
17
|
+
defineSolidMarkViewFactory(renderSolidRenderer, removeSolidRenderer),
|
|
18
|
+
defineSolidNodeViewFactory(renderSolidRenderer, removeSolidRenderer),
|
|
19
|
+
])
|
|
20
|
+
|
|
21
|
+
useEditorExtension(() => props.editor, () => extension)
|
|
22
|
+
|
|
23
|
+
return [props.children, render] as unknown as JSX.Element
|
|
24
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { defineMarkViewComponent, defineMarkViewFactory, type Extension } from '@prosekit/core'
|
|
2
|
-
import type { MarkViewConstructor } from '@prosekit/pm/view'
|
|
3
2
|
import type { CoreMarkViewUserOptions } from '@prosemirror-adapter/core'
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
AbstractSolidMarkView,
|
|
5
|
+
buildSolidMarkViewCreator,
|
|
7
6
|
type MarkViewContextProps,
|
|
8
|
-
type
|
|
7
|
+
type SolidRendererResult,
|
|
9
8
|
} from '@prosemirror-adapter/solid'
|
|
10
|
-
import { createComponent,
|
|
9
|
+
import { createComponent, type Component, type JSX } from 'solid-js'
|
|
10
|
+
import { Portal } from 'solid-js/web'
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { hidePortalDiv } from './helpers.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @public
|
|
@@ -33,37 +33,33 @@ export interface SolidMarkViewOptions extends CoreMarkViewUserOptions<SolidMarkV
|
|
|
33
33
|
name: string
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
get
|
|
43
|
-
|
|
36
|
+
class ProseKitSolidMarkView extends AbstractSolidMarkView<SolidMarkViewComponent> {
|
|
37
|
+
render = (): JSX.Element => {
|
|
38
|
+
const UserComponent = this.component
|
|
39
|
+
const getProps = this.context
|
|
40
|
+
return createComponent(Portal, {
|
|
41
|
+
mount: this.dom,
|
|
42
|
+
get children() {
|
|
43
|
+
const props: MarkViewContextProps = getProps()
|
|
44
|
+
return createComponent(UserComponent, props)
|
|
44
45
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
get mark() {
|
|
49
|
-
return context().mark
|
|
50
|
-
},
|
|
51
|
-
}
|
|
52
|
-
return createComponent(component, props)
|
|
46
|
+
ref: hidePortalDiv,
|
|
47
|
+
})
|
|
53
48
|
}
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
/**
|
|
57
52
|
* @internal
|
|
58
53
|
*/
|
|
59
|
-
export function
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
54
|
+
export function defineSolidMarkViewFactory(
|
|
55
|
+
renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],
|
|
56
|
+
removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],
|
|
57
|
+
): Extension {
|
|
58
|
+
const factory = buildSolidMarkViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidMarkView)
|
|
59
|
+
return defineMarkViewFactory<SolidMarkViewOptions>({
|
|
60
|
+
group: 'solid',
|
|
61
|
+
factory,
|
|
62
|
+
})
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
/**
|
|
@@ -72,25 +68,9 @@ export function consumeSolidMarkViews(): void {
|
|
|
72
68
|
* @public
|
|
73
69
|
*/
|
|
74
70
|
export function defineSolidMarkView(options: SolidMarkViewOptions): Extension {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const args: SolidMarkViewUserOptions = {
|
|
78
|
-
...userOptions,
|
|
79
|
-
component: withMarkViewProps(component),
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return defineMarkViewComponent<SolidMarkViewUserOptions>({
|
|
83
|
-
group: 'solid',
|
|
84
|
-
name,
|
|
85
|
-
args,
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function defineSolidMarkViewFactory(
|
|
90
|
-
factory: (options: SolidMarkViewOptions) => MarkViewConstructor,
|
|
91
|
-
) {
|
|
92
|
-
return defineMarkViewFactory<SolidMarkViewOptions>({
|
|
71
|
+
return defineMarkViewComponent<SolidMarkViewOptions>({
|
|
93
72
|
group: 'solid',
|
|
94
|
-
|
|
73
|
+
name: options.name,
|
|
74
|
+
args: options,
|
|
95
75
|
})
|
|
96
76
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { defineNodeViewComponent, defineNodeViewFactory, type Extension } from '@prosekit/core'
|
|
2
|
-
import type { NodeViewConstructor } from '@prosekit/pm/view'
|
|
3
2
|
import type { CoreNodeViewUserOptions } from '@prosemirror-adapter/core'
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
AbstractSolidNodeView,
|
|
5
|
+
buildSolidNodeViewCreator,
|
|
7
6
|
type NodeViewContextProps,
|
|
8
|
-
type
|
|
7
|
+
type SolidRendererResult,
|
|
9
8
|
} from '@prosemirror-adapter/solid'
|
|
10
|
-
import { createComponent,
|
|
9
|
+
import { createComponent, type Component, type JSX } from 'solid-js'
|
|
10
|
+
import { Portal } from 'solid-js/web'
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { hidePortalDiv } from './helpers.ts'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @public
|
|
@@ -33,52 +33,33 @@ export interface SolidNodeViewOptions extends CoreNodeViewUserOptions<SolidNodeV
|
|
|
33
33
|
name: string
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
get
|
|
43
|
-
|
|
36
|
+
class ProseKitSolidNodeView extends AbstractSolidNodeView<SolidNodeViewComponent> {
|
|
37
|
+
render = (): JSX.Element => {
|
|
38
|
+
const UserComponent = this.component
|
|
39
|
+
const getProps = this.context
|
|
40
|
+
return createComponent(Portal, {
|
|
41
|
+
mount: this.dom,
|
|
42
|
+
get children() {
|
|
43
|
+
const props: SolidNodeViewProps = getProps()
|
|
44
|
+
return createComponent(UserComponent, props)
|
|
44
45
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
get getPos() {
|
|
49
|
-
return context().getPos
|
|
50
|
-
},
|
|
51
|
-
get setAttrs() {
|
|
52
|
-
return context().setAttrs
|
|
53
|
-
},
|
|
54
|
-
get node() {
|
|
55
|
-
return context().node
|
|
56
|
-
},
|
|
57
|
-
get selected() {
|
|
58
|
-
return context().selected
|
|
59
|
-
},
|
|
60
|
-
get decorations() {
|
|
61
|
-
return context().decorations
|
|
62
|
-
},
|
|
63
|
-
get innerDecorations() {
|
|
64
|
-
return context().innerDecorations
|
|
65
|
-
},
|
|
66
|
-
}
|
|
67
|
-
return createComponent(component, props)
|
|
46
|
+
ref: hidePortalDiv,
|
|
47
|
+
})
|
|
68
48
|
}
|
|
69
49
|
}
|
|
70
50
|
|
|
71
51
|
/**
|
|
72
52
|
* @internal
|
|
73
53
|
*/
|
|
74
|
-
export function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
54
|
+
export function defineSolidNodeViewFactory(
|
|
55
|
+
renderSolidRenderer: SolidRendererResult['renderSolidRenderer'],
|
|
56
|
+
removeSolidRenderer: SolidRendererResult['removeSolidRenderer'],
|
|
57
|
+
): Extension {
|
|
58
|
+
const factory = buildSolidNodeViewCreator(renderSolidRenderer, removeSolidRenderer, ProseKitSolidNodeView)
|
|
59
|
+
return defineNodeViewFactory<SolidNodeViewOptions>({
|
|
60
|
+
group: 'solid',
|
|
61
|
+
factory,
|
|
62
|
+
})
|
|
82
63
|
}
|
|
83
64
|
|
|
84
65
|
/**
|
|
@@ -87,25 +68,9 @@ export function consumeSolidNodeViews(): void {
|
|
|
87
68
|
* @public
|
|
88
69
|
*/
|
|
89
70
|
export function defineSolidNodeView(options: SolidNodeViewOptions): Extension {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const args: SolidNodeViewUserOptions = {
|
|
93
|
-
...userOptions,
|
|
94
|
-
component: withNodeViewProps(component),
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return defineNodeViewComponent<SolidNodeViewUserOptions>({
|
|
98
|
-
group: 'solid',
|
|
99
|
-
name,
|
|
100
|
-
args,
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function defineSolidNodeViewFactory(
|
|
105
|
-
factory: (options: SolidNodeViewOptions) => NodeViewConstructor,
|
|
106
|
-
) {
|
|
107
|
-
return defineNodeViewFactory<SolidNodeViewOptions>({
|
|
71
|
+
return defineNodeViewComponent<SolidNodeViewOptions>({
|
|
108
72
|
group: 'solid',
|
|
109
|
-
|
|
73
|
+
name: options.name,
|
|
74
|
+
args: options,
|
|
110
75
|
})
|
|
111
76
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineDocChangeHandler } from '@prosekit/core'
|
|
2
2
|
import type { ProseMirrorNode } from '@prosekit/pm/model'
|
|
3
3
|
|
|
4
|
-
import { useExtension, type UseExtensionOptions } from './use-extension'
|
|
4
|
+
import { useExtension, type UseExtensionOptions } from './use-extension.ts'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Calls the given handler whenever the editor document changes.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Editor, Extension } from '@prosekit/core'
|
|
2
2
|
import { createMemo, type Accessor } from 'solid-js'
|
|
3
3
|
|
|
4
|
-
import type { MaybeAccessor } from '../types'
|
|
5
|
-
import { toValue } from '../utils/to-value'
|
|
4
|
+
import type { MaybeAccessor } from '../types.ts'
|
|
5
|
+
import { toValue } from '../utils/to-value.ts'
|
|
6
6
|
|
|
7
|
-
import { useEditor } from './use-editor'
|
|
7
|
+
import { useEditor } from './use-editor.ts'
|
|
8
8
|
|
|
9
9
|
export interface UseEditorDerivedOptions<E extends Extension = any> {
|
|
10
10
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EditorNotFoundError, type Editor, type Extension } from '@prosekit/core'
|
|
2
2
|
import { createEffect, onCleanup, type Accessor } from 'solid-js'
|
|
3
3
|
|
|
4
|
-
import { useEditorContext } from '../contexts/editor-context'
|
|
5
|
-
import type { MaybeAccessor } from '../types'
|
|
6
|
-
import { toValue } from '../utils/to-value'
|
|
4
|
+
import { useEditorContext } from '../contexts/editor-context.ts'
|
|
5
|
+
import type { MaybeAccessor } from '../types.ts'
|
|
6
|
+
import { toValue } from '../utils/to-value.ts'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
package/src/hooks/use-editor.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineMountHandler, defineUpdateHandler, ProseKitError, union, type Editor, type Extension } from '@prosekit/core'
|
|
2
2
|
import { createEffect, createSignal } from 'solid-js'
|
|
3
3
|
|
|
4
|
-
import { useEditorContext } from '../contexts/editor-context'
|
|
4
|
+
import { useEditorContext } from '../contexts/editor-context.ts'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Retrieves the editor instance from the nearest ProseKit component.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Editor, Extension, Priority } from '@prosekit/core'
|
|
2
2
|
import type { Accessor } from 'solid-js'
|
|
3
3
|
|
|
4
|
-
import type { MaybeAccessor } from '../types'
|
|
4
|
+
import type { MaybeAccessor } from '../types.ts'
|
|
5
5
|
|
|
6
|
-
import { useEditorExtension } from './use-editor-extension'
|
|
7
|
-
import { usePriorityExtension } from './use-priority-extension'
|
|
6
|
+
import { useEditorExtension } from './use-editor-extension.ts'
|
|
7
|
+
import { usePriorityExtension } from './use-priority-extension.ts'
|
|
8
8
|
|
|
9
9
|
export interface UseExtensionOptions {
|
|
10
10
|
/**
|