Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ and `MarkupString.Pueblo`. The packages share one version and are released toget
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project
follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 2.24.1 — Unreleased

### Fixed

- **A copied table keeps its rows**: a cell's text is no longer a block of its own, which a browser copied
as a line per cell. A cell that holds one text is laid out inline, so a copied row is its cells with tabs
between them.

## 2.24.0 — Unreleased

### Added
Expand Down
3 changes: 3 additions & 0 deletions MarkupString.Html/LayoutCss.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public static class LayoutCss
".ms-table { border-collapse: collapse; }\n" +
".ms-table.ms-fill { width: 100%; }\n" +
".ms-table th, .ms-table td { padding: 0 1ch; vertical-align: top; text-align: left; }\n" +
// A block inside a cell is copied as a line of its own, so a cell of one text is laid out inline: a copied
// row is its cells with tabs between, as a table with bare text in its cells copies.
".ms-table :is(th, td) > .ms-text:only-child { display: inline-block; width: 100%; }\n" +
".ms-table th { border-bottom: 1px solid var(--ms-header-rule, var(--ms-header-rule-default, currentColor)); color: var(--ms-heading, var(--ms-heading-default, inherit)); }\n" +
".ms-table.ms-striped > tbody > tr:nth-child(even) { background: var(--ms-stripe, var(--ms-stripe-default, rgba(127, 127, 127, 0.12))); }\n" +
".ms-table .ms-nowrap, .ms-table .ms-nowrap .ms-text { white-space: pre; overflow-wrap: normal; }\n" +
Expand Down
7 changes: 7 additions & 0 deletions MarkupString.Tests/Layout/WidgetLayoutTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@ public async Task Table_InHtml_KeepsAColumnThatDoesNotWrapOnOneLine()
await Assert.That(LayoutCss.Fixed).Contains(".ms-table .ms-nowrap, .ms-table .ms-nowrap .ms-text { white-space: pre; overflow-wrap: normal; }");
}

[Test]
public async Task Table_InHtml_LaysACellsOneTextInline()
{
// A browser copies a block as a line of its own: a cell's only text inline keeps a copied row on one line.
await Assert.That(LayoutCss.Fixed).Contains(".ms-table :is(th, td) > .ms-text:only-child { display: inline-block; width: 100%; }");
}

[Test]
public async Task Table_InHtml_NoWrapWithoutPriority_HasOnlyItsClass()
{
Expand Down
Loading