You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[CLNP-4962] fix: prevent HTML entity conversion by using insertText in document.execCommand (#1208)
Fixes the issue https://sendbird.atlassian.net/browse/CLNP-4962
where HTML entities like `§` or `<` were being automatically
converted to their corresponding symbols (§ or >) when pasting content
into a contentEditable element.
### Changes
The `document.execCommand('insertHTML', false, sanitizeString(text))`
command was replaced with `document.execCommand('insertText', false,
sanitizeString(text))`.
This change ensures that HTML entities are inserted as plain text rather
than being interpreted and converted by the browser. Now it prevents
unintended conversion of HTML entities, maintaining the original text as
expected when pasting content.
### How to test?
Try this on the preview.
Type `§` and copy & paste the text to the input box. The exact same
text(=`§`) should be on the input not `§`.
0 commit comments