MCPcopy Create free account
hub / github.com/chhoumann/quickadd / pickTemplate

Function pickTemplate

src/engine/applyTemplateToActiveNote.ts:240–267  ·  view source on GitHub ↗
(
	app: App,
	plugin: QuickAdd,
)

Source from the content-addressed store, hash-verified

238}
239
240async function pickTemplate(
241 app: App,
242 plugin: QuickAdd,
243): Promise<TemplatePickerItem | null> {
244 const items = buildTemplatePickerItems(
245 plugin.settings.choices,
246 plugin.getTemplateFiles().map((file) => file.path),
247 );
248
249 if (items.length === 0) {
250 new Notice(
251 "QuickAdd: No Template choices or template files found. Create a Template choice or set the template folder path in settings.",
252 );
253 return null;
254 }
255
256 try {
257 return await GenericSuggester.Suggest(
258 app,
259 items.map(templatePickerItemLabel),
260 items,
261 "Apply template to note",
262 );
263 } catch (error) {
264 if (isCancellationError(error)) return null;
265 throw error;
266 }
267}
268
269async function pickInsertMode(
270 app: App,

Callers 1

applyTemplateToNoteFunction · 0.85

Calls 4

isCancellationErrorFunction · 0.90
buildTemplatePickerItemsFunction · 0.85
getTemplateFilesMethod · 0.80
SuggestMethod · 0.45

Tested by

no test coverage detected