|
|
@ -42,6 +42,10 @@ function link(next: Wrapper, prev: Wrapper) {
|
|
|
|
if (next) next.prev = prev;
|
|
|
|
if (next) next.prev = prev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function at_each_boundary(child: INode, next_sibling: Wrapper): boolean {
|
|
|
|
|
|
|
|
return next_sibling.node.find_nearest(/EachBlock/) === child.find_nearest(/EachBlock/) || next_sibling.node.prev.type === 'EachBlock'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default class FragmentWrapper {
|
|
|
|
export default class FragmentWrapper {
|
|
|
|
nodes: Wrapper[];
|
|
|
|
nodes: Wrapper[];
|
|
|
|
|
|
|
|
|
|
|
@ -85,7 +89,7 @@ export default class FragmentWrapper {
|
|
|
|
if (this.nodes.length === 0) {
|
|
|
|
if (this.nodes.length === 0) {
|
|
|
|
const should_trim = (
|
|
|
|
const should_trim = (
|
|
|
|
// @ts-ignore todo: probably error, should it be next_sibling.node.data?
|
|
|
|
// @ts-ignore todo: probably error, should it be next_sibling.node.data?
|
|
|
|
next_sibling ? (next_sibling.node.type === 'Text' && /^\s/.test(next_sibling.data) && next_sibling.node.find_nearest(/EachBlock/) === child.find_nearest(/EachBlock/)) : !child.has_ancestor('EachBlock')
|
|
|
|
next_sibling ? (next_sibling.node.type === 'Text' && /^\s/.test(next_sibling.data) && at_each_boundary(child, next_sibling)) : !child.has_ancestor('EachBlock')
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (should_trim) {
|
|
|
|
if (should_trim) {
|
|
|
|