PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.2.0
Tableberg – Simple Gutenberg Table Block v1.2.0
1.2.0 1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 All 43 releases
← All changes | renderer/Table/TableRenderer.php +25 -8 1.1.4 → 1.2.0 View file →
@@ -131,14 +131,19 @@
131 131 $canApplyCustomWidth,
132 132 $tableAlignment
133 133 );
134 134
135 - $tableStyles = [
136 - 'border-collapse: ' . ($hasCellSpacing ? 'separate' : 'collapse'),
137 - // Neutralize theme-level table borders. Tableberg owns its
138 - // borders through the table/cell controls and rounded wrapper.
139 - 'border: 0',
140 - ];
135 + $tableStyles = array_merge(
136 + // Table-wide typography, inherited by everything in the cells that
137 + // does not set its own.
138 + $attrs->table->typography->asStyles(),
139 + [
140 + 'border-collapse: ' . ($hasCellSpacing ? 'separate' : 'collapse'),
141 + // Neutralize theme-level table borders. Tableberg owns its
142 + // borders through the table/cell controls and rounded wrapper.
143 + 'border: 0',
144 + ]
145 + );
141 146
142 147 if ($hasCellSpacing) {
143 148 $tableStyles[] = "border-spacing: {$cellSpacingHorizontal} {$cellSpacingVertical}";
144 149 }
@@ -416,8 +421,17 @@
416 421 if ($rowBackgroundColor !== '') {
417 422 $rowStyleParts[] = 'background-color:' . esc_attr($rowBackgroundColor);
418 423 }
419 424
425 + // Inherited by everything in the row's cells that has no colour
426 + // of its own.
427 + $rowTextColor = isset($rowStyles['textColor']) && is_string($rowStyles['textColor'])
428 + ? $rowStyles['textColor']
429 + : '';
430 + if ($rowTextColor !== '') {
431 + $rowStyleParts[] = 'color:' . esc_attr($rowTextColor);
432 + }
433 +
420 434 $rowBorder = isset($rowStyles['border']) && is_array($rowStyles['border'])
421 435 ? $rowStyles['border']
422 436 : [];
423 437 foreach (['top', 'right', 'bottom', 'left'] as $side) {
@@ -647,8 +661,11 @@
647 661 $mobileMaxWidth = max(1, (int) $mobile->maxWidth->value());
648 662 $tabletStackCount = max(1, (int) $tablet->stackCount->value());
649 663 $mobileStackCount = max(1, (int) $mobile->stackCount->value());
650 664
665 + $tabletRepeatFirstCol = $tablet->repeatFirstCol->asAttr();
666 + $mobileRepeatFirstCol = $mobile->repeatFirstCol->asAttr();
667 +
651 668 return "
652 669 data-tableberg-responsive='true'
653 670 data-tableberg-rows='{$rows}'
654 671 data-tableberg-cols='{$cols}'
@@ -656,15 +673,15 @@
656 673 data-tableberg-tablet-width='{$tabletMaxWidth}'
657 674 data-tableberg-tablet-mode='{$tablet->mode->asAttr()}'
658 675 data-tableberg-tablet-transpose='{$tablet->transpose->asAttr()}'
659 676 data-tableberg-tablet-count='{$tabletStackCount}'
660 - data-tableberg-tablet-repeat-first-col='{$tablet->repeatFirstCol->asAttr()}'
677 + data-tableberg-tablet-repeat-first-col='{$tabletRepeatFirstCol}'
661 678 data-tableberg-mobile-enabled='{$mobile->enabled->asAttr()}'
662 679 data-tableberg-mobile-width='{$mobileMaxWidth}'
663 680 data-tableberg-mobile-mode='{$mobile->mode->asAttr()}'
664 681 data-tableberg-mobile-transpose='{$mobile->transpose->asAttr()}'
665 682 data-tableberg-mobile-count='{$mobileStackCount}'
666 - data-tableberg-mobile-repeat-first-col='{$mobile->repeatFirstCol->asAttr()}'
683 + data-tableberg-mobile-repeat-first-col='{$mobileRepeatFirstCol}'
667 684 ";
668 685 }
669 686
670 687 private function getCell($row, $col, $cells) {