mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	feat(mobile): add new note launcher bar (fixes #1105)
This commit is contained in:
		
							parent
							
								
									96dc063b50
								
							
						
					
					
						commit
						f8f1e537db
					
				@ -7,7 +7,7 @@ import log from "./log.js";
 | 
				
			|||||||
import migrationService from "./migration.js";
 | 
					import migrationService from "./migration.js";
 | 
				
			||||||
import { t } from "i18next";
 | 
					import { t } from "i18next";
 | 
				
			||||||
import { getHelpHiddenSubtreeData } from "./in_app_help.js";
 | 
					import { getHelpHiddenSubtreeData } from "./in_app_help.js";
 | 
				
			||||||
import * as launchbarConfig from "./hidden_subtree_launcherbar.js";
 | 
					import buildLaunchBarConfig from "./hidden_subtree_launcherbar.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const LBTPL_ROOT = "_lbTplRoot";
 | 
					const LBTPL_ROOT = "_lbTplRoot";
 | 
				
			||||||
const LBTPL_BASE = "_lbTplBase";
 | 
					const LBTPL_BASE = "_lbTplBase";
 | 
				
			||||||
@ -59,6 +59,8 @@ enum Command {
 | 
				
			|||||||
let hiddenSubtreeDefinition: HiddenSubtreeItem;
 | 
					let hiddenSubtreeDefinition: HiddenSubtreeItem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function buildHiddenSubtreeDefinition(): HiddenSubtreeItem {
 | 
					function buildHiddenSubtreeDefinition(): HiddenSubtreeItem {
 | 
				
			||||||
 | 
					    const launchbarConfig = buildLaunchBarConfig();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
        id: "_hidden",
 | 
					        id: "_hidden",
 | 
				
			||||||
        title: t("hidden-subtree.root-title"),
 | 
					        title: t("hidden-subtree.root-title"),
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,14 @@
 | 
				
			|||||||
import { t } from "i18next";
 | 
					import { t } from "i18next";
 | 
				
			||||||
import type { HiddenSubtreeItem } from "./hidden_subtree.js";
 | 
					import type { HiddenSubtreeItem } from "./hidden_subtree.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const sharedLaunchers: Record<string, Omit<HiddenSubtreeItem, "id">> = {
 | 
					export default function buildLaunchBarConfig() {
 | 
				
			||||||
 | 
					    const sharedLaunchers: Record<string, Omit<HiddenSubtreeItem, "id">> = {
 | 
				
			||||||
 | 
					        newNote: {
 | 
				
			||||||
 | 
					            title: t("hidden-subtree.new-note-title"),
 | 
				
			||||||
 | 
					            type: "launcher",
 | 
				
			||||||
 | 
					            command: "createNoteIntoInbox",
 | 
				
			||||||
 | 
					            icon: "bx bx-file-blank"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
        backInHistory: {
 | 
					        backInHistory: {
 | 
				
			||||||
            title: t("hidden-subtree.go-to-previous-note-title"),
 | 
					            title: t("hidden-subtree.go-to-previous-note-title"),
 | 
				
			||||||
            type: "launcher",
 | 
					            type: "launcher",
 | 
				
			||||||
@ -16,16 +23,16 @@ const sharedLaunchers: Record<string, Omit<HiddenSubtreeItem, "id">> = {
 | 
				
			|||||||
            icon: "bx bxs-chevron-right",
 | 
					            icon: "bx bxs-chevron-right",
 | 
				
			||||||
            attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
 | 
					            attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
};
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const desktopAvailableLaunchers: HiddenSubtreeItem[] = [
 | 
					    const desktopAvailableLaunchers: HiddenSubtreeItem[] = [
 | 
				
			||||||
        { id: "_lbBackInHistory", ...sharedLaunchers.backInHistory },
 | 
					        { id: "_lbBackInHistory", ...sharedLaunchers.backInHistory },
 | 
				
			||||||
        { id: "_lbForwardInHistory", ...sharedLaunchers.forwardInHistory },
 | 
					        { id: "_lbForwardInHistory", ...sharedLaunchers.forwardInHistory },
 | 
				
			||||||
        { id: "_lbBackendLog", title: t("hidden-subtree.backend-log-title"), type: "launcher", targetNoteId: "_backendLog", icon: "bx bx-terminal" }
 | 
					        { id: "_lbBackendLog", title: t("hidden-subtree.backend-log-title"), type: "launcher", targetNoteId: "_backendLog", icon: "bx bx-terminal" }
 | 
				
			||||||
];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const desktopVisibleLaunchers: HiddenSubtreeItem[] = [
 | 
					    const desktopVisibleLaunchers: HiddenSubtreeItem[] = [
 | 
				
			||||||
    { id: "_lbNewNote", title: t("hidden-subtree.new-note-title"), type: "launcher", command: "createNoteIntoInbox", icon: "bx bx-file-blank" },
 | 
					        { id: "_lbNewNote", ...sharedLaunchers.newNote },
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            id: "_lbSearch",
 | 
					            id: "_lbSearch",
 | 
				
			||||||
            title: t("hidden-subtree.search-notes-title"),
 | 
					            title: t("hidden-subtree.search-notes-title"),
 | 
				
			||||||
@ -60,14 +67,22 @@ export const desktopVisibleLaunchers: HiddenSubtreeItem[] = [
 | 
				
			|||||||
        { id: "_lbProtectedSession", title: t("hidden-subtree.protected-session-title"), type: "launcher", builtinWidget: "protectedSession", icon: "bx bx bx-shield-quarter" },
 | 
					        { id: "_lbProtectedSession", title: t("hidden-subtree.protected-session-title"), type: "launcher", builtinWidget: "protectedSession", icon: "bx bx bx-shield-quarter" },
 | 
				
			||||||
        { id: "_lbSyncStatus", title: t("hidden-subtree.sync-status-title"), type: "launcher", builtinWidget: "syncStatus", icon: "bx bx-wifi" },
 | 
					        { id: "_lbSyncStatus", title: t("hidden-subtree.sync-status-title"), type: "launcher", builtinWidget: "syncStatus", icon: "bx bx-wifi" },
 | 
				
			||||||
        { id: "_lbSettings", title: t("hidden-subtree.settings-title"), type: "launcher", command: "showOptions", icon: "bx bx-cog" }
 | 
					        { id: "_lbSettings", title: t("hidden-subtree.settings-title"), type: "launcher", command: "showOptions", icon: "bx bx-cog" }
 | 
				
			||||||
]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const mobileAvailableLaunchers: HiddenSubtreeItem[] = [
 | 
					    const mobileAvailableLaunchers: HiddenSubtreeItem[] = [
 | 
				
			||||||
    // None for now.
 | 
					        { id: "_lbMobileNewNote", ...sharedLaunchers.newNote }
 | 
				
			||||||
];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const mobileVisibleLaunchers: HiddenSubtreeItem[] = [
 | 
					    const mobileVisibleLaunchers: HiddenSubtreeItem[] = [
 | 
				
			||||||
        { id: "_lbMobileBackInHistory", ...sharedLaunchers.backInHistory },
 | 
					        { id: "_lbMobileBackInHistory", ...sharedLaunchers.backInHistory },
 | 
				
			||||||
        { id: "_lbMobileForwardInHistory", ...sharedLaunchers.forwardInHistory },
 | 
					        { id: "_lbMobileForwardInHistory", ...sharedLaunchers.forwardInHistory },
 | 
				
			||||||
        { id: "_lbMobileJumpTo", title: t("hidden-subtree.jump-to-note-title"), type: "launcher", command: "jumpToNote", icon: "bx bx-plus-circle" }
 | 
					        { id: "_lbMobileJumpTo", title: t("hidden-subtree.jump-to-note-title"), type: "launcher", command: "jumpToNote", icon: "bx bx-plus-circle" }
 | 
				
			||||||
];
 | 
					    ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        desktopAvailableLaunchers,
 | 
				
			||||||
 | 
					        desktopVisibleLaunchers,
 | 
				
			||||||
 | 
					        mobileAvailableLaunchers,
 | 
				
			||||||
 | 
					        mobileVisibleLaunchers
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user