react-input-emoji 5.3.1 → 5.4.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -64,6 +64,7 @@ export default function Example() {
64
64
  | `fontFamily` | string | "sans-serif" | The font family of the placeholder and input container. |
65
65
  | `shouldReturn` | boolean | - | Allows the user to use the `Shift + Enter` or `Ctrl + Enter` keyboard shortcut to create a new line. | |
66
66
  | `buttonElement` | HTMLElement | - | An HTMLElement that, when clicked, triggers the emoji picker. If this prop is provided, the default emoji picker button is removed. |
67
+ | `keepOpened` | boolean | false | If set to true, the emoji picker will remain open after selecting an emoji. Defaults to false. |
67
68
 
68
69
  ## License
69
70
 
package/dist/index.es.js CHANGED
@@ -5021,8 +5021,24 @@ function InputEmoji(props, ref) {
5021
5021
 
5022
5022
 
5023
5023
  function handleCopy(event) {
5024
- event.clipboardData.setData("text", sanitizedTextRef.current);
5025
- event.preventDefault();
5024
+ var selection = window.getSelection();
5025
+
5026
+ if (selection !== null) {
5027
+ var selectedText = '';
5028
+
5029
+ if (selection.anchorNode && selection.anchorNode.nodeType === Node.ELEMENT_NODE) {
5030
+ // @ts-ignore
5031
+ selectedText = selection.anchorNode.innerHTML;
5032
+ } else if (selection.anchorNode && selection.anchorNode.nodeType === Node.TEXT_NODE) {
5033
+ var _selection$anchorNode;
5034
+
5035
+ selectedText = (_selection$anchorNode = selection.anchorNode.textContent) !== null && _selection$anchorNode !== void 0 ? _selection$anchorNode : '';
5036
+ }
5037
+
5038
+ var text = replaceAllTextEmojiToString(selectedText);
5039
+ event.clipboardData.setData("text", text);
5040
+ event.preventDefault();
5041
+ }
5026
5042
  }
5027
5043
  /**
5028
5044
  * Handle past on input