File tree Expand file tree Collapse file tree 3 files changed +26
-23
lines changed
apps/web/components/tailwind
packages/headless/src/components Expand file tree Collapse file tree 3 files changed +26
-23
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
10
10
EditorContent ,
11
11
type JSONContent ,
12
12
EditorInstance ,
13
+ EditorCommandList ,
13
14
} from "novel" ;
14
15
import { ImageResizer , handleCommandNavigation } from "novel/extensions" ;
15
16
import { defaultExtensions } from "./extensions" ;
@@ -87,24 +88,26 @@ const TailwindAdvancedEditor = () => {
87
88
< EditorCommandEmpty className = "px-2 text-muted-foreground" >
88
89
No results
89
90
</ EditorCommandEmpty >
90
- { suggestionItems . map ( ( item ) => (
91
- < EditorCommandItem
92
- value = { item . title }
93
- onCommand = { ( val ) => item . command ( val ) }
94
- 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 ` }
95
- key = { item . title }
96
- >
97
- < div className = "flex h-10 w-10 items-center justify-center rounded-md border border-muted bg-background" >
98
- { item . icon }
99
- </ div >
100
- < div >
101
- < p className = "font-medium" > { item . title } </ p >
102
- < p className = "text-xs text-muted-foreground" >
103
- { item . description }
104
- </ p >
105
- </ div >
106
- </ EditorCommandItem >
107
- ) ) }
91
+ < EditorCommandList >
92
+ { suggestionItems . map ( ( item ) => (
93
+ < EditorCommandItem
94
+ value = { item . title }
95
+ onCommand = { ( val ) => item . command ( val ) }
96
+ 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 ` }
97
+ key = { item . title }
98
+ >
99
+ < div className = "flex h-10 w-10 items-center justify-center rounded-md border border-muted bg-background" >
100
+ { item . icon }
101
+ </ div >
102
+ < div >
103
+ < p className = "font-medium" > { item . title } </ p >
104
+ < p className = "text-xs text-muted-foreground" >
105
+ { item . description }
106
+ </ p >
107
+ </ div >
108
+ </ EditorCommandItem >
109
+ ) ) }
110
+ </ EditorCommandList >
108
111
</ EditorCommand >
109
112
110
113
< GenerativeMenuSwitch open = { openAI } onOpenChange = { setOpenAI } >
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import type { ComponentPropsWithoutRef, FC } from "react";
8
8
import type { Range } from "@tiptap/core" ;
9
9
10
10
export const EditorCommandTunnelContext = createContext (
11
- { } as ReturnType < typeof tunnel >
11
+ { } as ReturnType < typeof tunnel > ,
12
12
) ;
13
13
14
14
interface EditorCommandOutProps {
@@ -44,7 +44,7 @@ export const EditorCommandOut: FC<EditorCommandOutProps> = ({
44
44
key : e . key ,
45
45
cancelable : true ,
46
46
bubbles : true ,
47
- } )
47
+ } ) ,
48
48
) ;
49
49
50
50
return false ;
@@ -67,7 +67,6 @@ export const EditorCommand = forwardRef<
67
67
HTMLDivElement ,
68
68
ComponentPropsWithoutRef < typeof Command >
69
69
> ( ( { children, className, ...rest } , ref ) => {
70
- const commandListRef = useRef < HTMLDivElement > ( null ) ;
71
70
const [ query , setQuery ] = useAtom ( queryAtom ) ;
72
71
73
72
return (
@@ -88,12 +87,13 @@ export const EditorCommand = forwardRef<
88
87
onValueChange = { setQuery }
89
88
style = { { display : "none" } }
90
89
/>
91
- < Command . List ref = { commandListRef } > { children } </ Command . List >
90
+ { children }
92
91
</ Command >
93
92
</ tunnelInstance . In >
94
93
) }
95
94
</ EditorCommandTunnelContext . Consumer >
96
95
) ;
97
96
} ) ;
97
+ export const EditorCommandList = Command . List ;
98
98
99
99
EditorCommand . displayName = "EditorCommand" ;
Original file line number Diff line number Diff line change @@ -5,5 +5,5 @@ export type { JSONContent } from "@tiptap/react";
5
5
export { EditorRoot , EditorContent , type EditorContentProps } from "./editor" ;
6
6
export { EditorBubble } from "./editor-bubble" ;
7
7
export { EditorBubbleItem } from "./editor-bubble-item" ;
8
- export { EditorCommand } from "./editor-command" ;
8
+ export { EditorCommand , EditorCommandList } from "./editor-command" ;
9
9
export { EditorCommandItem , EditorCommandEmpty } from "./editor-command-item" ;
You can’t perform that action at this time.
0 commit comments