refactorings for add link and include note

This commit is contained in:
zadam
2020-02-16 10:50:48 +01:00
parent 7e41a2750c
commit e06f3ef97e
11 changed files with 65 additions and 42 deletions

View File

@@ -5,10 +5,12 @@ import utils from "../services/utils.js";
const $dialog = $("#include-note-dialog");
const $form = $("#include-note-form");
const $autoComplete = $("#include-note-autocomplete");
let callback = null;
export async function showDialog(cb) {
callback = cb;
/** @var TextTypeWidget */
let textTypeWidget;
export async function showDialog(widget) {
textTypeWidget = widget;
$autoComplete.val('');
@@ -24,9 +26,9 @@ $form.on('submit', () => {
if (notePath) {
$dialog.modal('hide');
if (callback) {
callback(treeService.getNoteIdFromNotePath(notePath));
}
const includedNoteId = treeService.getNoteIdFromNotePath(notePath);
textTypeWidget.addIncludeNote(includedNoteId);
}
else {
console.error("No noteId to include.");