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