- Add multi-language support for registration and user menu components

- Refactor `TextEditor` to include book-closing functionality with updated toolbar buttons
- Replace `generateHTML` with a lightweight custom TipTap-to-HTML renderer
- Update and lock `esbuild` and related dependencies to latest versions
This commit is contained in:
natreex
2025-12-23 23:24:17 -05:00
parent 1f2513d565
commit 0366a2d444
10 changed files with 728 additions and 537 deletions

View File

@@ -1,4 +1,4 @@
import {app, BrowserWindow, ipcMain, IpcMainInvokeEvent, nativeImage, protocol, safeStorage, shell} from 'electron';
import {app, BrowserWindow, ipcMain, IpcMainInvokeEvent, Menu, nativeImage, protocol, safeStorage, shell} from 'electron';
import * as path from 'path';
import {fileURLToPath} from 'url';
import * as fs from 'fs';
@@ -21,11 +21,11 @@ const __dirname = path.dirname(__filename);
const isDev = !app.isPackaged;
// Enregistrer le protocole app:// comme standard (avant app.whenReady)
// Enregistrer le protocole scribedesktop:// comme standard (avant app.whenReady)
if (!isDev) {
protocol.registerSchemesAsPrivileged([
{
scheme: 'app',
scheme: 'scribedesktop',
privileges: {
standard: true,
secure: true,
@@ -58,6 +58,7 @@ function createLoginWindow(): void {
height: 900,
resizable: false,
...(process.platform !== 'darwin' && { icon: iconPath }),
autoHideMenuBar: true,
webPreferences: {
preload: preloadPath,
contextIsolation: true,
@@ -73,7 +74,7 @@ function createLoginWindow(): void {
loginWindow.loadURL(`http://localhost:${devPort}/login/login`);
loginWindow.webContents.openDevTools();
} else {
loginWindow.loadURL('app://./login/login/index.html');
loginWindow.loadURL('scribedesktop://./login/login/index.html');
}
loginWindow.once('ready-to-show', () => {
@@ -90,6 +91,7 @@ function createMainWindow(): void {
width: 1200,
height: 800,
...(process.platform !== 'darwin' && { icon: iconPath }),
autoHideMenuBar: true,
webPreferences: {
preload: preloadPath,
contextIsolation: true,
@@ -104,7 +106,7 @@ function createMainWindow(): void {
mainWindow.loadURL(`http://localhost:${devPort}`);
mainWindow.webContents.openDevTools();
} else {
mainWindow.loadURL('app://./index.html');
mainWindow.loadURL('scribedesktop://./index.html');
}
mainWindow.once('ready-to-show', () => {
@@ -345,11 +347,24 @@ ipcMain.handle('db-initialize', (_event, userId: string, encryptionKey: string)
});
app.whenReady().then(():void => {
// Menu minimal pour garder les raccourcis DevTools
const template: Electron.MenuItemConstructorOptions[] = [
{
label: 'View',
submenu: [
{ role: 'toggleDevTools' }
]
}
];
const menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu);
if (!isDev) {
const outPath:string = path.join(process.resourcesPath, 'app.asar.unpacked/out');
protocol.handle('app', async (request) => {
let filePath:string = request.url.replace('app://', '').replace(/^\.\//, '');
protocol.handle('scribedesktop', async (request) => {
let filePath:string = request.url.replace('scribedesktop://', '').replace(/^\.\//, '');
const fullPath:string = path.normalize(path.join(outPath, filePath));
if (!fullPath.startsWith(outPath)) {