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) {
365365 e . setAttribute ( "style" , s ) ;
366366
367367 if ( enableMentions ) {
368- cm . current . on ( "change" , ( _cm , changeObj ) => {
368+ cm . current . on ( "change" , ( cm , changeObj ) => {
369369 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+ }
371378 }
372379 } ) ;
373380 }
@@ -803,7 +810,6 @@ export function MarkdownInput(props: Props) {
803810
804811 // make sure that mentions is closed if we switch to another tab.
805812 useEffect ( ( ) => {
806- console . log ( "" )
807813 if ( mentions && ! isVisible ) {
808814 close_mentions ( ) ;
809815 }
You can’t perform that action at this time.
0 commit comments