create note inline, #1237

This commit is contained in:
zadam
2020-09-21 22:08:54 +02:00
parent 0eef18a799
commit 0e795b2978
10 changed files with 46 additions and 53 deletions

View File

@@ -6,6 +6,8 @@ import attributesParser from "../services/attribute_parser.js";
import libraryLoader from "../services/library_loader.js";
import treeCache from "../services/tree_cache.js";
import attributeRenderer from "../services/attribute_renderer.js";
import noteCreateService from "../services/note_create.js";
import treeService from "../services/tree.js";
const HELP_TEXT = `
<p>To add label, just type e.g. <code>#rock</code> or if you want to add also value then e.g. <code>#year = 2020</code></p>
@@ -73,21 +75,7 @@ const mentionSetup = {
feeds: [
{
marker: '@',
feed: queryText => {
return new Promise((res, rej) => {
noteAutocompleteService.autocompleteSource(queryText, rows => {
res(rows.map(row => {
return {
id: '@' + row.notePathTitle,
name: row.notePathTitle,
link: '#' + row.notePath,
notePath: row.notePath,
highlightedNotePathTitle: row.highlightedNotePathTitle
}
}));
});
});
},
feed: queryText => noteAutocompleteService.autocompleteSourceForCKEditor(queryText),
itemRenderer: item => {
const itemElement = document.createElement('button');
@@ -502,6 +490,15 @@ export default class AttributeEditorWidget extends TabAwareWidget {
}
}
async createNoteForReferenceLink(title) {
const {note} = await noteCreateService.createNote(this.noteId, {
activate: false,
title: title
});
return treeService.getSomeNotePath(note);
}
updateAttributeList(attributes) {
this.renderOwnedAttributes(attributes, false);
}