mirror of https://github.com/TriliumNext/Notes
feat(text-snippets): basic integration
parent
3b579a3b7b
commit
af8a905150
@ -0,0 +1,19 @@
|
||||
import search from "../../../services/search";
|
||||
import type { TemplateDefinition } from "@triliumnext/ckeditor5";
|
||||
|
||||
/**
|
||||
* Generates the list of snippets based on the user's notes to be passed down to the CKEditor configuration.
|
||||
*
|
||||
* @returns the list of templates.
|
||||
*/
|
||||
export default async function getTemplates() {
|
||||
const definitions: TemplateDefinition[] = [];
|
||||
const snippets = await search.searchForNotes("#textSnippet");
|
||||
for (const snippet of snippets) {
|
||||
definitions.push({
|
||||
title: snippet.title,
|
||||
data: await snippet.getContent() ?? ""
|
||||
})
|
||||
}
|
||||
return definitions;
|
||||
}
|
||||
Loading…
Reference in New Issue