diff options
author | David Yip <yipdw@member.fsf.org> | 2017-10-15 20:04:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-15 20:04:19 -0500 |
commit | 22df18e902f43448066371e250ed944469b83d40 (patch) | |
tree | fbf9045913397f655311d40559e9197862b1b29c /app/javascript | |
parent | cdc22d23b91e8c0140d3048ae8a11e749a434ac8 (diff) | |
parent | 723890b6fadd1a1936906dc2b12411642912ce57 (diff) |
Merge pull request #173 from glitch-soc/zerowidthmoji
use zerowidth spaces with emojis
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/components/autosuggest_textarea.js | 4 | ||||
-rw-r--r-- | app/javascript/mastodon/reducers/compose.js | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/javascript/mastodon/components/autosuggest_textarea.js b/app/javascript/mastodon/components/autosuggest_textarea.js index 14a8d4c38..a065ac988 100644 --- a/app/javascript/mastodon/components/autosuggest_textarea.js +++ b/app/javascript/mastodon/components/autosuggest_textarea.js @@ -11,8 +11,8 @@ import classNames from 'classnames'; const textAtCursorMatchesToken = (str, caretPosition) => { let word; - let left = str.slice(0, caretPosition).search(/\S+$/); - let right = str.slice(caretPosition).search(/\s/); + let left = str.slice(0, caretPosition).search(/[^\s\u200B]+$/); + let right = str.slice(caretPosition).search(/[\s\u200B]/); if (right < 0) { word = str.slice(left); diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index 2c34de4f5..251a40144 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -135,7 +135,7 @@ function removeMedia(state, mediaId) { const insertSuggestion = (state, position, token, completion) => { return state.withMutations(map => { - map.update('text', oldText => `${oldText.slice(0, position)}${completion} ${oldText.slice(position + token.length)}`); + map.update('text', oldText => `${oldText.slice(0, position)}${completion}\u200B${oldText.slice(position + token.length)}`); map.set('suggestion_token', null); map.update('suggestions', ImmutableList(), list => list.clear()); map.set('focusDate', new Date()); @@ -147,7 +147,7 @@ const insertEmoji = (state, position, emojiData) => { const emoji = emojiData.native; return state.withMutations(map => { - map.update('text', oldText => `${oldText.slice(0, position)}${emoji} ${oldText.slice(position)}`); + map.update('text', oldText => `${oldText.slice(0, position)}${emoji}\u200B${oldText.slice(position)}`); map.set('focusDate', new Date()); map.set('idempotencyKey', uuid()); }); |