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