mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
help-beta: Flatten only in case of matching tagName.
In the commits following this, we are going to make changes which will introduce cases with paragraphs, code blocks and other elements inside list items. Right now, FlattenList will just break in those cases. We need to return those elements without flattening since those are valid elements inside a list item.
This commit is contained in:
committed by
Tim Abbott
parent
8d0f67c3d5
commit
429bbae77c
@@ -26,12 +26,15 @@ const flattened = {
|
||||
if (other.type === "comment") {
|
||||
return [];
|
||||
}
|
||||
assert.ok(
|
||||
other.type === "element" &&
|
||||
(other.tagName === first_element.tagName ||
|
||||
other.tagName === "aside"),
|
||||
);
|
||||
return other.children;
|
||||
assert.ok(other.type === "element");
|
||||
// Flatten only in case of matching tagName, for the rest, we
|
||||
// return the elements without flattening since asides, code
|
||||
// blocks and other elements can be part of a single list item
|
||||
// and we do not want to flatten them.
|
||||
if (other.tagName === first_element.tagName) {
|
||||
return other.children;
|
||||
}
|
||||
return [other];
|
||||
}),
|
||||
};
|
||||
---
|
||||
|
Reference in New Issue
Block a user