This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 822
Custom emotes #9240
Closed
Closed
Custom emotes #9240
Changes from 195 commits
Commits
Show all changes
251 commits
Select commit
Hold shift + click to select a range
4db0a7e
emotes show up in messages
nmscode d3ea501
added tooltips
nmscode d1b6068
removed extra logging
nmscode 047f39e
edits to changelog
nmscode 43ab685
fixed bug with User Appearance Settings Tab caused by changes in Text…
nmscode 87aed98
added autocomplete custom emote functionality
nmscode 48af2e3
Removing merge conflict blocks and fixing some formatting
nmscode 99cf97b
some lint fixes
nmscode 9555dc2
more lint fixes
nmscode 776d40c
even more lint fixes
nmscode 1d18c70
lint fixes 4
nmscode e2d08cb
lint fixes 5
nmscode c376e1d
removed extraneous file that got accidentally copied over
nmscode 9d2b15f
fixed issue in autocomplete where title of normal emote was notsurrou…
nmscode 147fd66
changed i18n files to include emote phrases
nmscode 92d3bae
added some missing css
nmscode a2146be
added some more missing changes
nmscode 7da8d5f
lint fixes 6
nmscode 495774a
i18n fixes/changes
nmscode ced18d9
Merge branch 'develop' into prbranch
nmscode 12d7bda
i18n changes retry
nmscode 5c04be4
i18n changes retry 3
nmscode d7b0a44
i18n changes retry 4
nmscode 0b95257
i18n changes undo
nmscode c310091
i18n changes retry 6
nmscode e0a4fc3
i18n changes retry 7
nmscode 3d9d71c
Merge branch 'develop' into prbranch
nmscode 91c669a
autocomplete fix
nmscode 1507718
added encryption and decryption for emotes
nmscode c1a4727
encryption code cleanup
nmscode 05ccbd5
encryption code type fixes
nmscode e5dcdbf
added multiple emote upload and read shortcode from filename
nmscode 8d0a4e0
code cleanup
nmscode 842bee4
code cleanup 2
nmscode c88f28e
Merge branch 'develop' into prbranch
nmscode 8b190c1
Merge branch 'develop' into prbranch
nmscode 4fefa5c
makes emotes work in public(unencrypted) rooms and encrypted rooms
nmscode 53c9d35
code fix
nmscode 2aef28f
space between import groups
nmscode a2de64c
build commits
nmscode 42bf66e
Merge branch 'matrix-org:develop' into prbranch
nmscode ce04fce
Removing any and dictionary types
nmscode 2834610
Merge branch 'develop' into prbranch
nmscode d92c6f0
Replacing dictionary and any 2
nmscode bdbd408
Merge branch 'master' into buildbranch
nmscode 6bef012
Added custom emotes to the emojipicker
nmscode 8c2bded
Merge branch 'prbranch' into buildbranch
nmscode ceec93e
Update MessageComposerButtons.tsx
nmscode 59357f1
Merge remote-tracking branch 'upstream/master' into buildbranch
nmscode 6b8ff65
Add compatibility option with other clients
nmscode 3ba45ed
Merge branch 'prbranch' into buildbranch
nmscode eee9bb1
Update RoomEmoteSettings.tsx
nmscode 35bba69
Set height on compatible emotes
nmscode 0ce29b3
Emojipicker updates
nmscode 96a1cd7
Merge branch 'prbranch' into buildbranch
nmscode d83c750
Autocomplete bug fix
nmscode 6d2ba5d
Update Autocompleter.ts
nmscode 8d8d851
emotes show up in messages
nmscode 130fdda
emotes show up in messages
nmscode e866a98
added tooltips
nmscode 12e826d
removed extra logging
nmscode 6b07a69
edits to changelog
nmscode 9d28392
fixed bug with User Appearance Settings Tab caused by changes in Text…
nmscode 1fc4b9f
added autocomplete custom emote functionality
nmscode b740d1a
Removing merge conflict blocks and fixing some formatting
nmscode 9659d79
some lint fixes
nmscode d528ff3
more lint fixes
nmscode d8a5069
even more lint fixes
nmscode 24d63bc
lint fixes 4
nmscode 3d6c461
lint fixes 5
nmscode c741b27
removed extraneous file that got accidentally copied over
nmscode e242ca2
fixed issue in autocomplete where title of normal emote was notsurrou…
nmscode 135ce7d
changed i18n files to include emote phrases
nmscode 0340ccf
added some missing css
nmscode dbbe589
added some more missing changes
nmscode 1c103b0
lint fixes 6
nmscode 9b657f4
i18n fixes/changes
nmscode 3e1d525
i18n changes retry
nmscode eaa8f1b
i18n changes retry 3
nmscode 4c11a9a
i18n changes retry 4
nmscode 6026b34
i18n changes undo
nmscode 1662830
i18n changes retry 6
nmscode af641b7
i18n changes retry 7
nmscode f7a4e57
autocomplete fix
nmscode dc7bee7
added encryption and decryption for emotes
nmscode 92a836d
encryption code cleanup
nmscode 3c39b30
encryption code type fixes
nmscode 31ad8fc
added multiple emote upload and read shortcode from filename
nmscode 3cf41dd
code cleanup
nmscode 380cc54
code cleanup 2
nmscode 9f5d49a
makes emotes work in public(unencrypted) rooms and encrypted rooms
nmscode 2dfbc90
code fix
nmscode 225d2b4
Removing any and dictionary types
nmscode 03e700c
Replacing dictionary and any 2
nmscode 6740a08
Added custom emotes to the emojipicker
nmscode 8a28f23
Add compatibility option with other clients
nmscode a842e29
Update RoomEmoteSettings.tsx
nmscode b328efb
Set height on compatible emotes
nmscode b664b3a
Update EmojiButton.tsx
nmscode 3f6f1c8
Merge branch 'buildbranch' into prbranch
nmscode 583684c
Code format changes and some documentation
nmscode 87ce27e
clean up
nmscode 71aaead
fix in emoji
nmscode 461c4f4
cache regex and fix parenthesis issue
nmscode 3b3d696
Add UnstableValue and revert i18n
nmscode 57d5ec3
Undo accidental deletion
nmscode ed1f402
fix: code style and white space
JiffyCat 6cfd79e
fix: other lint and code style issues
JiffyCat ae01131
cleanup: comments in RoomEmoteSettings.tsx
JiffyCat 9e4dba7
cleanup: comments from _EmoteSettings.pcss
JiffyCat 9f77560
Unstable value update
nmscode 9d50f1a
Typo fix
nmscode c79780d
added comment about use of dangerouslySetInnerHTML
nmscode 9fec256
Directly use react components instead of using dangerouslySetInnerHTML
nmscode 3e2f506
bug fix in textualbody
nmscode 832f316
Restrict characters for shortcodes
nmscode 99b1354
allow underscore in shortcode
nmscode 646dd3b
Remove cheerio based bug fix
nmscode 351e4a5
Restore some accidentally removed code from emojiprovider
nmscode 029e1bc
Remove some duplicated code
nmscode c825e41
Update RoomSettingsDialog.tsx
nmscode d717eb1
Lint fixes 1
nmscode 3cd8016
Lint fixes 2
nmscode 9fd3d1e
Some fixes for tests
nmscode 4912b81
Add some null checks and test fixes
nmscode ab9e31e
emojipicker bug fix and check for room
nmscode d52f35b
test fix 3
nmscode 864ea57
Update EmojiProvider.tsx
nmscode 9ab8ce8
keep custom emotes enabled in emojipicker
nmscode b53ae44
Ran i18n
nmscode 35e091e
fix: automatic lint fixes
JiffyCat 3aca4b3
type fixes
nmscode 56899a2
Type and lint fixes
nmscode 600c499
Restore removed code in emojibutton
nmscode 533ce9b
i18n update
nmscode 44ee160
Update SendMessageComposer.tsx
nmscode f587039
Compatibility mode bug fix
nmscode 3dba10c
Remove Object type for more specific typing
nmscode 72051e3
Merge remote-tracking branch 'upstream/develop' into prbranch
nmscode 19569d6
lint fix
nmscode 2b25543
fix: keyboardevent lint error
JiffyCat bafd034
fix: revert filterboolean
JiffyCat 5005bbe
fix: test errors
JiffyCat 92c150d
Bug fix in roomemptesettings
nmscode 026e411
RoomEmoteSettings bug fix 2
nmscode 6a6ed02
fix: add test snapshots
JiffyCat ecc19e6
Strict type fixes
nmscode 18cfc7e
Lint fixes
nmscode 6838d1f
Merge branch 'develop' into prbranch
nmscode 8063c02
removed incorrect null safe assertions and used interface for imagePack
nmscode 2d884ec
Merge branch 'develop' into prbranch
nmscode 4e67a6b
fix: strict type check for emojiBodyElements
JiffyCat 2ad5f2c
fix for final strict type issues in emoji.ts and emojiprovider
nmscode 30303da
Added tests
nmscode f9c346f
Add more test coverage and remove sonar and strict type check bug
nmscode 556b1d6
Adding some more tests to increase coverage
nmscode 4c1298c
final test push
nmscode 32c9ccf
Merge branch 'develop' into prbranch
t3chguy 38efe85
Fix for new safeGet check
nmscode 537dd52
Merge branch 'develop' into prbranch
nmscode 68e0003
Merge branch 'develop' into prbranch
nmscode ab4e9ed
Merge branch 'develop' into prbranch
nmscode 86a82e0
Merge branch 'develop' into prbranch
nmscode 92e2f67
Merge branch 'develop' into prbranch
nmscode cebb2fd
Merge branch 'develop' into prbranch
nmscode 22c47b7
Make custom emotes a lab setting
nmscode 6193d09
i18n and a fix
nmscode 22471f0
test: add test snapshot for RoomSettingsDialog
JiffyCat 439a846
Merge branch 'develop' into prbranch
nmscode 1f8ff10
fix: snapshot with HtmlUtils
JiffyCat f373fbe
lint fix htmlutils
nmscode 6e205e7
Merge branch 'develop' into prbranch
nmscode 3f774a8
Merge branch 'develop' into prbranch
nmscode fe0e17b
fix: batch apply suggestions from code review
JiffyCat 89e9238
fix: cleanup comments and unused code
JiffyCat 3a68e2b
fix: EmoteSettings copyright
JiffyCat 875491b
revert: test-utils changes
JiffyCat 7db0bfc
Review fixes
nmscode d5b8ade
Merge branch 'prbranch' of https://github.com/nmscode/matrix-react-sd…
nmscode 47bab13
Review fixes 2
nmscode 499638c
Update _EventTile.pcss
nmscode dbf1282
Emotes css fix
nmscode f71b528
Fix strings
nmscode 1bbc67e
fix: unstable value and compat mode
JiffyCat b064451
Merge branch 'develop' into prbranch
nmscode 5941022
strict type fix
nmscode a3f3320
Merge branch 'develop' into prbranch
nmscode 4b1bf55
Merge branch 'develop' into prbranch
nmscode b8623eb
sonar coverage
nmscode 29777b0
Merge branch 'develop' into prbranch
nmscode 8f9d1ce
Merge branch 'develop' into prbranch
nmscode 83a522e
compatibility fix
nmscode 77f06b5
compatibility fix 2
nmscode 0a6d184
Add test for loading emotes uploaded from other clients when compat m…
nmscode aa715fe
Merge branch 'develop' into prbranch
nmscode 15ef7df
Merge branch 'develop' into prbranch
nmscode a2eaabe
Merge branch 'develop' into prbranch
nmscode e5273b7
Merge branch 'develop' into prbranch
nmscode 984cf01
Merge branch 'develop' into prbranch
nmscode 699bbf3
Merge branch 'develop' into prbranch
nmscode f85f36f
Merge branch 'develop' into prbranch
nmscode aa1ab71
Use readable state key instead of blank
nmscode 46732bd
Merge remote-tracking branch 'upstream/develop' into prbranch
JiffyCat 4c86ce1
fix: add copyright to Emotes css
JiffyCat c08bb72
Merge branch 'develop' into prbranch
nmscode 7d6a9e0
Merge branch 'develop' into prbranch
nmscode 949d889
Merge branch 'develop' into prbranch
nmscode 35ac50c
Merge branch 'develop' into prbranch
JiffyCat d455df0
Merge branch 'develop' into prbranch
nmscode 8ae190e
Merge branch 'develop' into prbranch
nmscode b11bb36
Add a pack name for the element compatible pack
nmscode 50db6a7
Merge branch 'develop' into prbranch
nmscode bbba7d3
Merge branch 'develop' into prbranch
nmscode 491006c
Merge branch 'develop' into prbranch
nmscode bd3e017
Merge branch 'develop' into prbranch
nmscode 0dcfb68
Merge branch 'develop' into prbranch
nmscode b57c7ff
Merge branch 'develop' into prbranch
nmscode 3f36820
Merge branch 'develop' into prbranch
nmscode 9b99b36
Merge branch 'develop' into prbranch
nmscode bc95d26
Merge branch 'develop' into prbranch
nmscode 870c48d
Merge branch 'develop' into prbranch
JiffyCat f8b6501
Merge branch 'develop' into prbranch
nmscode 8b49381
Merge branch 'develop' into prbranch
nmscode 3ad3e36
type and jest test fix
nmscode b9cbc72
Merge branch 'develop' into prbranch
nmscode 19a261b
Merge branch 'develop' into prbranch
nmscode 4e2e895
Merge branch 'develop' into prbranch
JiffyCat c78b5e5
Merge branch 'develop' into prbranch
nmscode 286ec09
Merge branch 'develop' into prbranch
nmscode 0533845
Merge branch 'develop' into prbranch
nmscode 56a06f9
Merge branch 'develop' into prbranch
nmscode 263fbb7
Merge branch 'develop' into prbranch
nmscode 45a9d81
Merge branch 'develop' into prbranch
nmscode 183ec44
lint fixes
nmscode 8155eab
Merge branch 'develop' into prbranch
nmscode 5e01cfc
new js sdk import lint fix
nmscode 7d0b01e
Merge branch 'develop' into prbranch
nmscode ff2ed60
lint fix
nmscode 0d2e8bb
Merge branch 'develop' into prbranch
nmscode 63b2342
another import lint fix
nmscode 18ed8c2
Merge branch 'develop' into prbranch
nmscode fc731cf
lint fix
nmscode 9125480
Merge branch 'develop' into prbranch
nmscode 9494f77
revert
nmscode dcc6aee
Merge branch 'develop' into prbranch
nmscode 15881be
i18n and a type fix
nmscode c054095
lint fixes
nmscode 62f8d53
Merge branch 'develop' into prbranch
nmscode cdebb6c
Merge branch 'develop' into prbranch
nmscode 64c3f50
Merge branch 'develop' into prbranch
nmscode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.mx_Emote { | ||
height: 32px; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
Copyright 2023 The Matrix.org Foundation C.I.C. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
.mx_EmoteSettings { | ||
margin-inline-end: var(--SettingsTab_fullWidthField-margin-inline-end); | ||
border-bottom: 1px solid $quinary-content; | ||
|
||
.mx_EmoteSettings_emoteUpload { | ||
display: none; | ||
} | ||
.mx_EmoteSettings_addEmoteField { | ||
display: flex; | ||
width: 100%; | ||
} | ||
.mx_EmoteSettings_uploadButton { | ||
margin-left: auto; | ||
align-self: center; | ||
} | ||
.mx_EmoteSettings_deleteButton { | ||
margin-left: auto; | ||
align-self: center; | ||
} | ||
.mx_EmoteSettings_uploadedEmoteImage { | ||
height: 30px; | ||
width: var(--emote-image-width) * 30 / var(--emote-image-height); // Sets emote height to 30px and scales the width accordingly | ||
margin-left: 30px; | ||
align-self: center; | ||
} | ||
.mx_EmoteSettings_Emote { | ||
display: flex; | ||
|
||
.mx_EmoteSettings_Emote_controls { | ||
flex-grow: 1; | ||
margin-inline-end: 54px; | ||
|
||
.mx_Field:first-child { | ||
margin-top: 0; | ||
} | ||
|
||
.mx_EmoteSettings_Emote_controls_topic { | ||
& > textarea { | ||
font-family: inherit; | ||
resize: vertical; | ||
} | ||
|
||
&.mx_EmoteSettings_Emote_controls_topic--room textarea { | ||
min-height: 4em; | ||
} | ||
} | ||
|
||
.mx_EmoteSettings_Emote_controls_userId { | ||
margin-inline-end: $spacing-20; | ||
} | ||
} | ||
} | ||
|
||
.mx_EmoteSettings_buttons { | ||
margin-top: 10px; /* 18px is already accounted for by the <p> above the buttons */ | ||
|
||
> .mx_AccessibleButton_kind_link { | ||
font-size: $font-14px; | ||
margin-inline-end: 10px; | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,8 @@ const BIGEMOJI_REGEX = new RegExp(`^(${EMOJIBASE_REGEX.source})+$`, "i"); | |
|
||
const COLOR_REGEX = /^#[0-9a-fA-F]{6}$/; | ||
|
||
const CUSTOM_EMOTES_REGEX = /:[\w+-]+:/g; | ||
|
||
export const PERMITTED_URL_SCHEMES = [ | ||
"bitcoin", | ||
"ftp", | ||
|
@@ -438,6 +440,7 @@ interface IOpts { | |
returnString?: boolean; | ||
forComposerQuote?: boolean; | ||
ref?: React.Ref<HTMLSpanElement>; | ||
emotes?: Map<string, string>; | ||
} | ||
|
||
export interface IOptsReturnNode extends IOpts { | ||
|
@@ -548,6 +551,12 @@ export function bodyToHtml(content: IContent, highlights: Optional<string[]>, op | |
// by an attempt to search for 'foobar'. Then again, the search query probably wouldn't work either | ||
// XXX: hacky bodge to temporarily apply a textFilter to the sanitizeParams structure. | ||
sanitizeParams.textFilter = function (safeText) { | ||
if (opts.emotes) { | ||
return highlighter | ||
.applyHighlights(safeText, safeHighlights!) | ||
.join("") | ||
.replace(CUSTOM_EMOTES_REGEX, (m) => (opts?.emotes?.has(m) ? opts.emotes.get(m)! : m)); | ||
} | ||
Comment on lines
+528
to
+533
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note for @matrix-org/product - this rendering is done on the receiving side, regardless of whether a sender intended it. It may not play well with bridges. If a room has a |
||
return highlighter.applyHighlights(safeText, safeHighlights!).join(""); | ||
}; | ||
} | ||
|
@@ -610,7 +619,12 @@ export function bodyToHtml(content: IContent, highlights: Optional<string[]>, op | |
"mx_EventTile_bigEmoji": emojiBody, | ||
"markdown-body": isHtmlMessage && !emojiBody, | ||
}); | ||
|
||
if (opts.emotes) { | ||
const tmp = strippedBody?.replace(CUSTOM_EMOTES_REGEX, (m) => (opts?.emotes?.has(m) ? opts.emotes.get(m)! : m)); | ||
if (tmp !== strippedBody) { | ||
safeBody = tmp; | ||
} | ||
} | ||
let emojiBodyElements: JSX.Element[] | undefined; | ||
if (!safeBody && bodyHasEmoji) { | ||
emojiBodyElements = formatEmojis(strippedBody, false) as JSX.Element[]; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.