File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/packages/frontend/editors/markdown-input Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -365,9 +365,16 @@ export function MarkdownInput(props: Props) {
365
365
e . setAttribute ( "style" , s ) ;
366
366
367
367
if ( enableMentions ) {
368
- cm . current . on ( "change" , ( _cm , changeObj ) => {
368
+ cm . current . on ( "change" , ( cm , changeObj ) => {
369
369
if ( changeObj . text [ 0 ] == "@" ) {
370
- show_mentions ( ) ;
370
+ const before = cm
371
+ . getLine ( changeObj . to . line )
372
+ . slice ( changeObj . to . ch - 1 , changeObj . to . ch )
373
+ ?. trim ( ) ;
374
+ // If previous character is whitespace or nothing, then activate mentions:
375
+ if ( ! before || before == "(" || before == "[" ) {
376
+ show_mentions ( ) ;
377
+ }
371
378
}
372
379
} ) ;
373
380
}
@@ -803,7 +810,6 @@ export function MarkdownInput(props: Props) {
803
810
804
811
// make sure that mentions is closed if we switch to another tab.
805
812
useEffect ( ( ) => {
806
- console . log ( "" )
807
813
if ( mentions && ! isVisible ) {
808
814
close_mentions ( ) ;
809
815
}
You can’t perform that action at this time.
0 commit comments