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 = ({
94
94
}
95
95
if ( Text . isText ( current ) ) {
96
96
const charBeforeCursor = current . text [ focus . offset - 1 ] ;
97
+ const charBeforeBefore = current . text [ focus . offset - 2 ] ?. trim ( ) ;
97
98
let afterMatch , beforeMatch , beforeRange , search ;
99
+ // try to keep this consistent with before stuff in frontend/editors/markdown-input/component.tsx
98
100
if ( charBeforeCursor == "@" ) {
99
101
beforeRange = {
100
102
focus : editor . selection . focus ,
@@ -118,7 +120,12 @@ export const useMentions: (Options) => MentionsControl = ({
118
120
const afterText = Editor . string ( editor , afterRange ) ;
119
121
afterMatch = afterText . match ( / ^ ( \s | $ ) / ) ;
120
122
}
121
- if ( charBeforeCursor == "@" || ( beforeMatch && afterMatch ) ) {
123
+ if (
124
+ ( charBeforeCursor == "@" || ( beforeMatch && afterMatch ) ) &&
125
+ ( ! charBeforeBefore ||
126
+ charBeforeBefore == "(" ||
127
+ charBeforeBefore == "[" )
128
+ ) {
122
129
setTarget ( beforeRange ) ;
123
130
setSearch ( search ) ;
124
131
return ;
You can’t perform that action at this time.
0 commit comments