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
  */
@@ -5324,10 +5324,15 @@ const fontFamily = {
5324
5324
  parse: (_context, tokens) => {
5325
5325
  const accumulator = [];
5326
5326
  const results = [];
5327
+ const quoted = [];
5328
+ let isQuoted = false;
5327
5329
  tokens.forEach((token) => {
5328
5330
  switch (token.type) {
5329
5331
  case 20:
5332
+ accumulator.push(token.value);
5333
+ break;
5330
5334
  case 0:
5335
+ isQuoted = true;
5331
5336
  accumulator.push(token.value);
5332
5337
  break;
5333
5338
  case 17:
@@ -5335,12 +5340,17 @@ const fontFamily = {
5335
5340
  break;
5336
5341
  case 4:
5337
5342
  results.push(accumulator.join(" "));
5343
+ quoted.push(isQuoted);
5344
+ isQuoted = false;
5338
5345
  accumulator.length = 0;
5339
5346
  break;
5340
5347
  }
5341
5348
  });
5342
- if (accumulator.length) results.push(accumulator.join(" "));
5343
- return results.map((result) => result.indexOf(" ") === -1 ? result : `'${result}'`);
5349
+ if (accumulator.length) {
5350
+ results.push(accumulator.join(" "));
5351
+ quoted.push(isQuoted);
5352
+ }
5353
+ 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);
5344
5354
  }
5345
5355
  };
5346
5356
  //#endregion