@contentful/field-editor-rich-text 3.4.12 → 3.4.14

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/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.4.14](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.13...@contentful/field-editor-rich-text@3.4.14) (2023-03-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - not removing whitespaces around inline elements [TOL-1041] ([#1374](https://github.com/contentful/field-editors/issues/1374)) ([2ebfb43](https://github.com/contentful/field-editors/commit/2ebfb432e9fcb841298b72401089b5248bd84c93))
11
+
12
+ ## [3.4.13](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.12...@contentful/field-editor-rich-text@3.4.13) (2023-03-14)
13
+
14
+ **Note:** Version bump only for package @contentful/field-editor-rich-text
15
+
6
16
  ## [3.4.12](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.11...@contentful/field-editor-rich-text@3.4.12) (2023-03-10)
7
17
 
8
18
  **Note:** Version bump only for package @contentful/field-editor-rich-text
@@ -6263,7 +6263,9 @@ var sanitizeHTML = function sanitizeHTML(html) {
6263
6263
  .replace(/(.*\s)?<div.*>\s*(<table(?:.|\s)*<\/table>)\s*<\/div>(.*\s)?/g, '$1$2$3') // remove whitespaces between some tags, as this can lead to unwanted behaviour:
6264
6264
  // - table -> empty table cells
6265
6265
  // - list -> leading whitespaces
6266
- .replace(/<(\/)?(table|thead|tbody|tr|td|th|caption|col|colgroup|ol|ul|li)(.*)>\s+</g, '<$1$2$3><');
6266
+ .replace(/<(\/)?(table|thead|tbody|tr|td|th|caption|col|colgroup|ol|ul|li)(.*)>\s+<(\/)?(table|thead|tbody|tr|td|th|caption|col|colgroup|ol|ul|li)/g, '<$1$2$3><$4$5') // Removes empty elements before the closing tag of the capture group
6267
+ // <p><span> </span></p> -> <p></p>
6268
+ .replace(/(?:<[^>^/]*>)?\s*(?:<\/[^>]*>)?<\/(div|p|table|thead|tbody|tr|td|th|caption|col|colgroup|ol|ul|li)/g, '</$1');
6267
6269
  } while (doc.body.innerHTML !== previous);
6268
6270
 
6269
6271
  return doc.body.innerHTML;