From 589f0803e6491cb2eafdc404503ab1f5d35fe04c Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Mon, 30 Dec 2019 15:10:43 +0100 Subject: [PATCH] Fixed Electron upgrade regressions --- CliClient/package-lock.json | 6 +++--- CliClient/package.json | 2 +- ElectronClient/app/bridge.js | 4 ++++ ElectronClient/app/gui/MainScreen.jsx | 4 +++- ElectronClient/app/gui/VerticalResizer.jsx | 6 +++--- ElectronClient/app/package-lock.json | 6 +++--- ElectronClient/app/package.json | 2 +- ReactNativeClient/package-lock.json | 6 +++--- ReactNativeClient/package.json | 2 +- 9 files changed, 22 insertions(+), 16 deletions(-) diff --git a/CliClient/package-lock.json b/CliClient/package-lock.json index 760c425d8..eba4a9a51 100644 --- a/CliClient/package-lock.json +++ b/CliClient/package-lock.json @@ -1557,9 +1557,9 @@ "dev": true }, "joplin-renderer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/joplin-renderer/-/joplin-renderer-1.0.4.tgz", - "integrity": "sha512-Q7GoEYA6hYtv8ZQgxccn/gSw25V8kQPyWdolK0PJhG7m2BJa0zunyagtaOhMkYuWl8beDYHwTsvsVx2ayKqMcQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/joplin-renderer/-/joplin-renderer-1.0.5.tgz", + "integrity": "sha512-6WHqJdHzpxkI4AIz7/uK+V4eB+uU3kg8ut8r1HwC10kWQCMdTtH0yv04l+cNpWvQFULsZANmVr7FAP6JNhcqcw==", "requires": { "base-64": "^0.1.0", "font-awesome-filetypes": "^2.1.0", diff --git a/CliClient/package.json b/CliClient/package.json index 3013a0bc8..ad9a3b86a 100644 --- a/CliClient/package.json +++ b/CliClient/package.json @@ -44,7 +44,7 @@ "html-minifier": "^3.5.15", "image-data-uri": "^2.0.0", "image-type": "^3.0.0", - "joplin-renderer": "^1.0.4", + "joplin-renderer": "^1.0.5", "joplin-turndown": "^4.0.19", "joplin-turndown-plugin-gfm": "^1.0.11", "jssha": "^2.3.0", diff --git a/ElectronClient/app/bridge.js b/ElectronClient/app/bridge.js index 95e84ad42..1d540fbde 100644 --- a/ElectronClient/app/bridge.js +++ b/ElectronClient/app/bridge.js @@ -143,6 +143,10 @@ class Bridge { return this.electronApp().buildDir(); } + screen() { + return require('electron').screen; + } + } let bridge_ = null; diff --git a/ElectronClient/app/gui/MainScreen.jsx b/ElectronClient/app/gui/MainScreen.jsx index fba656904..05f1ff314 100644 --- a/ElectronClient/app/gui/MainScreen.jsx +++ b/ElectronClient/app/gui/MainScreen.jsx @@ -380,7 +380,9 @@ class MainScreenComponent extends React.Component { this.styles_.verticalResizer = { width: 5, - height: rowHeight, + // HACK: For unknown reasons, the resizers are just a little bit taller than the other elements, + // making the whole window scroll vertically. So we remove 10 extra pixels here. + height: rowHeight - 10, display: 'inline-block', }; diff --git a/ElectronClient/app/gui/VerticalResizer.jsx b/ElectronClient/app/gui/VerticalResizer.jsx index 8ac2f0e6d..a10eab698 100644 --- a/ElectronClient/app/gui/VerticalResizer.jsx +++ b/ElectronClient/app/gui/VerticalResizer.jsx @@ -1,5 +1,5 @@ const React = require('react'); -const electron = require('electron'); +const { bridge } = require('electron').remote.require('./bridge'); class VerticalResizer extends React.PureComponent { constructor() { @@ -32,7 +32,7 @@ class VerticalResizer extends React.PureComponent { event.dataTransfer.dropEffect = 'none'; - const cursor = electron.screen.getCursorScreenPoint(); + const cursor = bridge().screen().getCursorScreenPoint(); this.setState({ drag: { @@ -52,7 +52,7 @@ class VerticalResizer extends React.PureComponent { // const e = event.nativeEvent; // if (!e.buttons || (!e.clientX && !e.clientY && !e.screenX && !e.screenY)) return; - const cursor = electron.screen.getCursorScreenPoint(); + const cursor = bridge().screen().getCursorScreenPoint(); const newX = cursor.x; const delta = newX - this.state.drag.lastX; if (!delta) return; diff --git a/ElectronClient/app/package-lock.json b/ElectronClient/app/package-lock.json index ac4aa67db..08a46d702 100644 --- a/ElectronClient/app/package-lock.json +++ b/ElectronClient/app/package-lock.json @@ -4179,9 +4179,9 @@ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" }, "joplin-renderer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/joplin-renderer/-/joplin-renderer-1.0.4.tgz", - "integrity": "sha512-Q7GoEYA6hYtv8ZQgxccn/gSw25V8kQPyWdolK0PJhG7m2BJa0zunyagtaOhMkYuWl8beDYHwTsvsVx2ayKqMcQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/joplin-renderer/-/joplin-renderer-1.0.5.tgz", + "integrity": "sha512-6WHqJdHzpxkI4AIz7/uK+V4eB+uU3kg8ut8r1HwC10kWQCMdTtH0yv04l+cNpWvQFULsZANmVr7FAP6JNhcqcw==", "requires": { "base-64": "^0.1.0", "font-awesome-filetypes": "^2.1.0", diff --git a/ElectronClient/app/package.json b/ElectronClient/app/package.json index 04e9e8939..a1270ac5a 100644 --- a/ElectronClient/app/package.json +++ b/ElectronClient/app/package.json @@ -105,7 +105,7 @@ "html-entities": "^1.2.1", "html-minifier": "^4.0.0", "image-type": "^3.0.0", - "joplin-renderer": "^1.0.4", + "joplin-renderer": "^1.0.5", "joplin-turndown": "^4.0.19", "joplin-turndown-plugin-gfm": "^1.0.11", "jssha": "^2.3.1", diff --git a/ReactNativeClient/package-lock.json b/ReactNativeClient/package-lock.json index c57a04012..0da4a1c5a 100644 --- a/ReactNativeClient/package-lock.json +++ b/ReactNativeClient/package-lock.json @@ -3796,9 +3796,9 @@ "dev": true }, "joplin-renderer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/joplin-renderer/-/joplin-renderer-1.0.4.tgz", - "integrity": "sha512-Q7GoEYA6hYtv8ZQgxccn/gSw25V8kQPyWdolK0PJhG7m2BJa0zunyagtaOhMkYuWl8beDYHwTsvsVx2ayKqMcQ==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/joplin-renderer/-/joplin-renderer-1.0.5.tgz", + "integrity": "sha512-6WHqJdHzpxkI4AIz7/uK+V4eB+uU3kg8ut8r1HwC10kWQCMdTtH0yv04l+cNpWvQFULsZANmVr7FAP6JNhcqcw==", "requires": { "base-64": "^0.1.0", "font-awesome-filetypes": "^2.1.0", diff --git a/ReactNativeClient/package.json b/ReactNativeClient/package.json index e1a575a6a..eb040e7dd 100644 --- a/ReactNativeClient/package.json +++ b/ReactNativeClient/package.json @@ -19,7 +19,7 @@ "events": "^1.1.1", "form-data": "^2.1.4", "html-entities": "^1.2.1", - "joplin-renderer": "^1.0.4", + "joplin-renderer": "^1.0.5", "jsc-android": "241213.1.0", "markdown-it": "^8.4.0", "md5": "^2.2.1",