mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
fix inserting current timestamp into editor
This commit is contained in:
parent
ee54dc3463
commit
1ece9b71ec
@ -149,7 +149,7 @@ function AttributesModel() {
|
||||
attr.value = attr.labelValue;
|
||||
}
|
||||
else if (attr.type === 'relation') {
|
||||
attr.value = treeUtils.getNoteIdFromNotePath(linkService.getNotePathFromLabel(attr.relationValue));
|
||||
attr.value = treeUtils.getNoteIdFromNotePath(linkService.getNotePathFromLabel(attr.relationValue)) || "";
|
||||
}
|
||||
else if (attr.type === 'label-definition') {
|
||||
attr.value = attr.labelDefinition;
|
||||
|
@ -85,9 +85,11 @@ function addLinkToEditor(linkTitle, linkHref) {
|
||||
|
||||
function addTextToEditor(text) {
|
||||
const editor = noteDetailText.getEditor();
|
||||
const doc = editor.document;
|
||||
|
||||
doc.enqueueChanges(() => editor.data.insertText(text), doc.selection);
|
||||
editor.model.change(writer => {
|
||||
const insertPosition = editor.model.document.selection.getFirstPosition();
|
||||
writer.insertText(text, insertPosition);
|
||||
});
|
||||
}
|
||||
|
||||
ko.bindingHandlers.noteLink = {
|
||||
|
@ -12,6 +12,10 @@ function getNodeByKey(key) {
|
||||
}
|
||||
|
||||
function getNoteIdFromNotePath(notePath) {
|
||||
if (!notePath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const path = notePath.split("/");
|
||||
|
||||
return path[path.length - 1];
|
||||
|
Loading…
x
Reference in New Issue
Block a user