Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch clipboard format evaluation priority to text/plain first #368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/components/DataSheetGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -861,14 +861,14 @@ export const DataSheetGrid = React.memo(
(event: ClipboardEvent) => {
if (activeCell && !editing) {
let pasteData = [['']]
if (event.clipboardData?.types.includes('text/html')) {
pasteData = parseTextHtmlData(
event.clipboardData?.getData('text/html')
)
} else if (event.clipboardData?.types.includes('text/plain')) {
if (event.clipboardData?.types.includes('text/plain')) {
pasteData = parseTextPlainData(
event.clipboardData?.getData('text/plain')
)
} else if (event.clipboardData?.types.includes('text/html')) {
pasteData = parseTextHtmlData(
event.clipboardData?.getData('text/html')
)
} else if (event.clipboardData?.types.includes('text')) {
pasteData = parseTextPlainData(
event.clipboardData?.getData('text')
Expand Down Expand Up @@ -1562,12 +1562,12 @@ export const DataSheetGrid = React.memo(
const items = await navigator.clipboard.read()
items.forEach(async (item) => {
let pasteData = [['']]
if (item.types.includes('text/html')) {
const htmlTextData = await item.getType('text/html')
pasteData = parseTextHtmlData(await htmlTextData.text())
} else if (item.types.includes('text/plain')) {
if (item.types.includes('text/plain')) {
const plainTextData = await item.getType('text/plain')
pasteData = parseTextPlainData(await plainTextData.text())
} else if (item.types.includes('text/html')) {
const htmlTextData = await item.getType('text/html')
pasteData = parseTextHtmlData(await htmlTextData.text())
} else if (item.types.includes('text')) {
const htmlTextData = await item.getType('text')
pasteData = parseTextHtmlData(await htmlTextData.text())
Expand Down