File tree Expand file tree Collapse file tree
src/components/editor/plugins Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -217,11 +217,21 @@ export default function TagCompletionPlugin() {
217217 return ;
218218 }
219219
220- const textUpToCursor = anchorNode
221- . getTextContent ( )
222- . slice ( 0 , anchor . offset ) ;
220+ const fullText = anchorNode . getTextContent ( ) ;
221+ const textUpToCursor = fullText . slice ( 0 , anchor . offset ) ;
223222 const match = matchHashtag ( textUpToCursor ) ;
224223
224+ // Only show menu when caret is at the end of the tag
225+ const charAfterCursor = fullText [ anchor . offset ] ;
226+ if (
227+ charAfterCursor !== undefined &&
228+ / [ ^ \s . , + * ? $ @ | { } ( ) ^ \- [ \] \\ / ! % ' " ~ = < > _ : ; # ] / . test ( charAfterCursor )
229+ ) {
230+ closeMenu ( ) ;
231+ if ( debounceRef . current ) clearTimeout ( debounceRef . current ) ;
232+ return ;
233+ }
234+
225235 if ( ! match ) {
226236 closeMenu ( ) ;
227237 if ( debounceRef . current ) clearTimeout ( debounceRef . current ) ;
You can’t perform that action at this time.
0 commit comments