mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 13:19:54 +01:00
feat(mobile/split): add an option to create new split
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { useContext } from "preact/hooks";
|
import { useContext } from "preact/hooks";
|
||||||
import appContext from "../../components/app_context";
|
import appContext, { CommandMappings } from "../../components/app_context";
|
||||||
import contextMenu from "../../menus/context_menu";
|
import contextMenu from "../../menus/context_menu";
|
||||||
import branches from "../../services/branches";
|
import branches from "../../services/branches";
|
||||||
import { t } from "../../services/i18n";
|
import { t } from "../../services/i18n";
|
||||||
@@ -7,6 +7,7 @@ import note_create from "../../services/note_create";
|
|||||||
import tree from "../../services/tree";
|
import tree from "../../services/tree";
|
||||||
import ActionButton from "../react/ActionButton";
|
import ActionButton from "../react/ActionButton";
|
||||||
import { ParentComponent } from "../react/react_utils";
|
import { ParentComponent } from "../react/react_utils";
|
||||||
|
import BasicWidget from "../basic_widget";
|
||||||
|
|
||||||
export default function MobileDetailMenu() {
|
export default function MobileDetailMenu() {
|
||||||
const parentComponent = useContext(ParentComponent);
|
const parentComponent = useContext(ParentComponent);
|
||||||
@@ -18,14 +19,16 @@ export default function MobileDetailMenu() {
|
|||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
const note = appContext.tabManager.getActiveContextNote();
|
const note = appContext.tabManager.getActiveContextNote();
|
||||||
|
|
||||||
contextMenu.show<"insertChildNote" | "delete" | "showRevisions">({
|
contextMenu.show<keyof CommandMappings>({
|
||||||
x: e.pageX,
|
x: e.pageX,
|
||||||
y: e.pageY,
|
y: e.pageY,
|
||||||
items: [
|
items: [
|
||||||
{ title: t("mobile_detail_menu.insert_child_note"), command: "insertChildNote", uiIcon: "bx bx-plus", enabled: note?.type !== "search" },
|
{ title: t("mobile_detail_menu.insert_child_note"), command: "insertChildNote", uiIcon: "bx bx-plus", enabled: note?.type !== "search" },
|
||||||
{ title: t("mobile_detail_menu.delete_this_note"), command: "delete", uiIcon: "bx bx-trash", enabled: note?.noteId !== "root" },
|
{ title: t("mobile_detail_menu.delete_this_note"), command: "delete", uiIcon: "bx bx-trash", enabled: note?.noteId !== "root" },
|
||||||
{ kind: "separator" },
|
{ kind: "separator" },
|
||||||
{ title: t("mobile_detail_menu.note_revisions"), command: "showRevisions", uiIcon: "bx bx-history" }
|
{ title: t("mobile_detail_menu.note_revisions"), command: "showRevisions", uiIcon: "bx bx-history" },
|
||||||
|
{ kind: "separator" },
|
||||||
|
{ title: t("create_pane_button.create_new_split"), command: "openNewNoteSplit", uiIcon: "bx bx-dock-right" }
|
||||||
],
|
],
|
||||||
selectMenuItemHandler: async ({ command }) => {
|
selectMenuItemHandler: async ({ command }) => {
|
||||||
if (command === "insertChildNote") {
|
if (command === "insertChildNote") {
|
||||||
@@ -46,7 +49,8 @@ export default function MobileDetailMenu() {
|
|||||||
parentComponent.triggerCommand("setActiveScreen", { screen: "tree" });
|
parentComponent.triggerCommand("setActiveScreen", { screen: "tree" });
|
||||||
}
|
}
|
||||||
} else if (command && parentComponent) {
|
} else if (command && parentComponent) {
|
||||||
parentComponent.triggerCommand(command);
|
const ntxId = (parentComponent as BasicWidget).getClosestNtxId();
|
||||||
|
parentComponent.triggerCommand(command, { ntxId });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
forcePositionOnMobile: true
|
forcePositionOnMobile: true
|
||||||
|
|||||||
Reference in New Issue
Block a user