payload-richtext-tiptap 0.0.42 → 0.0.44
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/src/fields/TiptapEditor/extensions/AICommand/AICommand.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AICommand.js +31 -14
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AICommand.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AIMenuList.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AIMenuList.js +39 -27
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AIMenuList.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/groups.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/groups.js +52 -227
- package/dist/src/fields/TiptapEditor/extensions/AICommand/groups.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/types.d.ts +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/types.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/types.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/Paragraph/AIEditorParagraph.d.ts +3 -0
- package/dist/src/fields/TiptapEditor/extensions/Paragraph/AIEditorParagraph.d.ts.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/Paragraph/AIEditorParagraph.js +35 -0
- package/dist/src/fields/TiptapEditor/extensions/Paragraph/AIEditorParagraph.js.map +1 -0
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/MenuList.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/MenuList.js +35 -26
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/MenuList.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.js +2 -2
- package/dist/src/fields/TiptapEditor/extensions/extension-kit.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-draft-selector-commands.d.ts +6 -0
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-draft-selector-commands.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-draft-selector-commands.js +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-draft-selector-commands.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.d.ts +2 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.js +60 -85
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/ui/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/ui/Dropdown/Dropdown.js +5 -1
- package/dist/src/fields/TiptapEditor/features/ui/Dropdown/Dropdown.js.map +1 -1
- package/dist/src/styles.css +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,256 +1,81 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Pen } from "lucide-react";
|
|
2
2
|
export const GROUPS = [
|
|
3
3
|
{
|
|
4
|
-
name: "
|
|
5
|
-
title: "
|
|
4
|
+
name: "draft",
|
|
5
|
+
title: "Draft with AI",
|
|
6
6
|
commands: [
|
|
7
7
|
{
|
|
8
|
-
name: "
|
|
9
|
-
label: "
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
aliases: [
|
|
13
|
-
"h1"
|
|
14
|
-
],
|
|
8
|
+
name: "brainstorm",
|
|
9
|
+
label: "Brainstorm Ideas...",
|
|
10
|
+
description: "Brainstorm ideas on ",
|
|
11
|
+
icon: Pen,
|
|
15
12
|
action: (editor)=>{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
// "Brainstorm ideas on "
|
|
14
|
+
return "Brainstorm ideas on ";
|
|
15
|
+
// editor.chain().focus().setHeading({ level: 1 }).run();
|
|
19
16
|
}
|
|
20
17
|
},
|
|
21
18
|
{
|
|
22
|
-
name: "
|
|
23
|
-
label: "
|
|
24
|
-
|
|
25
|
-
description: "Medium priority section title",
|
|
26
|
-
aliases: [
|
|
27
|
-
"h2"
|
|
28
|
-
],
|
|
19
|
+
name: "blog",
|
|
20
|
+
label: "Blog post...",
|
|
21
|
+
description: "Blog post",
|
|
29
22
|
action: (editor)=>{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
name: "heading3",
|
|
37
|
-
label: "Heading 3",
|
|
38
|
-
icon: Heading3,
|
|
39
|
-
description: "Low priority section title",
|
|
40
|
-
aliases: [
|
|
41
|
-
"h3"
|
|
42
|
-
],
|
|
43
|
-
action: (editor)=>{
|
|
44
|
-
editor.chain().focus().setHeading({
|
|
45
|
-
level: 3
|
|
46
|
-
}).run();
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: "bulletList",
|
|
51
|
-
label: "Bullet List",
|
|
52
|
-
icon: List,
|
|
53
|
-
description: "Unordered list of items",
|
|
54
|
-
aliases: [
|
|
55
|
-
"ul"
|
|
56
|
-
],
|
|
57
|
-
action: (editor)=>{
|
|
58
|
-
editor.chain().focus().toggleBulletList().run();
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: "numberedList",
|
|
63
|
-
label: "Numbered List",
|
|
64
|
-
icon: ListOrdered,
|
|
65
|
-
description: "Ordered list of items",
|
|
66
|
-
aliases: [
|
|
67
|
-
"ol"
|
|
68
|
-
],
|
|
69
|
-
action: (editor)=>{
|
|
70
|
-
editor.chain().focus().toggleOrderedList().run();
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
// {
|
|
74
|
-
// name: 'taskList',
|
|
75
|
-
// label: 'Task List',
|
|
76
|
-
// icon: ListTodo,
|
|
77
|
-
// description: 'Task list with todo items',
|
|
78
|
-
// aliases: ['todo'],
|
|
79
|
-
// action: (editor) => {
|
|
80
|
-
// editor.chain().focus().toggleTaskList().run()
|
|
81
|
-
// },
|
|
82
|
-
// },
|
|
83
|
-
{
|
|
84
|
-
name: "blockquote",
|
|
85
|
-
label: "Blockquote",
|
|
86
|
-
icon: Quote,
|
|
87
|
-
description: "Element for quoting",
|
|
88
|
-
action: (editor)=>{
|
|
89
|
-
editor.chain().focus().setBlockquote().run();
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "codeBlock",
|
|
94
|
-
label: "Code Block",
|
|
95
|
-
icon: SquareCode,
|
|
96
|
-
description: "Code block with syntax highlighting",
|
|
97
|
-
shouldBeHidden: (editor)=>editor.isActive("columns"),
|
|
98
|
-
action: (editor)=>{
|
|
99
|
-
editor.chain().focus().setCodeBlock().run();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
name: "insert",
|
|
106
|
-
title: "Insert",
|
|
107
|
-
commands: [
|
|
108
|
-
{
|
|
109
|
-
name: "table",
|
|
110
|
-
label: "Table",
|
|
111
|
-
icon: Table,
|
|
112
|
-
description: "Insert a table",
|
|
113
|
-
shouldBeHidden: (editor)=>editor.isActive("columns"),
|
|
114
|
-
action: (editor)=>{
|
|
115
|
-
editor.chain().focus().insertTable({
|
|
116
|
-
rows: 3,
|
|
117
|
-
cols: 3,
|
|
118
|
-
withHeaderRow: false
|
|
119
|
-
}).run();
|
|
120
|
-
}
|
|
23
|
+
return "Write a blog post about ";
|
|
24
|
+
// "Write a blog post about "
|
|
25
|
+
// editor.chain().focus().setHeading({ level: 1 }).run();
|
|
26
|
+
},
|
|
27
|
+
icon: Pen
|
|
121
28
|
},
|
|
122
29
|
{
|
|
123
|
-
name: "
|
|
124
|
-
label: "
|
|
125
|
-
|
|
126
|
-
description: "Insert an image",
|
|
127
|
-
aliases: [
|
|
128
|
-
"img"
|
|
129
|
-
],
|
|
30
|
+
name: "outline",
|
|
31
|
+
label: "Outline...",
|
|
32
|
+
description: "Outline",
|
|
130
33
|
action: (editor)=>{
|
|
131
|
-
|
|
132
|
-
}
|
|
34
|
+
return "Write an outline about ";
|
|
35
|
+
// editor.chain().focus().setHeading({ level: 1 }).run();
|
|
36
|
+
},
|
|
37
|
+
icon: Pen
|
|
133
38
|
},
|
|
134
39
|
{
|
|
135
|
-
name: "
|
|
136
|
-
label: "
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
aliases: [
|
|
140
|
-
"cols"
|
|
141
|
-
],
|
|
142
|
-
shouldBeHidden: (editor)=>editor.isActive("columns"),
|
|
40
|
+
name: "social",
|
|
41
|
+
label: "Social Media post...",
|
|
42
|
+
description: "Social Media post",
|
|
43
|
+
icon: Pen,
|
|
143
44
|
action: (editor)=>{
|
|
144
|
-
|
|
45
|
+
return;
|
|
46
|
+
"Write a social media post about ";
|
|
47
|
+
// editor.chain().focus().setHeading({ level: 1 }).run();
|
|
145
48
|
}
|
|
146
49
|
},
|
|
147
50
|
{
|
|
148
|
-
name: "
|
|
149
|
-
label: "
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
aliases: [
|
|
153
|
-
"hr"
|
|
154
|
-
],
|
|
51
|
+
name: "press",
|
|
52
|
+
label: "Press release...",
|
|
53
|
+
description: "Press release",
|
|
54
|
+
icon: Pen,
|
|
155
55
|
action: (editor)=>{
|
|
156
|
-
|
|
56
|
+
return "Write a press release about ";
|
|
57
|
+
// editor.chain().focus().setHeading({ level: 1 }).run();
|
|
157
58
|
}
|
|
158
59
|
},
|
|
159
60
|
{
|
|
160
|
-
name: "
|
|
161
|
-
label: "
|
|
162
|
-
|
|
163
|
-
aliases: [
|
|
164
|
-
"outline"
|
|
165
|
-
],
|
|
166
|
-
description: "Insert a table of contents",
|
|
167
|
-
shouldBeHidden: (editor)=>editor.isActive("columns"),
|
|
61
|
+
name: "creative",
|
|
62
|
+
label: "Creative Story...",
|
|
63
|
+
description: "Creative Story",
|
|
168
64
|
action: (editor)=>{
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
name: "embed",
|
|
176
|
-
title: "Embed",
|
|
177
|
-
commands: [
|
|
178
|
-
{
|
|
179
|
-
name: "iframe",
|
|
180
|
-
label: "IFrame",
|
|
181
|
-
icon: Link,
|
|
182
|
-
aliases: [
|
|
183
|
-
"iframe"
|
|
184
|
-
],
|
|
185
|
-
description: "Insert a iframe",
|
|
186
|
-
shouldBeHidden: (editor)=>editor.isActive("iframe"),
|
|
187
|
-
action: (editor)=>{
|
|
188
|
-
editor.chain().focus().setHtml("<div>Embed your content here</div>").run();
|
|
189
|
-
}
|
|
65
|
+
return "Write a creative story about ";
|
|
66
|
+
// editor.chain().focus().setHeading({ level: 1 }).run();
|
|
67
|
+
},
|
|
68
|
+
icon: Pen
|
|
190
69
|
},
|
|
191
70
|
{
|
|
192
|
-
name: "
|
|
193
|
-
label: "
|
|
194
|
-
|
|
195
|
-
aliases: [
|
|
196
|
-
"x",
|
|
197
|
-
"twitter"
|
|
198
|
-
],
|
|
199
|
-
description: "Insert a Twitter embed",
|
|
200
|
-
shouldBeHidden: (editor)=>editor.isActive("twitter"),
|
|
71
|
+
name: "essay",
|
|
72
|
+
label: "Essay...",
|
|
73
|
+
description: "Essay",
|
|
201
74
|
action: (editor)=>{
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
// name: 'facebook',
|
|
207
|
-
// label: 'Facebook Embed',
|
|
208
|
-
// icon: Facebook,
|
|
209
|
-
// aliases: ['meta', 'facebook'],
|
|
210
|
-
// description: 'Insert a Facebook embed',
|
|
211
|
-
// shouldBeHidden: (editor) => editor.isActive('facebook'),
|
|
212
|
-
// action: (editor) => {
|
|
213
|
-
// editor.chain().focus().insertFacebook().run()
|
|
214
|
-
// },
|
|
215
|
-
// },
|
|
216
|
-
{
|
|
217
|
-
name: "instagram",
|
|
218
|
-
label: "Instagram Embed",
|
|
219
|
-
icon: Instagram,
|
|
220
|
-
aliases: [
|
|
221
|
-
"instagram"
|
|
222
|
-
],
|
|
223
|
-
description: "Insert a Instagram embed",
|
|
224
|
-
shouldBeHidden: (editor)=>editor.isActive("instagram"),
|
|
225
|
-
action: (editor)=>{
|
|
226
|
-
editor.chain().focus().insertInstagram().run();
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
name: "youtube",
|
|
231
|
-
label: "Youtube Embed",
|
|
232
|
-
icon: Youtube,
|
|
233
|
-
aliases: [
|
|
234
|
-
"youtube"
|
|
235
|
-
],
|
|
236
|
-
description: "Insert a Youtube embed",
|
|
237
|
-
shouldBeHidden: (editor)=>editor.isActive("youtube"),
|
|
238
|
-
action: (editor)=>{
|
|
239
|
-
editor.chain().focus().insertYoutube().run();
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
name: "insideLinks",
|
|
244
|
-
label: "TRT Links",
|
|
245
|
-
icon: Youtube,
|
|
246
|
-
aliases: [
|
|
247
|
-
"insideLinks"
|
|
248
|
-
],
|
|
249
|
-
description: "Link internal content such as articles, videos, shows etc.",
|
|
250
|
-
shouldBeHidden: (editor)=>editor.isActive("insideLinks"),
|
|
251
|
-
action: (editor)=>{
|
|
252
|
-
editor.chain().focus().insertInsideLinks({}).run();
|
|
253
|
-
}
|
|
75
|
+
return "Write an essay about ";
|
|
76
|
+
// editor.chain().focus().setHeading({ level: 1 }).run();
|
|
77
|
+
},
|
|
78
|
+
icon: Pen
|
|
254
79
|
}
|
|
255
80
|
]
|
|
256
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/groups.ts"],"sourcesContent":["import {\n Book,\n Columns2,\n Facebook,\n Heading1,\n Heading2,\n Heading3,\n Image,\n Instagram,\n Link,\n Linkedin,\n List,\n ListOrdered,\n ListTodo,\n Minus,\n Music,\n Quote,\n SquareCode,\n Table,\n Twitch,\n Twitter,\n Youtube,\n} from \"lucide-react\";\nimport { Group } from \"./types.js\";\n\nexport const GROUPS: Group[] = [\n {\n name: \"format\",\n title: \"Format\",\n commands: [\n {\n name: \"heading1\",\n label: \"Heading 1\",\n icon: Heading1,\n description: \"High priority section title\",\n aliases: [\"h1\"],\n action: (editor) => {\n editor.chain().focus().setHeading({ level: 1 }).run();\n },\n },\n {\n name: \"heading2\",\n label: \"Heading 2\",\n icon: Heading2,\n description: \"Medium priority section title\",\n aliases: [\"h2\"],\n action: (editor) => {\n editor.chain().focus().setHeading({ level: 2 }).run();\n },\n },\n {\n name: \"heading3\",\n label: \"Heading 3\",\n icon: Heading3,\n description: \"Low priority section title\",\n aliases: [\"h3\"],\n action: (editor) => {\n editor.chain().focus().setHeading({ level: 3 }).run();\n },\n },\n {\n name: \"bulletList\",\n label: \"Bullet List\",\n icon: List,\n description: \"Unordered list of items\",\n aliases: [\"ul\"],\n action: (editor) => {\n editor.chain().focus().toggleBulletList().run();\n },\n },\n {\n name: \"numberedList\",\n label: \"Numbered List\",\n icon: ListOrdered,\n description: \"Ordered list of items\",\n aliases: [\"ol\"],\n action: (editor) => {\n editor.chain().focus().toggleOrderedList().run();\n },\n },\n // {\n // name: 'taskList',\n // label: 'Task List',\n // icon: ListTodo,\n // description: 'Task list with todo items',\n // aliases: ['todo'],\n // action: (editor) => {\n // editor.chain().focus().toggleTaskList().run()\n // },\n // },\n {\n name: \"blockquote\",\n label: \"Blockquote\",\n icon: Quote,\n description: \"Element for quoting\",\n action: (editor) => {\n editor.chain().focus().setBlockquote().run();\n },\n },\n {\n name: \"codeBlock\",\n label: \"Code Block\",\n icon: SquareCode,\n description: \"Code block with syntax highlighting\",\n shouldBeHidden: (editor) => editor.isActive(\"columns\"),\n action: (editor) => {\n editor.chain().focus().setCodeBlock().run();\n },\n },\n ],\n },\n {\n name: \"insert\",\n title: \"Insert\",\n commands: [\n {\n name: \"table\",\n label: \"Table\",\n icon: Table,\n description: \"Insert a table\",\n shouldBeHidden: (editor) => editor.isActive(\"columns\"),\n action: (editor) => {\n editor\n .chain()\n .focus()\n .insertTable({ rows: 3, cols: 3, withHeaderRow: false })\n .run();\n },\n },\n {\n name: \"image\",\n label: \"Image\",\n icon: Image,\n description: \"Insert an image\",\n aliases: [\"img\"],\n action: (editor) => {\n editor.chain().focus().setImageUpload().run();\n },\n },\n {\n name: \"columns\",\n label: \"Columns\",\n icon: Columns2,\n description: \"Add two column content\",\n aliases: [\"cols\"],\n shouldBeHidden: (editor) => editor.isActive(\"columns\"),\n action: (editor) => {\n editor\n .chain()\n .focus()\n .setColumns()\n .focus(editor.state.selection.head - 1)\n .run();\n },\n },\n {\n name: \"horizontalRule\",\n label: \"Horizontal Rule\",\n icon: Minus,\n description: \"Insert a horizontal divider\",\n aliases: [\"hr\"],\n action: (editor) => {\n editor.chain().focus().setHorizontalRule().run();\n },\n },\n {\n name: \"toc\",\n label: \"Table of Contents\",\n icon: Book,\n aliases: [\"outline\"],\n description: \"Insert a table of contents\",\n shouldBeHidden: (editor) => editor.isActive(\"columns\"),\n action: (editor) => {\n editor.chain().focus().insertTableOfContents().run();\n },\n },\n ],\n },\n {\n name: \"embed\",\n title: \"Embed\",\n commands: [\n {\n name: \"iframe\",\n label: \"IFrame\",\n icon: Link,\n aliases: [\"iframe\"],\n description: \"Insert a iframe\",\n shouldBeHidden: (editor) => editor.isActive(\"iframe\"),\n action: (editor) => {\n editor\n .chain()\n .focus()\n .setHtml(\"<div>Embed your content here</div>\")\n .run();\n },\n },\n {\n name: \"twitter\",\n label: \"Twitter Embed\",\n icon: Twitter,\n aliases: [\"x\", \"twitter\"],\n description: \"Insert a Twitter embed\",\n shouldBeHidden: (editor) => editor.isActive(\"twitter\"),\n action: (editor) => {\n editor.chain().focus().insertTwitter().run();\n },\n },\n // {\n // name: 'facebook',\n // label: 'Facebook Embed',\n // icon: Facebook,\n // aliases: ['meta', 'facebook'],\n // description: 'Insert a Facebook embed',\n // shouldBeHidden: (editor) => editor.isActive('facebook'),\n // action: (editor) => {\n // editor.chain().focus().insertFacebook().run()\n // },\n // },\n {\n name: \"instagram\",\n label: \"Instagram Embed\",\n icon: Instagram,\n aliases: [\"instagram\"],\n description: \"Insert a Instagram embed\",\n shouldBeHidden: (editor) => editor.isActive(\"instagram\"),\n action: (editor) => {\n editor.chain().focus().insertInstagram().run();\n },\n },\n {\n name: \"youtube\",\n label: \"Youtube Embed\",\n icon: Youtube,\n aliases: [\"youtube\"],\n description: \"Insert a Youtube embed\",\n shouldBeHidden: (editor) => editor.isActive(\"youtube\"),\n action: (editor) => {\n editor.chain().focus().insertYoutube().run();\n },\n },\n {\n name: \"insideLinks\",\n label: \"TRT Links\",\n icon: Youtube,\n aliases: [\"insideLinks\"],\n description:\n \"Link internal content such as articles, videos, shows etc.\",\n shouldBeHidden: (editor) => editor.isActive(\"insideLinks\"),\n action: (editor) => {\n editor.chain().focus().insertInsideLinks({}).run();\n },\n },\n // {\n // name: 'linkedin',\n // label: 'Linkedin Embed',\n // icon: Linkedin,\n // aliases: ['linkedin'],\n // description: 'Insert a Linkedin embed',\n // shouldBeHidden: (editor) => editor.isActive('linkedin'),\n // action: (editor) => {\n\n // editor.chain().focus().insertLinkedin().run()\n // },\n // },\n\n // {\n // name: 'tiktok',\n // label: 'Tiktok Embed',\n // icon: Music,\n // aliases: ['tiktok'],\n // description: 'Insert a Tiktok embed',\n // shouldBeHidden: (editor) => editor.isActive('tiktok'),\n // action: (editor) => {\n // editor.chain().focus().insertTiktok().run()\n // },\n // },\n ],\n },\n];\n\nexport default GROUPS;\n"],"names":["Book","Columns2","Heading1","Heading2","Heading3","Image","Instagram","Link","List","ListOrdered","Minus","Quote","SquareCode","Table","Twitter","Youtube","GROUPS","name","title","commands","label","icon","description","aliases","action","editor","chain","focus","setHeading","level","run","toggleBulletList","toggleOrderedList","setBlockquote","shouldBeHidden","isActive","setCodeBlock","insertTable","rows","cols","withHeaderRow","setImageUpload","setColumns","state","selection","head","setHorizontalRule","insertTableOfContents","setHtml","insertTwitter","insertInstagram","insertYoutube","insertInsideLinks"],"mappings":"AAAA,SACEA,IAAI,EACJC,QAAQ,EAERC,QAAQ,EACRC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,IAAI,EAEJC,IAAI,EACJC,WAAW,EAEXC,KAAK,EAELC,KAAK,EACLC,UAAU,EACVC,KAAK,EAELC,OAAO,EACPC,OAAO,QACF,eAAe;AAGtB,OAAO,MAAMC,SAAkB;IAC7B;QACEC,MAAM;QACNC,OAAO;QACPC,UAAU;YACR;gBACEF,MAAM;gBACNG,OAAO;gBACPC,MAAMnB;gBACNoB,aAAa;gBACbC,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGC,UAAU,CAAC;wBAAEC,OAAO;oBAAE,GAAGC,GAAG;gBACrD;YACF;YACA;gBACEb,MAAM;gBACNG,OAAO;gBACPC,MAAMlB;gBACNmB,aAAa;gBACbC,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGC,UAAU,CAAC;wBAAEC,OAAO;oBAAE,GAAGC,GAAG;gBACrD;YACF;YACA;gBACEb,MAAM;gBACNG,OAAO;gBACPC,MAAMjB;gBACNkB,aAAa;gBACbC,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGC,UAAU,CAAC;wBAAEC,OAAO;oBAAE,GAAGC,GAAG;gBACrD;YACF;YACA;gBACEb,MAAM;gBACNG,OAAO;gBACPC,MAAMb;gBACNc,aAAa;gBACbC,SAAS;oBAAC;iBAAK;gBACfC,QAAQ,CA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,GAAGnB,GAAG;gBAC5C;YACF;YACA,IAAI;YACJ,sBAAsB;YACtB,6BAA6B;YAC7B,oBAAoB;YACpB,mCAAmC;YACnC,4CAA4C;YAC5C,6DAA6D;YAC7D,0BAA0B;YAC1B,oDAAoD;YACpD,OAAO;YACP,KAAK;YACL;gBACEb,MAAM;gBACNG,OAAO;gBACPC,MAAMf;gBACNiB,SAAS;oBAAC;iBAAY;gBACtBD,aAAa;gBACbY,gBAAgB,CAACT,SAAWA,OAAOU,QAAQ,CAAC;gBAC5CX,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGuB,eAAe,GAAGpB,GAAG;gBAC9C;YACF;YACA;gBACEb,MAAM;gBACNG,OAAO;gBACPC,MAAMN;gBACNQ,SAAS;oBAAC;iBAAU;gBACpBD,aAAa;gBACbY,gBAAgB,CAACT,SAAWA,OAAOU,QAAQ,CAAC;gBAC5CX,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGwB,aAAa,GAAGrB,GAAG;gBAC5C;YACF;YACA;gBACEb,MAAM;gBACNG,OAAO;gBACPC,MAAMN;gBACNQ,SAAS;oBAAC;iBAAc;gBACxBD,aACE;gBACFY,gBAAgB,CAACT,SAAWA,OAAOU,QAAQ,CAAC;gBAC5CX,QAAQ,CAACC;oBACPA,OAAOC,KAAK,GAAGC,KAAK,GAAGyB,iBAAiB,CAAC,CAAC,GAAGtB,GAAG;gBAClD;YACF;SAyBD;IACH;CACD,CAAC;AAEF,eAAed,OAAO"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/groups.ts"],"sourcesContent":["import {\n Book,\n Columns2,\n Facebook,\n Heading1,\n Heading2,\n Heading3,\n Image,\n Instagram,\n Link,\n Linkedin,\n List,\n ListOrdered,\n ListTodo,\n Minus,\n Music,\n Pen,\n Quote,\n SquareCode,\n Table,\n Twitch,\n Twitter,\n Youtube,\n} from \"lucide-react\";\nimport { Group } from \"./types.js\";\n\nexport const GROUPS: Group[] = [\n {\n name: \"draft\",\n title: \"Draft with AI\",\n commands: [\n {\n name: \"brainstorm\",\n label: \"Brainstorm Ideas...\",\n description: \"Brainstorm ideas on \",\n icon: Pen,\n action: (editor) => {\n // \"Brainstorm ideas on \"\n return \"Brainstorm ideas on \";\n // editor.chain().focus().setHeading({ level: 1 }).run();\n },\n },\n {\n name: \"blog\",\n label: \"Blog post...\",\n description: \"Blog post\",\n action: (editor) => {\n return \"Write a blog post about \";\n\n // \"Write a blog post about \"\n // editor.chain().focus().setHeading({ level: 1 }).run();\n },\n icon: Pen,\n },\n {\n name: \"outline\",\n label: \"Outline...\",\n description: \"Outline\",\n\n action: (editor) => {\n return \"Write an outline about \";\n // editor.chain().focus().setHeading({ level: 1 }).run();\n },\n icon: Pen,\n },\n\n {\n name: \"social\",\n label: \"Social Media post...\",\n description: \"Social Media post\",\n\n icon: Pen,\n action: (editor) => {\n return;\n (\"Write a social media post about \");\n // editor.chain().focus().setHeading({ level: 1 }).run();\n },\n },\n {\n name: \"press\",\n label: \"Press release...\",\n description: \"Press release\",\n\n icon: Pen,\n action: (editor) => {\n return \"Write a press release about \";\n // editor.chain().focus().setHeading({ level: 1 }).run();\n },\n },\n {\n name: \"creative\",\n label: \"Creative Story...\",\n description: \"Creative Story\",\n action: (editor) => {\n return \"Write a creative story about \";\n // editor.chain().focus().setHeading({ level: 1 }).run();\n },\n icon: Pen,\n },\n {\n name: \"essay\",\n label: \"Essay...\",\n description: \"Essay\",\n action: (editor) => {\n return \"Write an essay about \";\n // editor.chain().focus().setHeading({ level: 1 }).run();\n },\n icon: Pen,\n },\n ],\n },\n];\n\nexport default GROUPS;\n"],"names":["Pen","GROUPS","name","title","commands","label","description","icon","action","editor"],"mappings":"AAAA,SAgBEA,GAAG,QAOE,eAAe;AAGtB,OAAO,MAAMC,SAAkB;IAC7B;QACEC,MAAM;QACNC,OAAO;QACPC,UAAU;YACR;gBACEF,MAAM;gBACNG,OAAO;gBACPC,aAAa;gBACbC,MAAMP;gBACNQ,QAAQ,CAACC;oBACP,0BAA0B;oBAC1B,OAAO;gBACP,yDAAyD;gBAC3D;YACF;YACA;gBACEP,MAAM;gBACNG,OAAO;gBACPC,aAAa;gBACbE,QAAQ,CAACC;oBACP,OAAO;gBAEP,8BAA8B;gBAC9B,yDAAyD;gBAC3D;gBACAF,MAAMP;YACR;YACA;gBACEE,MAAM;gBACNG,OAAO;gBACPC,aAAa;gBAEbE,QAAQ,CAACC;oBACP,OAAO;gBACP,yDAAyD;gBAC3D;gBACAF,MAAMP;YACR;YAEA;gBACEE,MAAM;gBACNG,OAAO;gBACPC,aAAa;gBAEbC,MAAMP;gBACNQ,QAAQ,CAACC;oBACP;oBACC;gBACD,yDAAyD;gBAC3D;YACF;YACA;gBACEP,MAAM;gBACNG,OAAO;gBACPC,aAAa;gBAEbC,MAAMP;gBACNQ,QAAQ,CAACC;oBACP,OAAO;gBACP,yDAAyD;gBAC3D;YACF;YACA;gBACEP,MAAM;gBACNG,OAAO;gBACPC,aAAa;gBACbE,QAAQ,CAACC;oBACP,OAAO;gBACP,yDAAyD;gBAC3D;gBACAF,MAAMP;YACR;YACA;gBACEE,MAAM;gBACNG,OAAO;gBACPC,aAAa;gBACbE,QAAQ,CAACC;oBACP,OAAO;gBACP,yDAAyD;gBAC3D;gBACAF,MAAMP;YACR;SACD;IACH;CACD,CAAC;AAEF,eAAeC,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,GAAG,CAAC;IAChC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9C;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/types.ts"],"sourcesContent":["import { Editor } from \"@tiptap/core\";\nimport { LucideIcon } from \"lucide-react\";\n\nexport interface Group {\n name: string;\n title: string;\n commands: Command[];\n}\n\nexport interface Command {\n name: string;\n label: string;\n description: string;\n aliases?: string[];\n icon: LucideIcon;\n action: (editor: Editor) =>
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/types.ts"],"sourcesContent":["import { Editor } from \"@tiptap/core\";\nimport { LucideIcon } from \"lucide-react\";\n\nexport interface Group {\n name: string;\n title: string;\n commands: Command[];\n}\n\nexport interface Command {\n name: string;\n label: string;\n description: string;\n aliases?: string[];\n icon: LucideIcon;\n action: (editor: Editor) => any;\n shouldBeHidden?: (editor: Editor) => boolean;\n}\n\nexport interface AIMenuListProps {\n editor: Editor;\n items: Group[];\n command: (command: Command) => void;\n}\n"],"names":[],"mappings":"AAmBA,WAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AIEditorParagraph.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/Paragraph/AIEditorParagraph.tsx"],"names":[],"mappings":";AAEA,wBAgCE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { NodeViewContent, NodeViewWrapper } from "@tiptap/react";
|
|
3
|
+
export default ((props)=>{
|
|
4
|
+
console.log("PROPS", props);
|
|
5
|
+
return /*#__PURE__*/ _jsx(NodeViewWrapper, {
|
|
6
|
+
onClick: ()=>{
|
|
7
|
+
props?.editor?.commands?.setNodeSelection(props.getPos());
|
|
8
|
+
},
|
|
9
|
+
children: /*#__PURE__*/ _jsx(NodeViewContent, {
|
|
10
|
+
contentEditable: "false",
|
|
11
|
+
children: props?.node?.type?.spec?.draggable ? /*#__PURE__*/ _jsx("div", {
|
|
12
|
+
draggable: "true",
|
|
13
|
+
"data-drag-handle": "",
|
|
14
|
+
style: {
|
|
15
|
+
width: "100%"
|
|
16
|
+
},
|
|
17
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
18
|
+
className: "w-full bg-zinc-100 py-8 px-6 flex items-center justify-center gap-2 socialMediaCard",
|
|
19
|
+
draggable: "true",
|
|
20
|
+
"data-drag-handle": "",
|
|
21
|
+
contentEditable: "false",
|
|
22
|
+
children: /*#__PURE__*/ _jsx("p", {
|
|
23
|
+
className: "w-full flex items-center justify-start mt-0",
|
|
24
|
+
style: {
|
|
25
|
+
marginTop: 0
|
|
26
|
+
},
|
|
27
|
+
children: "TEEEEE"
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
}) : null
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=AIEditorParagraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/Paragraph/AIEditorParagraph.tsx"],"sourcesContent":["import { NodeViewContent, NodeViewWrapper } from \"@tiptap/react\";\n\nexport default (props) => {\n console.log(\"PROPS\", props);\n return (\n <NodeViewWrapper\n onClick={() => {\n props?.editor?.commands?.setNodeSelection(props.getPos());\n }}\n >\n <NodeViewContent contentEditable=\"false\">\n {props?.node?.type?.spec?.draggable ? (\n <div draggable=\"true\" data-drag-handle=\"\" style={{ width: \"100%\" }}>\n <div\n className=\"w-full bg-zinc-100 py-8 px-6 flex items-center justify-center gap-2 socialMediaCard\"\n draggable=\"true\"\n data-drag-handle=\"\"\n contentEditable=\"false\"\n >\n <p\n className=\"w-full flex items-center justify-start mt-0\"\n style={{\n marginTop: 0,\n }}\n >\n TEEEEE\n {/* {text} */}\n </p>\n </div>\n </div>\n ) : null}\n </NodeViewContent>\n </NodeViewWrapper>\n );\n};\n"],"names":["NodeViewContent","NodeViewWrapper","props","console","log","onClick","editor","commands","setNodeSelection","getPos","contentEditable","node","type","spec","draggable","div","data-drag-handle","style","width","className","p","marginTop"],"mappings":";AAAA,SAASA,eAAe,EAAEC,eAAe,QAAQ,gBAAgB;AAEjE,eAAe,CAAA,CAACC;IACdC,QAAQC,GAAG,CAAC,SAASF;IACrB,qBACE,KAACD;QACCI,SAAS;YACPH,OAAOI,QAAQC,UAAUC,iBAAiBN,MAAMO,MAAM;QACxD;kBAEA,cAAA,KAACT;YAAgBU,iBAAgB;sBAC9BR,OAAOS,MAAMC,MAAMC,MAAMC,0BACxB,KAACC;gBAAID,WAAU;gBAAOE,oBAAiB;gBAAGC,OAAO;oBAAEC,OAAO;gBAAO;0BAC/D,cAAA,KAACH;oBACCI,WAAU;oBACVL,WAAU;oBACVE,oBAAiB;oBACjBN,iBAAgB;8BAEhB,cAAA,KAACU;wBACCD,WAAU;wBACVF,OAAO;4BACLI,WAAW;wBACb;kCACD;;;iBAMH;;;AAIZ,CAAA,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuList.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/MenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAW,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"MenuList.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/MenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAIxE,OAAO,EAAW,aAAa,EAAE,MAAM,YAAY,CAAC;AAKpD,eAAO,MAAM,QAAQ,+EAoJnB,CAAC;AAIH,eAAe,QAAQ,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { DropdownButton } from "../../features/ui/Dropdown/Dropdown.js";
|
|
4
4
|
import { Surface } from "../../features/ui/Surface.js";
|
|
5
5
|
import { Icon } from "../../features/ui/Icon.js";
|
|
6
|
+
import { AICommandPanel } from "../../features/panels/AICommandPanel/AICommandPanel.js";
|
|
6
7
|
export const MenuList = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
7
8
|
const scrollContainer = useRef(null);
|
|
8
9
|
const activeItem = useRef(null);
|
|
@@ -90,31 +91,39 @@ export const MenuList = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
|
90
91
|
if (!props.items.length) {
|
|
91
92
|
return null;
|
|
92
93
|
}
|
|
93
|
-
return /*#__PURE__*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
94
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
95
|
+
children: [
|
|
96
|
+
/*#__PURE__*/ _jsx(AICommandPanel, {
|
|
97
|
+
editor: props.editor,
|
|
98
|
+
onOpenChange: ()=>{}
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ _jsx(Surface, {
|
|
101
|
+
ref: scrollContainer,
|
|
102
|
+
className: "text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-2",
|
|
103
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
104
|
+
className: "grid grid-cols-1 gap-0.5",
|
|
105
|
+
children: props.items.map((group, groupIndex)=>/*#__PURE__*/ _jsxs(React.Fragment, {
|
|
106
|
+
children: [
|
|
107
|
+
/*#__PURE__*/ _jsx("div", {
|
|
108
|
+
className: "text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-4 font-semibold tracking-wider select-none uppercase first:mt-0.5",
|
|
109
|
+
children: group.title
|
|
110
|
+
}, `${group.title}`),
|
|
111
|
+
group.commands.map((command, commandIndex)=>/*#__PURE__*/ _jsxs(DropdownButton, {
|
|
112
|
+
isActive: selectedGroupIndex === groupIndex && selectedCommandIndex === commandIndex,
|
|
113
|
+
onClick: createCommandClickHandler(groupIndex, commandIndex),
|
|
114
|
+
children: [
|
|
115
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
116
|
+
icon: command.icon,
|
|
117
|
+
className: "mr-1"
|
|
118
|
+
}),
|
|
119
|
+
command.label
|
|
120
|
+
]
|
|
121
|
+
}, `${command.label}`))
|
|
122
|
+
]
|
|
123
|
+
}, `${group.title}-wrapper`))
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
]
|
|
118
127
|
});
|
|
119
128
|
});
|
|
120
129
|
MenuList.displayName = "MenuList";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/MenuList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { DropdownButton } from \"../../features/ui/Dropdown/Dropdown.js\";\nimport { Surface } from \"../../features/ui/Surface.js\";\nimport { Command, MenuListProps } from \"./types.js\";\n\nimport { Icon } from \"../../features/ui/Icon.js\";\n\nexport const MenuList = React.forwardRef((props: MenuListProps, ref) => {\n const scrollContainer = useRef<HTMLDivElement>(null);\n const activeItem = useRef<HTMLButtonElement>(null);\n const [selectedGroupIndex, setSelectedGroupIndex] = useState(0);\n const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);\n\n // Anytime the groups change, i.e. the user types to narrow it down, we want to\n // reset the current selection to the first menu item\n useEffect(() => {\n setSelectedGroupIndex(0);\n setSelectedCommandIndex(0);\n }, [props.items]);\n\n const selectItem = useCallback(\n (groupIndex: number, commandIndex: number) => {\n const command = props.items[groupIndex].commands[commandIndex];\n props.command(command);\n },\n [props]\n );\n\n React.useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }: { event: React.KeyboardEvent }) => {\n if (event.key === \"ArrowDown\") {\n if (!props.items.length) {\n return false;\n }\n\n const commands = props.items[selectedGroupIndex].commands;\n\n let newCommandIndex = selectedCommandIndex + 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (commands.length - 1 < newCommandIndex) {\n newCommandIndex = 0;\n newGroupIndex = selectedGroupIndex + 1;\n }\n\n if (props.items.length - 1 < newGroupIndex) {\n newGroupIndex = 0;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"ArrowUp\") {\n if (!props.items.length) {\n return false;\n }\n\n let newCommandIndex = selectedCommandIndex - 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (newCommandIndex < 0) {\n newGroupIndex = selectedGroupIndex - 1;\n newCommandIndex =\n props.items[newGroupIndex]?.commands.length - 1 || 0;\n }\n\n if (newGroupIndex < 0) {\n newGroupIndex = props.items.length - 1;\n newCommandIndex = props.items[newGroupIndex].commands.length - 1;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"Enter\") {\n if (\n !props.items.length ||\n selectedGroupIndex === -1 ||\n selectedCommandIndex === -1\n ) {\n return false;\n }\n\n selectItem(selectedGroupIndex, selectedCommandIndex);\n\n return true;\n }\n\n return false;\n },\n }));\n\n useEffect(() => {\n if (activeItem.current && scrollContainer.current) {\n const offsetTop = activeItem.current.offsetTop;\n const offsetHeight = activeItem.current.offsetHeight;\n\n scrollContainer.current.scrollTop = offsetTop - offsetHeight;\n }\n }, [selectedCommandIndex, selectedGroupIndex]);\n\n const createCommandClickHandler = useCallback(\n (groupIndex: number, commandIndex: number) => {\n return () => {\n selectItem(groupIndex, commandIndex);\n };\n },\n [selectItem]\n );\n\n if (!props.items.length) {\n return null;\n }\n\n return (\n <Surface\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/SlashCommand/MenuList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { DropdownButton } from \"../../features/ui/Dropdown/Dropdown.js\";\nimport { Surface } from \"../../features/ui/Surface.js\";\nimport { Command, MenuListProps } from \"./types.js\";\n\nimport { Icon } from \"../../features/ui/Icon.js\";\nimport { AICommandPanel } from \"../../features/panels/AICommandPanel/AICommandPanel.js\";\n\nexport const MenuList = React.forwardRef((props: MenuListProps, ref) => {\n const scrollContainer = useRef<HTMLDivElement>(null);\n const activeItem = useRef<HTMLButtonElement>(null);\n const [selectedGroupIndex, setSelectedGroupIndex] = useState(0);\n const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);\n\n // Anytime the groups change, i.e. the user types to narrow it down, we want to\n // reset the current selection to the first menu item\n useEffect(() => {\n setSelectedGroupIndex(0);\n setSelectedCommandIndex(0);\n }, [props.items]);\n\n const selectItem = useCallback(\n (groupIndex: number, commandIndex: number) => {\n const command = props.items[groupIndex].commands[commandIndex];\n props.command(command);\n },\n [props]\n );\n\n React.useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }: { event: React.KeyboardEvent }) => {\n if (event.key === \"ArrowDown\") {\n if (!props.items.length) {\n return false;\n }\n\n const commands = props.items[selectedGroupIndex].commands;\n\n let newCommandIndex = selectedCommandIndex + 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (commands.length - 1 < newCommandIndex) {\n newCommandIndex = 0;\n newGroupIndex = selectedGroupIndex + 1;\n }\n\n if (props.items.length - 1 < newGroupIndex) {\n newGroupIndex = 0;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"ArrowUp\") {\n if (!props.items.length) {\n return false;\n }\n\n let newCommandIndex = selectedCommandIndex - 1;\n let newGroupIndex = selectedGroupIndex;\n\n if (newCommandIndex < 0) {\n newGroupIndex = selectedGroupIndex - 1;\n newCommandIndex =\n props.items[newGroupIndex]?.commands.length - 1 || 0;\n }\n\n if (newGroupIndex < 0) {\n newGroupIndex = props.items.length - 1;\n newCommandIndex = props.items[newGroupIndex].commands.length - 1;\n }\n\n setSelectedCommandIndex(newCommandIndex);\n setSelectedGroupIndex(newGroupIndex);\n\n return true;\n }\n\n if (event.key === \"Enter\") {\n if (\n !props.items.length ||\n selectedGroupIndex === -1 ||\n selectedCommandIndex === -1\n ) {\n return false;\n }\n\n selectItem(selectedGroupIndex, selectedCommandIndex);\n\n return true;\n }\n\n return false;\n },\n }));\n\n useEffect(() => {\n if (activeItem.current && scrollContainer.current) {\n const offsetTop = activeItem.current.offsetTop;\n const offsetHeight = activeItem.current.offsetHeight;\n\n scrollContainer.current.scrollTop = offsetTop - offsetHeight;\n }\n }, [selectedCommandIndex, selectedGroupIndex]);\n\n const createCommandClickHandler = useCallback(\n (groupIndex: number, commandIndex: number) => {\n return () => {\n selectItem(groupIndex, commandIndex);\n };\n },\n [selectItem]\n );\n\n if (!props.items.length) {\n return null;\n }\n\n return (\n <>\n <AICommandPanel editor={props.editor as any} onOpenChange={() => {}} />\n <Surface\n ref={scrollContainer}\n className=\"text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-2\"\n >\n <div className=\"grid grid-cols-1 gap-0.5\">\n {props.items.map((group, groupIndex: number) => (\n <React.Fragment key={`${group.title}-wrapper`}>\n <div\n className=\"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-4 font-semibold tracking-wider select-none uppercase first:mt-0.5\"\n key={`${group.title}`}\n >\n {group.title}\n </div>\n {group.commands.map((command: Command, commandIndex: number) => (\n <DropdownButton\n key={`${command.label}`}\n isActive={\n selectedGroupIndex === groupIndex &&\n selectedCommandIndex === commandIndex\n }\n onClick={createCommandClickHandler(groupIndex, commandIndex)}\n >\n <Icon icon={command.icon} className=\"mr-1\" />\n {command.label}\n </DropdownButton>\n ))}\n </React.Fragment>\n ))}\n </div>\n </Surface>\n </>\n );\n});\n\nMenuList.displayName = \"MenuList\";\n\nexport default MenuList;\n"],"names":["React","useCallback","useEffect","useRef","useState","DropdownButton","Surface","Icon","AICommandPanel","MenuList","forwardRef","props","ref","scrollContainer","activeItem","selectedGroupIndex","setSelectedGroupIndex","selectedCommandIndex","setSelectedCommandIndex","items","selectItem","groupIndex","commandIndex","command","commands","useImperativeHandle","onKeyDown","event","key","length","newCommandIndex","newGroupIndex","current","offsetTop","offsetHeight","scrollTop","createCommandClickHandler","editor","onOpenChange","className","div","map","group","Fragment","title","isActive","onClick","icon","label","displayName"],"mappings":";AAAA,OAAOA,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAExE,SAASC,cAAc,QAAQ,yCAAyC;AACxE,SAASC,OAAO,QAAQ,+BAA+B;AAGvD,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,cAAc,QAAQ,yDAAyD;AAExF,OAAO,MAAMC,yBAAWT,MAAMU,UAAU,CAAC,CAACC,OAAsBC;IAC9D,MAAMC,kBAAkBV,OAAuB;IAC/C,MAAMW,aAAaX,OAA0B;IAC7C,MAAM,CAACY,oBAAoBC,sBAAsB,GAAGZ,SAAS;IAC7D,MAAM,CAACa,sBAAsBC,wBAAwB,GAAGd,SAAS;IAEjE,+EAA+E;IAC/E,qDAAqD;IACrDF,UAAU;QACRc,sBAAsB;QACtBE,wBAAwB;IAC1B,GAAG;QAACP,MAAMQ,KAAK;KAAC;IAEhB,MAAMC,aAAanB,YACjB,CAACoB,YAAoBC;QACnB,MAAMC,UAAUZ,MAAMQ,KAAK,CAACE,WAAW,CAACG,QAAQ,CAACF,aAAa;QAC9DX,MAAMY,OAAO,CAACA;IAChB,GACA;QAACZ;KAAM;IAGTX,MAAMyB,mBAAmB,CAACb,KAAK,IAAO,CAAA;YACpCc,WAAW,CAAC,EAAEC,KAAK,EAAkC;gBACnD,IAAIA,MAAMC,GAAG,KAAK,aAAa;oBAC7B,IAAI,CAACjB,MAAMQ,KAAK,CAACU,MAAM,EAAE;wBACvB,OAAO;oBACT;oBAEA,MAAML,WAAWb,MAAM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,eAAepB,WAAWkB,OAAO,CAACE,YAAY;YAEpDrB,gBAAgBmB,OAAO,CAACG,SAAS,GAAGF,YAAYC;QAClD;IACF,GAAG;QAACjB;QAAsBF;KAAmB;IAE7C,MAAMqB,4BAA4BnC,YAChC,CAACoB,YAAoBC;QACnB,OAAO;YACLF,WAAWC,YAAYC;QACzB;IACF,GACA;QAACF;KAAW;IAGd,IAAI,CAACT,MAAMQ,KAAK,CAACU,MAAM,EAAE;QACvB,OAAO;IACT;IAEA,qBACE;;0BACE,KAACrB;gBAAe6B,QAAQ1B,MAAM0B,MAAM;gBAASC,cAAc,KAAO;;0BAClE,KAAChC;gBACCM,KAAKC;gBACL0B,WAAU;0BAEV,cAAA,KAACC;oBAAID,WAAU;8BACZ5B,MAAMQ,KAAK,CAACsB,GAAG,CAAC,CAACC,OAAOrB,2BACvB,MAACrB,MAAM2C,QAAQ;;8CACb,KAACH;oCACCD,WAAU;8CAGTG,MAAME,KAAK;mCAFP,CAAC,EAAEF,MAAME,KAAK,CAAC,CAAC;gCAItBF,MAAMlB,QAAQ,CAACiB,GAAG,CAAC,CAAClB,SAAkBD,6BACrC,MAACjB;wCAECwC,UACE9B,uBAAuBM,cACvBJ,yBAAyBK;wCAE3BwB,SAASV,0BAA0Bf,YAAYC;;0DAE/C,KAACf;gDAAKwC,MAAMxB,QAAQwB,IAAI;gDAAER,WAAU;;4CACnChB,QAAQyB,KAAK;;uCART,CAAC,EAAEzB,QAAQyB,KAAK,CAAC,CAAC;;2BATR,CAAC,EAAEN,MAAME,KAAK,CAAC,QAAQ,CAAC;;;;;AA0BzD,GAAG;AAEHnC,SAASwC,WAAW,GAAG;AAEvB,eAAexC,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-kit.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension-kit.d.ts","sourceRoot":"","sources":["../../../../../src/fields/TiptapEditor/extensions/extension-kit.ts"],"names":[],"mappings":"AAwDA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAI9C,UAAU,iBAAiB;IACzB,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,kBAAkB,EAAE,eAAe,CAAC;CACrC;AAED,eAAO,MAAM,YAAY,iCAGtB,iBAAiB,+LAsHnB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AICommand, BlockquoteFigure, CharacterCount, Color, Column, // emojiSuggestion,
|
|
2
|
-
Columns, Document, Dropcursor, Facebook, Figcaption, FileHandler, Focus, FontFamily, FontSize, Heading, Highlight, HorizontalRule, ImageBlock, InsideLinks, Instagram, Link, Linkedin, Placeholder, Selection, SlashCommand, StarterKit, Subscript, Superscript, Table, TableCell, TableHeader, TableOfContents, TableRow, TaskItem, TaskList, TextAlign, TextStyle, Tiktok, TrailingNode, Twitter, Typography, Underline, Youtube } from "./index.js";
|
|
2
|
+
Columns, Document, Dropcursor, Facebook, Figcaption, FileHandler, Focus, FontFamily, FontSize, Heading, Highlight, HorizontalRule, ImageBlock, InsideLinks, Instagram, Link, Linkedin, Placeholder, Paragraph, Selection, SlashCommand, StarterKit, Subscript, Superscript, Table, TableCell, TableHeader, TableOfContents, TableRow, TaskItem, TaskList, TextAlign, TextStyle, Tiktok, TrailingNode, Twitter, Typography, Underline, Youtube } from "./index.js";
|
|
3
3
|
import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
|
|
4
4
|
import lowlight from "lowlight";
|
|
5
5
|
import TextDirection from "tiptap-text-direction";
|
|
@@ -134,7 +134,7 @@ export const ExtensionKit = ({ dir, openAssetHQHandler })=>[
|
|
|
134
134
|
Facebook,
|
|
135
135
|
Linkedin,
|
|
136
136
|
Youtube,
|
|
137
|
-
|
|
137
|
+
Paragraph,
|
|
138
138
|
InsideLinks,
|
|
139
139
|
TextDirection.configure({
|
|
140
140
|
types: [
|