@@ -579,6 +579,11 @@ class LayoutBuilder {
579
579
if ( startingSpanCell && startingSpanCell . _endingCell ) {
580
580
// Reference to the last cell of the rowspan
581
581
endingSpanCell = startingSpanCell . _endingCell ;
582
+ // Store if we are in an unbreakable block when we save the context and the originalX
583
+ if ( this . writer . transactionLevel > 0 ) {
584
+ endingSpanCell . _isUnbreakableContext = true ;
585
+ endingSpanCell . _originalXOffset = this . writer . originalX ;
586
+ }
582
587
}
583
588
584
589
// We pass the endingSpanCell reference to store the context just after processing rowspan cell
@@ -587,9 +592,15 @@ class LayoutBuilder {
587
592
this . processNode ( column ) ;
588
593
addAll ( positions , column . positions ) ;
589
594
} else if ( column . _columnEndingContext ) {
595
+ let originalXOffset = 0 ;
596
+ // If context was saved from an unbreakable block and we are not in an unbreakable block anymore
597
+ // We have to sum the originalX (X before starting unbreakable block) to X
598
+ if ( column . _isUnbreakableContext && ! this . writer . transactionLevel ) {
599
+ originalXOffset = column . _originalXOffset ;
600
+ }
590
601
// row-span ending
591
602
// Recover the context after processing the rowspanned cell
592
- this . writer . context ( ) . markEnding ( column ) ;
603
+ this . writer . context ( ) . markEnding ( column , originalXOffset ) ;
593
604
}
594
605
}
595
606
@@ -607,6 +618,11 @@ class LayoutBuilder {
607
618
if ( startingSpanCell ) {
608
619
// Context will be stored here (ending cell)
609
620
endingSpanCell = startingSpanCell . _endingCell ;
621
+ // Store if we are in an unbreakable block when we save the context and the originalX
622
+ if ( this . writer . transactionLevel > 0 ) {
623
+ endingSpanCell . _isUnbreakableContext = true ;
624
+ endingSpanCell . _originalXOffset = this . writer . originalX ;
625
+ }
610
626
}
611
627
}
612
628
}
0 commit comments