File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/packages/frontend/editors/slate/slate-mentions Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -94,9 +94,9 @@ export const useMentions: (Options) => MentionsControl = ({
9494 }
9595 if ( Text . isText ( current ) ) {
9696 const charBeforeCursor = current . text [ focus . offset - 1 ] ;
97+ // keep use of this consistent with before stuff in frontend/editors/markdown-input/component.tsx
9798 const charBeforeBefore = current . text [ focus . offset - 2 ] ?. trim ( ) ;
9899 let afterMatch , beforeMatch , beforeRange , search ;
99- // try to keep this consistent with before stuff in frontend/editors/markdown-input/component.tsx
100100 if ( charBeforeCursor == "@" ) {
101101 beforeRange = {
102102 focus : editor . selection . focus ,
@@ -121,10 +121,11 @@ export const useMentions: (Options) => MentionsControl = ({
121121 afterMatch = afterText . match ( / ^ ( \s | $ ) / ) ;
122122 }
123123 if (
124- ( charBeforeCursor == "@" || ( beforeMatch && afterMatch ) ) &&
125- ( ! charBeforeBefore ||
126- charBeforeBefore == "(" ||
127- charBeforeBefore == "[" )
124+ ( charBeforeCursor == "@" &&
125+ ( ! charBeforeBefore ||
126+ charBeforeBefore == "(" ||
127+ charBeforeBefore == "[" ) ) ||
128+ ( beforeMatch && afterMatch )
128129 ) {
129130 setTarget ( beforeRange ) ;
130131 setSearch ( search ) ;
You can’t perform that action at this time.
0 commit comments