@octanejs/tiptap 0.0.55 → 0.0.56
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/package.json +5 -5
- package/src/Context.tsrx +14 -15
- package/src/EditorContent.tsrx +1 -1
- package/src/Tiptap.tsrx +14 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/tiptap",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
"@tiptap/extension-floating-menu": "3.28.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"octane": "^0.
|
|
59
|
+
"octane": "^0.11.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@octanejs/testing-library": "0.1.
|
|
62
|
+
"@octanejs/testing-library": "0.1.61",
|
|
63
63
|
"@testing-library/jest-dom": "^6.9.1",
|
|
64
64
|
"@testing-library/react": "16.3.2",
|
|
65
65
|
"@tiptap/react": "3.28.0",
|
|
66
66
|
"@tiptap/starter-kit": "3.28.0",
|
|
67
|
-
"@tsrx/react": "^0.
|
|
67
|
+
"@tsrx/react": "^0.4.5",
|
|
68
68
|
"esbuild": "^0.28.1",
|
|
69
|
-
"octane": "0.
|
|
69
|
+
"octane": "0.11.0",
|
|
70
70
|
"playwright": "^1.61.1",
|
|
71
71
|
"react": "19.2.7",
|
|
72
72
|
"react-dom": "19.2.7",
|
package/src/Context.tsrx
CHANGED
|
@@ -25,20 +25,18 @@ export interface EditorConsumerProps {
|
|
|
25
25
|
children: (value: EditorContextValue) => OctaneNode;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export type EditorContainerProps =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
28
|
+
export type EditorContainerProps = Omit<EditorContentProps, 'editor' | 'innerRef' | 'ref'> & {
|
|
29
|
+
editor?: never;
|
|
30
|
+
innerRef?: never;
|
|
31
|
+
ref?: never;
|
|
32
|
+
};
|
|
34
33
|
|
|
35
|
-
export type EditorProviderProps =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
34
|
+
export type EditorProviderProps = UseEditorOptions & {
|
|
35
|
+
children?: OctaneNode;
|
|
36
|
+
slotBefore?: OctaneNode;
|
|
37
|
+
slotAfter?: OctaneNode;
|
|
38
|
+
editorContainerProps?: EditorContainerProps;
|
|
39
|
+
};
|
|
42
40
|
|
|
43
41
|
export function EditorConsumer(props: EditorConsumerProps): OctaneNode {
|
|
44
42
|
const value = useCurrentEditor();
|
|
@@ -66,8 +64,9 @@ export function EditorProvider(props: EditorProviderProps) @{
|
|
|
66
64
|
<EditorContext value={contextValue}>
|
|
67
65
|
{slotBefore}
|
|
68
66
|
<EditorConsumer>
|
|
69
|
-
{({ editor: currentEditor }: EditorContextValue) =>
|
|
70
|
-
<EditorContent {...editorContainerProps} editor={currentEditor} />
|
|
67
|
+
{({ editor: currentEditor }: EditorContextValue) => (
|
|
68
|
+
<EditorContent {...editorContainerProps} editor={currentEditor} />
|
|
69
|
+
)}
|
|
71
70
|
</EditorConsumer>
|
|
72
71
|
{children}
|
|
73
72
|
{slotAfter}
|
package/src/EditorContent.tsrx
CHANGED
|
@@ -161,7 +161,7 @@ export function PureEditorContent(props: EditorContentProps) @{
|
|
|
161
161
|
|
|
162
162
|
<>
|
|
163
163
|
<div
|
|
164
|
-
{...rest as typeof rest & { ref?: undefined }}
|
|
164
|
+
{...(rest as typeof rest & { ref?: undefined })}
|
|
165
165
|
ref={[ref ?? null, innerRef ?? null, editorContentRef]}
|
|
166
166
|
/>
|
|
167
167
|
@if (contentComponent) {
|
package/src/Tiptap.tsrx
CHANGED
|
@@ -25,16 +25,14 @@ export type TiptapWrapperEditorInstanceProps =
|
|
|
25
25
|
instance: Editor;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export type TiptapWrapperProps =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
28
|
+
export type TiptapWrapperProps = TiptapWrapperEditorInstanceProps & {
|
|
29
|
+
children: OctaneNode;
|
|
30
|
+
};
|
|
32
31
|
|
|
33
|
-
export type TiptapContentProps =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
32
|
+
export type TiptapContentProps = Omit<EditorContentProps, 'editor' | 'ref'> & {
|
|
33
|
+
editor?: never;
|
|
34
|
+
ref?: never;
|
|
35
|
+
};
|
|
38
36
|
|
|
39
37
|
export const TiptapContext: Context<TiptapContextType> & { displayName?: string } = createContext({
|
|
40
38
|
get editor(): Editor {
|
|
@@ -55,16 +53,16 @@ export function useTiptapState<TSelectorResult>(
|
|
|
55
53
|
...args: [equalityFn?: (left: TSelectorResult, right: TSelectorResult | null) => boolean]
|
|
56
54
|
): TSelectorResult {
|
|
57
55
|
const [userArgs, slot] = splitSlot(args);
|
|
58
|
-
const equalityFn = userArgs[0] as
|
|
59
|
-
|
|
56
|
+
const equalityFn = userArgs[0] as
|
|
57
|
+
((left: TSelectorResult, right: TSelectorResult | null) => boolean) | undefined;
|
|
60
58
|
const { editor } = useTiptap();
|
|
61
59
|
|
|
62
60
|
// Call through a non-hook-named alias because this source is itself compiled:
|
|
63
61
|
// the public call site's slot is already being forwarded explicitly here.
|
|
64
|
-
const selectEditorState = useEditorState as (
|
|
65
|
-
TSelectorResult,
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
const selectEditorState = useEditorState as (
|
|
63
|
+
options: UseEditorStateOptions<TSelectorResult, Editor>,
|
|
64
|
+
slot: symbol,
|
|
65
|
+
) => TSelectorResult;
|
|
68
66
|
return selectEditorState(
|
|
69
67
|
{
|
|
70
68
|
editor,
|
|
@@ -76,8 +74,7 @@ export function useTiptapState<TSelectorResult>(
|
|
|
76
74
|
}
|
|
77
75
|
|
|
78
76
|
export function TiptapWrapper({ children, ...props }: TiptapWrapperProps) @{
|
|
79
|
-
const resolvedEditor =
|
|
80
|
-
'editor' in props ? props.editor : props.instance;
|
|
77
|
+
const resolvedEditor = 'editor' in props ? props.editor : props.instance;
|
|
81
78
|
|
|
82
79
|
if (!resolvedEditor) {
|
|
83
80
|
throw new Error('Tiptap: An editor instance is required. Pass a non-null `editor` prop.');
|