Centralize drag-and-drop upload code

This commit is contained in:
2024-09-10 18:51:13 +02:00
parent 75b6c304b2
commit c5ddc20ce2
13 changed files with 219 additions and 235 deletions

View File

@@ -10,7 +10,7 @@ export const branding_from_path = path => {
add_styles(style, node.properties)
}
last_generated_style = style
return gen_css(style)
return style
}
// The last style which was generated is cached, when we don't have a complete
@@ -21,6 +21,10 @@ export const branding_from_node = node => {
return gen_css(last_generated_style)
}
export const css_from_path = path => {
return gen_css(branding_from_path(path))
}
const gen_css = style => {
return Object.entries(style).map(([key, value]) => `--${key}:${value}`).join(';');
}