react-input-emoji 5.6.8 → 5.6.10
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.es.js +21 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -839,7 +839,9 @@ function replaceAllHtmlToString(html, shouldReturn) {
|
|
|
839
839
|
|
|
840
840
|
// remove all ↵ for safari
|
|
841
841
|
text = text.replace(/\n/gi, "");
|
|
842
|
-
|
|
842
|
+
var tempContainer = document.createElement("div");
|
|
843
|
+
tempContainer.innerHTML = text;
|
|
844
|
+
return tempContainer.innerText || "";
|
|
843
845
|
}
|
|
844
846
|
|
|
845
847
|
// @ts-check
|
|
@@ -3590,6 +3592,9 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
|
|
|
3590
3592
|
});
|
|
3591
3593
|
}
|
|
3592
3594
|
|
|
3595
|
+
var EMOJI_MART_DATA_URL = "https://cdn.jsdelivr.net/npm/@emoji-mart/data";
|
|
3596
|
+
var cacheI18n = {};
|
|
3597
|
+
|
|
3593
3598
|
/**
|
|
3594
3599
|
* @typedef {object} Props
|
|
3595
3600
|
* @property {'light' | 'dark' | 'auto'} theme
|
|
@@ -3628,8 +3633,13 @@ function EmojiPicker(props) {
|
|
|
3628
3633
|
var _ref2;
|
|
3629
3634
|
if (!language) {
|
|
3630
3635
|
var _ref;
|
|
3636
|
+
if (cacheI18n.en) {
|
|
3637
|
+
setI18n(cacheI18n.en);
|
|
3638
|
+
return;
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3631
3641
|
// @ts-ignore
|
|
3632
|
-
fetch("
|
|
3642
|
+
fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/en.json")).then(function (_x) {
|
|
3633
3643
|
return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
3634
3644
|
var translations;
|
|
3635
3645
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -3640,7 +3650,8 @@ function EmojiPicker(props) {
|
|
|
3640
3650
|
case 2:
|
|
3641
3651
|
translations = _context.sent;
|
|
3642
3652
|
setI18n(translations);
|
|
3643
|
-
|
|
3653
|
+
cacheI18n.en = translations;
|
|
3654
|
+
case 5:
|
|
3644
3655
|
case "end":
|
|
3645
3656
|
return _context.stop();
|
|
3646
3657
|
}
|
|
@@ -3651,9 +3662,13 @@ function EmojiPicker(props) {
|
|
|
3651
3662
|
});
|
|
3652
3663
|
return;
|
|
3653
3664
|
}
|
|
3665
|
+
if (cacheI18n[language]) {
|
|
3666
|
+
setI18n(cacheI18n[language]);
|
|
3667
|
+
return;
|
|
3668
|
+
}
|
|
3654
3669
|
|
|
3655
3670
|
// @ts-ignore
|
|
3656
|
-
fetch("
|
|
3671
|
+
fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/").concat(language, ".json")).then(function (_x2) {
|
|
3657
3672
|
return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
|
|
3658
3673
|
var translations;
|
|
3659
3674
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -3664,7 +3679,8 @@ function EmojiPicker(props) {
|
|
|
3664
3679
|
case 2:
|
|
3665
3680
|
translations = _context2.sent;
|
|
3666
3681
|
setI18n(translations);
|
|
3667
|
-
|
|
3682
|
+
cacheI18n[language] = translations;
|
|
3683
|
+
case 5:
|
|
3668
3684
|
case "end":
|
|
3669
3685
|
return _context2.stop();
|
|
3670
3686
|
}
|