diff --git a/app/main.js b/app/main.js index 2a98c37..ea472d5 100644 --- a/app/main.js +++ b/app/main.js @@ -53,6 +53,10 @@ function createWindow() { }, 2000); } +ipcMain.on("open-menu", (event, arg) => { + openFile(); +}); + app.on("ready", async () => { const t = await i18next.use(Backend).init(i18nextOptions); createWindow(); diff --git a/src/components/Home.vue b/src/components/Home.vue index a720405..c657e8e 100644 --- a/src/components/Home.vue +++ b/src/components/Home.vue @@ -8,10 +8,23 @@ :click="onClick" :class="[tabs?.length ? '' : 'display-none']" :on-close="onClose" - /> -
+ > + +
-
@@ -46,7 +59,7 @@ >
-
+

{{ t("welcomeNote1", {}, { locale: lang }) }}
@@ -119,6 +132,7 @@ export default { }); tab.value = key; + electron.ipcRenderer.send('open-menu'); }; const handleRemove = () => { @@ -126,6 +140,10 @@ export default { }; electron.ipcRenderer.on("pdf-open", (event, args) => { + const currentTabObj = tabs.filter((item) => item.key === tab.value); + if (currentTabObj.length && currentTabObj[0].label === "New Tab") { + tabRef.value.removeTab(tab.value); + } window.dispatchEvent(new Event("mousedown")); const path = args[0].replace(/^.*[\\\/]/, ""); const key = "tab" + Date.now(); @@ -134,7 +152,7 @@ export default { label: path, key, favico: require("../assets/icons/pdf.svg"), - link: args[0], + link: `lib/pdfjs/web/viewer.html?file=${args[0]}`, isPdf: true, isShowXML: !!res, isShowingXMLSection: false, @@ -145,6 +163,10 @@ export default { }); electron.ipcRenderer.on("xml-open", (event, args) => { + const currentTabObj = tabs.filter((item) => item.key === tab.value); + if (currentTabObj.length && currentTabObj[0].label === "New Tab") { + tabRef.value.removeTab(tab.value); + } window.dispatchEvent(new Event("mousedown")); const path = args[0].replace(/^.*[\\\/]/, ""); const key = "tab" + Date.now(); @@ -237,7 +259,7 @@ export default { document.addEventListener("drop", (event) => { event.preventDefault(); - event.stopPropagation(); + //event.stopPropagation(); for (const f of event.dataTransfer.files) { electron.ipcRenderer.send("open-dragged-file", f.path); diff --git a/src/translation/de.json b/src/translation/de.json index 6a48134..27d898b 100644 --- a/src/translation/de.json +++ b/src/translation/de.json @@ -1,7 +1,7 @@ { "showXML": "Eingebettetes XML anzeigen", - "welcomeNote1": "XML- oder PDF-Dateien über das Menü öffnen, ", - "welcomeNote2": "durch Drücken von Strg + O oder Drag&Drop ", + "welcomeNote1": "XML- oder PDF-Dateien über das Menü öffnen,", + "welcomeNote2": "durch Drücken von Strg + O oder Drag&Drop", "appName":"E-Rechnungsviewer", "Examples":"Beispiele" } \ No newline at end of file diff --git a/src/translation/fr.json b/src/translation/fr.json index 5a6343b..8418208 100644 --- a/src/translation/fr.json +++ b/src/translation/fr.json @@ -1,7 +1,7 @@ { "showXML": "Afficher le XML incorporé", - "welcomeNote1": "Ouvrez-les depuis le menu invoice XML- or PDF-file ", - "welcomeNote2": "ou en cliquant Ctrl + O glisser & déposer", + "welcomeNote1": "Ouvrir les fichiers XML ou PDF via le menu,", + "welcomeNote2": "en appuyant sur Ctrl + O ou par glisser-déposer", "appName": "Visionneuse de factures électroniques", "Examples":"Exemples" } \ No newline at end of file