react-konva-grid
Advanced tools
Comparing version 2.7.3 to 2.7.4
{ | ||
"name": "react-konva-grid", | ||
"description": "Declarative React Canvas Grid primitive for Data table, Pivot table, Excel Worksheets", | ||
"version": "2.7.3", | ||
"version": "2.7.4", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -92,3 +92,3 @@ import React, { useCallback, useEffect, useMemo, useRef } from "react"; | ||
const { items } = e.clipboardData; | ||
const mimeTypes = [MimeType.csv, MimeType.plain]; | ||
const mimeTypes = [MimeType.html, MimeType.csv, MimeType.plain]; | ||
let type; | ||
@@ -108,10 +108,20 @@ let value; | ||
const doc = domparser.parseFromString(value, type); | ||
const tableRows = doc.querySelectorAll("tr"); | ||
for (const tableRow of tableRows) { | ||
const row = []; | ||
const cells = tableRow.querySelectorAll("td"); | ||
for (const cell of cells) { | ||
row.push(cell.textContent); | ||
const supportedNodes = "table, p, h1, h2, h3, h4, h5, h6"; | ||
const nodes = doc.querySelectorAll(supportedNodes); | ||
for (let i = 0; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
if (node.nodeName === "TABLE") { | ||
const tableRows = doc.querySelectorAll("tr"); | ||
for (const tableRow of tableRows) { | ||
const row = []; | ||
const cells = tableRow.querySelectorAll("td"); | ||
for (const cell of cells) { | ||
row.push(cell.textContent); | ||
} | ||
rows.push(row); | ||
} | ||
} else { | ||
// Single nodes | ||
rows.push([node.textContent]); | ||
} | ||
rows.push(row); | ||
} | ||
@@ -128,3 +138,2 @@ } else { | ||
} | ||
onPaste && onPaste(rows, selectionRef.current.activeCell); | ||
@@ -131,0 +140,0 @@ }; |
Sorry, the diff of this file is not supported yet
14803411
21745