sheet-happens 0.0.19 → 0.0.20

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
@@ -583,14 +583,10 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
583
583
 
584
584
  if (rowSelectionActive) {
585
585
  var p1x = Math.max(-100, p1.x);
586
- var p1y = Math.max(-100, p1.y);
587
- context.fillRect(p1x, p1y, 100000, p2.y - p1.y);
586
+ context.fillRect(p1x, p1.y, 100000, p2.y - p1.y);
588
587
  } else if (colSelectionActive) {
589
- var _p1x = Math.max(-100, p1.x);
590
-
591
- var _p1y = Math.max(-100, p1.y);
592
-
593
- context.fillRect(_p1x, _p1y, p2.x - p1.x, 100000);
588
+ var p1y = Math.max(0, p1.y);
589
+ context.fillRect(p1.x, p1y, p2.x - p1.x, 100000);
594
590
  } else {
595
591
  context.fillRect(p1.x, p1.y, p2.x - p1.x, p2.y - p1.y);
596
592
  }
@@ -717,17 +713,13 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
717
713
  context.beginPath();
718
714
 
719
715
  if (rowSelectionActive) {
720
- var _p1x2 = Math.max(-100, p1.x);
721
-
722
- var _p1y2 = Math.max(-100, p1.y);
716
+ var _p1x = Math.max(-100, p1.x);
723
717
 
724
- context.rect(_p1x2, _p1y2, 100000, p2.y - p1.y);
718
+ context.rect(_p1x, p1.y, 100000, p2.y - p1.y);
725
719
  } else if (colSelectionActive) {
726
- var _p1x3 = Math.max(-100, p1.x);
727
-
728
- var _p1y3 = Math.max(-100, p1.y);
720
+ var _p1y = Math.max(-100, p1.y);
729
721
 
730
- context.rect(_p1x3, _p1y3, p2.x - p1.x, 100000);
722
+ context.rect(p1.x, _p1y, p2.x - p1.x, 100000);
731
723
  } else {
732
724
  context.rect(p1.x, p1.y, p2.x - p1.x, p2.y - p1.y);
733
725
  }
@@ -1336,12 +1328,12 @@ function Sheet(props) {
1336
1328
  var clipboardData = e.clipboardData || window.clipboardData;
1337
1329
  var types = clipboardData.types;
1338
1330
 
1339
- if (types.includes('text/rtf') && types.includes('text/plain') || types.includes('text/plain') && !types.includes('text/html')) {
1340
- var text = clipboardData.getData('text/plain');
1341
- parsePastedText(text);
1342
- } else if (types.includes('text/html')) {
1331
+ if (types.includes('text/html')) {
1343
1332
  var pastedHtml = clipboardData.getData('text/html');
1344
1333
  parsePastedHtml(pastedHtml);
1334
+ } else if (types.includes('text/plain')) {
1335
+ var text = clipboardData.getData('text/plain');
1336
+ parsePastedText(text);
1345
1337
  }
1346
1338
  };
1347
1339
 
@@ -1422,12 +1414,12 @@ function Sheet(props) {
1422
1414
  var p = td.children[0];
1423
1415
 
1424
1416
  if (p.children.length !== 0 && p.children[0].nodeName === 'FONT') {
1425
- str = p.children[0].innerHTML;
1417
+ str = p.children[0].textContent.trim();
1426
1418
  } else {
1427
- str = p.innerHTML;
1419
+ str = p.textContent.trim();
1428
1420
  }
1429
1421
  } else {
1430
- str = td.innerHTML;
1422
+ str = td.textContent.trim();
1431
1423
  }
1432
1424
 
1433
1425
  str = str.replaceAll('\n', '');