Parcourir la source

notwendige Updates für Electron 12

hmt il y a 4 ans
Parent
commit
baf136cde4
3 fichiers modifiés avec 14 ajouts et 19 suppressions
  1. 3 3
      src/components/Print.svelte
  2. 4 9
      src/main.js
  3. 7 7
      src/stores.js

+ 3 - 3
src/components/Print.svelte

@@ -25,9 +25,9 @@
     if (event.key === 's') ipcRenderer.send('pdf', pdf_name)
   }
 
-  $: if ($print.name === 'Schueler') c = PrintSchueler
-     else if ($print.name === 'Kurs') c = PrintKurs;
-     else if ($print.name === 'Medien') c = PrintMedien;
+  $: if ($print.name.startsWith('Schueler')) c = PrintSchueler
+     else if ($print.name.startsWith('Kurs')) c = PrintKurs;
+     else if ($print.name.startsWith('Medien')) c = PrintMedien;
 </script>
 
 <svelte:window on:keydown={handle_keydown} />

+ 4 - 9
src/main.js

@@ -1,4 +1,3 @@
-import url from 'url'
 import { app, BrowserWindow, ipcMain } from 'electron'
 import { is } from 'electron-util'
 import { join, dirname } from "path";
@@ -30,20 +29,16 @@ function createWindow() {
     ...configData.get('windowBounds.main'),
     show: false,
     useContentSize: true,
-    defaultEncoding: 'utf-8',
     webPreferences: {
-      nodeIntegration: true
+      defaultEncoding: 'utf-8',
+      nodeIntegration: true,
+      contextIsolation: false
     },
     title: `${app.name} ${VERSION['buildVersion']}`
     // icon: join(__dirname, '../icons/icon.png')
   })
   mainWindow.removeMenu()
-  mainWindow.loadURL(
-    url.format({
-      pathname: join(__dirname, "index.html"),
-      protocol: "file:",
-      slashes: true
-    }))
+  mainWindow.loadURL(join(__dirname, "index.html"))
   if (is.development || process.argv.some(a => a === '--devtools')) mainWindow.openDevTools()
 
   mainWindow.on('close', e => {

+ 7 - 7
src/stores.js

@@ -1,7 +1,7 @@
 import { writable } from 'svelte/store';
 import { ipcRenderer } from 'electron';
 
-export const configData = writable();
+export const configData = writable(undefined);
 ipcRenderer.invoke("get_store").then((res) => {
   configData.set(res);
   configData.subscribe((value) => {
@@ -10,10 +10,10 @@ ipcRenderer.invoke("get_store").then((res) => {
 });
 
 export const schueler = writable([]);
-export const view = writable();
-export const notification = writable()
-export const db = writable()
-export const medien = writable()
-export const titel = writable()
+export const view = writable(undefined);
+export const notification = writable(undefined)
+export const db = writable(undefined)
+export const medien = writable(undefined)
+export const titel = writable(undefined)
 export const print = writable(false)
-export const scan_status = writable()
+export const scan_status = writable(undefined)