Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(splits): give the split actions a section of their own
Elian Dorancc0d15a39a82
diff --git a/apps/server/src/assets/translations/en/server.json b/apps/server/src/assets/translations/en/server.jsonindex 1014fd6d5f..f4ab838b75 100644--- a/apps/server/src/assets/translations/en/server.json+++ b/apps/server/src/assets/translations/en/server.json@@ -74,7 +74,8 @@"create-new-split": "Open a new empty split to the right of the active one","close-active-split": "Close the active split, keeping the other splits of the tab open","focus-split-left": "Move the focus to the split on the left of the active one",- "focus-split-right": "Move the focus to the split on the right of the active one"+ "focus-split-right": "Move the focus to the split on the right of the active one",+ "split-view": "Split view"},"keyboard_action_names": {"back-in-note-history": "Back in Note History",diff --git a/packages/trilium-core/src/services/keyboard_actions.spec.ts b/packages/trilium-core/src/services/keyboard_actions.spec.tsindex 47a926f893..d183e0be07 100644--- a/packages/trilium-core/src/services/keyboard_actions.spec.ts+++ b/packages/trilium-core/src/services/keyboard_actions.spec.ts@@ -51,7 +51,7 @@ describe("keyboard_actions service", () => {}});- it("ships the split actions unbound, so no layout is left unable to press them", () => {+ it("ships the split actions unbound and in a section of their own", () => {const actions = keyboardActions.getDefaultKeyboardActions();const splitActions = [@@ -64,6 +64,15 @@ describe("keyboard_actions service", () => {expect(action, actionName).toBeDefined();expect(action && "defaultShortcuts" in action && action.defaultShortcuts, actionName).toEqual([]);}++ // The options page buckets each action under the separator preceding it, and with nothing+ // bound by default that page is the only way to reach these -- so the six make up a section+ // of their own, rather than trailing the two dozen tab actions.+ const firstIndex = actions.findIndex((a) => "actionName" in a && a.actionName === splitActions[0]);+ expect(actions[firstIndex - 1]).toHaveProperty("separator");+ expect(actions.slice(firstIndex, firstIndex + splitActions.length)+ .map((a) => "actionName" in a && a.actionName)).toEqual(splitActions);+ expect(actions[firstIndex + splitActions.length]).toHaveProperty("separator");});it("throws if loaded before translations are available", async () => {diff --git a/packages/trilium-core/src/services/keyboard_actions.ts b/packages/trilium-core/src/services/keyboard_actions.tsindex b2f89fcd9b..c10afe16e2 100644--- a/packages/trilium-core/src/services/keyboard_actions.ts+++ b/packages/trilium-core/src/services/keyboard_actions.ts@@ -412,6 +412,10 @@ function getDefaultKeyboardActions() {defaultShortcuts: [],scope: "window"},++ {+ separator: t("keyboard_actions.split-view")+ },{actionName: "openNewNoteSplit",friendlyName: t("keyboard_action_names.create-new-split"),