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.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
- return text;
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("https://cdn.jsdelivr.net/npm/@emoji-mart/data/i18n/en.json").then(function (_x) {
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
- case 4:
3653
+ cacheI18n.en = translations;
3654
+ case 5:
3644
3655
  case "end":
3645
3656
  return _context.stop();
3646
3657
  }
@@ -3653,7 +3664,7 @@ function EmojiPicker(props) {
3653
3664
  }
3654
3665
 
3655
3666
  // @ts-ignore
3656
- fetch("https://cdn.jsdelivr.net/npm/@emoji-mart/data/i18n/".concat(language, ".json")).then(function (_x2) {
3667
+ fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/").concat(language, ".json")).then(function (_x2) {
3657
3668
  return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
3658
3669
  var translations;
3659
3670
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -3664,7 +3675,8 @@ function EmojiPicker(props) {
3664
3675
  case 2:
3665
3676
  translations = _context2.sent;
3666
3677
  setI18n(translations);
3667
- case 4:
3678
+ cacheI18n[language] = translations;
3679
+ case 5:
3668
3680
  case "end":
3669
3681
  return _context2.stop();
3670
3682
  }