Fix regex to ignore html tag in editor output (#1515)
authorAjay Bura <32841439+ajbura@users.noreply.github.com>
Sun, 29 Oct 2023 11:42:05 +0000 (22:42 +1100)
committerGitHub <noreply@github.com>
Sun, 29 Oct 2023 11:42:05 +0000 (22:42 +1100)
src/app/components/editor/output.ts

index 1fb2d590ae33206b91f346b1b0b93b718fcafa5f..9a03604c18c2bd6eced70c135ca355ac76c0a004 100644 (file)
@@ -69,7 +69,7 @@ const elementToCustomHtml = (node: CustomElement, children: string): string => {
   }
 };
 
-const HTML_TAG_REG = /<([\w-]+)(?:[^/>]*)(?:(?:\/>)|(?:>.*?<\/\1>))/;
+const HTML_TAG_REG = /<([\w-]+)(?: [^>]*)?(?:(?:\/>)|(?:>.*?<\/\1>))/;
 const ignoreHTMLParseInlineMD = (text: string): string => {
   if (text === '') return text;
   const match = text.match(HTML_TAG_REG);