react-input-emoji 5.6.1 → 5.6.3
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/README.md +21 -21
- package/dist/__mocks__/getSelectionMock.d.ts +5 -0
- package/dist/fixtures/examples.d.ts +5 -0
- package/dist/index.es.js +11 -15
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +11 -16
- package/dist/index.js.map +1 -1
- package/dist/src/components/emoji-picker-button.d.ts +21 -0
- package/dist/src/components/emoji-picker-container.d.ts +26 -0
- package/dist/src/components/emoji-picker-wrapper.d.ts +37 -0
- package/dist/src/components/emoji-picker.d.ts +23 -0
- package/dist/src/components/mention-user-list.d.ts +15 -0
- package/dist/src/components/mention-wrapper.d.ts +29 -0
- package/dist/src/components/mention-wrapper.test.d.ts +1 -0
- package/dist/src/hooks/use-emit.d.ts +10 -0
- package/dist/src/hooks/use-event-listeners.d.ts +9 -0
- package/dist/src/hooks/use-event-listeners.test.d.ts +1 -0
- package/dist/src/hooks/use-expose.d.ts +18 -0
- package/dist/src/hooks/use-mention.d.ts +17 -0
- package/dist/src/hooks/use-mention.test.d.ts +1 -0
- package/dist/src/hooks/use-sanitize.d.ts +19 -0
- package/dist/src/hooks/user-pollute.d.ts +9 -0
- package/dist/src/index.d.ts +48 -0
- package/dist/src/text-input.d.ts +30 -0
- package/dist/src/utils/emoji-utils.d.ts +20 -0
- package/dist/src/utils/input-event-utils.d.ts +95 -0
- package/dist/src/utils/mention-utils.d.ts +15 -0
- package/dist/src/utils/observer.d.ts +5 -0
- package/dist/src/utils/use-debounce.d.ts +1 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var ReactDOM = require('react-dom');
|
|
5
|
-
var t = require('prop-types');
|
|
6
5
|
|
|
7
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
7
|
|
|
9
8
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
9
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
11
|
-
var t__default = /*#__PURE__*/_interopDefaultLegacy(t);
|
|
12
10
|
|
|
13
11
|
function styleInject(css, ref) {
|
|
14
12
|
if (ref === void 0) ref = {};
|
|
@@ -523,7 +521,7 @@ function replaceAllTextEmojis(text) {
|
|
|
523
521
|
allEmojis = _toConsumableArray(new Set(allEmojis)); // remove duplicates
|
|
524
522
|
|
|
525
523
|
allEmojis.forEach(function (emoji) {
|
|
526
|
-
text = replaceAll(text, emoji, getInputEmojiHTML(emoji));
|
|
524
|
+
text = replaceAll(text, emoji, getInputEmojiHTML('', emoji));
|
|
527
525
|
});
|
|
528
526
|
}
|
|
529
527
|
return text;
|
|
@@ -767,7 +765,7 @@ function useExpose(_ref) {
|
|
|
767
765
|
textInputRef = _ref.textInputRef,
|
|
768
766
|
setValue = _ref.setValue,
|
|
769
767
|
emitChange = _ref.emitChange;
|
|
770
|
-
var _useSanitize = useSanitize(),
|
|
768
|
+
var _useSanitize = useSanitize(false),
|
|
771
769
|
sanitize = _useSanitize.sanitize,
|
|
772
770
|
sanitizedTextRef = _useSanitize.sanitizedTextRef;
|
|
773
771
|
React.useImperativeHandle(ref, function () {
|
|
@@ -882,7 +880,7 @@ var TextInput = function TextInput(_ref, ref) {
|
|
|
882
880
|
if (textInputRef.current) {
|
|
883
881
|
textInputRef.current.focus();
|
|
884
882
|
}
|
|
885
|
-
if (textInputRef.current && placeholderRef.current && textInputRef.current.innerHTML
|
|
883
|
+
if (textInputRef.current && placeholderRef.current && replaceAllTextEmojiToString(textInputRef.current.innerHTML) === "") {
|
|
886
884
|
placeholderRef.current.style.visibility = "visible";
|
|
887
885
|
} else if (placeholderRef.current) {
|
|
888
886
|
placeholderRef.current.style.visibility = "hidden";
|
|
@@ -896,7 +894,8 @@ var TextInput = function TextInput(_ref, ref) {
|
|
|
896
894
|
textInputRef.current.innerHTML = value;
|
|
897
895
|
}
|
|
898
896
|
if (placeholderRef.current) {
|
|
899
|
-
|
|
897
|
+
var text = replaceAllTextEmojiToString(value);
|
|
898
|
+
if (text === "") {
|
|
900
899
|
placeholderRef.current.style.visibility = "visible";
|
|
901
900
|
} else {
|
|
902
901
|
placeholderRef.current.style.visibility = "hidden";
|
|
@@ -977,9 +976,9 @@ var TextInput = function TextInput(_ref, ref) {
|
|
|
977
976
|
function handleKeyUp(event) {
|
|
978
977
|
props.onKeyUp(event);
|
|
979
978
|
var input = textInputRef.current;
|
|
980
|
-
if (placeholderRef.current) {
|
|
981
|
-
var
|
|
982
|
-
if (
|
|
979
|
+
if (placeholderRef.current && input) {
|
|
980
|
+
var text = replaceAllTextEmojiToString(input.innerHTML);
|
|
981
|
+
if (text === "") {
|
|
983
982
|
placeholderRef.current.style.visibility = "visible";
|
|
984
983
|
} else {
|
|
985
984
|
placeholderRef.current.style.visibility = "hidden";
|
|
@@ -3501,14 +3500,13 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
|
|
|
3501
3500
|
* @property {'light' | 'dark' | 'auto'} theme
|
|
3502
3501
|
* @property {function(import("../types/types").EmojiMartItem): void} onSelectEmoji
|
|
3503
3502
|
* @property {boolean} disableRecent
|
|
3504
|
-
* @property {
|
|
3503
|
+
* @property {any[]=} customEmojis
|
|
3505
3504
|
* @property {import('../types/types').Languages=} language
|
|
3506
3505
|
*/
|
|
3507
3506
|
|
|
3508
3507
|
/**
|
|
3509
3508
|
* Emoji Picker Component
|
|
3510
3509
|
* @param {Props} props
|
|
3511
|
-
* @return {React.FC}
|
|
3512
3510
|
*/
|
|
3513
3511
|
function EmojiPicker(props) {
|
|
3514
3512
|
var theme = props.theme,
|
|
@@ -3552,7 +3550,7 @@ var EmojiPicker$1 = /*#__PURE__*/React.memo(EmojiPicker);
|
|
|
3552
3550
|
* @property {'light' | 'dark' | 'auto'} theme
|
|
3553
3551
|
* @property {(emoji: import("../types/types").EmojiMartItem) => void} handleSelectEmoji
|
|
3554
3552
|
* @property {boolean} disableRecent
|
|
3555
|
-
* @property {
|
|
3553
|
+
* @property {any[]=} customEmojis
|
|
3556
3554
|
* @property {('above' | 'below')=} position
|
|
3557
3555
|
* @property {import('../types/types').Languages=} language
|
|
3558
3556
|
*/
|
|
@@ -3606,7 +3604,7 @@ var EMOJI_PICKER_CONTAINER_HEIGHT = 435;
|
|
|
3606
3604
|
* @property {'light' | 'dark' | 'auto'} theme
|
|
3607
3605
|
* @property {boolean} keepOpened
|
|
3608
3606
|
* @property {boolean} disableRecent
|
|
3609
|
-
* @property {
|
|
3607
|
+
* @property {any[]=} customEmojis
|
|
3610
3608
|
* @property {(fn: SanitizeFn) => void} addSanitizeFn
|
|
3611
3609
|
* @property {(fn: PolluteFn) => void} addPolluteFn
|
|
3612
3610
|
* @property {(html: string) => void} appendContent
|
|
@@ -4082,9 +4080,6 @@ var MentionUserList = function MentionUserList(_ref, ref) {
|
|
|
4082
4080
|
}));
|
|
4083
4081
|
};
|
|
4084
4082
|
var MentionUserListWithRef = /*#__PURE__*/React.forwardRef(MentionUserList);
|
|
4085
|
-
MentionUserListWithRef.propTypes = {
|
|
4086
|
-
users: t__default["default"].array.isRequired
|
|
4087
|
-
};
|
|
4088
4083
|
|
|
4089
4084
|
/**
|
|
4090
4085
|
* @typedef {import('../types/types').MentionUser} MetionUser
|