fix inserting current timestamp into editor

This commit is contained in:
azivner 2018-08-29 20:22:57 +02:00
parent ee54dc3463
commit 1ece9b71ec
3 changed files with 9 additions and 3 deletions

View File

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

View File

@ -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 = {

View File

@ -12,6 +12,10 @@ function getNodeByKey(key) {
}
function getNoteIdFromNotePath(notePath) {
if (!notePath) {
return null;
}
const path = notePath.split("/");
return path[path.length - 1];