@@ -53,7 +53,7 @@ const IssueSuggestionList = ({
53
53
const commandListContainer = useRef < HTMLDivElement > ( null ) ;
54
54
55
55
useEffect ( ( ) => {
56
- let newDisplayedItems : { [ key : string ] : IssueSuggestionProps [ ] } = { } ;
56
+ const newDisplayedItems : { [ key : string ] : IssueSuggestionProps [ ] } = { } ;
57
57
let totalLength = 0 ;
58
58
sections . forEach ( ( section ) => {
59
59
newDisplayedItems [ section ] = items . filter ( ( item ) => item . state === section ) . slice ( 0 , 5 ) ;
@@ -65,8 +65,8 @@ const IssueSuggestionList = ({
65
65
} , [ items ] ) ;
66
66
67
67
const selectItem = useCallback (
68
- ( index : number ) => {
69
- const item = displayedItems [ currentSection ] [ index ] ;
68
+ ( section : string , index : number ) => {
69
+ const item = displayedItems [ section ] [ index ] ;
70
70
if ( item ) {
71
71
command ( item ) ;
72
72
}
@@ -87,6 +87,7 @@ const IssueSuggestionList = ({
87
87
setSelectedIndex (
88
88
( selectedIndex + displayedItems [ currentSection ] . length - 1 ) % displayedItems [ currentSection ] . length
89
89
) ;
90
+ e . stopPropagation ( ) ;
90
91
return true ;
91
92
}
92
93
if ( e . key === "ArrowDown" ) {
@@ -101,17 +102,20 @@ const IssueSuggestionList = ({
101
102
[ currentSection ] : [ ...prevItems [ currentSection ] , ...nextItems ] ,
102
103
} ) ) ;
103
104
}
105
+ e . stopPropagation ( ) ;
104
106
return true ;
105
107
}
106
108
if ( e . key === "Enter" ) {
107
- selectItem ( selectedIndex ) ;
109
+ selectItem ( currentSection , selectedIndex ) ;
110
+ e . stopPropagation ( ) ;
108
111
return true ;
109
112
}
110
113
if ( e . key === "Tab" ) {
111
114
const currentSectionIndex = sections . indexOf ( currentSection ) ;
112
115
const nextSectionIndex = ( currentSectionIndex + 1 ) % sections . length ;
113
116
setCurrentSection ( sections [ nextSectionIndex ] ) ;
114
117
setSelectedIndex ( 0 ) ;
118
+ e . stopPropagation ( ) ;
115
119
return true ;
116
120
}
117
121
return false ;
@@ -172,7 +176,7 @@ const IssueSuggestionList = ({
172
176
}
173
177
) }
174
178
key = { item . identifier }
175
- onClick = { ( ) => selectItem ( index ) }
179
+ onClick = { ( ) => selectItem ( section , index ) }
176
180
>
177
181
< h5 className = "whitespace-nowrap text-xs text-custom-text-300" > { item . identifier } </ h5 >
178
182
< PriorityIcon priority = { item . priority } />
@@ -195,7 +199,7 @@ export const IssueListRenderer = () => {
195
199
let popup : any | null = null ;
196
200
197
201
return {
198
- onStart : ( props : { editor : Editor ; clientRect : DOMRect } ) => {
202
+ onStart : ( props : { editor : Editor ; clientRect ?: ( ( ) => DOMRect | null ) | null } ) => {
199
203
component = new ReactRenderer ( IssueSuggestionList , {
200
204
props,
201
205
// @ts -ignore
@@ -210,10 +214,10 @@ export const IssueListRenderer = () => {
210
214
showOnCreate : true ,
211
215
interactive : true ,
212
216
trigger : "manual" ,
213
- placement : "right " ,
217
+ placement : "bottom-start " ,
214
218
} ) ;
215
219
} ,
216
- onUpdate : ( props : { editor : Editor ; clientRect : DOMRect } ) => {
220
+ onUpdate : ( props : { editor : Editor ; clientRect ?: ( ( ) => DOMRect | null ) | null } ) => {
217
221
component ?. updateProps ( props ) ;
218
222
219
223
popup &&
0 commit comments