html2canvas-pro 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,10 +9,15 @@ exports.fontFamily = {
9
9
  parse: (_context, tokens) => {
10
10
  const accumulator = [];
11
11
  const results = [];
12
+ const quoted = [];
13
+ let isQuoted = false;
12
14
  tokens.forEach((token) => {
13
15
  switch (token.type) {
14
16
  case 20 /* TokenType.IDENT_TOKEN */:
17
+ accumulator.push(token.value);
18
+ break;
15
19
  case 0 /* TokenType.STRING_TOKEN */:
20
+ isQuoted = true;
16
21
  accumulator.push(token.value);
17
22
  break;
18
23
  case 17 /* TokenType.NUMBER_TOKEN */:
@@ -20,13 +25,23 @@ exports.fontFamily = {
20
25
  break;
21
26
  case 4 /* TokenType.COMMA_TOKEN */:
22
27
  results.push(accumulator.join(' '));
28
+ quoted.push(isQuoted);
29
+ isQuoted = false;
23
30
  accumulator.length = 0;
24
31
  break;
25
32
  }
26
33
  });
27
34
  if (accumulator.length) {
28
35
  results.push(accumulator.join(' '));
36
+ quoted.push(isQuoted);
29
37
  }
30
- return results.map((result) => (result.indexOf(' ') === -1 ? result : `'${result}'`));
38
+ return results.map((result, index) => quoted[index] || result.indexOf(' ') !== -1
39
+ ? `'${result
40
+ .replace(/\\/g, '\\\\')
41
+ .replace(/'/g, "\\'")
42
+ .replace(/\n/g, '\\a ')
43
+ .replace(/\r/g, '\\d ')
44
+ .replace(/\f/g, '\\c ')}'`
45
+ : result);
31
46
  }
32
47
  };
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "default": "./dist/html2canvas-pro.esm.js"
20
20
  }
21
21
  },
22
- "version": "2.4.2",
22
+ "version": "2.4.3",
23
23
  "author": {
24
24
  "name": "yorickshan",
25
25
  "email": "yorickshan@gmail.com",