@contentful/field-editor-markdown 1.1.9 → 1.1.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.
@@ -18,8 +18,8 @@ import min from 'lodash-es/min';
18
18
  import max from 'lodash-es/max';
19
19
  import times from 'lodash-es/times';
20
20
  import repeat from 'lodash-es/repeat';
21
- import Markdown from 'markdown-to-jsx';
22
21
  import DOMPurify from 'dompurify';
22
+ import Markdown from 'markdown-to-jsx';
23
23
  import inRange from 'lodash-es/inRange';
24
24
  import isObject from 'lodash-es/isObject';
25
25
  import extend from 'lodash-es/extend';
@@ -1879,6 +1879,14 @@ var openCheatsheetModal = function openCheatsheetModal(dialogs) {
1879
1879
  });
1880
1880
  };
1881
1881
 
1882
+ // This code will replace '&' with '&' only inside the href attribute of the mailto link.
1883
+ // Otherwise the mailto link will not work correctly
1884
+ var replaceMailtoAmp = function replaceMailtoAmp(string) {
1885
+ return string.replace(/href="mailto:[^"]*&/g, function (match) {
1886
+ return match.replace(/&/g, '&');
1887
+ });
1888
+ };
1889
+
1882
1890
  var _excluded$2 = ["Embedly", "children"];
1883
1891
 
1884
1892
  var _templateObject$1;
@@ -1925,7 +1933,7 @@ var MarkdownPreview = /*#__PURE__*/React.memo(function (props) {
1925
1933
  // https://github.com/cure53/DOMPurify/blob/main/src/tags.js#L3-L121
1926
1934
 
1927
1935
  var cleanHTML = React.useMemo(function () {
1928
- return DOMPurify.sanitize(props.value);
1936
+ return replaceMailtoAmp(DOMPurify.sanitize(props.value));
1929
1937
  }, [props.value]);
1930
1938
  return React.createElement("div", {
1931
1939
  className: className,