Skip to content

Commit e222bce

Browse files
committed
closes #82
1 parent c916eaa commit e222bce

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@ general and some Electron and E-Invoice peculiarities like [interprocess (IPC) c
1010
History
1111
=============
1212

13+
1314
<details>
14-
<summary>1.4.1 30.10.2024</summary>
15+
<summary>1.4.2 .2024</summary>
1516
- #54 print only prints first page
17+
- #83 NaN for VAT amount and rounding amount
18+
- #82 Drag&Drop does not work
19+
20+
</details>
21+
22+
<details>
23+
<summary>1.4.1 30.10.2024</summary>
1624
- #78 default language to OS language, if de|en|fr
1725
- #68 structured invoice data won't get parsed from zugferd-file
1826
- #23 Does not work on intel macs

app/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ function initApp() {
344344
ipcMain.on("open-dragged-file", (event, filePath) => {
345345
if (filePath.toLowerCase().includes(".pdf")) {
346346
mainWindow.webContents.send("pdf-open", [filePath, null]);
347-
} else if (filePath.toLowerCase().includes(".xml")) {
347+
} else /*if (filePath.toLowerCase().includes(".xml"))*/ {
348348
loadAndDisplayXML(filePath);
349349
}
350350
});

app/menuConfig.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function buildMenu(app, mainWindow, i18n, openFile, openDir) {
7979
into a separate window
8080
* */
8181
mainWindow.webContents.executeJavaScript("document.getElementById('xmlViewer').innerHTML").then( (result) => {
82+
// get HTML into result, create invisible window
8283
let newWindow = new BrowserWindow({
8384
show: false,
8485
height: 185,
@@ -93,14 +94,17 @@ function buildMenu(app, mainWindow, i18n, openFile, openDir) {
9394
contextIsolation: false,
9495
},
9596
});
96-
97+
// start loading from result
9798
newWindow.loadURL('data:text/html;charset=utf-8,'+encodeURIComponent(result));
98-
newWindow.webContents.print({}, (success, failureReason) => {
99-
newWindow.close();
99+
// wait for load
100+
newWindow.webContents.on('did-finish-load', () => {
101+
// after load start printing
102+
newWindow.webContents.print({}, (success, failureReason) => {
103+
// after printing dispose invisible window
104+
newWindow.close();
105+
});
100106
});
101-
// newWindow.close();
102107
});
103-
104108
},
105109
},
106110
],

app/preload.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { contextBridge, ipcRenderer, Menu, app, remote } = require('electron');
1+
const { contextBridge, ipcRenderer, Menu, app, remote, webUtils } = require('electron');
22

33

44
const API = {
@@ -16,7 +16,7 @@ const API = {
1616
ipcRenderer.send('app_version');
1717
},
1818
sendOpenDraggedFile: (path) => {
19-
ipcRenderer.send('open-dragged-file', path);
19+
ipcRenderer.send('open-dragged-file', webUtils.getPathForFile(path));
2020
},
2121
sendRestartApp: () => {
2222
ipcRenderer.send('restart_app');

src/components/Home.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,12 @@ export default {
383383
}
384384
});
385385
386-
document.addEventListener("drop", (event) => {
386+
387+
window.addEventListener("drop", (event) => {
387388
event.preventDefault();
388389
//event.stopPropagation();
389-
390390
for (const f of event.dataTransfer.files) {
391-
window.api.sendOpenDraggedFile(f.path);
391+
window.api.sendOpenDraggedFile(f);
392392
}
393393
return false;
394394
}, false);

0 commit comments

Comments
 (0)