Skip to content

Commit

Permalink
Drag and Drop has been fixed by adding add new tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
LAPTOP-MS3A4HDC\Asim khan committed Oct 27, 2021
1 parent a414678 commit 9fb900c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
33 changes: 27 additions & 6 deletions src/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,23 @@
:click="onClick"
:class="[tabs?.length ? '' : 'display-none']"
:on-close="onClose"
/>
<div class="btns">
><template v-slot:after>
<button
class="btn"
style="
height: 20px;
line-height: 20px;
padding: 0 10px;
margin-left: 0px;
"
@click="handleAdd"
>
+
</button>
</template>
</vue3-tabs-chrome>
<div class="btns">
</div>
<div v-if="currentTab">
<div v-if="currentTab.isPdf">
<div :class="[currentTab?.isShowXML ? 'left-part' : '']">
Expand Down Expand Up @@ -46,7 +59,7 @@
></iframe>
</div>
</div>
<div v-if="!currentTab" class="center">
<div v-if="!currentTab" class="center" id="drag-box">
<img src="../assets/img/logo_whitetext.svg"><br>
{{ t("welcomeNote1", {}, { locale: lang }) }}<br>
Expand Down Expand Up @@ -126,6 +139,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();
Expand All @@ -134,7 +151,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,
Expand All @@ -145,6 +162,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();
Expand Down Expand Up @@ -237,7 +258,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);
Expand Down
4 changes: 2 additions & 2 deletions src/translation/de.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"showXML": "Eingebettetes XML anzeigen",
"welcomeNote1": "XML- oder PDF-Dateien über das Menü öffnen ",
"welcomeNote2": "oder durch Drücken von Strg + O Ziehen und Ablegen ",
"welcomeNote1": "XML- oder PDF-Dateien über das Menü öffnen,",
"welcomeNote2": "durch Drücken von Strg + O oder Drag&Drop",
"appName":"E-Rechnungsviewer",
"Examples":"Beispiele"
}
4 changes: 2 additions & 2 deletions src/translation/fr.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 9fb900c

Please sign in to comment.