feat(views/table): allow creation of new notes

This commit is contained in:
Elian Doran 2025-07-04 17:17:39 +03:00
parent ac70908c5a
commit 4ac7b6e9e8
No known key found for this signature in database

View File

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