File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/packages/frontend/editors/slate/slate-mentions Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,9 @@ export const useMentions: (Options) => MentionsControl = ({
9494 }
9595 if ( Text . isText ( current ) ) {
9696 const charBeforeCursor = current . text [ focus . offset - 1 ] ;
97+ const charBeforeBefore = current . text [ focus . offset - 2 ] ?. trim ( ) ;
9798 let afterMatch , beforeMatch , beforeRange , search ;
99+ // try to keep this consistent with before stuff in frontend/editors/markdown-input/component.tsx
98100 if ( charBeforeCursor == "@" ) {
99101 beforeRange = {
100102 focus : editor . selection . focus ,
@@ -118,7 +120,12 @@ export const useMentions: (Options) => MentionsControl = ({
118120 const afterText = Editor . string ( editor , afterRange ) ;
119121 afterMatch = afterText . match ( / ^ ( \s | $ ) / ) ;
120122 }
121- if ( charBeforeCursor == "@" || ( beforeMatch && afterMatch ) ) {
123+ if (
124+ ( charBeforeCursor == "@" || ( beforeMatch && afterMatch ) ) &&
125+ ( ! charBeforeBefore ||
126+ charBeforeBefore == "(" ||
127+ charBeforeBefore == "[" )
128+ ) {
122129 setTarget ( beforeRange ) ;
123130 setSearch ( search ) ;
124131 return ;
You can’t perform that action at this time.
0 commit comments