diff --git a/package-lock.json b/package-lock.json index dcf5e270c..dca228dce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -589,32 +589,32 @@ "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" }, "app-builder-bin": { - "version": "2.6.6", - "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-2.6.6.tgz", - "integrity": "sha512-G0Ee6xkbxV+fvM/7xXWIgSDjWAD4E/d/aNbxerq/TVsCyBIau/0VPmrEqBMyZv0NbTwLDW5aF/yHG+0ZEY77kA==", + "version": "2.6.16", + "resolved": "https://registry.npmjs.org/app-builder-bin/-/app-builder-bin-2.6.16.tgz", + "integrity": "sha512-TSq2/AwXbFI+jK4SPRRASZEpZ32HsrugxuCzHshnZ3Wj5LDVIAMU3EGXfaciXWx7TV047G69RlA4/Y8OiHBn3w==", "dev": true }, "app-builder-lib": { - "version": "20.43.0", - "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-20.43.0.tgz", - "integrity": "sha512-8OhRPGbTFsgBn07mcG1x0FApqsLLQkNMrdl2sBPo/haI/E1QqhN4DU5x7nKbbFwnsG2XvqvBBZwnMV3FXgDi9Q==", + "version": "20.44.2", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-20.44.2.tgz", + "integrity": "sha512-84AEt+k/edrwHwFtaXx8SGAC9ZdMJabx5xf2VGM8L8sFYbBPJppl4G6TieHqpPhDURbPXqL710HKEA/lyiEIRQ==", "dev": true, "requires": { "7zip-bin": "~4.1.0", - "app-builder-bin": "2.6.6", + "app-builder-bin": "2.6.16", "async-exit-hook": "^2.0.1", "bluebird-lst": "^1.0.9", - "builder-util": "10.0.2", - "builder-util-runtime": "8.2.4", + "builder-util": "10.1.0", + "builder-util-runtime": "8.2.5", "chromium-pickle-js": "^0.2.0", "debug": "^4.1.1", - "ejs": "^2.6.1", + "ejs": "^2.6.2", "electron-osx-sign": "0.4.11", - "electron-publish": "20.43.0", + "electron-publish": "20.44.2", "fs-extra-p": "^8.0.2", "hosted-git-info": "^2.7.1", "is-ci": "^2.0.0", - "isbinaryfile": "^4.0.0", + "isbinaryfile": "^4.0.1", "js-yaml": "^3.13.1", "lazy-val": "^1.0.4", "minimatch": "^3.0.4", @@ -623,7 +623,7 @@ "read-config-file": "3.2.2", "sanitize-filename": "^1.6.1", "semver": "^6.1.1", - "temp-file": "^3.3.2" + "temp-file": "^3.3.3" }, "dependencies": { "ci-info": { @@ -678,9 +678,9 @@ } }, "resolve": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.1.tgz", - "integrity": "sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw==", + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.11.0.tgz", + "integrity": "sha512-WL2pBDjqT6pGUNSUzMw00o4T7If+z4H2x3Gz893WoUQ5KW8Vr9txp00ykiP16VBaZF5+j/OcXJHZ9+PCvdiDKw==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -1386,16 +1386,16 @@ } }, "builder-util": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-10.0.2.tgz", - "integrity": "sha512-Dt11O/MTdCsaCjAdnkVVcDSSkQEkvPWAs18sNQBc6l6wt5RvzcI4nfgpLxwbUi/DkCpHCltUgIj94TLQXQv1bw==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-10.1.0.tgz", + "integrity": "sha512-M+XnPGbVKSssgxgejtcrCPr7BcJfTyZZYf9yJ8r3o3kDJfBcF0ShaxyuOk956PnAUuanRGtfhZb4cD6dx+x1jA==", "dev": true, "requires": { "7zip-bin": "~4.1.0", "@types/debug": "^4.1.4", - "app-builder-bin": "2.6.6", + "app-builder-bin": "2.6.16", "bluebird-lst": "^1.0.9", - "builder-util-runtime": "^8.2.4", + "builder-util-runtime": "^8.2.5", "chalk": "^2.4.2", "debug": "^4.1.1", "fs-extra-p": "^8.0.2", @@ -1403,7 +1403,7 @@ "js-yaml": "^3.13.1", "source-map-support": "^0.5.12", "stat-mode": "^0.3.0", - "temp-file": "^3.3.2" + "temp-file": "^3.3.3" }, "dependencies": { "ansi-styles": { @@ -1475,9 +1475,9 @@ } }, "builder-util-runtime": { - "version": "8.2.4", - "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.2.4.tgz", - "integrity": "sha512-iwRnmFnGs63+p6uJem2N/d9Q0SKj5c0TP8PTesKnWsWvo1saKKM/0yiT137w+3uz+r/Cmf8VH/8nt75uW8jeUw==", + "version": "8.2.5", + "resolved": "https://registry.npmjs.org/builder-util-runtime/-/builder-util-runtime-8.2.5.tgz", + "integrity": "sha512-YILT+YUlxrE3yNB6mDC1tF+Q24mr1LSYdjP5U861jbBeDZfvy1/VPDzW3boMVrDtzYnDnvkYrzLJnoh6TXA75w==", "dev": true, "requires": { "bluebird-lst": "^1.0.9", @@ -2621,14 +2621,14 @@ } }, "dmg-builder": { - "version": "6.6.4", - "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-6.6.4.tgz", - "integrity": "sha512-neJXwnFaJ4wisP++Yyi9H0kEUsvxyY7TBBEK2fu8V8i1VoMQKljY/6Dgf2HktLVHzXSWP71TQwKKWSIWI/3aeQ==", + "version": "6.7.0", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-6.7.0.tgz", + "integrity": "sha512-YluV5KM2sbqKZ0SeL+K7Q0E37EAeV64UmdUtnV4CZqe7TYaVa5j2K5zpfoMZyg+sekxAN8utfmrvaLf9V6SNeA==", "dev": true, "requires": { - "app-builder-lib": "~20.43.0", + "app-builder-lib": "~20.44.2", "bluebird-lst": "^1.0.9", - "builder-util": "~10.0.2", + "builder-util": "~10.1.0", "fs-extra-p": "^8.0.2", "iconv-lite": "^0.4.24", "js-yaml": "^3.13.1", @@ -2831,17 +2831,17 @@ } }, "electron-builder": { - "version": "20.43.0", - "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-20.43.0.tgz", - "integrity": "sha512-8trMnW3K2BWtPGQJqCWZ5QMwZajMucmzlTCHrzhufQWuQbaPhanmho6tWFm2ftyuYku3T4TB4kD7UCX/YQDGyg==", + "version": "20.44.2", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-20.44.2.tgz", + "integrity": "sha512-4n7s8gfmMuNr3IbVLXo/XzcdaWcOFxu+VeC0FUjl90lU8H8pvuQ/LZS+yD7k0zVw98p4+GvMg0nIwjdF+BbwTA==", "dev": true, "requires": { - "app-builder-lib": "20.43.0", + "app-builder-lib": "20.44.2", "bluebird-lst": "^1.0.9", - "builder-util": "10.0.2", - "builder-util-runtime": "8.2.4", + "builder-util": "10.1.0", + "builder-util-runtime": "8.2.5", "chalk": "^2.4.2", - "dmg-builder": "6.6.4", + "dmg-builder": "6.7.0", "fs-extra-p": "^8.0.2", "is-ci": "^2.0.0", "lazy-val": "^1.0.4", @@ -3055,15 +3055,15 @@ "dev": true }, "package-json": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.3.0.tgz", - "integrity": "sha512-XO7WS3EEXd48vmW633Y97Mh9xuENFiOevI9G+ExfTG/k6xuY9cBd3fxkAoDMSEsNZXasaVJIJ1rD/n7GMf18bA==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.4.0.tgz", + "integrity": "sha512-bd1T8OBG7hcvMd9c/udgv6u5v9wISP3Oyl9Cm7Weop8EFwrtcQDnS2sb6zhwqus2WslSr5wSTIPiTTpxxmPm7Q==", "dev": true, "requires": { "got": "^9.6.0", "registry-auth-token": "^3.4.0", "registry-url": "^5.0.0", - "semver": "^5.6.0" + "semver": "^6.1.1" } }, "prepend-http": { @@ -3091,12 +3091,6 @@ "rc": "^1.2.8" } }, - "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", - "dev": true - }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -3583,18 +3577,18 @@ } }, "electron-publish": { - "version": "20.43.0", - "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-20.43.0.tgz", - "integrity": "sha512-+oaTdbMmh1xceKPZWORYyGkNmxIhu7rkE1qEEn0NeG3KHEAePHg9FZGemR4aV3tQmtOwti2Vj+x8snAUxsnHHQ==", + "version": "20.44.2", + "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-20.44.2.tgz", + "integrity": "sha512-GRzmMFdVG63zKip2wY+fa5Vmw6bHz1OaGemz3Ebfzm60CfaPOw8o3iWa49JuxYYPobi2BbZrbr76a0flECmAzg==", "dev": true, "requires": { "bluebird-lst": "^1.0.9", - "builder-util": "~10.0.2", - "builder-util-runtime": "^8.2.4", + "builder-util": "~10.1.0", + "builder-util-runtime": "^8.2.5", "chalk": "^2.4.2", "fs-extra-p": "^8.0.2", "lazy-val": "^1.0.4", - "mime": "^2.4.3" + "mime": "^2.4.4" }, "dependencies": { "ansi-styles": { @@ -11917,37 +11911,14 @@ "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=" }, "temp-file": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.3.2.tgz", - "integrity": "sha512-FGKccAW0Mux9hC/2bdUIe4bJRv4OyVo4RpVcuplFird1V/YoplIFbnPZjfzbJSf/qNvRZIRB9/4n/RkI0GziuQ==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/temp-file/-/temp-file-3.3.3.tgz", + "integrity": "sha512-ErWJ0vfZwkozaH7dn/5QtYdrGwy6fWID0GG3PEzNb9Vmt6urL4mQ3lKz7NWVi1/kmZsWQzgjTL7/P4mwGx5jqg==", "dev": true, "requires": { "async-exit-hook": "^2.0.1", - "bluebird-lst": "^1.0.6", - "fs-extra-p": "^7.0.0" - }, - "dependencies": { - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs-extra-p": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra-p/-/fs-extra-p-7.0.1.tgz", - "integrity": "sha512-yhd2OV0HnHt2oitlp+X9hl2ReX4X/7kQeL7/72qzPHTZj5eUPGzAKOvEglU02Fa1OeG2rSy/aKB4WGVaLiF8tw==", - "dev": true, - "requires": { - "bluebird-lst": "^1.0.7", - "fs-extra": "^7.0.1" - } - } + "bluebird-lst": "^1.0.9", + "fs-extra-p": "^8.0.2" } }, "tempfile": { diff --git a/package.json b/package.json index 4b91c4cb3..7dae9f290 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "devDependencies": { "devtron": "1.4.0", "electron": "6.0.0-beta.9", - "electron-builder": "20.43.0", + "electron-builder": "20.44.2", "electron-compile": "6.4.4", "electron-installer-debian": "2.0.0", "electron-packager": "13.1.1", diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.js index b093467e6..c8eb954e2 100644 --- a/src/public/javascripts/desktop.js +++ b/src/public/javascripts/desktop.js @@ -142,10 +142,10 @@ $noteTabContainer.on("click", ".export-note-button", function () { return; } - exportDialog.showDialog('single'); + exportDialog.showDialog(treeService.getActiveNode(), 'single'); }); -$noteTabContainer.on("click", ".import-files-button", importDialog.showDialog); +$noteTabContainer.on("click", ".import-files-button", () => importDialog.showDialog(treeService.getActiveNode())); $('[data-toggle="tooltip"]').tooltip({ html: true diff --git a/src/public/javascripts/dialogs/branch_prefix.js b/src/public/javascripts/dialogs/branch_prefix.js index 4dbd3a1d7..ffa4246e6 100644 --- a/src/public/javascripts/dialogs/branch_prefix.js +++ b/src/public/javascripts/dialogs/branch_prefix.js @@ -12,21 +12,19 @@ const $noteTitle = $('#branch-prefix-note-title'); let branchId; -async function showDialog() { +async function showDialog(node) { utils.closeActiveDialog(); glob.activeDialog = $dialog; $dialog.modal(); - const currentNode = treeService.getActiveNode(); - - branchId = currentNode.data.branchId; + branchId = node.data.branchId; const branch = await treeCache.getBranch(branchId); $treePrefixInput.val(branch.prefix); - const noteTitle = await treeUtils.getNoteTitle(currentNode.data.noteId); + const noteTitle = await treeUtils.getNoteTitle(node.data.noteId); $noteTitle.text(" - " + noteTitle); } diff --git a/src/public/javascripts/dialogs/export.js b/src/public/javascripts/dialogs/export.js index 75b70dd06..3d93e9100 100644 --- a/src/public/javascripts/dialogs/export.js +++ b/src/public/javascripts/dialogs/export.js @@ -1,4 +1,3 @@ -import treeService from '../services/tree.js'; import treeUtils from "../services/tree_utils.js"; import utils from "../services/utils.js"; import messagingService from "../services/messaging.js"; @@ -6,7 +5,7 @@ import infoService from "../services/info.js"; const $dialog = $("#export-dialog"); const $form = $("#export-form"); -const $noteTitle = $dialog.find(".note-title"); +const $noteTitle = $dialog.find(".export-note-title"); const $subtreeFormats = $("#export-subtree-formats"); const $singleFormats = $("#export-single-formats"); const $subtreeType = $("#export-type-subtree"); @@ -17,8 +16,9 @@ const $exportButton = $("#export-button"); const $opmlVersions = $("#opml-versions"); let exportId = ''; +let branchId = null; -async function showDialog(defaultType) { +async function showDialog(node, defaultType) { utils.closeActiveDialog(); // each opening of the dialog resets the exportId so we don't associate it with previous exports anymore @@ -46,8 +46,9 @@ async function showDialog(defaultType) { $dialog.modal(); - const currentNode = treeService.getActiveNode(); - const noteTitle = await treeUtils.getNoteTitle(currentNode.data.noteId); + branchId = node.data.branchId; + + const noteTitle = await treeUtils.getNoteTitle(node.data.noteId); $noteTitle.html(noteTitle); } @@ -70,9 +71,7 @@ $form.submit(() => { const exportVersion = exportFormat === 'opml' ? $dialog.find("input[name='opml-version']:checked").val() : "1.0"; - const currentNode = treeService.getActiveNode(); - - exportBranch(currentNode.data.branchId, exportType, exportFormat, exportVersion); + exportBranch(branchId, exportType, exportFormat, exportVersion); return false; }); diff --git a/src/public/javascripts/dialogs/import.js b/src/public/javascripts/dialogs/import.js index 41610510e..c4d8b2ea3 100644 --- a/src/public/javascripts/dialogs/import.js +++ b/src/public/javascripts/dialogs/import.js @@ -19,8 +19,9 @@ const $codeImportedAsCodeCheckbox = $("#code-imported-as-code-checkbox"); const $explodeArchivesCheckbox = $("#explode-archives-checkbox"); let importId; +let importIntoNoteId = null; -async function showDialog() { +async function showDialog(node) { utils.closeActiveDialog(); // each opening of the dialog resets the importId so we don't associate it with previous imports anymore @@ -37,19 +38,18 @@ async function showDialog() { glob.activeDialog = $dialog; - const currentNode = treeService.getActiveNode(); - $noteTitle.text(await treeUtils.getNoteTitle(currentNode.data.noteId)); + importIntoNoteId = node.data.noteId; + + $noteTitle.text(await treeUtils.getNoteTitle(importIntoNoteId)); $dialog.modal(); } $form.submit(() => { - const currentNode = treeService.getActiveNode(); - // disabling so that import is not triggered again. $importButton.attr("disabled", "disabled"); - importIntoNote(currentNode.data.noteId); + importIntoNote(importIntoNoteId); return false; }); diff --git a/src/public/javascripts/services/tree_context_menu.js b/src/public/javascripts/services/tree_context_menu.js index e02bd162a..8e073aed5 100644 --- a/src/public/javascripts/services/tree_context_menu.js +++ b/src/public/javascripts/services/tree_context_menu.js @@ -132,10 +132,10 @@ class TreeContextMenu { treeChangesService.deleteNodes(treeService.getSelectedOrActiveNodes(this.node)); } else if (cmd === "export") { - exportDialog.showDialog("subtree"); + exportDialog.showDialog(this.node,"subtree"); } else if (cmd === "importIntoNote") { - importDialog.showDialog(); + importDialog.showDialog(this.node); } else if (cmd === "collapseSubtree") { treeService.collapseTree(this.node); diff --git a/src/services/import/single.js b/src/services/import/single.js index 1fb682421..37ba50b4f 100644 --- a/src/services/import/single.js +++ b/src/services/import/single.js @@ -74,8 +74,6 @@ function getMime(fileName) { const ext = path.extname(fileName).toLowerCase(); - console.log("EXT", ext); - if (ext in EXTENSION_TO_MIME) { console.log(EXTENSION_TO_MIME[ext]); diff --git a/src/views/dialogs/export.ejs b/src/views/dialogs/export.ejs index 13bf68ad3..15dcee16d 100644 --- a/src/views/dialogs/export.ejs +++ b/src/views/dialogs/export.ejs @@ -2,7 +2,7 @@