mirror of
https://github.com/laurent22/joplin.git
synced 2025-03-20 20:55:18 +02:00
Desktop: Upgrade to Electron 7
This commit is contained in:
parent
ee38590c35
commit
cad6b7971f
@ -43,14 +43,17 @@ class InteropServiceHelper {
|
||||
win = bridge().newBrowserWindow(windowOptions);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
win.webContents.on('did-finish-load', async () => {
|
||||
|
||||
if (target === 'pdf') {
|
||||
win.webContents.printToPDF(options, (error, data) => {
|
||||
cleanup();
|
||||
if (error) reject(error);
|
||||
try {
|
||||
const data = await win.webContents.printToPDF(options);
|
||||
resolve(data);
|
||||
});
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
} else {
|
||||
win.webContents.print(options, (success) => {
|
||||
// TODO: This is correct but broken in Electron 4. Need to upgrade to 5+
|
||||
|
@ -47,7 +47,7 @@ class Bridge {
|
||||
const {dialog} = require('electron');
|
||||
if (!options) options = {};
|
||||
if (!('defaultPath' in options) && this.lastSelectedPath_) options.defaultPath = this.lastSelectedPath_;
|
||||
const filePath = dialog.showSaveDialog(this.window(), options);
|
||||
const filePath = dialog.showSaveDialogSync(this.window(), options);
|
||||
if (filePath) {
|
||||
this.lastSelectedPath_ = filePath;
|
||||
}
|
||||
@ -59,7 +59,7 @@ class Bridge {
|
||||
if (!options) options = {};
|
||||
if (!('defaultPath' in options) && this.lastSelectedPath_) options.defaultPath = this.lastSelectedPath_;
|
||||
if (!('createDirectory' in options)) options.createDirectory = true;
|
||||
const filePaths = dialog.showOpenDialog(this.window(), options);
|
||||
const filePaths = dialog.showOpenDialogSync(this.window(), options);
|
||||
if (filePaths && filePaths.length) {
|
||||
this.lastSelectedPath_ = dirname(filePaths[0]);
|
||||
}
|
||||
@ -70,7 +70,7 @@ class Bridge {
|
||||
showMessageBox_(window, options) {
|
||||
const {dialog} = require('electron');
|
||||
if (!window) window = this.window();
|
||||
return dialog.showMessageBox(window, options);
|
||||
return dialog.showMessageBoxSync(window, options);
|
||||
}
|
||||
|
||||
showErrorMessageBox(message) {
|
||||
|
@ -1266,7 +1266,7 @@ class NoteTextComponent extends React.Component {
|
||||
pageSize: Setting.value('export.pdfPageSize'),
|
||||
landscape: Setting.value('export.pdfPageOrientation') === 'landscape',
|
||||
});
|
||||
shim.fsDriver().writeFile(options.path, pdfData, 'buffer');
|
||||
await shim.fsDriver().writeFile(options.path, pdfData, 'buffer');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
bridge().showErrorMessageBox(error.message);
|
||||
|
2367
ElectronClient/app/package-lock.json
generated
2367
ElectronClient/app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -74,9 +74,9 @@
|
||||
"app-builder-bin": "^1.9.11",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"electron": "^4.1.4",
|
||||
"electron-builder": "20.38.5",
|
||||
"electron-rebuild": "^1.8.5"
|
||||
"electron": "^7.1.5",
|
||||
"electron-builder": "^21.2.0",
|
||||
"electron-rebuild": "^1.8.8"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"7zip-bin-linux": "^1.0.1",
|
||||
@ -149,7 +149,7 @@
|
||||
"server-destroy": "^1.0.1",
|
||||
"smalltalk": "^2.5.1",
|
||||
"sprintf-js": "^1.1.1",
|
||||
"sqlite3": "^4.0.6",
|
||||
"sqlite3": "^4.1.1",
|
||||
"string-padding": "^1.0.2",
|
||||
"string-to-stream": "^1.1.1",
|
||||
"syswide-cas": "^5.1.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user