Skip to content

Commit

Permalink
fix(regexp): revert regexp that matches start tags
Browse files Browse the repository at this point in the history
  • Loading branch information
lyngai authored May 23, 2022
1 parent 916cc7d commit ee0f40f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/hooks/Paragraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export default class Paragraph extends ParagraphBase {
joinRawHtml(textContainsHtml) {
if (!this.removeBrAfterBlock) {
// preprocess custom white list
const customTagWhiteList = this.$engine.htmlWhiteListAppend?.split('|') ?? [];
customTagWhiteList
let customTagWhiteList = this.$engine.htmlWhiteListAppend?.split('|') ?? [];
customTagWhiteList = customTagWhiteList
.map((tag) => {
if (/[a-z-]+/gi.test(tag)) {
return tag;
Expand All @@ -84,7 +84,7 @@ export default class Paragraph extends ParagraphBase {
* ^^
* $1$2
*/
this.removeBrAfterBlock = new RegExp(`<(${allBlockNames})((?: [^>]*?)>)[^\\S\\n]*?\\n`, 'ig');
this.removeBrAfterBlock = new RegExp(`<(${allBlockNames})(>| [^>]*?>)[^\\S\\n]*?\\n`, 'ig');
/**
* remove newlines before end tag, and whitespaces before end tag will be preserved
* e.g.
Expand All @@ -101,7 +101,7 @@ export default class Paragraph extends ParagraphBase {
* $1 $2 $3 $4
*/
this.removeNewlinesBetweenTags = new RegExp(
`<\\/(${allBlockNames})>[^\\S\\n]*?\\n([^\\S\\n]*?)<(${allBlockNames})((?: [^>]*?)>)`,
`<\\/(${allBlockNames})>[^\\S\\n]*?\\n([^\\S\\n]*?)<(${allBlockNames})(>| [^>]*?>)`,
'ig',
);
}
Expand Down

0 comments on commit ee0f40f

Please sign in to comment.