mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
* refactoring of repository layer to represent booleans as true/false instead of 1/0
* show list of inherited attributes, fixes #136 * properly work with inheritance
This commit is contained in:
@@ -23,7 +23,7 @@ function getNotePathFromLabel(label) {
|
||||
return null;
|
||||
}
|
||||
|
||||
async function createNoteLink(notePath, noteTitle) {
|
||||
async function createNoteLink(notePath, noteTitle = null) {
|
||||
if (!noteTitle) {
|
||||
const noteId = treeUtils.getNoteIdFromNotePath(notePath);
|
||||
|
||||
@@ -90,6 +90,18 @@ function addTextToEditor(text) {
|
||||
doc.enqueueChanges(() => editor.data.insertText(text), doc.selection);
|
||||
}
|
||||
|
||||
ko.bindingHandlers.noteLink = {
|
||||
init: async function(element, valueAccessor, allBindings, viewModel, bindingContext) {
|
||||
const noteId = ko.unwrap(valueAccessor());
|
||||
|
||||
if (noteId) {
|
||||
const link = await createNoteLink(noteId);
|
||||
|
||||
$(element).append(link);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// when click on link popup, in case of internal link, just go the the referenced note instead of default behavior
|
||||
// of opening the link in new window/tab
|
||||
$(document).on('click', "a[action='note']", goToLink);
|
||||
|
||||
Reference in New Issue
Block a user