|
|
|
|
@ -4,6 +4,7 @@ import contextMenu from "../../menus/context_menu.js";
|
|
|
|
|
import noteCreateService from "../../services/note_create.js";
|
|
|
|
|
import branchService from "../../services/branches.js";
|
|
|
|
|
import treeService from "../../services/tree.js";
|
|
|
|
|
import { t } from "../../services/i18n.js";
|
|
|
|
|
|
|
|
|
|
const TPL = `<button type="button" class="action-button bx bx-menu" style="padding-top: 10px;"></button>`;
|
|
|
|
|
|
|
|
|
|
@ -18,9 +19,9 @@ class MobileDetailMenuWidget extends BasicWidget {
|
|
|
|
|
x: e.pageX,
|
|
|
|
|
y: e.pageY,
|
|
|
|
|
items: [
|
|
|
|
|
{ title: "Insert child note", command: "insertChildNote", uiIcon: "bx bx-plus",
|
|
|
|
|
{ title: t("mobile_detail_menu.insert_child_note"), command: "insertChildNote", uiIcon: "bx bx-plus",
|
|
|
|
|
enabled: note.type !== 'search' },
|
|
|
|
|
{ title: "Delete this note", command: "delete", uiIcon: "bx bx-trash",
|
|
|
|
|
{ title: t("mobile_detail_menu.delete_this_note"), command: "delete", uiIcon: "bx bx-trash",
|
|
|
|
|
enabled: note.noteId !== 'root' }
|
|
|
|
|
],
|
|
|
|
|
selectMenuItemHandler: async ({command}) => {
|
|
|
|
|
@ -32,7 +33,7 @@ class MobileDetailMenuWidget extends BasicWidget {
|
|
|
|
|
const branchId = await treeService.getBranchIdFromUrl(notePath);
|
|
|
|
|
|
|
|
|
|
if (!branchId) {
|
|
|
|
|
throw new Error(`Cannot get branchId for notePath '${notePath}'`);
|
|
|
|
|
throw new Error(t("mobile_detail_menu.error_cannot_get_branch_id", { notePath }));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (await branchService.deleteNotes([branchId])) {
|
|
|
|
|
@ -40,7 +41,7 @@ class MobileDetailMenuWidget extends BasicWidget {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
throw new Error(`Unrecognized command ${command}`);
|
|
|
|
|
throw new Error(t("mobile_detail_menu.error_unrecognized_command", { command }));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|