payload-richtext-tiptap 0.0.158 → 0.0.160

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.
Files changed (69) hide show
  1. package/dist/src/fields/TiptapEditor/extensions/BlockquoteFigure/BlockquoteFigure.d.ts +1 -1
  2. package/dist/src/fields/TiptapEditor/extensions/BlockquoteFigure/BlockquoteFigure.d.ts.map +1 -1
  3. package/dist/src/fields/TiptapEditor/extensions/BlockquoteFigure/BlockquoteFigure.js +61 -15
  4. package/dist/src/fields/TiptapEditor/extensions/BlockquoteFigure/BlockquoteFigure.js.map +1 -1
  5. package/dist/src/fields/TiptapEditor/extensions/BlockquoteFigure/Quote/Quote.d.ts.map +1 -1
  6. package/dist/src/fields/TiptapEditor/extensions/BlockquoteFigure/Quote/Quote.js +1 -3
  7. package/dist/src/fields/TiptapEditor/extensions/BlockquoteFigure/Quote/Quote.js.map +1 -1
  8. package/dist/src/fields/TiptapEditor/extensions/BlockquoteFigure/QuoteCaption/QuoteCaption.js.map +1 -1
  9. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/GifPlayer.d.ts +12 -0
  10. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/GifPlayer.d.ts.map +1 -0
  11. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/GifPlayer.js +152 -0
  12. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/GifPlayer.js.map +1 -0
  13. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/SmartImage.d.ts +12 -0
  14. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/SmartImage.d.ts.map +1 -0
  15. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/SmartImage.js +55 -0
  16. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/SmartImage.js.map +1 -0
  17. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/TestImage.d.ts +4 -0
  18. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/TestImage.d.ts.map +1 -0
  19. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/TestImage.js +26 -0
  20. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/components/TestImage.js.map +1 -0
  21. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/utils/gifUtils.d.ts +31 -0
  22. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/utils/gifUtils.d.ts.map +1 -0
  23. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/utils/gifUtils.js +62 -0
  24. package/dist/src/fields/TiptapEditor/extensions/ImageBlock/utils/gifUtils.js.map +1 -0
  25. package/dist/src/fields/TiptapEditor/extensions/Paragraph/Paragraph.d.ts.map +1 -1
  26. package/dist/src/fields/TiptapEditor/extensions/Paragraph/Paragraph.js +27 -4
  27. package/dist/src/fields/TiptapEditor/extensions/Paragraph/Paragraph.js.map +1 -1
  28. package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts +3 -3
  29. package/dist/src/fields/TiptapEditor/extensions/extension-kit.d.ts.map +1 -1
  30. package/dist/src/fields/TiptapEditor/extensions/extension-kit.js +23 -21
  31. package/dist/src/fields/TiptapEditor/extensions/extension-kit.js.map +1 -1
  32. package/dist/src/fields/TiptapEditor/features/menus/TextMenu/TextMenu.d.ts +2 -2
  33. package/dist/src/fields/TiptapEditor/features/menus/TextMenu/TextMenu.d.ts.map +1 -1
  34. package/dist/src/fields/TiptapEditor/features/menus/TextMenu/TextMenu.js +55 -61
  35. package/dist/src/fields/TiptapEditor/features/menus/TextMenu/TextMenu.js.map +1 -1
  36. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.d.ts +4 -0
  37. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.d.ts.map +1 -0
  38. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.js +32 -0
  39. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.js.map +1 -0
  40. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.d.ts +4 -0
  41. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.d.ts.map +1 -0
  42. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.js +70 -0
  43. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.js.map +1 -0
  44. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.d.ts +10 -0
  45. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.d.ts.map +1 -0
  46. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.js +249 -0
  47. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.js.map +1 -0
  48. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.d.ts +15 -0
  49. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.d.ts.map +1 -0
  50. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.js +291 -0
  51. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.js.map +1 -0
  52. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/index.d.ts +7 -0
  53. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/index.d.ts.map +1 -0
  54. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/index.js +7 -0
  55. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/index.js.map +1 -0
  56. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/types.d.ts +28 -0
  57. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/types.d.ts.map +1 -0
  58. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/types.js +3 -0
  59. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/types.js.map +1 -0
  60. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/utils.d.ts +6 -0
  61. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/utils.d.ts.map +1 -0
  62. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/utils.js +222 -0
  63. package/dist/src/fields/TiptapEditor/features/ui/SlashCommand/utils.js.map +1 -0
  64. package/dist/src/fields/TiptapEditor/lib/utils/updateImageUrl.d.ts +2 -0
  65. package/dist/src/fields/TiptapEditor/lib/utils/updateImageUrl.d.ts.map +1 -0
  66. package/dist/src/fields/TiptapEditor/lib/utils/updateImageUrl.js +17 -0
  67. package/dist/src/fields/TiptapEditor/lib/utils/updateImageUrl.js.map +1 -0
  68. package/dist/tsconfig.tsbuildinfo +1 -1
  69. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Button } from '../Button/Button.jsx';
