sheet-happens 0.0.54 → 0.0.56

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.
package/dist/index.js CHANGED
@@ -2176,6 +2176,7 @@ function _catch(body, recover) {
2176
2176
  return result;
2177
2177
  }
2178
2178
 
2179
+ var NON_BREAKING_SPACE = ' ';
2179
2180
  var EMPTY_TABLE = {
2180
2181
  rows: []
2181
2182
  };
@@ -2448,7 +2449,9 @@ var formatRowsAsTSV = function formatRowsAsTSV(rows) {
2448
2449
  var formatRowsAsHTML = function formatRowsAsHTML(rows, payload) {
2449
2450
  var trs = rows.map(function (row) {
2450
2451
  var tds = row.map(formatTextAsHTML).map(function (cell) {
2451
- return "<td>" + cell + "</td>";
2452
+ return "<td>" + cell.replaceAll(/ +/g, function (x) {
2453
+ return ' ' + NON_BREAKING_SPACE.repeat(x.length - 1);
2454
+ }) + "</td>";
2452
2455
  });
2453
2456
  return tds.join('');
2454
2457
  }).map(function (row) {
@@ -2525,6 +2528,7 @@ var parsePastedHtml = function parsePastedHtml(html) {
2525
2528
  } catch (e) {}
2526
2529
  }
2527
2530
  var tableNode = _findTag(div, 'TABLE');
2531
+ var spanNode = _findTag(div, 'SPAN');
2528
2532
  if (tableNode) {
2529
2533
  for (var _iterator2 = _createForOfIteratorHelperLoose(tableNode.children), _step2; !(_step2 = _iterator2()).done;) {
2530
2534
  var tableChild = _step2.value;
@@ -2548,7 +2552,7 @@ var parsePastedHtml = function parsePastedHtml(html) {
2548
2552
  str = td.textContent.trim();
2549
2553
  }
2550
2554
  str = str.replaceAll(/[\r\n\t ]+/g, ' ');
2551
- str = str.replaceAll(' ', ' ');
2555
+ str = str.replaceAll(NON_BREAKING_SPACE, ' ');
2552
2556
  row.push(str);
2553
2557
  }
2554
2558
  }
@@ -2557,6 +2561,12 @@ var parsePastedHtml = function parsePastedHtml(html) {
2557
2561
  }
2558
2562
  }
2559
2563
  }
2564
+ } else if (spanNode) {
2565
+ var _str = '';
2566
+ _str = spanNode.textContent.trim();
2567
+ _str = _str.replaceAll('\n', '');
2568
+ _str = _str.replaceAll(/\s\s+/g, ' ');
2569
+ rows.push([_str]);
2560
2570
  }
2561
2571
  return {
2562
2572
  rows: rows,