1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-18 09:35:20 +02:00

Desktop: Fixes #11444: Allow zooming in/out in secondary windows (#11467)

This commit is contained in:
Henry Heino 2024-12-09 07:56:40 -08:00 committed by GitHub
parent df577bc08c
commit 56dce15537
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 2 deletions

View File

@ -99,6 +99,11 @@ export default class ElectronAppWrapper {
return null;
}
public allAppWindows() {
const allWindowIds = [...this.secondaryWindows_.keys(), defaultWindowId];
return allWindowIds.map(id => this.windowById(id));
}
public env() {
return this.env_;
}
@ -358,6 +363,9 @@ export default class ElectronAppWrapper {
const electronWindowId = window?.id;
this.secondaryWindows_.set(windowId, { electronId: electronWindowId });
// Match the main window's zoom:
window.webContents.setZoomFactor(this.mainWindow().webContents.getZoomFactor());
window.once('close', () => {
this.secondaryWindows_.delete(windowId);

View File

@ -29,7 +29,7 @@ import { reg } from '@joplin/lib/registry';
const packageInfo: PackageInfo = require('./packageInfo.js');
import DecryptionWorker from '@joplin/lib/services/DecryptionWorker';
import ClipperServer from '@joplin/lib/ClipperServer';
import { ipcRenderer, webFrame } from 'electron';
import { ipcRenderer } from 'electron';
const Menu = bridge().Menu;
const PluginManager = require('@joplin/lib/services/PluginManager');
import RevisionService from '@joplin/lib/services/RevisionService';
@ -152,7 +152,7 @@ class Application extends BaseApplication {
}
if (action.type === 'SETTING_UPDATE_ONE' && action.key === 'windowContentZoomFactor' || action.type === 'SETTING_UPDATE_ALL') {
webFrame.setZoomFactor(Setting.value('windowContentZoomFactor') / 100);
bridge().setZoomFactor(Setting.value('windowContentZoomFactor') / 100);
}
if (action.type === 'SETTING_UPDATE_ONE' && action.key === 'linking.extraAllowedExtensions' || action.type === 'SETTING_UPDATE_ALL') {

View File

@ -285,6 +285,13 @@ export class Bridge {
this.switchToWindow(defaultWindowId);
}
// zoom should be in the range [0..1]
public setZoomFactor(zoom: number) {
for (const window of this.electronWrapper_.allAppWindows()) {
window.webContents.setZoomFactor(zoom);
}
}
public showItemInFolder(fullPath: string) {
return require('electron').shell.showItemInFolder(toSystemSlashes(fullPath));
}