react-input-emoji 5.3.1 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5029,8 +5029,24 @@ function InputEmoji(props, ref) {
5029
5029
 
5030
5030
 
5031
5031
  function handleCopy(event) {
5032
- event.clipboardData.setData("text", sanitizedTextRef.current);
5033
- event.preventDefault();
5032
+ var selection = window.getSelection();
5033
+
5034
+ if (selection !== null) {
5035
+ var selectedText = '';
5036
+
5037
+ if (selection.anchorNode && selection.anchorNode.nodeType === Node.ELEMENT_NODE) {
5038
+ // @ts-ignore
5039
+ selectedText = selection.anchorNode.innerHTML;
5040
+ } else if (selection.anchorNode && selection.anchorNode.nodeType === Node.TEXT_NODE) {
5041
+ var _selection$anchorNode;
5042
+
5043
+ selectedText = (_selection$anchorNode = selection.anchorNode.textContent) !== null && _selection$anchorNode !== void 0 ? _selection$anchorNode : '';
5044
+ }
5045
+
5046
+ var text = replaceAllTextEmojiToString(selectedText);
5047
+ event.clipboardData.setData("text", text);
5048
+ event.preventDefault();
5049
+ }
5034
5050
  }
5035
5051
  /**
5036
5052
  * Handle past on input