Convert break-*: page to break-*: column

`break-*` is the newer standard that replaced the legacy `page-break-*`
properties.

Note that setting it to `always` or `all` does not work. There seems to
be no way of telling browsers to break in both paged media and multicol.
This commit is contained in:
John Factotum
2023-10-24 13:29:36 +08:00
parent 969f4c1850
commit 6d55d3e6b1
+4 -2
View File
@@ -735,8 +735,10 @@ class Loader {
.replace(/(\d*\.?\d+)vw/gi, (_, d) => parseFloat(d) * w / 100 + 'px')
.replace(/(\d*\.?\d+)vh/gi, (_, d) => parseFloat(d) * h / 100 + 'px')
// `page-break-*` unsupported in columns; replace with `column-break-*`
.replace(/page-break-(after|before|inside)/gi, (_, x) =>
`-webkit-column-break-${x}`)
.replace(/page-break-(after|before|inside)\s*:/gi, (_, x) =>
`-webkit-column-break-${x}:`)
.replace(/break-(after|before|inside)\s*:\s*(avoid-)?page/gi, (_, x, y) =>
`break-${x}: ${y ?? ''}column`)
}
// find & replace all possible relative paths for all assets without parsing
replaceString(str, href, parents = []) {