mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
feat(views/table): allow creation of new notes
This commit is contained in:
parent
ac70908c5a
commit
4ac7b6e9e8
@ -24,18 +24,20 @@ export function RelationEditor(cell: CellComponent, onRendered, success, cancel,
|
|||||||
|
|
||||||
//set focus on the select box when the editor is selected
|
//set focus on the select box when the editor is selected
|
||||||
onRendered(function(){
|
onRendered(function(){
|
||||||
note_autocomplete.initNoteAutocomplete($editor);
|
note_autocomplete.initNoteAutocomplete($editor, {
|
||||||
|
allowCreatingNotes: true
|
||||||
|
}).on("autocomplete:noteselected", (event, suggestion, dataset) => {
|
||||||
|
const notePath = suggestion.notePath;
|
||||||
|
if (!notePath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const noteId = notePath.split("/").at(-1);
|
||||||
|
success(noteId);
|
||||||
|
});
|
||||||
editor.focus();
|
editor.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
//when the value has been set, trigger the cell to update
|
|
||||||
function successFunc(){
|
|
||||||
success($editor.getSelectedNoteId());
|
|
||||||
}
|
|
||||||
|
|
||||||
editor.addEventListener("change", successFunc);
|
|
||||||
editor.addEventListener("blur", successFunc);
|
|
||||||
|
|
||||||
//return the editor element
|
//return the editor element
|
||||||
return editor;
|
return editor;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user