unhalf the text
This commit is contained in:
parent
7d4e85bed6
commit
7a577e251e
2 changed files with 2 additions and 15 deletions
|
|
@ -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('; ')}`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue