Skip to content

Commit

Permalink
Fix cell copying on Firefox (#2869)
Browse files Browse the repository at this point in the history
  • Loading branch information
fonsp authored Mar 29, 2024
1 parent ad977f5 commit 001220c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/TypeScriptCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "18.x"
node-version: "21.x"

- run: npm install typescript@5.0.4 -g
- run: npm install typescript@5.4.3 -g

- run: npm install
working-directory: frontend
Expand Down
12 changes: 8 additions & 4 deletions frontend/components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1320,10 +1320,14 @@ patch: ${JSON.stringify(
if (!in_textarea_or_input()) {
const serialized = this.serialize_selected()
if (serialized) {
navigator.clipboard.writeText(serialized).catch((err) => {
console.error("Error copying cells", e, err)
alert(`Error copying cells: ${err?.message ?? err}`)
})
e.preventDefault()
// wait one frame to get transient user activation
requestAnimationFrame(() =>
navigator.clipboard.writeText(serialized).catch((err) => {
console.error("Error copying cells", e, err, navigator.userActivation)
alert(`Error copying cells: ${err?.message ?? err}`)
})
)
}
}
})
Expand Down

0 comments on commit 001220c

Please sign in to comment.