4
+ import { Icon } from '../Icon.js';
5
+ import { Plus } from 'lucide-react';
6
+ export const SlashCommandTriggerButton = ({ editor, config })=>{
7
+ if (!editor) {
8
+ return null;
9
+ }
10
+ const handleClick = ()=>{
11
+ // Insert a slash command trigger
12
+ editor.chain().focus().insertContent('/').run();
13
+ };
14
+ return /*#__PURE__*/ _jsxs(Button, {
15
+ variant: "ghost",
16
+ buttonSize: "small",
17
+ onClick: handleClick,
18
+ className: "flex items-center gap-2 text-neutral-500 hover:text-black",
19
+ children: [
20
+ /*#__PURE__*/ _jsx(Icon, {
21
+ icon: Plus,
22
+ className: "w-4 h-4"
23
+ }),
24
+ /*#__PURE__*/ _jsx("span", {
25
+ className: "text-sm font-medium",
26
+ children: "Insert"
27
+ })
28
+ ]
29
+ });
30
+ };
31
+
32
+ //# sourceMappingURL=SlashCommandTriggerButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/features/ui/SlashCommand/SlashCommandTriggerButton.tsx"],"sourcesContent":["import React from 'react'\r\nimport { Editor } from '@tiptap/core'\r\nimport { SlashCommandTriggerButtonProps } from './types.js'\r\nimport { Button } from '../Button/Button.jsx'\r\nimport { Icon } from '../Icon.js'\r\nimport { Plus } from 'lucide-react'\r\n\r\nexport const SlashCommandTriggerButton = ({ editor, config }: SlashCommandTriggerButtonProps) => {\r\n if (!editor) {\r\n return null\r\n }\r\n\r\n const handleClick = () => {\r\n // Insert a slash command trigger\r\n editor.chain().focus().insertContent('/').run()\r\n }\r\n\r\n return (\r\n <Button\r\n variant=\"ghost\"\r\n buttonSize=\"small\"\r\n onClick={handleClick}\r\n className=\"flex items-center gap-2 text-neutral-500 hover:text-black\"\r\n >\r\n <Icon icon={Plus} className=\"w-4 h-4\" />\r\n <span className=\"text-sm font-medium\">Insert</span>\r\n </Button>\r\n )\r\n}\r\n"],"names":["React","Button","Icon","Plus","SlashCommandTriggerButton","editor","config","handleClick","chain","focus","insertContent","run","variant","buttonSize","onClick","className","icon","span"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAGzB,SAASC,MAAM,QAAQ,uBAAsB;AAC7C,SAASC,IAAI,QAAQ,aAAY;AACjC,SAASC,IAAI,QAAQ,eAAc;AAEnC,OAAO,MAAMC,4BAA4B,CAAC,EAAEC,MAAM,EAAEC,MAAM,EAAkC;IAC1F,IAAI,CAACD,QAAQ;QACX,OAAO;IACT;IAEA,MAAME,cAAc;QAClB,iCAAiC;QACjCF,OAAOG,KAAK,GAAGC,KAAK,GAAGC,aAAa,CAAC,KAAKC,GAAG;IAC/C;IAEA,qBACE,MAACV;QACCW,SAAQ;QACRC,YAAW;QACXC,SAASP;QACTQ,WAAU;;0BAEV,KAACb;gBAAKc,MAAMb;gBAAMY,WAAU;;0BAC5B,KAACE;gBAAKF,WAAU;0BAAsB;;;;AAG5C,EAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SlashDropdownMenuProps } from './types.js';
3
+ export declare const SlashDropdownMenu: ({ editor, config }: SlashDropdownMenuProps) => React.JSX.Element;
4
+ //# sourceMappingURL=SlashDropdownMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlashDropdownMenu.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,sBAAsB,EAAmC,MAAM,YAAY,CAAA;AA+CpF,eAAO,MAAM,iBAAiB,uBAAwC,sBAAsB,sBAwB3F,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { SuggestionMenu } from './SuggestionMenu.js';
4
+ import { SlashMenuList } from './SlashMenuList.js';
5
+ import { getSlashMenuItems, filterSuggestionItems } from './utils.js';
6
+ const defaultConfig = {
7
+ enabledItems: [
8
+ 'text',
9
+ 'heading_1',
10
+ 'heading_2',
11
+ 'heading_3',
12
+ 'bullet_list',
13
+ 'ordered_list',
14
+ 'quote',
15
+ 'code_block',
16
+ 'image',
17
+ 'horizontal_rule',
18
+ 'button',
19
+ 'custom_html',
20
+ 'social',
21
+ 'columns',
22
+ 'unsubscribe_footer',
23
+ 'twitter'
24
+ ],
25
+ showGroups: true,
26
+ itemGroups: {
27
+ text: 'Style',
28
+ heading_1: 'Style',
29
+ heading_2: 'Style',
30
+ heading_3: 'Style',
31
+ bullet_list: 'Lists',
32
+ ordered_list: 'Lists',
33
+ quote: 'Style',
34
+ code_block: 'Style',
35
+ image: 'Content',
36
+ horizontal_rule: 'Content',
37
+ button: 'Content',
38
+ custom_html: 'Content',
39
+ social: 'Content',
40
+ columns: 'Layout',
41
+ unsubscribe_footer: 'Content',
42
+ twitter: 'Content'
43
+ }
44
+ };
45
+ export const SlashDropdownMenu = ({ editor, config = defaultConfig })=>{
46
+ if (!editor) {
47
+ return null;
48
+ }
49
+ const mergedConfig = {
50
+ ...defaultConfig,
51
+ ...config
52
+ };
53
+ const getItems = ({ query, editor })=>{
54
+ const allItems = getSlashMenuItems(editor, mergedConfig);
55
+ return filterSuggestionItems(allItems, query);
56
+ };
57
+ return /*#__PURE__*/ _jsx(SuggestionMenu, {
58
+ editor: editor,
59
+ char: "/",
60
+ items: getItems,
61
+ children: (props)=>/*#__PURE__*/ _jsx(SlashMenuList, {
62
+ ref: props.ref,
63
+ items: props.items,
64
+ command: props.command,
65
+ showGroups: mergedConfig.showGroups
66
+ })
67
+ });
68
+ };
69
+
70
+ //# sourceMappingURL=SlashDropdownMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/features/ui/SlashCommand/SlashDropdownMenu.tsx"],"sourcesContent":["import React from 'react'\r\nimport { Editor } from '@tiptap/core'\r\nimport { SlashDropdownMenuProps, SlashMenuConfig, SuggestionItem } from './types.js'\r\nimport { SuggestionMenu } from './SuggestionMenu.js'\r\nimport { SlashMenuList } from './SlashMenuList.js'\r\nimport { getSlashMenuItems, filterSuggestionItems } from './utils.js'\r\n\r\nconst defaultConfig: SlashMenuConfig = {\r\n enabledItems: [\r\n 'text',\r\n 'heading_1',\r\n 'heading_2',\r\n 'heading_3',\r\n 'bullet_list',\r\n 'ordered_list',\r\n 'quote',\r\n 'code_block',\r\n 'image',\r\n 'horizontal_rule',\r\n 'button',\r\n 'custom_html',\r\n 'social',\r\n 'columns',\r\n 'unsubscribe_footer',\r\n 'twitter',\r\n // 'ai_writer',\r\n ],\r\n showGroups: true,\r\n itemGroups: {\r\n text: 'Style',\r\n heading_1: 'Style',\r\n heading_2: 'Style',\r\n heading_3: 'Style',\r\n bullet_list: 'Lists',\r\n ordered_list: 'Lists',\r\n quote: 'Style',\r\n code_block: 'Style',\r\n image: 'Content',\r\n horizontal_rule: 'Content',\r\n button: 'Content',\r\n custom_html: 'Content',\r\n social: 'Content',\r\n columns: 'Layout',\r\n unsubscribe_footer: 'Content',\r\n twitter: 'Content',\r\n // ai_writer: 'AI',\r\n },\r\n}\r\n\r\nexport const SlashDropdownMenu = ({ editor, config = defaultConfig }: SlashDropdownMenuProps) => {\r\n if (!editor) {\r\n return null\r\n }\r\n\r\n const mergedConfig = { ...defaultConfig, ...config }\r\n\r\n const getItems = ({ query, editor }: { query: string; editor: Editor }) => {\r\n const allItems = getSlashMenuItems(editor, mergedConfig)\r\n return filterSuggestionItems(allItems, query)\r\n }\r\n\r\n return (\r\n <SuggestionMenu editor={editor} char=\"/\" items={getItems}>\r\n {(props: any) => (\r\n <SlashMenuList\r\n ref={props.ref}\r\n items={props.items}\r\n command={props.command}\r\n showGroups={mergedConfig.showGroups}\r\n />\r\n )}\r\n </SuggestionMenu>\r\n )\r\n}\r\n"],"names":["React","SuggestionMenu","SlashMenuList","getSlashMenuItems","filterSuggestionItems","defaultConfig","enabledItems","showGroups","itemGroups","text","heading_1","heading_2","heading_3","bullet_list","ordered_list","quote","code_block","image","horizontal_rule","button","custom_html","social","columns","unsubscribe_footer","twitter","SlashDropdownMenu","editor","config","mergedConfig","getItems","query","allItems","char","items","props","ref","command"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAGzB,SAASC,cAAc,QAAQ,sBAAqB;AACpD,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,aAAY;AAErE,MAAMC,gBAAiC;IACrCC,cAAc;QACZ;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KAED;IACDC,YAAY;IACZC,YAAY;QACVC,MAAM;QACNC,WAAW;QACXC,WAAW;QACXC,WAAW;QACXC,aAAa;QACbC,cAAc;QACdC,OAAO;QACPC,YAAY;QACZC,OAAO;QACPC,iBAAiB;QACjBC,QAAQ;QACRC,aAAa;QACbC,QAAQ;QACRC,SAAS;QACTC,oBAAoB;QACpBC,SAAS;IAEX;AACF;AAEA,OAAO,MAAMC,oBAAoB,CAAC,EAAEC,MAAM,EAAEC,SAAStB,aAAa,EAA0B;IAC1F,IAAI,CAACqB,QAAQ;QACX,OAAO;IACT;IAEA,MAAME,eAAe;QAAE,GAAGvB,aAAa;QAAE,GAAGsB,MAAM;IAAC;IAEnD,MAAME,WAAW,CAAC,EAAEC,KAAK,EAAEJ,MAAM,EAAqC;QACpE,MAAMK,WAAW5B,kBAAkBuB,QAAQE;QAC3C,OAAOxB,sBAAsB2B,UAAUD;IACzC;IAEA,qBACE,KAAC7B;QAAeyB,QAAQA;QAAQM,MAAK;QAAIC,OAAOJ;kBAC7C,CAACK,sBACA,KAAChC;gBACCiC,KAAKD,MAAMC,GAAG;gBACdF,OAAOC,MAAMD,KAAK;gBAClBG,SAASF,MAAME,OAAO;gBACtB7B,YAAYqB,aAAarB,UAAU;;;AAK7C,EAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { SuggestionItem } from './types.js';
3
+ interface SlashMenuListProps {
4
+ items: SuggestionItem[];
5
+ command: (item: SuggestionItem) => void;
6
+ showGroups?: boolean;
7
+ }
8
+ export declare const SlashMenuList: React.ForwardRefExoticComponent<SlashMenuListProps & React.RefAttributes<any>>;
9
+ export {};
10
+ //# sourceMappingURL=SlashMenuList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlashMenuList.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAK3C,UAAU,kBAAkB;IAC1B,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,OAAO,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;IACvC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,eAAO,MAAM,aAAa,gFAoPzB,CAAA"}
@@ -0,0 +1,249 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
3
+ import { Surface } from '../Surface.js';
4
+ import { DropdownButton } from '../Dropdown/Dropdown.js';
5
+ import { Icon } from '../Icon.js';
6
+ export const SlashMenuList = /*#__PURE__*/ React.forwardRef(({ items, command, showGroups = true }, ref)=>{
7
+ const scrollContainer = useRef(null);
8
+ const activeItem = useRef(null);
9
+ const [selectedIndex, setSelectedIndex] = useState(0);
10
+ const [hoveredIndex, setHoveredIndex] = useState(null);
11
+ const isKeyboardNavigation = useRef(false);
12
+ // Group items by their group property
13
+ const groupedItems = React.useMemo(()=>{
14
+ if (!showGroups) {
15
+ return {
16
+ All: items
17
+ };
18
+ }
19
+ return items.reduce((groups, item)=>{
20
+ const group = item.group || 'Other';
21
+ if (!groups[group]) {
22
+ groups[group] = [];
23
+ }
24
+ groups[group].push(item);
25
+ return groups;
26
+ }, {});
27
+ }, [
28
+ items,
29
+ showGroups
30
+ ]);
31
+ // Flatten grouped items for navigation
32
+ const flatItems = React.useMemo(()=>{
33
+ return Object.values(groupedItems).flat();
34
+ }, [
35
+ groupedItems
36
+ ]);
37
+ // Reset selection when items change
38
+ useEffect(()=>{
39
+ setSelectedIndex(0);
40
+ setHoveredIndex(null);
41
+ }, [
42
+ items
43
+ ]);
44
+ const selectItem = useCallback((index)=>{
45
+ const item = flatItems[index];
46
+ if (item) {
47
+ command(item);
48
+ }
49
+ }, [
50
+ flatItems,
51
+ command
52
+ ]);
53
+ // Expose the handleKeyDown method for external use
54
+ React.useImperativeHandle(ref, ()=>({
55
+ onKeyDown: ({ event })=>{
56
+ handleKeyDown(event);
57
+ return true;
58
+ }
59
+ }));
60
+ // Only scroll on keyboard navigation, not on hover
61
+ const scrollToActiveItem = useCallback(()=>{
62
+ if (activeItem.current && scrollContainer.current) {
63
+ const container = scrollContainer.current;
64
+ const item = activeItem.current;
65
+ const containerRect = container.getBoundingClientRect();
66
+ const itemRect = item.getBoundingClientRect();
67
+ // Only scroll if item is not fully visible
68
+ if (itemRect.top < containerRect.top) {
69
+ container.scrollTop = item.offsetTop - container.offsetTop - 10;
70
+ } else if (itemRect.bottom > containerRect.bottom) {
71
+ container.scrollTop = item.offsetTop - container.offsetTop - container.clientHeight + item.offsetHeight + 10;
72
+ }
73
+ }
74
+ }, []);
75
+ useEffect(()=>{
76
+ // Only scroll on keyboard navigation, not on hover
77
+ if (isKeyboardNavigation.current) {
78
+ scrollToActiveItem();
79
+ isKeyboardNavigation.current = false // Reset flag
80
+ ;
81
+ }
82
+ }, [
83
+ selectedIndex,
84
+ scrollToActiveItem
85
+ ]);
86
+ // Note: Focus is only set when arrow keys are pressed, not on mount
87
+ const createItemClickHandler = useCallback((index)=>{
88
+ return ()=>{
89
+ selectItem(index);
90
+ };
91
+ }, [
92
+ selectItem
93
+ ]);
94
+ const createItemHoverHandler = useCallback((index)=>{
95
+ return ()=>{
96
+ setHoveredIndex(index);
97
+ setSelectedIndex(index) // Update selected index on hover
98
+ ;
99
+ };
100
+ }, []);
101
+ const createItemLeaveHandler = useCallback(()=>{
102
+ return ()=>{
103
+ setHoveredIndex(null);
104
+ };
105
+ }, []);
106
+ // Handle keyboard events directly
107
+ const handleKeyDown = useCallback((event)=>{
108
+ if (event.key === 'ArrowDown') {
109
+ event.preventDefault();
110
+ event.stopPropagation();
111
+ if (!flatItems.length) {
112
+ return;
113
+ }
114
+ isKeyboardNavigation.current = true // Mark as keyboard navigation
115
+ ;
116
+ const newIndex = (selectedIndex + 1) % flatItems.length;
117
+ setSelectedIndex(newIndex);
118
+ setHoveredIndex(null);
119
+ return;
120
+ }
121
+ if (event.key === 'ArrowUp') {
122
+ event.preventDefault();
123
+ event.stopPropagation();
124
+ if (!flatItems.length) {
125
+ return;
126
+ }
127
+ // If at the top and pressing up again, return focus to editor
128
+ if (selectedIndex === 0) {
129
+ // Return focus to editor
130
+ const editorElement = document.querySelector('.ProseMirror');
131
+ if (editorElement) {
132
+ ;
133
+ editorElement.focus();
134
+ }
135
+ return;
136
+ }
137
+ isKeyboardNavigation.current = true // Mark as keyboard navigation
138
+ ;
139
+ const newIndex = selectedIndex - 1;
140
+ setSelectedIndex(newIndex);
141
+ setHoveredIndex(null);
142
+ return;
143
+ }
144
+ if (event.key === 'Enter') {
145
+ event.preventDefault();
146
+ event.stopPropagation();
147
+ if (!flatItems.length || selectedIndex === -1) {
148
+ return;
149
+ }
150
+ console.log('Enter key pressed, selecting item:', selectedIndex);
151
+ selectItem(selectedIndex);
152
+ // Return focus to editor after selection
153
+ setTimeout(()=>{
154
+ const editorElement = document.querySelector('.ProseMirror');
155
+ if (editorElement) {
156
+ ;
157
+ editorElement.focus();
158
+ }
159
+ }, 0);
160
+ return;
161
+ }
162
+ if (event.key === 'Escape') {
163
+ event.preventDefault();
164
+ event.stopPropagation();
165
+ // Let the parent handle closing - it will return focus to editor
166
+ return;
167
+ }
168
+ // For any other key, return focus to editor
169
+ event.preventDefault();
170
+ event.stopPropagation();
171
+ const editorElement = document.querySelector('.ProseMirror');
172
+ if (editorElement) {
173
+ ;
174
+ editorElement.focus();
175
+ }
176
+ }, [
177
+ selectedIndex,
178
+ flatItems,
179
+ selectItem
180
+ ]);
181
+ if (!items.length) {
182
+ return null;
183
+ }
184
+ return /*#__PURE__*/ _jsx(Surface, {
185
+ ref: scrollContainer,
186
+ className: "bg-dark-panel text-dark-text max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-3 focus:outline-none focus:ring-0 rounded-lg shadow-lg border border-dark-border animate-slide-up-fade",
187
+ onKeyDown: handleKeyDown,
188
+ onMouseEnter: (e)=>{
189
+ e.stopPropagation();
190
+ },
191
+ onMouseLeave: (e)=>{
192
+ e.stopPropagation();
193
+ },
194
+ role: "menu",
195
+ "aria-label": "Slash command menu",
196
+ "aria-activedescendant": selectedIndex >= 0 ? `menu-item-${selectedIndex}` : undefined,
197
+ tabIndex: 0,
198
+ children: /*#__PURE__*/ _jsx("div", {
199
+ className: "space-y-1",
200
+ children: Object.entries(groupedItems).map(([groupName, groupItems])=>/*#__PURE__*/ _jsxs(React.Fragment, {
201
+ children: [
202
+ showGroups && /*#__PURE__*/ _jsx("div", {
203
+ className: "text-dark-text-muted text-xs px-2 py-1 font-medium tracking-wide select-none uppercase",
204
+ children: groupName
205
+ }),
206
+ groupItems.map((item, itemIndex)=>{
207
+ const flatIndex = flatItems.indexOf(item);
208
+ const isActive = selectedIndex === flatIndex;
209
+ const isHovered = hoveredIndex === flatIndex;
210
+ return /*#__PURE__*/ _jsxs(DropdownButton, {
211
+ ref: isActive ? activeItem : null,
212
+ isActive: isActive || isHovered,
213
+ onClick: createItemClickHandler(flatIndex),
214
+ onMouseEnter: createItemHoverHandler(flatIndex),
215
+ onMouseLeave: createItemLeaveHandler(),
216
+ role: "menuitem",
217
+ id: `menu-item-${flatIndex}`,
218
+ "aria-label": `${item.title}: ${item.subtext}`,
219
+ "aria-selected": isActive,
220
+ tabIndex: -1,
221
+ children: [
222
+ /*#__PURE__*/ _jsx(Icon, {
223
+ icon: item.badge,
224
+ className: "mr-1"
225
+ }),
226
+ /*#__PURE__*/ _jsxs("div", {
227
+ className: "flex flex-col items-start",
228
+ children: [
229
+ /*#__PURE__*/ _jsx("div", {
230
+ className: "text-sm font-medium",
231
+ children: item.title
232
+ }),
233
+ /*#__PURE__*/ _jsx("div", {
234
+ className: "text-xs text-neutral-500",
235
+ children: item.subtext
236
+ })
237
+ ]
238
+ })
239
+ ]
240
+ }, `${item.title}-${itemIndex}`);
241
+ })
242
+ ]
243
+ }, groupName))
244
+ })
245
+ });
246
+ });
247
+ SlashMenuList.displayName = 'SlashMenuList';
248
+
249
+ //# sourceMappingURL=SlashMenuList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../src/fields/TiptapEditor/features/ui/SlashCommand/SlashMenuList.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react'\r\nimport { SuggestionItem } from './types.js'\r\nimport { Surface } from '../Surface.js'\r\nimport { DropdownButton } from '../Dropdown/Dropdown.js'\r\nimport { Icon } from '../Icon.js'\r\n\r\ninterface SlashMenuListProps {\r\n items: SuggestionItem[]\r\n command: (item: SuggestionItem) => void\r\n showGroups?: boolean\r\n}\r\n\r\nexport const SlashMenuList = React.forwardRef<any, SlashMenuListProps>(\r\n ({ items, command, showGroups = true }, ref) => {\r\n const scrollContainer = useRef<HTMLDivElement>(null)\r\n const activeItem = useRef<HTMLButtonElement>(null)\r\n const [selectedIndex, setSelectedIndex] = useState(0)\r\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null)\r\n const isKeyboardNavigation = useRef(false)\r\n\r\n // Group items by their group property\r\n const groupedItems = React.useMemo(() => {\r\n if (!showGroups) {\r\n return { All: items }\r\n }\r\n\r\n return items.reduce(\r\n (groups, item) => {\r\n const group = item.group || 'Other'\r\n if (!groups[group]) {\r\n groups[group] = []\r\n }\r\n groups[group].push(item)\r\n return groups\r\n },\r\n {} as Record<string, SuggestionItem[]>,\r\n )\r\n }, [items, showGroups])\r\n\r\n // Flatten grouped items for navigation\r\n const flatItems = React.useMemo(() => {\r\n return Object.values(groupedItems).flat()\r\n }, [groupedItems])\r\n\r\n // Reset selection when items change\r\n useEffect(() => {\r\n setSelectedIndex(0)\r\n setHoveredIndex(null)\r\n }, [items])\r\n\r\n const selectItem = useCallback(\r\n (index: number) => {\r\n const item = flatItems[index]\r\n if (item) {\r\n command(item)\r\n }\r\n },\r\n [flatItems, command],\r\n )\r\n\r\n // Expose the handleKeyDown method for external use\r\n React.useImperativeHandle(ref, () => ({\r\n onKeyDown: ({ event }: { event: React.KeyboardEvent }) => {\r\n handleKeyDown(event)\r\n return true\r\n },\r\n }))\r\n\r\n // Only scroll on keyboard navigation, not on hover\r\n const scrollToActiveItem = useCallback(() => {\r\n if (activeItem.current && scrollContainer.current) {\r\n const container = scrollContainer.current\r\n const item = activeItem.current\r\n const containerRect = container.getBoundingClientRect()\r\n const itemRect = item.getBoundingClientRect()\r\n\r\n // Only scroll if item is not fully visible\r\n if (itemRect.top < containerRect.top) {\r\n container.scrollTop = item.offsetTop - container.offsetTop - 10\r\n } else if (itemRect.bottom > containerRect.bottom) {\r\n container.scrollTop =\r\n item.offsetTop - container.offsetTop - container.clientHeight + item.offsetHeight + 10\r\n }\r\n }\r\n }, [])\r\n\r\n useEffect(() => {\r\n // Only scroll on keyboard navigation, not on hover\r\n if (isKeyboardNavigation.current) {\r\n scrollToActiveItem()\r\n isKeyboardNavigation.current = false // Reset flag\r\n }\r\n }, [selectedIndex, scrollToActiveItem])\r\n\r\n // Note: Focus is only set when arrow keys are pressed, not on mount\r\n\r\n const createItemClickHandler = useCallback(\r\n (index: number) => {\r\n return () => {\r\n selectItem(index)\r\n }\r\n },\r\n [selectItem],\r\n )\r\n\r\n const createItemHoverHandler = useCallback((index: number) => {\r\n return () => {\r\n setHoveredIndex(index)\r\n setSelectedIndex(index) // Update selected index on hover\r\n }\r\n }, [])\r\n\r\n const createItemLeaveHandler = useCallback(() => {\r\n return () => {\r\n setHoveredIndex(null)\r\n }\r\n }, [])\r\n\r\n // Handle keyboard events directly\r\n const handleKeyDown = useCallback(\r\n (event: React.KeyboardEvent) => {\r\n if (event.key === 'ArrowDown') {\r\n event.preventDefault()\r\n event.stopPropagation()\r\n if (!flatItems.length) {\r\n return\r\n }\r\n isKeyboardNavigation.current = true // Mark as keyboard navigation\r\n const newIndex = (selectedIndex + 1) % flatItems.length\r\n setSelectedIndex(newIndex)\r\n setHoveredIndex(null)\r\n return\r\n }\r\n\r\n if (event.key === 'ArrowUp') {\r\n event.preventDefault()\r\n event.stopPropagation()\r\n if (!flatItems.length) {\r\n return\r\n }\r\n\r\n // If at the top and pressing up again, return focus to editor\r\n if (selectedIndex === 0) {\r\n // Return focus to editor\r\n const editorElement = document.querySelector('.ProseMirror')\r\n if (editorElement) {\r\n ;(editorElement as HTMLElement).focus()\r\n }\r\n return\r\n }\r\n\r\n isKeyboardNavigation.current = true // Mark as keyboard navigation\r\n const newIndex = selectedIndex - 1\r\n setSelectedIndex(newIndex)\r\n setHoveredIndex(null)\r\n return\r\n }\r\n\r\n if (event.key === 'Enter') {\r\n event.preventDefault()\r\n event.stopPropagation()\r\n if (!flatItems.length || selectedIndex === -1) {\r\n return\r\n }\r\n console.log('Enter key pressed, selecting item:', selectedIndex)\r\n selectItem(selectedIndex)\r\n\r\n // Return focus to editor after selection\r\n setTimeout(() => {\r\n const editorElement = document.querySelector('.ProseMirror')\r\n if (editorElement) {\r\n ;(editorElement as HTMLElement).focus()\r\n }\r\n }, 0)\r\n return\r\n }\r\n\r\n if (event.key === 'Escape') {\r\n event.preventDefault()\r\n event.stopPropagation()\r\n // Let the parent handle closing - it will return focus to editor\r\n return\r\n }\r\n\r\n // For any other key, return focus to editor\r\n event.preventDefault()\r\n event.stopPropagation()\r\n const editorElement = document.querySelector('.ProseMirror')\r\n if (editorElement) {\r\n ;(editorElement as HTMLElement).focus()\r\n }\r\n },\r\n [selectedIndex, flatItems, selectItem],\r\n )\r\n\r\n if (!items.length) {\r\n return null\r\n }\r\n\r\n return (\r\n <Surface\r\n ref={scrollContainer}\r\n className=\"bg-dark-panel text-dark-text max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-3 focus:outline-none focus:ring-0 rounded-lg shadow-lg border border-dark-border animate-slide-up-fade\"\r\n onKeyDown={handleKeyDown}\r\n onMouseEnter={(e) => {\r\n e.stopPropagation()\r\n }}\r\n onMouseLeave={(e) => {\r\n e.stopPropagation()\r\n }}\r\n role=\"menu\"\r\n aria-label=\"Slash command menu\"\r\n aria-activedescendant={selectedIndex >= 0 ? `menu-item-${selectedIndex}` : undefined}\r\n tabIndex={0}\r\n >\r\n <div className=\"space-y-1\">\r\n {Object.entries(groupedItems).map(([groupName, groupItems]) => (\r\n <React.Fragment key={groupName}>\r\n {showGroups && (\r\n <div className=\"text-dark-text-muted text-xs px-2 py-1 font-medium tracking-wide select-none uppercase\">\r\n {groupName}\r\n </div>\r\n )}\r\n {groupItems.map((item, itemIndex) => {\r\n const flatIndex = flatItems.indexOf(item)\r\n const isActive = selectedIndex === flatIndex\r\n const isHovered = hoveredIndex === flatIndex\r\n\r\n return (\r\n <DropdownButton\r\n key={`${item.title}-${itemIndex}`}\r\n ref={isActive ? activeItem : null}\r\n isActive={isActive || isHovered}\r\n onClick={createItemClickHandler(flatIndex)}\r\n onMouseEnter={createItemHoverHandler(flatIndex)}\r\n onMouseLeave={createItemLeaveHandler()}\r\n role=\"menuitem\"\r\n id={`menu-item-${flatIndex}`}\r\n aria-label={`${item.title}: ${item.subtext}`}\r\n aria-selected={isActive}\r\n tabIndex={-1}\r\n >\r\n <Icon icon={item.badge} className=\"mr-1\" />\r\n <div className=\"flex flex-col items-start\">\r\n <div className=\"text-sm font-medium\">{item.title}</div>\r\n <div className=\"text-xs text-neutral-500\">{item.subtext}</div>\r\n </div>\r\n </DropdownButton>\r\n )\r\n })}\r\n </React.Fragment>\r\n ))}\r\n </div>\r\n </Surface>\r\n )\r\n },\r\n)\r\n\r\nSlashMenuList.displayName = 'SlashMenuList'\r\n"],"names":["React","useCallback","useEffect","useRef","useState","Surface","DropdownButton","Icon","SlashMenuList","forwardRef","items","command","showGroups","ref","scrollContainer","activeItem","selectedIndex","setSelectedIndex","hoveredIndex","setHoveredIndex","isKeyboardNavigation","groupedItems","useMemo","All","reduce","groups","item","group","push","flatItems","Object","values","flat","selectItem","index","useImperativeHandle","onKeyDown","event","handleKeyDown","scrollToActiveItem","current","container","containerRect","getBoundingClientRect","itemRect","top","scrollTop","offsetTop","bottom","clientHeight","offsetHeight","createItemClickHandler","createItemHoverHandler","createItemLeaveHandler","key","preventDefault","stopPropagation","length","newIndex","editorElement","document","querySelector","focus","console","log","setTimeout","className","onMouseEnter","e","onMouseLeave","role","aria-label","aria-activedescendant","undefined","tabIndex","div","entries","map","groupName","groupItems","Fragment","itemIndex","flatIndex","indexOf","isActive","isHovered","onClick","id","title","subtext","aria-selected","icon","badge","displayName"],"mappings":";AAAA,OAAOA,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAEvE,SAASC,OAAO,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IT,WAAU;0DAA4BxC,KAAK+D,OAAO;;;;;+BAfpD,GAAG/D,KAAK8D,KAAK,CAAC,CAAC,EAAEP,WAAW;wBAmBvC;;mBAhCmBH;;;AAsC/B,GACD;AAEDtE,cAAcqF,WAAW,GAAG"}
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Editor } from '@tiptap/core';
3
+ import { SuggestionItem } from './types.js';
4
+ interface SuggestionMenuProps {
5
+ editor: Editor;
6
+ char: string;
7
+ items: (props: {
8
+ query: string;
9
+ editor: Editor;
10
+ }) => SuggestionItem[];
11
+ children: (props: any) => React.ReactElement;
12
+ }
13
+ export declare const SuggestionMenu: ({ editor, char, items, children }: SuggestionMenuProps) => any;
14
+ export {};
15
+ //# sourceMappingURL=SuggestionMenu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SuggestionMenu.d.ts","sourceRoot":"","sources":["../../../../../../../src/fields/TiptapEditor/features/ui/SlashCommand/SuggestionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAIrC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAG3C,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,cAAc,EAAE,CAAA;IACrE,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,YAAY,CAAA;CAC7C;AAoED,eAAO,MAAM,cAAc,sCAAuC,mBAAmB,QAgRpF,CAAA"}