| @@ -1238,8 +1238,65 @@ | ||
| 1238 | 1238 | //Doc Layout 7 Controls End |
| 1239 | 1239 | |
| 1240 | 1240 | /** Single Doc Start **/ |
| 1241 | 1241 | |
| 1242 | +/** | |
| 1243 | + * Single Doc Content Area Width / Maximum Width. | |
| 1244 | + * | |
| 1245 | + * One pair of settings, three selectors — each layout family caps its content | |
| 1246 | + * wrapper through a different rule in the stylesheet, so the override has to | |
| 1247 | + * match the rule it is replacing: | |
| 1248 | + * | |
| 1249 | + * layouts 8 / 9 / 10 .betterdocs-wrapper.betterdocs-single-layout-8 ... | |
| 1250 | + * (9 and 10 also carry the layout-8 class) | |
| 1251 | + * layouts 1 / 6 ...:not(.betterdocs-fluid-wrapper) — these two are the | |
| 1252 | + * only single layouts without the fluid class | |
| 1253 | + * layout 5 .betterdocs-single-layout-5 ... | |
| 1254 | + * | |
| 1255 | + * The 1/6 selector is additionally scoped to .betterdocs-single-wrapper: the | |
| 1256 | + * docs-archive and category-archive wrappers are also non-fluid, and they have | |
| 1257 | + * their own width controls (betterdocs_doc_page_content_* / | |
| 1258 | + * betterdocs_archive_content_area_*) that this would otherwise override. | |
| 1259 | + * | |
| 1260 | + * Layouts 2, 3 and 4 are deliberately absent — they are full-bleed and both | |
| 1261 | + * controls are hidden for them in customizer-condition.js. | |
| 1262 | + */ | |
| 1263 | +/** | |
| 1264 | + * Each selector is prefixed with `body` purely to win the cascade. The base | |
| 1265 | + * caps live in common/_normalizer.scss and templates/single.scss, which are | |
| 1266 | + * @imported into a dozen front-end bundles (single.css, article-summary.css, | |
| 1267 | + * category-grid.css, reactions.css, …), so the identical 0,3,0 rule is emitted | |
| 1268 | + * many times over and several of those stylesheets load *after* this inline | |
| 1269 | + * block in wp_head. At equal specificity the last one would win and the | |
| 1270 | + * setting would silently do nothing. One element selector takes us to 0,3,1 | |
| 1271 | + * and beats every copy without resorting to !important. | |
| 1272 | + */ | |
| 1273 | +$betterdocs_single_content_width_selectors = [ | |
| 1274 | + 'body .betterdocs-wrapper.betterdocs-single-layout-8 .betterdocs-content-wrapper', | |
| 1275 | + 'body .betterdocs-wrapper.betterdocs-single-wrapper:not(.betterdocs-fluid-wrapper) .betterdocs-content-wrapper', | |
| 1276 | + 'body .betterdocs-single-layout-5 .betterdocs-content-wrapper' | |
| 1277 | +]; | |
| 1278 | + | |
| 1279 | +$css->add_rule( | |
| 1280 | + $betterdocs_single_content_width_selectors, | |
| 1281 | + $css->properties( | |
| 1282 | + [ | |
| 1283 | + 'width' => 'betterdocs_single_doc_content_width' | |
| 1284 | + ], | |
| 1285 | + '%' | |
| 1286 | + ) | |
| 1287 | +); | |
| 1288 | + | |
| 1289 | +$css->add_rule( | |
| 1290 | + $betterdocs_single_content_width_selectors, | |
| 1291 | + $css->properties( | |
| 1292 | + [ | |
| 1293 | + 'max-width' => 'betterdocs_single_doc_content_max_width' | |
| 1294 | + ], | |
| 1295 | + 'px' | |
| 1296 | + ) | |
| 1297 | +); | |
| 1298 | + | |
| 1242 | 1299 | //Single Doc Common Controllers Content Area Background Color |
| 1243 | 1300 | $css->add_rule( |
| 1244 | 1301 | '.betterdocs-wrapper.betterdocs-single-wrapper .betterdocs-content-wrapper', |
| 1245 | 1302 | $css->properties( |