@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.
@@ -6256,7 +6256,9 @@ var sanitizeHTML = function sanitizeHTML(html) {
6256
6256
  .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:
6257
6257
  // - table -> empty table cells
6258
6258
  // - list -> leading whitespaces
6259
- .replace(/<(\/)?(table|thead|tbody|tr|td|th|caption|col|colgroup|ol|ul|li)(.*)>\s+</g, '<$1$2$3><');
6259
+ .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
6260
+ // <p><span> </span></p> -> <p></p>
6261
+ .replace(/(?:<[^>^/]*>)?\s*(?:<\/[^>]*>)?<\/(div|p|table|thead|tbody|tr|td|th|caption|col|colgroup|ol|ul|li)/g, '</$1');
6260
6262
  } while (doc.body.innerHTML !== previous);
6261
6263
 
6262
6264
  return doc.body.innerHTML;