react-input-emoji 5.6.8 → 5.6.9

Sign up to get free protection for your applications and to get access to all the features.
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
- return text;
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("https://cdn.jsdelivr.net/npm/@emoji-mart/data/i18n/en.json").then(function (_x) {
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
- case 4:
3646
+ cacheI18n.en = translations;
3647
+ case 5:
3637
3648
  case "end":
3638
3649
  return _context.stop();
3639
3650
  }
@@ -3646,7 +3657,7 @@ function EmojiPicker(props) {
3646
3657
  }
3647
3658
 
3648
3659
  // @ts-ignore
3649
- fetch("https://cdn.jsdelivr.net/npm/@emoji-mart/data/i18n/".concat(language, ".json")).then(function (_x2) {
3660
+ fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/").concat(language, ".json")).then(function (_x2) {
3650
3661
  return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
3651
3662
  var translations;
3652
3663
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -3657,7 +3668,8 @@ function EmojiPicker(props) {
3657
3668
  case 2:
3658
3669
  translations = _context2.sent;
3659
3670
  setI18n(translations);
3660
- case 4:
3671
+ cacheI18n[language] = translations;
3672
+ case 5:
3661
3673
  case "end":
3662
3674
  return _context2.stop();
3663
3675
  }