Skip to content

Commit

Permalink
hidden until found
Browse files Browse the repository at this point in the history
  • Loading branch information
zurfyx committed May 27, 2024
1 parent c1bb991 commit 0f93570
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ export class CollapsibleContainerNode extends ElementNode {
'Expected contentDom to be an HTMLElement',
);
if (currentOpen) {
contentDom.style.removeProperty('display');
contentDom.hidden = false;
} else {
contentDom.style.display = 'none';
// @ts-expect-error
contentDom.hidden = 'until-found';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,23 @@ export class CollapsibleContentNode extends ElementNode {
'Expected parent node to be a CollapsibleContainerNode',
);
if (!containerNode.__open) {
dom.style.display = 'none';
// @ts-expect-error
dom.hidden = 'until-found';
}
});
// @ts-expect-error
dom.onbeforematch = () => {
editor.update(() => {
const containerNode = this.getParentOrThrow().getLatest();
invariant(
$isCollapsibleContainerNode(containerNode),
'Expected parent node to be a CollapsibleContainerNode',
);
if (!containerNode.__open) {
containerNode.toggleOpen();
}
});
};
return dom;
}

Expand Down

0 comments on commit 0f93570

Please sign in to comment.