unhalf the text

This commit is contained in:
nick-delirium 2025-05-16 15:11:28 +02:00
parent 7d4e85bed6
commit 7a577e251e
No known key found for this signature in database
GPG key ID: 93ABD695DF5FDBA0
2 changed files with 2 additions and 15 deletions

View file

@ -344,17 +344,6 @@ const shorthandMap: Record<string, string[]> = {
outline: ['outline-width', 'outline-style', 'outline-color'],
}
const defaultValues: Record<string, string> = {
'background-color': 'transparent',
'background-image': 'none',
'background-repeat': 'repeat',
'background-attachment': 'scroll',
'background-position': '0% 0%',
'background-size': 'auto',
'background-origin': 'padding-box',
'background-clip': 'border-box',
}
const expandShorthand = (declaration: string): string => {
for (const [shorthand, longhandProps] of Object.entries(shorthandMap)) {
const regex = new RegExp(`${shorthand}\\s*:\\s*([^;]+)`, 'g')
@ -367,7 +356,7 @@ const expandShorthand = (declaration: string): string => {
) {
return `background-color: ${value}; ${longhandProps
.slice(1)
.map((prop) => `${prop}: ${defaultValues[prop] || 'initial'}`)
.map((prop) => `${prop}: initial`)
.join('; ')}`
}

View file

@ -393,9 +393,7 @@ export default abstract class Observer {
this.inlinerOptions?.forcePlain,
(cssText: string, fakeTextId: number) => {
this.app.send(CreateTextNode(fakeTextId, id, 0))
const halvenText = cssText.substring(0, Math.round(cssText.length / 2))
const msg = SetCSSDataURLBased(fakeTextId, halvenText, this.app.getBaseHref())
console.log('fakeTextId', fakeTextId, 'node parent', id, 'cssText', msg, 'half', halvenText)
const msg = SetCSSDataURLBased(fakeTextId, cssText, this.app.getBaseHref())
setTimeout(() => {
this.app.send(msg)
}, 10)