@octanejs/tiptap 0.0.51 → 0.0.53
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 +4 -4
- package/src/Context.tsrx +16 -2
- package/src/Context.tsrx.d.ts +12 -2
- package/src/EditorContent.tsrx +4 -1
- package/src/Tiptap.tsrx +1 -1
- package/src/index.ts +0 -1
- package/src/menus/BubbleMenu.ts +1 -1
- package/src/menus/FloatingMenu.ts +1 -1
- package/src/Context.ts +0 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/tiptap",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@tiptap/extension-floating-menu": "3.28.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"octane": "^0.
|
|
59
|
+
"octane": "^0.9.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"use-sync-external-store": "^1.4.0",
|
|
74
74
|
"@types/react": "19.2.17",
|
|
75
75
|
"@types/react-dom": "19.2.3",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
76
|
+
"@octanejs/testing-library": "0.1.58",
|
|
77
|
+
"octane": "0.9.0"
|
|
78
78
|
},
|
|
79
79
|
"scripts": {
|
|
80
80
|
"test": "vitest run",
|
package/src/Context.tsrx
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
// Ported from @tiptap/react 3.28.0 Context.tsx. Octane contexts intentionally
|
|
2
2
|
// have no `.Consumer`; the compatibility component below implements the same
|
|
3
3
|
// render-prop contract with useContext instead.
|
|
4
|
-
import {
|
|
4
|
+
import type { Editor } from '@tiptap/core';
|
|
5
|
+
import { createContext, isChildrenBlock, useContext, useMemo, type OctaneNode } from 'octane';
|
|
5
6
|
|
|
6
|
-
import { EditorContext, useCurrentEditor, type EditorContextValue } from './Context';
|
|
7
7
|
import { EditorContent, type EditorContentProps } from './EditorContent.tsrx';
|
|
8
8
|
import { useEditor, type UseEditorOptions } from './useEditor';
|
|
9
9
|
|
|
10
|
+
/** The editor value shared by the legacy TipTap context API. */
|
|
11
|
+
export type EditorContextValue = {
|
|
12
|
+
editor: Editor | null;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const EditorContext = createContext<EditorContextValue>({
|
|
16
|
+
editor: null,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
/** Read the editor from the nearest `EditorProvider` or `Tiptap` component. */
|
|
20
|
+
export function useCurrentEditor(): EditorContextValue {
|
|
21
|
+
return useContext(EditorContext);
|
|
22
|
+
}
|
|
23
|
+
|
|
10
24
|
export interface EditorConsumerProps {
|
|
11
25
|
children: (value: EditorContextValue) => OctaneNode;
|
|
12
26
|
}
|
package/src/Context.tsrx.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Editor } from '@tiptap/core';
|
|
2
|
+
import type { Context, OctaneNode } from 'octane';
|
|
2
3
|
import type { Octane } from 'octane/jsx-runtime';
|
|
3
4
|
|
|
4
5
|
import type { EditorContentProps } from './EditorContent.tsrx';
|
|
5
|
-
import type { EditorContextValue } from './Context';
|
|
6
6
|
import type { UseEditorOptions } from './useEditor';
|
|
7
7
|
|
|
8
|
+
/** The editor value shared by the legacy TipTap context API. */
|
|
9
|
+
export type EditorContextValue = {
|
|
10
|
+
editor: Editor | null;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export declare const EditorContext: Context<EditorContextValue>;
|
|
14
|
+
|
|
15
|
+
/** Read the editor from the nearest `EditorProvider` or `Tiptap` component. */
|
|
16
|
+
export declare function useCurrentEditor(): EditorContextValue;
|
|
17
|
+
|
|
8
18
|
export interface EditorConsumerProps {
|
|
9
19
|
children: (value: EditorContextValue) => OctaneNode;
|
|
10
20
|
}
|
package/src/EditorContent.tsrx
CHANGED
|
@@ -160,7 +160,10 @@ export function PureEditorContent(props: EditorContentProps) @{
|
|
|
160
160
|
}, [editor]);
|
|
161
161
|
|
|
162
162
|
<>
|
|
163
|
-
<div
|
|
163
|
+
<div
|
|
164
|
+
{...rest as typeof rest & { ref?: undefined }}
|
|
165
|
+
ref={[ref ?? null, innerRef ?? null, editorContentRef]}
|
|
166
|
+
/>
|
|
164
167
|
@if (contentComponent) {
|
|
165
168
|
<Portals contentComponent={contentComponent} />
|
|
166
169
|
}
|
package/src/Tiptap.tsrx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { Editor } from '@tiptap/core';
|
|
4
4
|
import { createContext, useContext, useMemo, type Context, type OctaneNode } from 'octane';
|
|
5
5
|
|
|
6
|
-
import { EditorContext } from './Context';
|
|
6
|
+
import { EditorContext } from './Context.tsrx';
|
|
7
7
|
import { EditorContent, type EditorContentProps } from './EditorContent.tsrx';
|
|
8
8
|
import { splitSlot, subSlot } from './internal';
|
|
9
9
|
import {
|
package/src/index.ts
CHANGED
package/src/menus/BubbleMenu.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Editor } from '@tiptap/core';
|
|
|
3
3
|
import type { PluginKey } from '@tiptap/pm/state';
|
|
4
4
|
import { createPortal, useEffect, useLayoutEffect, useRef, useState } from 'octane';
|
|
5
5
|
|
|
6
|
-
import { useCurrentEditor } from '../Context';
|
|
6
|
+
import { useCurrentEditor } from '../Context.tsrx';
|
|
7
7
|
import { subSlot } from '../internal';
|
|
8
8
|
import { getAutoPluginKey } from './getAutoPluginKey';
|
|
9
9
|
import {
|
|
@@ -3,7 +3,7 @@ import { type FloatingMenuPluginProps, FloatingMenuPlugin } from '@tiptap/extens
|
|
|
3
3
|
import type { PluginKey } from '@tiptap/pm/state';
|
|
4
4
|
import { createPortal, useEffect, useLayoutEffect, useRef, useState } from 'octane';
|
|
5
5
|
|
|
6
|
-
import { useCurrentEditor } from '../Context';
|
|
6
|
+
import { useCurrentEditor } from '../Context.tsrx';
|
|
7
7
|
import { subSlot } from '../internal';
|
|
8
8
|
import { getAutoPluginKey } from './getAutoPluginKey';
|
|
9
9
|
import {
|
package/src/Context.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@tiptap/core';
|
|
2
|
-
import { createContext, useContext } from 'octane';
|
|
3
|
-
|
|
4
|
-
/** The editor value shared by the legacy TipTap context API. */
|
|
5
|
-
export type EditorContextValue = {
|
|
6
|
-
editor: Editor | null;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const EditorContext = createContext<EditorContextValue>({
|
|
10
|
-
editor: null,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
/** Read the editor from the nearest `EditorProvider` or `Tiptap` component. */
|
|
14
|
-
export function useCurrentEditor(): EditorContextValue {
|
|
15
|
-
return useContext(EditorContext);
|
|
16
|
-
}
|