mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-01 20:52:27 +08:00
chore(client/ts): port mobile_detail_menu
This commit is contained in:
parent
229f473f8b
commit
e3bcd75a5a
@ -108,6 +108,7 @@ export type CommandMappings = {
|
|||||||
toggleNoteHoisting: ContextMenuCommandData;
|
toggleNoteHoisting: ContextMenuCommandData;
|
||||||
insertNoteAfter: ContextMenuCommandData;
|
insertNoteAfter: ContextMenuCommandData;
|
||||||
insertChildNote: ContextMenuCommandData;
|
insertChildNote: ContextMenuCommandData;
|
||||||
|
delete: ContextMenuCommandData;
|
||||||
protectSubtree: ContextMenuCommandData;
|
protectSubtree: ContextMenuCommandData;
|
||||||
unprotectSubtree: ContextMenuCommandData;
|
unprotectSubtree: ContextMenuCommandData;
|
||||||
openBulkActionsDialog: ContextMenuCommandData;
|
openBulkActionsDialog: ContextMenuCommandData;
|
||||||
|
@ -9,7 +9,9 @@ import { t } from "../../services/i18n.js";
|
|||||||
const TPL = `<button type="button" class="action-button bx" style="padding-top: 10px;"></button>`;
|
const TPL = `<button type="button" class="action-button bx" style="padding-top: 10px;"></button>`;
|
||||||
|
|
||||||
class MobileDetailMenuWidget extends BasicWidget {
|
class MobileDetailMenuWidget extends BasicWidget {
|
||||||
constructor(isHorizontalLayout) {
|
private isHorizontalLayout: boolean;
|
||||||
|
|
||||||
|
constructor(isHorizontalLayout: boolean) {
|
||||||
super();
|
super();
|
||||||
this.isHorizontalLayout = isHorizontalLayout;
|
this.isHorizontalLayout = isHorizontalLayout;
|
||||||
}
|
}
|
||||||
@ -31,9 +33,13 @@ class MobileDetailMenuWidget extends BasicWidget {
|
|||||||
],
|
],
|
||||||
selectMenuItemHandler: async ({ command }) => {
|
selectMenuItemHandler: async ({ command }) => {
|
||||||
if (command === "insertChildNote") {
|
if (command === "insertChildNote") {
|
||||||
noteCreateService.createNote(appContext.tabManager.getActiveContextNotePath());
|
noteCreateService.createNote(appContext.tabManager.getActiveContextNotePath() ?? undefined);
|
||||||
} else if (command === "delete") {
|
} else if (command === "delete") {
|
||||||
const notePath = appContext.tabManager.getActiveContextNotePath();
|
const notePath = appContext.tabManager.getActiveContextNotePath();
|
||||||
|
if (!notePath) {
|
||||||
|
throw new Error("Cannot get note path to delete.");
|
||||||
|
}
|
||||||
|
|
||||||
const branchId = await treeService.getBranchIdFromUrl(notePath);
|
const branchId = await treeService.getBranchIdFromUrl(notePath);
|
||||||
|
|
||||||
if (!branchId) {
|
if (!branchId) {
|
Loading…
x
Reference in New Issue
Block a user