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.es.js
CHANGED
|
@@ -832,7 +832,9 @@ function replaceAllHtmlToString(html, shouldReturn) {
|
|
|
832
832
|
|
|
833
833
|
// remove all ↵ for safari
|
|
834
834
|
text = text.replace(/\n/gi, "");
|
|
835
|
-
|
|
835
|
+
var tempContainer = document.createElement("div");
|
|
836
|
+
tempContainer.innerHTML = text;
|
|
837
|
+
return tempContainer.innerText || "";
|
|
836
838
|
}
|
|
837
839
|
|
|
838
840
|
// @ts-check
|
|
@@ -3583,6 +3585,9 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
|
|
|
3583
3585
|
});
|
|
3584
3586
|
}
|
|
3585
3587
|
|
|
3588
|
+
var EMOJI_MART_DATA_URL = "https://cdn.jsdelivr.net/npm/@emoji-mart/data";
|
|
3589
|
+
var cacheI18n = {};
|
|
3590
|
+
|
|
3586
3591
|
/**
|
|
3587
3592
|
* @typedef {object} Props
|
|
3588
3593
|
* @property {'light' | 'dark' | 'auto'} theme
|
|
@@ -3621,8 +3626,13 @@ function EmojiPicker(props) {
|
|
|
3621
3626
|
var _ref2;
|
|
3622
3627
|
if (!language) {
|
|
3623
3628
|
var _ref;
|
|
3629
|
+
if (cacheI18n.en) {
|
|
3630
|
+
setI18n(cacheI18n.en);
|
|
3631
|
+
return;
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3624
3634
|
// @ts-ignore
|
|
3625
|
-
fetch("
|
|
3635
|
+
fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/en.json")).then(function (_x) {
|
|
3626
3636
|
return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
3627
3637
|
var translations;
|
|
3628
3638
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -3633,7 +3643,8 @@ function EmojiPicker(props) {
|
|
|
3633
3643
|
case 2:
|
|
3634
3644
|
translations = _context.sent;
|
|
3635
3645
|
setI18n(translations);
|
|
3636
|
-
|
|
3646
|
+
cacheI18n.en = translations;
|
|
3647
|
+
case 5:
|
|
3637
3648
|
case "end":
|
|
3638
3649
|
return _context.stop();
|
|
3639
3650
|
}
|
|
@@ -3644,9 +3655,13 @@ function EmojiPicker(props) {
|
|
|
3644
3655
|
});
|
|
3645
3656
|
return;
|
|
3646
3657
|
}
|
|
3658
|
+
if (cacheI18n[language]) {
|
|
3659
|
+
setI18n(cacheI18n[language]);
|
|
3660
|
+
return;
|
|
3661
|
+
}
|
|
3647
3662
|
|
|
3648
3663
|
// @ts-ignore
|
|
3649
|
-
fetch("
|
|
3664
|
+
fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/").concat(language, ".json")).then(function (_x2) {
|
|
3650
3665
|
return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
|
|
3651
3666
|
var translations;
|
|
3652
3667
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
@@ -3657,7 +3672,8 @@ function EmojiPicker(props) {
|
|
|
3657
3672
|
case 2:
|
|
3658
3673
|
translations = _context2.sent;
|
|
3659
3674
|
setI18n(translations);
|
|
3660
|
-
|
|
3675
|
+
cacheI18n[language] = translations;
|
|
3676
|
+
case 5:
|
|
3661
3677
|
case "end":
|
|
3662
3678
|
return _context2.stop();
|
|
3663
3679
|
}
|