Skip to content

Commit

Permalink
Fix picker issue, allow + for mentions (#2783)
Browse files Browse the repository at this point in the history
  • Loading branch information
JiuqingSong authored Sep 4, 2024
1 parent 3584f95 commit db6f174
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const UNIDENTIFIED_KEY = 'Unidentified';
// the char code for Android keyboard events on Webview below 51.
const UNIDENTIFIED_CODE = [0, 229];

const ALLOWED_CHAR_BEFORE_TRIGGER = ['(', '+'];

/**
* PickerPlugin represents a plugin of editor which can handle picker related behaviors, including
* - Show picker when special trigger key is pressed
Expand Down Expand Up @@ -347,7 +349,7 @@ export default class PickerPlugin<T extends PickerDataProvider = PickerDataProvi
wordBeforeCursor != null &&
wordBeforeCursor.split(' ').length <= 4 &&
(wordBeforeCursor[0] == this.pickerOptions.triggerCharacter ||
(wordBeforeCursor[0] == '(' &&
(ALLOWED_CHAR_BEFORE_TRIGGER.indexOf(wordBeforeCursor[0]) >= 0 &&
wordBeforeCursor[1] == this.pickerOptions.triggerCharacter))
) {
this.setIsSuggesting(true);
Expand Down Expand Up @@ -565,7 +567,8 @@ export default class PickerPlugin<T extends PickerDataProvider = PickerDataProvi
// so wordFromCache is what we want to return.
if (
wordFromRange == this.pickerOptions.triggerCharacter &&
wordFromRange != wordFromCache
wordFromRange != wordFromCache &&
wordFromCache?.[wordFromCache?.length - 1] != wordFromRange
) {
return wordFromCache;
}
Expand Down
4 changes: 3 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"legacy": "8.62.0",
"react": "8.56.0",
"overrides": {}
"overrides": {
"roosterjs-editor-plugins": "8.62.1"
}
}

0 comments on commit db6f174

Please sign in to comment.