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 //set focus on the select box when the editor is selected
onRendered(function(){ onRendered(function(){
note_autocomplete.initNoteAutocomplete($editor); note_autocomplete.initNoteAutocomplete($editor, {
editor.focus(); allowCreatingNotes: true
}); }).on("autocomplete:noteselected", (event, suggestion, dataset) => {
const notePath = suggestion.notePath;
//when the value has been set, trigger the cell to update if (!notePath) {
function successFunc(){ return;
success($editor.getSelectedNoteId());
} }
editor.addEventListener("change", successFunc); const noteId = notePath.split("/").at(-1);
editor.addEventListener("blur", successFunc); success(noteId);
});
editor.focus();
});
//return the editor element //return the editor element
return editor; return editor;