MCPcopy
hub / github.com/callumalpass/tasknotes / addTagOptions

Method addTagOptions

src/components/TaskContextMenu.ts:1426–1467  ·  view source on GitHub ↗
(submenu: Menu, task: TaskInfo, plugin: TaskNotesPlugin)

Source from the content-addressed store, hash-verified

1424 }
1425
1426 private addTagOptions(submenu: Menu, task: TaskInfo, plugin: TaskNotesPlugin): void {
1427 const editableTags = getEditableTaskTags(task, plugin.settings);
1428
1429 submenu.addItem((item) => {
1430 item.setTitle(this.t("contextMenus.task.addTag"));
1431 item.setIcon("plus");
1432 item.onClick(() => {
1433 this.menu.hide();
1434 void this.openTagInput(task, plugin, "add");
1435 });
1436 });
1437
1438 if (editableTags.length > 0) {
1439 submenu.addSeparator();
1440 for (const tag of editableTags) {
1441 submenu.addItem((item) => {
1442 item.setTitle(this.t("contextMenus.task.removeTag", { tag: `#${tag}` }));
1443 item.setIcon("x");
1444 item.onClick(async () => {
1445 await this.updateTaskTags(
1446 task,
1447 plugin,
1448 removeTagsFromList(task.tags, [tag])
1449 );
1450 });
1451 });
1452 }
1453
1454 submenu.addSeparator();
1455 submenu.addItem((item) => {
1456 item.setTitle(this.t("contextMenus.task.clearTags"));
1457 item.setIcon("eraser");
1458 item.onClick(async () => {
1459 await this.updateTaskTags(
1460 task,
1461 plugin,
1462 clearEditableTagsFromList(task.tags, plugin.settings)
1463 );
1464 });
1465 });
1466 }
1467 }
1468
1469 private async openTagInput(
1470 task: TaskInfo,

Callers 1

buildMenuMethod · 0.95

Calls 9

tMethod · 0.95
openTagInputMethod · 0.95
updateTaskTagsMethod · 0.95
getEditableTaskTagsFunction · 0.90
removeTagsFromListFunction · 0.90
setIconMethod · 0.80
onClickMethod · 0.80
hideMethod · 0.45

Tested by

no test coverage detected