Fix pillification sometimes doubling up (#9152)

* Fix pillification sometimes doubling up

* Remove redundant assignment

* Add unit tests around pillification

* Kill ts-ignore
This commit is contained in:
Michael Telatynski 2022-08-09 15:37:13 +01:00 committed by GitHub
parent 147ec49ff5
commit 48ae16b5a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 95 additions and 2 deletions

View file

@ -44,8 +44,8 @@ export function pillifyLinks(nodes: ArrayLike<Element>, mxEvent: MatrixEvent, pi
while (node) {
let pillified = false;
if (node.tagName === "PRE" || node.tagName === "CODE") {
// Skip code blocks
if (node.tagName === "PRE" || node.tagName === "CODE" || pills.includes(node)) {
// Skip code blocks and existing pills
node = node.nextSibling as Element;
continue;
} else if (node.tagName === "A" && node.getAttribute("href")) {