nick-keller / react-datasheet-grid

An Airtable-like / Excel-like component to create beautiful spreadsheets.
MIT License
1.81k stars 171 forks source link

Context Menu Paste issue fixed. #331

Closed faseehahmed1 closed 10 months ago

faseehahmed1 commented 10 months ago

Problem: When copying from an excel sheet where cell has multiple lines the context menu paste does not work.

There are 2 ways you can paste: Keyboard: cntrl+v (OnPaste) Context Menu: right click paste (Type: 'PASTE')

Keyboard first checks

if (item.types.includes('text/html')) {
                      const htmlTextData = await item.getType('text/html')
                      pasteData = parseTextHtmlData(await htmlTextData.text())
}

Whereas the context menu paste was first checking:

if (item.types.includes('text/plain')) {
                      const plainTextData = await item.getType('text/plain')
                      pasteData = parseTextPlainData(await plainTextData.text())
 }

With my changes 'text/html' is checked first on context menu paste just like it already is on keybaord paste.

Here is a gif showing the issue when a cell has multiple lines context menu paste does not work:

CleanShot 2024-01-17 at 10  06 20

Issue is fixed with my changes 🙂

netlify[bot] commented 10 months ago

Deploy Preview for react-datasheet-grid canceled.

Name Link
Latest commit 35c777c6ad5b5bee7b6269234350c7bf8c1d0483
Latest deploy log https://app.netlify.com/sites/react-datasheet-grid/deploys/65a7a721f24d960008af7cd7