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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * html2canvas-pro 2.4.2 <https://yorickshan.github.io/html2canvas-pro/>
2
+ * html2canvas-pro 2.4.3 <https://yorickshan.github.io/html2canvas-pro/>
3
3
  * Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
4
4
  * Released under MIT License
5
5
  */
@@ -5328,10 +5328,15 @@ const fontFamily = {
5328
5328
  parse: (_context, tokens) => {
5329
5329
  const accumulator = [];
5330
5330
  const results = [];
5331
+ const quoted = [];
5332
+ let isQuoted = false;
5331
5333
  tokens.forEach((token) => {
5332
5334
  switch (token.type) {
5333
5335
  case 20:
5336
+ accumulator.push(token.value);
5337
+ break;
5334
5338
  case 0:
5339
+ isQuoted = true;
5335
5340
  accumulator.push(token.value);
5336
5341
  break;
5337
5342
  case 17:
@@ -5339,12 +5344,17 @@ const fontFamily = {
5339
5344
  break;
5340
5345
  case 4:
5341
5346
  results.push(accumulator.join(" "));
5347
+ quoted.push(isQuoted);
5348
+ isQuoted = false;
5342
5349
  accumulator.length = 0;
5343
5350
  break;
5344
5351
  }
5345
5352
  });
5346
- if (accumulator.length) results.push(accumulator.join(" "));
5347
- return results.map((result) => result.indexOf(" ") === -1 ? result : `'${result}'`);
5353
+ if (accumulator.length) {
5354
+ results.push(accumulator.join(" "));
5355
+ quoted.push(isQuoted);
5356
+ }
5357
+ return results.map((result, index) => quoted[index] || result.indexOf(" ") !== -1 ? `'${result.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\a ").replace(/\r/g, "\\d ").replace(/\f/g, "\\c ")}'` : result);
5348
5358
  }
5349
5359
  };
5350
5360
  //#endregion