electron19

This commit is contained in:
SheetJS 2022-11-07 18:23:05 -05:00
parent b01bf3873c
commit 3c8a75c5e3
5 changed files with 27 additions and 20 deletions

@ -137,7 +137,7 @@ from the main or the renderer thread.
Electron presents a `fs` module. The `require('xlsx')` call loads the CommonJS
module, so `XLSX.readFile` and `XLSX.writeFile` work in the renderer thread.
This demo was tested against Electron 19.0.5 on an Intel Mac (`darwin-x64`).
This demo was tested on 2022 November 07 with Electron 21.2.2 on `darwin-x64`.
<details><summary><b>Complete Example</b> (click to show)</summary>
@ -327,7 +327,7 @@ function importFile(workbook) {
### Electron Breaking Changes
The first version of this demo used Electron 1.7.5. The current demo includes
the required changes for Electron 19.0.5.
the required changes for Electron 19.2.2.
There are no Electron-specific workarounds in the library, but Electron broke
backwards compatibility multiple times. A summary of changes is noted below.

@ -377,7 +377,7 @@ XLSX.writeFile(wb, "bun.xlsx");
</TabItem>
<TabItem value="deno" label="Deno">
[`sqlite` library](https://deno.land/x/sqlite/) returns raw arrays of arrays.
Deno `sqlite` library returns raw arrays of arrays.
1) Save the following to `deno.ts`:
@ -429,11 +429,6 @@ XLSX.writeFile(wb, "deno.xlsx");
This information is included for legacy deployments. Web SQL is deprecated.
<https://caniuse.com/sql-storage> has up-to-date info on browser support.
[Firefox](https://nolanlawson.com/2014/04/26/web-sql-database-in-memoriam/)
never supported Web SQL. Safari 13 dropped support. As of the time of writing,
the current Chrome version (103) supports WebSQL.
::::
WebSQL was a popular SQL-based in-browser database available on Chrome. In

@ -180,8 +180,7 @@ function ClipboardWrite() {
## Electron
Electron [Clipboard API](https://www.electronjs.org/docs/latest/api/clipboard)
supports HTML and RTF clipboards.
Electron Clipboard API supports HTML and RTF clipboards.
There are special methods for specific clipboard types:
@ -193,6 +192,21 @@ There are special methods for specific clipboard types:
Each method operates on JS strings.
`clipboard.write` can assign to multiple clipboard types:
```js
const { clipboard } = require('electron');
const XLSX = require('xlsx');
function copy_first_sheet_to_clipboard(workbook) {
clipboard.write({
text: XLSX.write(wb, {type: "string", bookType: "txt"}),
rtf: XLSX.write(wb, {type: "string", bookType: "rtf"}),
html: XLSX.write(wb, {type: "string", bookType: "html"})
});
}
```
:::caution Experimental Buffer Clipboard Support
Electron additionally supports binary operations using `Buffer` objects. This
@ -204,7 +218,7 @@ On the `MacOS` platform, some versions of Excel store a packaged file with key
a simple CFB file that can be parsed:
```js
const { clipboard } = require('electron')
const { clipboard } = require('electron');
const XLSX = require("xlsx");
const buf = clipboard.readBuffer('dyn.ah62d4qmxhk4d425try1g44pdsm11g55gsu1en5pcqzwc4y5tsz3gg3k');
const cfb = XLSX.CFB.read(buf, {type: "buffer"});

@ -242,8 +242,6 @@ function export_pouchdb_to_xlsx(db) {
0) Download the "Working Version" from the Getting Started guide.
[ZIP](https://github.com/nickcolley/getting-started-todo/archive/master.zip)
The ZIP file should have `MD5` checksum `ac4da7cb0cade1be293ba222462f109c`:
```bash

@ -5,7 +5,7 @@
"main": "main.js",
"dependencies": {
"@electron/remote": "2.0.8",
"electron-squirrel-startup": "^1.0.0",
"electron-squirrel-startup": "1.0.0",
"xlsx": "https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz"
},
"scripts": {
@ -14,12 +14,12 @@
"make": "electron-forge make"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.64",
"@electron-forge/maker-deb": "^6.0.0-beta.64",
"@electron-forge/maker-rpm": "^6.0.0-beta.64",
"@electron-forge/maker-squirrel": "^6.0.0-beta.64",
"@electron-forge/maker-zip": "^6.0.0-beta.64",
"electron": "19.0.5"
"@electron-forge/cli": "6.0.0",
"@electron-forge/maker-deb": "6.0.0",
"@electron-forge/maker-rpm": "6.0.0",
"@electron-forge/maker-squirrel": "6.0.0",
"@electron-forge/maker-zip": "6.0.0",
"electron": "21.2.2"
},
"config": {
"forge": {