@youngonesworks/ui 0.1.119 → 0.1.121

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/dist/index.js CHANGED
@@ -3508,7 +3508,12 @@ const WysiwygEditor = forwardRef(({ id, content, className, placeholder, onChang
3508
3508
  immediatelyRender: false,
3509
3509
  editable: !readOnly,
3510
3510
  onUpdate({ editor: editor$1 }) {
3511
- onChange && onChange(editor$1.getHTML().replaceAll(/<li><p>(.*?)<\/p><(\/?)(ol|li|ul)>/gi, "<li>$1<$2$3>").replaceAll("<p></p>", ""));
3511
+ let sanitizedOutput = editor$1.getHTML().replaceAll(/<li><p>(.*?)<\/p><(\/?)(ol|li|ul)>/gi, "<li>$1<$2$3>");
3512
+ sanitizedOutput = sanitizedOutput.replace(/(<p><\/p>\s*)+/gi, "<p></p>");
3513
+ sanitizedOutput = sanitizedOutput.replace(/^(<p><\/p>\s*)+/gi, "");
3514
+ sanitizedOutput = sanitizedOutput.replace(/(<p><\/p>\s*)+$/gi, "");
3515
+ sanitizedOutput = sanitizedOutput.replace(/<p><\/p>/gi, "<br>");
3516
+ onChange && onChange(sanitizedOutput);
3512
3517
  }
3513
3518
  });
3514
3519
  useEffect(() => {