fix note export/import/branch prefix to use right-clicked note as opposed to current active

This commit is contained in:
zadam
2019-06-20 09:37:18 +02:00
parent a7cf3cdf05
commit fead3cd7ad
9 changed files with 74 additions and 108 deletions

View File

@@ -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;
});