Fix SVG generator on cutting values

This commit is contained in:
yuanchuan 2022-10-09 10:53:56 +08:00
parent 8ce6786020
commit be9fb9a3bd
3 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ export default function svg(rules) {
parse_grid('1x1')
);
let raw = result && result.styles && result.styles.cells || '';
let cut = raw.substring(52, raw.length - 5);
let cut = raw.substring(raw.indexOf('%3'), raw.lastIndexOf('");'));
try {
return decodeURIComponent(cut);
} catch (e) {

View File

@ -400,7 +400,7 @@ class Rules {
}
}
if (prop === 'background' && (value.includes('shader') || value.includes('canvas') || value.includes('pattern'))) {
if (prop === 'background' && (value.includes('@shader') || value.includes('@canvas') || value.includes('@pattern'))) {
rule += 'background-size: 100% 100%;';
}

View File

@ -20,7 +20,7 @@ function readStatement(iter, token) {
} else {
stackQuote.pop();
}
if (next.isSymbol('}') && !stackQuote.length) {
if ((next && next.isSymbol('}')) && !stackQuote.length) {
isStatementBreak = true;
}
}