neuphlo-editor 1.7.0 → 1.8.0
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 +28 -17
- package/dist/mention-DgnzKpqn.d.cts +0 -145
- package/dist/mention-DgnzKpqn.d.ts +0 -145
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neuphlo-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A lightweight React wrapper around Tiptap with sensible defaults and image upload support.",
|
|
6
6
|
"type": "module",
|
|
@@ -40,37 +40,48 @@
|
|
|
40
40
|
"README.md"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@tiptap/pm": "3.
|
|
44
|
-
"@tiptap/react": "3.
|
|
45
|
-
"@tiptap/suggestion": "3.
|
|
46
|
-
"@tiptap/extension-collaboration": "3.
|
|
47
|
-
"@tiptap/
|
|
43
|
+
"@tiptap/pm": "^3.20.2",
|
|
44
|
+
"@tiptap/react": "^3.20.2",
|
|
45
|
+
"@tiptap/suggestion": "^3.20.2",
|
|
46
|
+
"@tiptap/extension-collaboration": "^3.20.2",
|
|
47
|
+
"@tiptap/y-tiptap": "^3.0.2",
|
|
48
48
|
"@types/react": "^18.2.0 || ^19.0.0",
|
|
49
49
|
"@types/react-dom": "^18.2.0 || ^19.0.0",
|
|
50
50
|
"react": "^18.2.0 || ^19.0.0",
|
|
51
51
|
"react-dom": "^18.2.0 || ^19.0.0",
|
|
52
52
|
"yjs": "^13.6.0"
|
|
53
53
|
},
|
|
54
|
-
"peerDependenciesMeta": {
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"@tiptap/extension-collaboration": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"@tiptap/y-tiptap": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
55
62
|
"devDependencies": {
|
|
56
|
-
"@tiptap/
|
|
63
|
+
"@tiptap/pm": "3.20.2",
|
|
64
|
+
"@tiptap/react": "3.20.2",
|
|
65
|
+
"@tiptap/suggestion": "3.20.2",
|
|
57
66
|
"@types/node": "^20.0.0",
|
|
58
67
|
"@types/react": "^19.1.12",
|
|
59
68
|
"@types/react-dom": "^19.1.5",
|
|
69
|
+
"react": "^19.2.3",
|
|
70
|
+
"react-dom": "^19.2.3",
|
|
60
71
|
"tsup": "^8.0.0",
|
|
61
72
|
"typescript": "^5.9.2"
|
|
62
73
|
},
|
|
63
74
|
"dependencies": {
|
|
64
75
|
"@tabler/icons-react": "^3.34.1",
|
|
65
|
-
"@tiptap/core": "3.
|
|
66
|
-
"@tiptap/extension-code-block-lowlight": "3.
|
|
67
|
-
"@tiptap/extension-image": "3.
|
|
68
|
-
"@tiptap/extension-link": "3.
|
|
69
|
-
"@tiptap/extension-mention": "3.
|
|
70
|
-
"@tiptap/extension-placeholder": "3.
|
|
71
|
-
"@tiptap/starter-kit": "3.
|
|
72
|
-
"@tiptap/extension-collaboration": "3.
|
|
73
|
-
"@tiptap/
|
|
76
|
+
"@tiptap/core": "3.20.2",
|
|
77
|
+
"@tiptap/extension-code-block-lowlight": "3.20.2",
|
|
78
|
+
"@tiptap/extension-image": "3.20.2",
|
|
79
|
+
"@tiptap/extension-link": "3.20.2",
|
|
80
|
+
"@tiptap/extension-mention": "3.20.2",
|
|
81
|
+
"@tiptap/extension-placeholder": "3.20.2",
|
|
82
|
+
"@tiptap/starter-kit": "3.20.2",
|
|
83
|
+
"@tiptap/extension-collaboration": "3.20.2",
|
|
84
|
+
"@tiptap/y-tiptap": "^3.0.2",
|
|
74
85
|
"cmdk": "^1.1.1",
|
|
75
86
|
"highlight.js": "^11.11.1",
|
|
76
87
|
"jotai": "^2.11.0",
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import * as _tiptap_core from '@tiptap/core';
|
|
2
|
-
import { Range } from '@tiptap/core';
|
|
3
|
-
import * as react from 'react';
|
|
4
|
-
import { ReactNode, FC } from 'react';
|
|
5
|
-
import { EditorProviderProps } from '@tiptap/react';
|
|
6
|
-
import * as _tiptap_extension_mention from '@tiptap/extension-mention';
|
|
7
|
-
|
|
8
|
-
interface EditorRootProps {
|
|
9
|
-
readonly children: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
declare const EditorRoot: FC<EditorRootProps>;
|
|
12
|
-
type EditorContentProps = EditorProviderProps & {
|
|
13
|
-
readonly children?: ReactNode;
|
|
14
|
-
readonly className?: string;
|
|
15
|
-
readonly initialContent?: any;
|
|
16
|
-
};
|
|
17
|
-
declare const EditorContent: react.ForwardRefExoticComponent<{
|
|
18
|
-
children?: ReactNode;
|
|
19
|
-
slotBefore?: ReactNode;
|
|
20
|
-
slotAfter?: ReactNode;
|
|
21
|
-
editorContainerProps?: react.HTMLAttributes<HTMLDivElement>;
|
|
22
|
-
} & Partial<_tiptap_core.EditorOptions> & {
|
|
23
|
-
immediatelyRender?: boolean;
|
|
24
|
-
shouldRerenderOnTransaction?: boolean;
|
|
25
|
-
} & {
|
|
26
|
-
readonly children?: ReactNode;
|
|
27
|
-
readonly className?: string;
|
|
28
|
-
readonly initialContent?: any;
|
|
29
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
30
|
-
|
|
31
|
-
declare module "@tiptap/core" {
|
|
32
|
-
interface Commands<ReturnType> {
|
|
33
|
-
imageBlock: {
|
|
34
|
-
setImageBlock: (attributes: {
|
|
35
|
-
src: string;
|
|
36
|
-
}) => ReturnType;
|
|
37
|
-
setImageBlockAt: (attributes: {
|
|
38
|
-
src: string;
|
|
39
|
-
pos: number | Range;
|
|
40
|
-
}) => ReturnType;
|
|
41
|
-
setImageBlockAlign: (align: "left" | "center" | "right") => ReturnType;
|
|
42
|
-
setImageBlockWidth: (width: number) => ReturnType;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* TipTap AI Suggestion Extension
|
|
49
|
-
*
|
|
50
|
-
* This extension provides inline AI-powered text completions that appear
|
|
51
|
-
* as ghost text at the cursor position.
|
|
52
|
-
*
|
|
53
|
-
* Usage:
|
|
54
|
-
* ```ts
|
|
55
|
-
* import { AISuggestion } from 'neuphlo-editor'
|
|
56
|
-
*
|
|
57
|
-
* const editor = new Editor({
|
|
58
|
-
* extensions: [
|
|
59
|
-
* AISuggestion.configure({
|
|
60
|
-
* onFetchSuggestion: async (context) => {
|
|
61
|
-
* // Call your AI API here
|
|
62
|
-
* const response = await fetch('/api/complete', {
|
|
63
|
-
* method: 'POST',
|
|
64
|
-
* body: JSON.stringify({ text: context }),
|
|
65
|
-
* })
|
|
66
|
-
* const data = await response.json()
|
|
67
|
-
* return data.completion
|
|
68
|
-
* },
|
|
69
|
-
* debounceMs: 2000,
|
|
70
|
-
* }),
|
|
71
|
-
* ],
|
|
72
|
-
* })
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
declare module "@tiptap/core" {
|
|
77
|
-
interface Commands<ReturnType> {
|
|
78
|
-
aiSuggestion: {
|
|
79
|
-
/**
|
|
80
|
-
* Accept the current AI suggestion
|
|
81
|
-
*/
|
|
82
|
-
acceptAISuggestion: () => ReturnType;
|
|
83
|
-
/**
|
|
84
|
-
* Dismiss the current AI suggestion
|
|
85
|
-
*/
|
|
86
|
-
dismissAISuggestion: () => ReturnType;
|
|
87
|
-
/**
|
|
88
|
-
* Manually trigger a suggestion fetch
|
|
89
|
-
*/
|
|
90
|
-
triggerAISuggestion: () => ReturnType;
|
|
91
|
-
/**
|
|
92
|
-
* Set a suggestion programmatically
|
|
93
|
-
*/
|
|
94
|
-
setAISuggestion: (text: string) => ReturnType;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
interface MentionItem {
|
|
100
|
-
id: string;
|
|
101
|
-
label: string;
|
|
102
|
-
avatar?: string;
|
|
103
|
-
email?: string;
|
|
104
|
-
type?: "node" | "article";
|
|
105
|
-
nodeId?: string;
|
|
106
|
-
slug?: string;
|
|
107
|
-
}
|
|
108
|
-
interface MentionOptions {
|
|
109
|
-
/**
|
|
110
|
-
* Function to fetch/filter mentionable items based on query
|
|
111
|
-
*/
|
|
112
|
-
items?: (query: string) => MentionItem[] | Promise<MentionItem[]>;
|
|
113
|
-
/**
|
|
114
|
-
* Custom render function for mention nodes
|
|
115
|
-
*/
|
|
116
|
-
renderLabel?: (props: {
|
|
117
|
-
node: any;
|
|
118
|
-
options: any;
|
|
119
|
-
}) => string;
|
|
120
|
-
/**
|
|
121
|
-
* Character that triggers the mention autocomplete (default: @)
|
|
122
|
-
*/
|
|
123
|
-
char?: string;
|
|
124
|
-
/**
|
|
125
|
-
* Custom name for the extension (to avoid duplicates)
|
|
126
|
-
*/
|
|
127
|
-
name?: string;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Create the mention extension with custom suggestion rendering
|
|
131
|
-
*/
|
|
132
|
-
declare const createMentionExtension: (options?: MentionOptions) => _tiptap_core.Node<_tiptap_extension_mention.MentionOptions<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
|
|
133
|
-
/**
|
|
134
|
-
* Render function for mention suggestions (autocomplete dropdown)
|
|
135
|
-
*/
|
|
136
|
-
declare const renderMentionSuggestion: () => {
|
|
137
|
-
onStart: (props: any) => void;
|
|
138
|
-
onUpdate: (props: any) => void;
|
|
139
|
-
onKeyDown: ({ event }: {
|
|
140
|
-
event: KeyboardEvent;
|
|
141
|
-
}) => any;
|
|
142
|
-
onExit: () => void;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export { type EditorContentProps as E, type MentionOptions as M, type MentionItem as a, EditorRoot as b, EditorContent as c, createMentionExtension as d, renderMentionSuggestion as r };
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import * as _tiptap_core from '@tiptap/core';
|
|
2
|
-
import { Range } from '@tiptap/core';
|
|
3
|
-
import * as react from 'react';
|
|
4
|
-
import { ReactNode, FC } from 'react';
|
|
5
|
-
import { EditorProviderProps } from '@tiptap/react';
|
|
6
|
-
import * as _tiptap_extension_mention from '@tiptap/extension-mention';
|
|
7
|
-
|
|
8
|
-
interface EditorRootProps {
|
|
9
|
-
readonly children: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
declare const EditorRoot: FC<EditorRootProps>;
|
|
12
|
-
type EditorContentProps = EditorProviderProps & {
|
|
13
|
-
readonly children?: ReactNode;
|
|
14
|
-
readonly className?: string;
|
|
15
|
-
readonly initialContent?: any;
|
|
16
|
-
};
|
|
17
|
-
declare const EditorContent: react.ForwardRefExoticComponent<{
|
|
18
|
-
children?: ReactNode;
|
|
19
|
-
slotBefore?: ReactNode;
|
|
20
|
-
slotAfter?: ReactNode;
|
|
21
|
-
editorContainerProps?: react.HTMLAttributes<HTMLDivElement>;
|
|
22
|
-
} & Partial<_tiptap_core.EditorOptions> & {
|
|
23
|
-
immediatelyRender?: boolean;
|
|
24
|
-
shouldRerenderOnTransaction?: boolean;
|
|
25
|
-
} & {
|
|
26
|
-
readonly children?: ReactNode;
|
|
27
|
-
readonly className?: string;
|
|
28
|
-
readonly initialContent?: any;
|
|
29
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
30
|
-
|
|
31
|
-
declare module "@tiptap/core" {
|
|
32
|
-
interface Commands<ReturnType> {
|
|
33
|
-
imageBlock: {
|
|
34
|
-
setImageBlock: (attributes: {
|
|
35
|
-
src: string;
|
|
36
|
-
}) => ReturnType;
|
|
37
|
-
setImageBlockAt: (attributes: {
|
|
38
|
-
src: string;
|
|
39
|
-
pos: number | Range;
|
|
40
|
-
}) => ReturnType;
|
|
41
|
-
setImageBlockAlign: (align: "left" | "center" | "right") => ReturnType;
|
|
42
|
-
setImageBlockWidth: (width: number) => ReturnType;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* TipTap AI Suggestion Extension
|
|
49
|
-
*
|
|
50
|
-
* This extension provides inline AI-powered text completions that appear
|
|
51
|
-
* as ghost text at the cursor position.
|
|
52
|
-
*
|
|
53
|
-
* Usage:
|
|
54
|
-
* ```ts
|
|
55
|
-
* import { AISuggestion } from 'neuphlo-editor'
|
|
56
|
-
*
|
|
57
|
-
* const editor = new Editor({
|
|
58
|
-
* extensions: [
|
|
59
|
-
* AISuggestion.configure({
|
|
60
|
-
* onFetchSuggestion: async (context) => {
|
|
61
|
-
* // Call your AI API here
|
|
62
|
-
* const response = await fetch('/api/complete', {
|
|
63
|
-
* method: 'POST',
|
|
64
|
-
* body: JSON.stringify({ text: context }),
|
|
65
|
-
* })
|
|
66
|
-
* const data = await response.json()
|
|
67
|
-
* return data.completion
|
|
68
|
-
* },
|
|
69
|
-
* debounceMs: 2000,
|
|
70
|
-
* }),
|
|
71
|
-
* ],
|
|
72
|
-
* })
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
declare module "@tiptap/core" {
|
|
77
|
-
interface Commands<ReturnType> {
|
|
78
|
-
aiSuggestion: {
|
|
79
|
-
/**
|
|
80
|
-
* Accept the current AI suggestion
|
|
81
|
-
*/
|
|
82
|
-
acceptAISuggestion: () => ReturnType;
|
|
83
|
-
/**
|
|
84
|
-
* Dismiss the current AI suggestion
|
|
85
|
-
*/
|
|
86
|
-
dismissAISuggestion: () => ReturnType;
|
|
87
|
-
/**
|
|
88
|
-
* Manually trigger a suggestion fetch
|
|
89
|
-
*/
|
|
90
|
-
triggerAISuggestion: () => ReturnType;
|
|
91
|
-
/**
|
|
92
|
-
* Set a suggestion programmatically
|
|
93
|
-
*/
|
|
94
|
-
setAISuggestion: (text: string) => ReturnType;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
interface MentionItem {
|
|
100
|
-
id: string;
|
|
101
|
-
label: string;
|
|
102
|
-
avatar?: string;
|
|
103
|
-
email?: string;
|
|
104
|
-
type?: "node" | "article";
|
|
105
|
-
nodeId?: string;
|
|
106
|
-
slug?: string;
|
|
107
|
-
}
|
|
108
|
-
interface MentionOptions {
|
|
109
|
-
/**
|
|
110
|
-
* Function to fetch/filter mentionable items based on query
|
|
111
|
-
*/
|
|
112
|
-
items?: (query: string) => MentionItem[] | Promise<MentionItem[]>;
|
|
113
|
-
/**
|
|
114
|
-
* Custom render function for mention nodes
|
|
115
|
-
*/
|
|
116
|
-
renderLabel?: (props: {
|
|
117
|
-
node: any;
|
|
118
|
-
options: any;
|
|
119
|
-
}) => string;
|
|
120
|
-
/**
|
|
121
|
-
* Character that triggers the mention autocomplete (default: @)
|
|
122
|
-
*/
|
|
123
|
-
char?: string;
|
|
124
|
-
/**
|
|
125
|
-
* Custom name for the extension (to avoid duplicates)
|
|
126
|
-
*/
|
|
127
|
-
name?: string;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Create the mention extension with custom suggestion rendering
|
|
131
|
-
*/
|
|
132
|
-
declare const createMentionExtension: (options?: MentionOptions) => _tiptap_core.Node<_tiptap_extension_mention.MentionOptions<any, _tiptap_extension_mention.MentionNodeAttrs>, any>;
|
|
133
|
-
/**
|
|
134
|
-
* Render function for mention suggestions (autocomplete dropdown)
|
|
135
|
-
*/
|
|
136
|
-
declare const renderMentionSuggestion: () => {
|
|
137
|
-
onStart: (props: any) => void;
|
|
138
|
-
onUpdate: (props: any) => void;
|
|
139
|
-
onKeyDown: ({ event }: {
|
|
140
|
-
event: KeyboardEvent;
|
|
141
|
-
}) => any;
|
|
142
|
-
onExit: () => void;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
export { type EditorContentProps as E, type MentionOptions as M, type MentionItem as a, EditorRoot as b, EditorContent as c, createMentionExtension as d, renderMentionSuggestion as r };
|