Merge branch '8-have-zettel-selection-dialog-not-add-unnecessary-ids-to-its-list' into 'master'

Resolve "Have Zettel selection dialog not add unnecessary IDs to its list"

Closes #8

See merge request marty.oehme/qown-zettelkasten!4
This commit is contained in:
Marty 2018-11-28 19:25:57 +00:00
commit aa20871579
1 changed files with 11 additions and 11 deletions

View File

@ -124,22 +124,22 @@ QtObject {
// ---- Internal Functions ----
// ----------------------------
function zettelSelectorDialog(editableTextBox, zettelArray) {
if (zettelArray == null) {
zettelArray = [];
fetchZettelIDs().forEach(function (noteId){
let note = script.fetchNoteById(noteId);
zettelArray.push(note.name + " --id:"+note.id);
});
}
function zettelSelectorDialog(isEditableTextBox) {
let backingIDs = [];
let zettelArray = [];
fetchZettelIDs().forEach(function (noteId){
let note = script.fetchNoteById(noteId);
zettelArray.push(note.name);
backingIDs.push(note.id);
});
if (zettelArray.length == 0) {
script.informationMessageBox("No valid Zettel found.");
}
let selected = script.inputDialogGetItem("Zettel", "Select a Zettel", zettelArray, 0, editableTextBox);
// FIXME dont display id in names - rather, go getNotebyName(name) -> (get its id) -> set note to it
return script.fetchNoteById(selected.substring(selected.search(/--id:/)+5));
let selected = script.inputDialogGetItem("Zettel", "Select a Zettel", zettelArray, 0, isEditableTextBox);
return script.fetchNoteById(backingIDs[zettelArray.indexOf(selected)]);
}
function extractAnchorFromString(text) {