Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent adding empty paragraph if cell contains altChunk #233

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/processTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ export async function walkTemplate(
delete ctx.pendingHtmlNode;
}

// `w:tc` nodes shouldn't be left with no `w:p` children; if that's the
// `w:tc` nodes shouldn't be left with no `w:p` or 'w:altChunk' children; if that's the
// case, add an empty `w:p` inside
if (
!nodeOut._fTextNode && // Flow-prevention
nodeOut._tag === 'w:tc' &&
!nodeOut._children.filter(o => !o._fTextNode && o._tag === 'w:p').length
!nodeOut._children.filter(o => !o._fTextNode && (o._tag === 'w:p' || o._tag === 'w:altChunk')).length
) {
nodeOut._children.push({
_parent: nodeOut,
Expand Down