payload-richtext-tiptap 0.0.46 → 0.0.47
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/AIMenuList.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AIMenuList.js +10 -123
- package/dist/src/fields/TiptapEditor/extensions/AICommand/AIMenuList.js.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/MenuList.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/MenuList.js +26 -33
- package/dist/src/fields/TiptapEditor/extensions/SlashCommand/MenuList.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.d.ts +2 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.d.ts.map +1 -1
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.js +5 -5
- package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.d.ts +4 -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 +196 -69
- package/dist/src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.js.map +1 -1
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/AIEditorPanel.js +5 -3
- package/dist/src/fields/TiptapEditor/features/panels/AIEditorPanel/AIEditorPanel.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AIMenuList.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/AIMenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AIMenuList.d.ts","sourceRoot":"","sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/AIMenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAI7C,eAAO,MAAM,UAAU,iFAkBrB,CAAC;AAIH,eAAe,UAAU,CAAC"}
|
|
@@ -1,132 +1,19 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import React, {
|
|
3
|
-
import { DropdownButton } from "../../features/ui/Dropdown/Dropdown.js";
|
|
4
|
-
import { Surface } from "../../features/ui/Surface.js";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from "react";
|
|
5
3
|
import { AICommandPanel } from "../../features/panels/AICommandPanel/AICommandPanel.js";
|
|
6
|
-
import { Icon } from "../../features/ui/Icon.js";
|
|
7
4
|
export const AIMenuList = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
8
|
-
const scrollContainer = useRef(null);
|
|
9
|
-
const activeItem = useRef(null);
|
|
10
|
-
const [selectedGroupIndex, setSelectedGroupIndex] = useState(0);
|
|
11
|
-
const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);
|
|
12
5
|
const [userPrompt, setUserPrompt] = useState("");
|
|
13
|
-
// Anytime the groups change, i.e. the user types to narrow it down, we want to
|
|
14
|
-
// reset the current selection to the first menu item
|
|
15
|
-
useEffect(()=>{
|
|
16
|
-
setSelectedGroupIndex(0);
|
|
17
|
-
setSelectedCommandIndex(0);
|
|
18
|
-
}, [
|
|
19
|
-
props.items
|
|
20
|
-
]);
|
|
21
|
-
const selectItem = useCallback((groupIndex, commandIndex)=>{
|
|
22
|
-
const command = props.items[groupIndex].commands[commandIndex];
|
|
23
|
-
setUserPrompt(command.action(props.editor));
|
|
24
|
-
// props.command(command);
|
|
25
|
-
}, [
|
|
26
|
-
props
|
|
27
|
-
]);
|
|
28
|
-
React.useImperativeHandle(ref, ()=>({
|
|
29
|
-
onKeyDown: ({ event })=>{
|
|
30
|
-
if (event.key === "ArrowDown") {
|
|
31
|
-
if (!props.items.length) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const commands = props.items[selectedGroupIndex].commands;
|
|
35
|
-
let newCommandIndex = selectedCommandIndex + 1;
|
|
36
|
-
let newGroupIndex = selectedGroupIndex;
|
|
37
|
-
if (commands.length - 1 < newCommandIndex) {
|
|
38
|
-
newCommandIndex = 0;
|
|
39
|
-
newGroupIndex = selectedGroupIndex + 1;
|
|
40
|
-
}
|
|
41
|
-
if (props.items.length - 1 < newGroupIndex) {
|
|
42
|
-
newGroupIndex = 0;
|
|
43
|
-
}
|
|
44
|
-
setSelectedCommandIndex(newCommandIndex);
|
|
45
|
-
setSelectedGroupIndex(newGroupIndex);
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
if (event.key === "ArrowUp") {
|
|
49
|
-
if (!props.items.length) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
let newCommandIndex = selectedCommandIndex - 1;
|
|
53
|
-
let newGroupIndex = selectedGroupIndex;
|
|
54
|
-
if (newCommandIndex < 0) {
|
|
55
|
-
newGroupIndex = selectedGroupIndex - 1;
|
|
56
|
-
newCommandIndex = props.items[newGroupIndex]?.commands.length - 1 || 0;
|
|
57
|
-
}
|
|
58
|
-
if (newGroupIndex < 0) {
|
|
59
|
-
newGroupIndex = props.items.length - 1;
|
|
60
|
-
newCommandIndex = props.items[newGroupIndex].commands.length - 1;
|
|
61
|
-
}
|
|
62
|
-
setSelectedCommandIndex(newCommandIndex);
|
|
63
|
-
setSelectedGroupIndex(newGroupIndex);
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
if (event.key === "Enter") {
|
|
67
|
-
if (!props.items.length || selectedGroupIndex === -1 || selectedCommandIndex === -1) {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
selectItem(selectedGroupIndex, selectedCommandIndex);
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
}));
|
|
76
|
-
useEffect(()=>{
|
|
77
|
-
if (activeItem.current && scrollContainer.current) {
|
|
78
|
-
const offsetTop = activeItem.current.offsetTop;
|
|
79
|
-
const offsetHeight = activeItem.current.offsetHeight;
|
|
80
|
-
scrollContainer.current.scrollTop = offsetTop - offsetHeight;
|
|
81
|
-
}
|
|
82
|
-
}, [
|
|
83
|
-
selectedCommandIndex,
|
|
84
|
-
selectedGroupIndex
|
|
85
|
-
]);
|
|
86
|
-
const createCommandClickHandler = useCallback((groupIndex, commandIndex)=>{
|
|
87
|
-
return ()=>{
|
|
88
|
-
selectItem(groupIndex, commandIndex);
|
|
89
|
-
};
|
|
90
|
-
}, [
|
|
91
|
-
selectItem
|
|
92
|
-
]);
|
|
93
6
|
if (!props.items.length) {
|
|
94
7
|
return null;
|
|
95
8
|
}
|
|
96
|
-
return /*#__PURE__*/
|
|
97
|
-
children:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
ref: scrollContainer,
|
|
105
|
-
className: "text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-2",
|
|
106
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
107
|
-
className: "grid grid-cols-1 gap-0.5",
|
|
108
|
-
children: props.items.map((group, groupIndex)=>/*#__PURE__*/ _jsxs(React.Fragment, {
|
|
109
|
-
children: [
|
|
110
|
-
/*#__PURE__*/ _jsx("div", {
|
|
111
|
-
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",
|
|
112
|
-
children: group.title
|
|
113
|
-
}, `${group.title}`),
|
|
114
|
-
group.commands.map((command, commandIndex)=>/*#__PURE__*/ _jsxs(DropdownButton, {
|
|
115
|
-
isActive: selectedGroupIndex === groupIndex && selectedCommandIndex === commandIndex,
|
|
116
|
-
onClick: createCommandClickHandler(groupIndex, commandIndex),
|
|
117
|
-
children: [
|
|
118
|
-
/*#__PURE__*/ _jsx(Icon, {
|
|
119
|
-
icon: command.icon,
|
|
120
|
-
className: "mr-1"
|
|
121
|
-
}),
|
|
122
|
-
command.label
|
|
123
|
-
]
|
|
124
|
-
}, `${command.label}`))
|
|
125
|
-
]
|
|
126
|
-
}, `${group.title}-wrapper`))
|
|
127
|
-
})
|
|
128
|
-
})
|
|
129
|
-
]
|
|
9
|
+
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
10
|
+
children: /*#__PURE__*/ _jsx(AICommandPanel, {
|
|
11
|
+
editor: props?.editor,
|
|
12
|
+
onOpenChange: ()=>{},
|
|
13
|
+
userPrompt: userPrompt,
|
|
14
|
+
items: props?.items,
|
|
15
|
+
ref: ref
|
|
16
|
+
})
|
|
130
17
|
});
|
|
131
18
|
});
|
|
132
19
|
AIMenuList.displayName = "AIMenuList";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/AIMenuList.tsx"],"sourcesContent":["import React, {
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/fields/TiptapEditor/extensions/AICommand/AIMenuList.tsx"],"sourcesContent":["import React, { useState } from \"react\";\n\nimport { AIMenuListProps } from \"./types.js\";\n\nimport { AICommandPanel } from \"../../features/panels/AICommandPanel/AICommandPanel.js\";\n\nexport const AIMenuList = React.forwardRef((props: AIMenuListProps, ref) => {\n const [userPrompt, setUserPrompt] = useState(\"\");\n\n if (!props.items.length) {\n return null;\n }\n\n return (\n <>\n <AICommandPanel\n editor={props?.editor as any}\n onOpenChange={() => {}}\n userPrompt={userPrompt}\n items={props?.items}\n ref={ref}\n />\n </>\n );\n});\n\nAIMenuList.displayName = \"AIMenuList\";\n\nexport default AIMenuList;\n"],"names":["React","useState","AICommandPanel","AIMenuList","forwardRef","props","ref","userPrompt","setUserPrompt","items","length","editor","onOpenChange","displayName"],"mappings":";AAAA,OAAOA,SAASC,QAAQ,QAAQ,QAAQ;AAIxC,SAASC,cAAc,QAAQ,yDAAyD;AAExF,OAAO,MAAMC,2BAAaH,MAAMI,UAAU,CAAC,CAACC,OAAwBC;IAClE,MAAM,CAACC,YAAYC,cAAc,GAAGP,SAAS;IAE7C,IAAI,CAACI,MAAMI,KAAK,CAACC,MAAM,EAAE;QACvB,OAAO;IACT;IAEA,qBACE;kBACE,cAAA,KAACR;YACCS,QAAQN,OAAOM;YACfC,cAAc,KAAO;YACrBL,YAAYA;YACZE,OAAOJ,OAAOI;YACdH,KAAKA;;;AAIb,GAAG;AAEHH,WAAWU,WAAW,GAAG;AAEzB,eAAeV,WAAW"}
|
|
@@ -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;AAKpD,eAAO,MAAM,QAAQ,+
|
|
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,+EAmJnB,CAAC;AAIH,eAAe,QAAQ,CAAC"}
|
|
@@ -3,7 +3,6 @@ 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";
|
|
7
6
|
export const MenuList = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
8
7
|
const scrollContainer = useRef(null);
|
|
9
8
|
const activeItem = useRef(null);
|
|
@@ -91,39 +90,33 @@ export const MenuList = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
|
91
90
|
if (!props.items.length) {
|
|
92
91
|
return null;
|
|
93
92
|
}
|
|
94
|
-
return /*#__PURE__*/
|
|
95
|
-
children:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
children:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
command.label
|
|
120
|
-
]
|
|
121
|
-
}, `${command.label}`))
|
|
122
|
-
]
|
|
123
|
-
}, `${group.title}-wrapper`))
|
|
124
|
-
})
|
|
93
|
+
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
94
|
+
children: /*#__PURE__*/ _jsx(Surface, {
|
|
95
|
+
ref: scrollContainer,
|
|
96
|
+
className: "text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-2",
|
|
97
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
98
|
+
className: "grid grid-cols-1 gap-0.5",
|
|
99
|
+
children: props.items.map((group, groupIndex)=>/*#__PURE__*/ _jsxs(React.Fragment, {
|
|
100
|
+
children: [
|
|
101
|
+
/*#__PURE__*/ _jsx("div", {
|
|
102
|
+
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",
|
|
103
|
+
children: group.title
|
|
104
|
+
}, `${group.title}`),
|
|
105
|
+
group.commands.map((command, commandIndex)=>/*#__PURE__*/ _jsxs(DropdownButton, {
|
|
106
|
+
isActive: selectedGroupIndex === groupIndex && selectedCommandIndex === commandIndex,
|
|
107
|
+
onClick: createCommandClickHandler(groupIndex, commandIndex),
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
110
|
+
icon: command.icon,
|
|
111
|
+
className: "mr-1"
|
|
112
|
+
}),
|
|
113
|
+
command.label
|
|
114
|
+
]
|
|
115
|
+
}, `${command.label}`))
|
|
116
|
+
]
|
|
117
|
+
}, `${group.title}-wrapper`))
|
|
125
118
|
})
|
|
126
|
-
|
|
119
|
+
})
|
|
127
120
|
});
|
|
128
121
|
});
|
|
129
122
|
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\";\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 <
|
|
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 <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","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","className","div","map","group","Fragment","title","isActive","onClick","icon","label","displayName"],"mappings":"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"}
|
package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/react";
|
|
2
2
|
interface AISelectorCommandsProps {
|
|
3
3
|
editor: Editor;
|
|
4
|
+
messages?: string;
|
|
4
5
|
onSelect: (value: string, options: {
|
|
5
6
|
option: string;
|
|
6
7
|
language?: string;
|
|
7
8
|
}) => void;
|
|
8
9
|
}
|
|
9
|
-
declare const AISelectorCommands: ({ onSelect, editor }: AISelectorCommandsProps) => import("react").JSX.Element;
|
|
10
|
+
declare const AISelectorCommands: ({ messages, onSelect, editor, }: AISelectorCommandsProps) => import("react").JSX.Element;
|
|
10
11
|
export default AISelectorCommands;
|
|
11
12
|
//# sourceMappingURL=ai-selector-commands.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-selector-commands.d.ts","sourceRoot":"","sources":["../../../../../../../../src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAwDvC,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,CACR,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAC3C,IAAI,CAAC;CACX;AAED,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ai-selector-commands.d.ts","sourceRoot":"","sources":["../../../../../../../../src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAwDvC,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CACR,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAC3C,IAAI,CAAC;CACX;AAED,QAAA,MAAM,kBAAkB,oCAIrB,uBAAuB,gCA0FzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.js
CHANGED
|
@@ -46,8 +46,8 @@ const options = [
|
|
|
46
46
|
icon: WrapText
|
|
47
47
|
}
|
|
48
48
|
];
|
|
49
|
-
const AISelectorCommands = ({ onSelect, editor })=>{
|
|
50
|
-
const { status,
|
|
49
|
+
const AISelectorCommands = ({ messages, onSelect, editor })=>{
|
|
50
|
+
const { status, input, submitMessage, handleInputChange } = useAssistant({
|
|
51
51
|
api: "/api/assistant"
|
|
52
52
|
});
|
|
53
53
|
const { code } = useLocale();
|
|
@@ -92,7 +92,7 @@ const AISelectorCommands = ({ onSelect, editor })=>{
|
|
|
92
92
|
languages.map((lang)=>/*#__PURE__*/ _jsx(Toolbar.Button, {
|
|
93
93
|
onClick: ()=>{
|
|
94
94
|
const { from, to, empty } = editor.state.selection;
|
|
95
|
-
const content = editor.state.doc.textBetween(from, to, " ");
|
|
95
|
+
const content = messages ? messages ?? "" : editor.state.doc.textBetween(from, to, " ");
|
|
96
96
|
onSelect(content, {
|
|
97
97
|
option: "translate",
|
|
98
98
|
language: lang.value
|
|
@@ -114,7 +114,7 @@ const AISelectorCommands = ({ onSelect, editor })=>{
|
|
|
114
114
|
// }}
|
|
115
115
|
onClick: ()=>{
|
|
116
116
|
const { from, to, empty } = editor.state.selection;
|
|
117
|
-
const content = editor.state.doc.textBetween(from, to, " ");
|
|
117
|
+
const content = messages ? messages ?? "" : editor.state.doc.textBetween(from, to, " ");
|
|
118
118
|
onSelect(content, {
|
|
119
119
|
option: option.value,
|
|
120
120
|
language: code ?? "en"
|
|
@@ -137,7 +137,7 @@ const AISelectorCommands = ({ onSelect, editor })=>{
|
|
|
137
137
|
}),
|
|
138
138
|
/*#__PURE__*/ _jsxs(Toolbar.Button, {
|
|
139
139
|
onClick: ()=>{
|
|
140
|
-
const text = getPrevText(editor, {
|
|
140
|
+
const text = messages ? messages : getPrevText(editor, {
|
|
141
141
|
chars: 5000
|
|
142
142
|
});
|
|
143
143
|
onSelect(text, {
|
package/dist/src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.tsx"],"sourcesContent":["import { useLocale } from \"@payloadcms/ui/providers/Locale\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport { Editor } from \"@tiptap/react\";\nimport { useAssistant } from \"ai/react\";\nimport {\n ArrowDownWideNarrow,\n CheckCheck,\n ChevronDown,\n Languages,\n RefreshCcwDot,\n StepForward,\n WrapText,\n} from \"lucide-react\";\nimport { languages } from \"../../../../lib/constants.js\";\nimport { getPrevText } from \"../../../../lib/utils/index.js\";\nimport { DropdownCategoryTitle } from \"../../../ui/Dropdown/Dropdown.js\";\nimport { Icon } from \"../../../ui/Icon.js\";\nimport { Surface } from \"../../../ui/Surface.js\";\nimport { Toolbar } from \"../../../ui/Toolbar.js\";\nconst options = [\n // {\n // value: 'translate',\n // label: 'Translate text',\n // icon: WrapText,\n // },\n {\n value: \"summarize\",\n label: \"Summarize text\",\n icon: WrapText,\n },\n {\n value: \"rewrite\",\n label: \"Rewrite into Axios\",\n icon: WrapText,\n },\n {\n value: \"improve\",\n label: \"Improve writing\",\n icon: RefreshCcwDot,\n },\n\n {\n value: \"fix\",\n label: \"Fix grammar\",\n icon: CheckCheck,\n },\n {\n value: \"shorter\",\n label: \"Make shorter\",\n icon: ArrowDownWideNarrow,\n },\n {\n value: \"longer\",\n label: \"Make longer\",\n icon: WrapText,\n },\n];\n\ninterface AISelectorCommandsProps {\n editor: Editor;\n onSelect: (\n value: string,\n options: { option: string; language?: string }\n ) => void;\n}\n\nconst AISelectorCommands = ({
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../src/fields/TiptapEditor/features/menus/TextMenu/components/ai-selector-commands.tsx"],"sourcesContent":["import { useLocale } from \"@payloadcms/ui/providers/Locale\";\nimport * as Popover from \"@radix-ui/react-popover\";\nimport { Editor } from \"@tiptap/react\";\nimport { useAssistant } from \"ai/react\";\nimport {\n ArrowDownWideNarrow,\n CheckCheck,\n ChevronDown,\n Languages,\n RefreshCcwDot,\n StepForward,\n WrapText,\n} from \"lucide-react\";\nimport { languages } from \"../../../../lib/constants.js\";\nimport { getPrevText } from \"../../../../lib/utils/index.js\";\nimport { DropdownCategoryTitle } from \"../../../ui/Dropdown/Dropdown.js\";\nimport { Icon } from \"../../../ui/Icon.js\";\nimport { Surface } from \"../../../ui/Surface.js\";\nimport { Toolbar } from \"../../../ui/Toolbar.js\";\nconst options = [\n // {\n // value: 'translate',\n // label: 'Translate text',\n // icon: WrapText,\n // },\n {\n value: \"summarize\",\n label: \"Summarize text\",\n icon: WrapText,\n },\n {\n value: \"rewrite\",\n label: \"Rewrite into Axios\",\n icon: WrapText,\n },\n {\n value: \"improve\",\n label: \"Improve writing\",\n icon: RefreshCcwDot,\n },\n\n {\n value: \"fix\",\n label: \"Fix grammar\",\n icon: CheckCheck,\n },\n {\n value: \"shorter\",\n label: \"Make shorter\",\n icon: ArrowDownWideNarrow,\n },\n {\n value: \"longer\",\n label: \"Make longer\",\n icon: WrapText,\n },\n];\n\ninterface AISelectorCommandsProps {\n editor: Editor;\n messages?: string;\n onSelect: (\n value: string,\n options: { option: string; language?: string }\n ) => void;\n}\n\nconst AISelectorCommands = ({\n messages,\n onSelect,\n editor,\n}: AISelectorCommandsProps) => {\n const { status, input, submitMessage, handleInputChange } = useAssistant({\n api: \"/api/assistant\",\n });\n const { code } = useLocale();\n\n return (\n <>\n <DropdownCategoryTitle>Edit or review selection</DropdownCategoryTitle>\n <Popover.Root>\n <Popover.Trigger asChild>\n <Toolbar.Button\n className=\"gap-2 px-4 w-full flex justify-start \"\n type=\"button\"\n // active={!!states.currentHighlight}\n tooltip=\"Highlight text\"\n >\n <Icon icon={Languages} className=\"h-4 w-4 text-blue-500\" />\n Translate text\n <Icon icon={ChevronDown} className=\"h-4 w-4 text-blue-500\" />\n </Toolbar.Button>\n </Popover.Trigger>\n <Popover.Content side=\"right\" align=\"start\" sideOffset={8} asChild>\n <Surface className=\"flex flex-col min-w-[15rem] p-2 max-h-[20rem] overflow-auto\">\n <DropdownCategoryTitle>Languages</DropdownCategoryTitle>\n\n {languages.map((lang) => (\n <Toolbar.Button\n onClick={() => {\n const { from, to, empty } = editor.state.selection;\n const content = messages\n ? messages ?? \"\"\n : editor.state.doc.textBetween(from, to, \" \");\n onSelect(content, {\n option: \"translate\",\n language: lang.value,\n });\n }}\n className=\"gap-2 px-4 w-full flex justify-start \"\n key={lang.value}\n >\n {lang.label}\n </Toolbar.Button>\n ))}\n </Surface>\n </Popover.Content>\n </Popover.Root>\n\n {options.map((option) => (\n <Toolbar.Button\n // onSelect={(value) => {\n // const slice = editor.state.selection.content()\n // const text = editor.storage.markdown.serializer.serialize(slice.content)\n // onSelect(text, option.value)\n // }}\n onClick={() => {\n const { from, to, empty } = editor.state.selection;\n const content = messages\n ? messages ?? \"\"\n : editor.state.doc.textBetween(from, to, \" \");\n onSelect(content, {\n option: option.value,\n language: code ?? \"en\",\n });\n }}\n className=\" gap-2 px-4 w-full flex justify-start\"\n key={option.value}\n value={option.value}\n >\n <option.icon className=\"h-4 w-4 text-blue-500\" />\n {option.label}\n </Toolbar.Button>\n ))}\n <Toolbar.Divider horizontal />\n <DropdownCategoryTitle>Use AI to do more</DropdownCategoryTitle>\n <Toolbar.Button\n onClick={() => {\n const text = messages\n ? messages\n : getPrevText(editor, { chars: 5000 });\n onSelect(text, { option: \"continue\", language: code ?? \"en\" });\n }}\n value=\"continue\"\n className=\"gap-2 px-4 w-full flex justify-start\"\n >\n <StepForward className=\"h-4 w-4 text-blue-500\" />\n Continue writing\n </Toolbar.Button>\n </>\n );\n};\n\nexport default AISelectorCommands;\n"],"names":["useLocale","Popover","useAssistant","ArrowDownWideNarrow","CheckCheck","ChevronDown","Languages","RefreshCcwDot","StepForward","WrapText","languages","getPrevText","DropdownCategoryTitle","Icon","Surface","Toolbar","options","value","label","icon","AISelectorCommands","messages","onSelect","editor","status","input","submitMessage","handleInputChange","api","code","Root","Trigger","asChild","Button","className","type","tooltip","Content","side","align","sideOffset","map","lang","onClick","from","to","empty","state","selection","content","doc","textBetween","option","language","Divider","horizontal","text","chars"],"mappings":";AAAA,SAASA,SAAS,QAAQ,kCAAkC;AAC5D,YAAYC,aAAa,0BAA0B;AAEnD,SAASC,YAAY,QAAQ,WAAW;AACxC,SACEC,mBAAmB,EACnBC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,WAAW,EACXC,QAAQ,QACH,eAAe;AACtB,SAASC,SAAS,QAAQ,+BAA+B;AACzD,SAASC,WAAW,QAAQ,iCAAiC;AAC7D,SAASC,qBAAqB,QAAQ,mCAAmC;AACzE,SAASC,IAAI,QAAQ,sBAAsB;AAC3C,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,OAAO,QAAQ,yBAAyB;AACjD,MAAMC,UAAU;IACd,IAAI;IACJ,wBAAwB;IACxB,6BAA6B;IAC7B,oBAAoB;IACpB,KAAK;IACL;QACEC,OAAO;QACPC,OAAO;QACPC,MAAMV;IACR;IACA;QACEQ,OAAO;QACPC,OAAO;QACPC,MAAMV;IACR;IACA;QACEQ,OAAO;QACPC,OAAO;QACPC,MAAMZ;IACR;IAEA;QACEU,OAAO;QACPC,OAAO;QACPC,MAAMf;IACR;IACA;QACEa,OAAO;QACPC,OAAO;QACPC,MAAMhB;IACR;IACA;QACEc,OAAO;QACPC,OAAO;QACPC,MAAMV;IACR;CACD;AAWD,MAAMW,qBAAqB,CAAC,EAC1BC,QAAQ,EACRC,QAAQ,EACRC,MAAM,EACkB;IACxB,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAEC,aAAa,EAAEC,iBAAiB,EAAE,GAAGzB,aAAa;QACvE0B,KAAK;IACP;IACA,MAAM,EAAEC,IAAI,EAAE,GAAG7B;IAEjB,qBACE;;0BACE,KAACY;0BAAsB;;0BACvB,MAACX,QAAQ6B,IAAI;;kCACX,KAAC7B,QAAQ8B,OAAO;wBAACC,OAAO;kCACtB,cAAA,MAACjB,QAAQkB,MAAM;4BACbC,WAAU;4BACVC,MAAK;4BACL,qCAAqC;4BACrCC,SAAQ;;8CAER,KAACvB;oCAAKM,MAAMb;oCAAW4B,WAAU;;gCAA0B;8CAE3D,KAACrB;oCAAKM,MAAMd;oCAAa6B,WAAU;;;;;kCAGvC,KAACjC,QAAQoC,OAAO;wBAACC,MAAK;wBAAQC,OAAM;wBAAQC,YAAY;wBAAGR,OAAO;kCAChE,cAAA,MAAClB;4BAAQoB,WAAU;;8CACjB,KAACtB;8CAAsB;;gCAEtBF,UAAU+B,GAAG,CAAC,CAACC,qBACd,KAAC3B,QAAQkB,MAAM;wCACbU,SAAS;4CACP,MAAM,EAAEC,IAAI,EAAEC,EAAE,EAAEC,KAAK,EAAE,GAAGvB,OAAOwB,KAAK,CAACC,SAAS;4CAClD,MAAMC,UAAU5B,WACZA,YAAY,KACZE,OAAOwB,KAAK,CAACG,GAAG,CAACC,WAAW,CAACP,MAAMC,IAAI;4CAC3CvB,SAAS2B,SAAS;gDAChBG,QAAQ;gDACRC,UAAUX,KAAKzB,KAAK;4CACtB;wCACF;wCACAiB,WAAU;kDAGTQ,KAAKxB,KAAK;uCAFNwB,KAAKzB,KAAK;;;;;;YASxBD,QAAQyB,GAAG,CAAC,CAACW,uBACZ,MAACrC,QAAQkB,MAAM;oBACb,yBAAyB;oBACzB,mDAAmD;oBACnD,6EAA6E;oBAC7E,iCAAiC;oBACjC,KAAK;oBACLU,SAAS;wBACP,MAAM,EAAEC,IAAI,EAAEC,EAAE,EAAEC,KAAK,EAAE,GAAGvB,OAAOwB,KAAK,CAACC,SAAS;wBAClD,MAAMC,UAAU5B,WACZA,YAAY,KACZE,OAAOwB,KAAK,CAACG,GAAG,CAACC,WAAW,CAACP,MAAMC,IAAI;wBAC3CvB,SAAS2B,SAAS;4BAChBG,QAAQA,OAAOnC,KAAK;4BACpBoC,UAAUxB,QAAQ;wBACpB;oBACF;oBACAK,WAAU;oBAEVjB,OAAOmC,OAAOnC,KAAK;;sCAEnB,KAACmC,OAAOjC,IAAI;4BAACe,WAAU;;wBACtBkB,OAAOlC,KAAK;;mBAJRkC,OAAOnC,KAAK;0BAOrB,KAACF,QAAQuC,OAAO;gBAACC,UAAU;;0BAC3B,KAAC3C;0BAAsB;;0BACvB,MAACG,QAAQkB,MAAM;gBACbU,SAAS;oBACP,MAAMa,OAAOnC,WACTA,WACAV,YAAYY,QAAQ;wBAAEkC,OAAO;oBAAK;oBACtCnC,SAASkC,MAAM;wBAAEJ,QAAQ;wBAAYC,UAAUxB,QAAQ;oBAAK;gBAC9D;gBACAZ,OAAM;gBACNiB,WAAU;;kCAEV,KAAC1B;wBAAY0B,WAAU;;oBAA0B;;;;;AAKzD;AAEA,eAAed,mBAAmB"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import { Editor } from "@tiptap/react";
|
|
3
|
+
import { Group } from "src/fields/TiptapEditor/extensions/AICommand/types.js";
|
|
2
4
|
export type AICommandPanelProps = {
|
|
3
5
|
editor: Editor;
|
|
4
6
|
userPrompt?: string;
|
|
5
7
|
onOpenChange: (value: boolean) => void;
|
|
8
|
+
items: Group[];
|
|
6
9
|
};
|
|
7
|
-
export declare const AICommandPanel:
|
|
10
|
+
export declare const AICommandPanel: React.ForwardRefExoticComponent<AICommandPanelProps & React.RefAttributes<unknown>>;
|
|
8
11
|
//# sourceMappingURL=AICommandPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AICommandPanel.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AICommandPanel.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/features/panels/AICommandPanel/AICommandPanel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAON,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAEL,KAAK,EACN,MAAM,uDAAuD,CAAC;AAW/D,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,KAAK,EAAE,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,cAAc,qFAsU1B,CAAC"}
|