diff --git a/apps/web/components/tailwind/advanced-editor.tsx b/apps/web/components/tailwind/advanced-editor.tsx index 64352eb0c..abc1b56e8 100644 --- a/apps/web/components/tailwind/advanced-editor.tsx +++ b/apps/web/components/tailwind/advanced-editor.tsx @@ -10,6 +10,7 @@ import { EditorContent, type JSONContent, EditorInstance, + EditorCommandList, } from "novel"; import { ImageResizer, handleCommandNavigation } from "novel/extensions"; import { defaultExtensions } from "./extensions"; @@ -87,24 +88,26 @@ const TailwindAdvancedEditor = () => { No results - {suggestionItems.map((item) => ( - item.command(val)} - className={`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent aria-selected:bg-accent `} - key={item.title} - > -
- {item.icon} -
-
-

{item.title}

-

- {item.description} -

-
-
- ))} + + {suggestionItems.map((item) => ( + item.command(val)} + className={`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent aria-selected:bg-accent `} + key={item.title} + > +
+ {item.icon} +
+
+

{item.title}

+

+ {item.description} +

+
+
+ ))} +
diff --git a/packages/headless/src/components/editor-command.tsx b/packages/headless/src/components/editor-command.tsx index 7335755d5..f3882f0e6 100644 --- a/packages/headless/src/components/editor-command.tsx +++ b/packages/headless/src/components/editor-command.tsx @@ -8,7 +8,7 @@ import type { ComponentPropsWithoutRef, FC } from "react"; import type { Range } from "@tiptap/core"; export const EditorCommandTunnelContext = createContext( - {} as ReturnType + {} as ReturnType, ); interface EditorCommandOutProps { @@ -44,7 +44,7 @@ export const EditorCommandOut: FC = ({ key: e.key, cancelable: true, bubbles: true, - }) + }), ); return false; @@ -67,7 +67,6 @@ export const EditorCommand = forwardRef< HTMLDivElement, ComponentPropsWithoutRef >(({ children, className, ...rest }, ref) => { - const commandListRef = useRef(null); const [query, setQuery] = useAtom(queryAtom); return ( @@ -88,12 +87,13 @@ export const EditorCommand = forwardRef< onValueChange={setQuery} style={{ display: "none" }} /> - {children} + {children} )} ); }); +export const EditorCommandList = Command.List; EditorCommand.displayName = "EditorCommand"; diff --git a/packages/headless/src/components/index.ts b/packages/headless/src/components/index.ts index 9771b553b..0a2bb710c 100644 --- a/packages/headless/src/components/index.ts +++ b/packages/headless/src/components/index.ts @@ -5,5 +5,5 @@ export type { JSONContent } from "@tiptap/react"; export { EditorRoot, EditorContent, type EditorContentProps } from "./editor"; export { EditorBubble } from "./editor-bubble"; export { EditorBubbleItem } from "./editor-bubble-item"; -export { EditorCommand } from "./editor-command"; +export { EditorCommand, EditorCommandList } from "./editor-command"; export { EditorCommandItem, EditorCommandEmpty } from "./editor-command-item";