Commit 9c5ccea6 authored by Julie Blanc's avatar Julie Blanc

string-set content(after)

parent b54ac9a1
/*
Get generated content into ::before and ::after elements
Utils for string-sets and target-text properties
counter = OK
string = OK
attr = TO-DO
*/
export function getGeneratedContent(content, elem){
let cssVar;
let cssVar;
let contentCounter = content.match(/counter\((.*?)\)\s?/g);
if(contentCounter !== null){
for(let i = 0; i < contentCounter.length; i++){
......@@ -27,7 +23,7 @@ export function getGeneratedContent(content, elem){
}
}else{
cssVar = content.replace(/"/g, '');
}
}
return cssVar;
}
......
......@@ -69,7 +69,12 @@ class StringSets extends Handler {
fragment.style.setProperty(`--pagedjs-string-${name}`, `"${set.first}"`);
}
} else if(set.value === "content(after)"){
let after = getComputedStyle(selected, ':after').getPropertyValue('content');
if(after !== 'none'){
let cssVar = getGeneratedContent(after, selected);
set.first = cssVar;
fragment.style.setProperty(`--pagedjs-string-${name}`, `"${set.first}"`);
}
} else {
console.warn(set.value + "needs css replacement");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment