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,17 +24,19 @@ export function RelationEditor(cell: CellComponent, onRendered, success, cancel,
|
||||
|
||||
//set focus on the select box when the editor is selected
|
||||
onRendered(function(){
|
||||
note_autocomplete.initNoteAutocomplete($editor);
|
||||
editor.focus();
|
||||
});
|
||||
|
||||
//when the value has been set, trigger the cell to update
|
||||
function successFunc(){
|
||||
success($editor.getSelectedNoteId());
|
||||
note_autocomplete.initNoteAutocomplete($editor, {
|
||||
allowCreatingNotes: true
|
||||
}).on("autocomplete:noteselected", (event, suggestion, dataset) => {
|
||||
const notePath = suggestion.notePath;
|
||||
if (!notePath) {
|
||||
return;
|
||||
}
|
||||
|
||||
editor.addEventListener("change", successFunc);
|
||||
editor.addEventListener("blur", successFunc);
|
||||
const noteId = notePath.split("/").at(-1);
|
||||
success(noteId);
|
||||
});
|
||||
editor.focus();
|
||||
});
|
||||
|
||||
//return the editor element
|
||||
return editor;
|
||||
|
Loading…
x
Reference in New Issue
Block a user