mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-26 13:41:36 +01:00
Fix emoji being inserted in incorrect places
This commit is contained in:
parent
6eede9d84b
commit
138286147f
2 changed files with 6 additions and 6 deletions
|
@ -15,8 +15,8 @@ import { AutosuggestHashtag } from './autosuggest_hashtag';
|
|||
const textAtCursorMatchesToken = (str, caretPosition, searchTokens) => {
|
||||
let word;
|
||||
|
||||
let left = str.slice(0, caretPosition).search(/[^\s\u200B]+$/);
|
||||
let right = str.slice(caretPosition).search(/[\s\u200B]/);
|
||||
let left = str.slice(0, caretPosition).search(/\S+$/);
|
||||
let right = str.slice(caretPosition).search(/\s/);
|
||||
|
||||
if (right < 0) {
|
||||
word = str.slice(left);
|
||||
|
@ -31,7 +31,7 @@ const textAtCursorMatchesToken = (str, caretPosition, searchTokens) => {
|
|||
word = word.trim().toLowerCase();
|
||||
|
||||
if (word.length > 0) {
|
||||
return [left, word];
|
||||
return [left + 1, word];
|
||||
} else {
|
||||
return [null, null];
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ import { AutosuggestHashtag } from './autosuggest_hashtag';
|
|||
const textAtCursorMatchesToken = (str, caretPosition) => {
|
||||
let word;
|
||||
|
||||
let left = str.slice(0, caretPosition).search(/[^\s\u200B]+$/);
|
||||
let right = str.slice(caretPosition).search(/[\s\u200B]/);
|
||||
let left = str.slice(0, caretPosition).search(/\S+$/);
|
||||
let right = str.slice(caretPosition).search(/\s/);
|
||||
|
||||
if (right < 0) {
|
||||
word = str.slice(left);
|
||||
|
@ -32,7 +32,7 @@ const textAtCursorMatchesToken = (str, caretPosition) => {
|
|||
word = word.trim().toLowerCase();
|
||||
|
||||
if (word.length > 0) {
|
||||
return [left, word];
|
||||
return [left + 1, word];
|
||||
} else {
|
||||
return [null, null];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue