mirror of
https://github.com/JannisX11/blockbench.git
synced 2024-11-21 01:13:37 +08:00
fix overflowing and chained selectors
This commit is contained in:
parent
a4289e4af9
commit
669bbd5e83
@ -804,6 +804,7 @@
|
||||
background-color: var(--color-frame);
|
||||
border: 2px solid var(--color-frame);
|
||||
border-top: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.custom_thumbnail_preview {
|
||||
position: relative;
|
||||
|
@ -442,15 +442,21 @@ const CustomTheme = {
|
||||
style.textContent = theme.thumbnail;
|
||||
const sheet = style.sheet;
|
||||
for (const rule of sheet.cssRules) {
|
||||
thumbnailStyles += `.custom_theme_thumbnail_${theme.id} ${rule.selectorText} { ${rule.style.cssText} }\n`;
|
||||
}
|
||||
const selectors = rule.selectorText.split(/(?<!\[[^\]]*),(?![^\[]*\])|(?<!"[^"]*),(?![^"]*")/g).map(e => e.trim())
|
||||
for (const selector of selectors) {
|
||||
thumbnailStyles += `.custom_theme_thumbnail_${theme.id} ${selector} { ${rule.style.cssText} }\n`;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CustomTheme.data.customized) {
|
||||
style.textContent = CustomTheme.data.thumbnail;
|
||||
const sheet = style.sheet;
|
||||
for (const rule of sheet.cssRules) {
|
||||
thumbnailStyles += `.custom_theme_thumbnail_${CustomTheme.data.id} ${rule.selectorText} { ${rule.style.cssText} }\n`;
|
||||
}
|
||||
const selectors = rule.selectorText.split(/(?<!\[[^\]]*),(?![^\[]*\])|(?<!"[^"]*),(?![^"]*")/g).map(e => e.trim())
|
||||
for (const selector of selectors) {
|
||||
thumbnailStyles += `.custom_theme_thumbnail_${CustomTheme.data.id} ${selector} { ${rule.style.cssText} }\n`;
|
||||
}
|
||||
}
|
||||
}
|
||||
document.head.removeChild(style);
|
||||
$('style#theme_thumbnail_css').text(thumbnailStyles);
|
||||
|
Loading…
Reference in New Issue
Block a user