Command palette (#6491)

This commit is contained in:
Elian Doran
2025-07-28 21:20:19 +03:00
committed by GitHub
51 changed files with 1287 additions and 298 deletions

View File

@@ -133,6 +133,8 @@ export type CommandMappings = {
hideLeftPane: CommandData;
showCpuArchWarning: CommandData;
showLeftPane: CommandData;
showAttachments: CommandData;
showSearchHistory: CommandData;
hoistNote: CommandData & { noteId: string };
leaveProtectedSession: CommandData;
enterProtectedSession: CommandData;
@@ -173,7 +175,7 @@ export type CommandMappings = {
deleteNotes: ContextMenuCommandData;
importIntoNote: ContextMenuCommandData;
exportNote: ContextMenuCommandData;
searchInSubtree: ContextMenuCommandData;
searchInSubtree: CommandData & { notePath: string; };
moveNoteUp: ContextMenuCommandData;
moveNoteDown: ContextMenuCommandData;
moveNoteUpInHierarchy: ContextMenuCommandData;
@@ -262,6 +264,7 @@ export type CommandMappings = {
closeThisNoteSplit: CommandData;
moveThisNoteSplit: CommandData & { isMovingLeft: boolean };
jumpToNote: CommandData;
commandPalette: CommandData;
// Geomap
deleteFromMap: { noteId: string };

View File

@@ -23,7 +23,7 @@ let lastTargetNode: HTMLElement | null = null;
// This will include all commands that implement ContextMenuCommandData, but it will not work if it additional options are added via the `|` operator,
// so they need to be added manually.
export type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData> | "openBulkActionsDialog";
export type TreeCommandNames = FilteredCommandNames<ContextMenuCommandData> | "openBulkActionsDialog" | "searchInSubtree";
export default class TreeContextMenu implements SelectMenuItemEventListener<TreeCommandNames> {
private treeWidget: NoteTreeWidget;
@@ -129,7 +129,7 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
enabled: isNotRoot && parentNotSearch && noSelectedNotes && notOptionsOrHelp
},
{ title: t("tree-context-menu.convert-to-attachment"), command: "convertNoteToAttachment", uiIcon: "bx bx-paperclip", enabled: isNotRoot && !isHoisted && notOptionsOrHelp },
{ title: "----" },
{ title: `${t("tree-context-menu.expand-subtree")} <kbd data-command="expandSubtree"></kbd>`, command: "expandSubtree", uiIcon: "bx bx-expand", enabled: noSelectedNotes },

View File

@@ -0,0 +1,268 @@
import appContext, { type CommandNames } from "../components/app_context.js";
import type NoteTreeWidget from "../widgets/note_tree.js";
import { t, translationsInitializedPromise } from "./i18n.js";
import keyboardActions, { Action } from "./keyboard_actions.js";
import utils from "./utils.js";
export interface CommandDefinition {
id: string;
name: string;
description?: string;
icon?: string;
shortcut?: string;
commandName?: CommandNames;
handler?: () => Promise<unknown> | null | undefined | void;
aliases?: string[];
source?: "manual" | "keyboard-action";
/** Reference to the original keyboard action for scope checking. */
keyboardAction?: Action;
}
class CommandRegistry {
private commands: Map<string, CommandDefinition> = new Map();
private aliases: Map<string, string> = new Map();
constructor() {
this.loadCommands();
}
private async loadCommands() {
await translationsInitializedPromise;
this.registerDefaultCommands();
await this.loadKeyboardActionsAsync();
}
private registerDefaultCommands() {
this.register({
id: "export-note",
name: t("command_palette.export_note_title"),
description: t("command_palette.export_note_description"),
icon: "bx bx-export",
handler: () => {
const notePath = appContext.tabManager.getActiveContextNotePath();
if (notePath) {
appContext.triggerCommand("showExportDialog", {
notePath,
defaultType: "single"
});
}
}
});
this.register({
id: "show-attachments",
name: t("command_palette.show_attachments_title"),
description: t("command_palette.show_attachments_description"),
icon: "bx bx-paperclip",
handler: () => appContext.triggerCommand("showAttachments")
});
// Special search commands with custom logic
this.register({
id: "search-notes",
name: t("command_palette.search_notes_title"),
description: t("command_palette.search_notes_description"),
icon: "bx bx-search",
handler: () => appContext.triggerCommand("searchNotes", {})
});
this.register({
id: "search-in-subtree",
name: t("command_palette.search_subtree_title"),
description: t("command_palette.search_subtree_description"),
icon: "bx bx-search-alt",
handler: () => {
const notePath = appContext.tabManager.getActiveContextNotePath();
if (notePath) {
appContext.triggerCommand("searchInSubtree", { notePath });
}
}
});
this.register({
id: "show-search-history",
name: t("command_palette.search_history_title"),
description: t("command_palette.search_history_description"),
icon: "bx bx-history",
handler: () => appContext.triggerCommand("showSearchHistory")
});
this.register({
id: "show-launch-bar",
name: t("command_palette.configure_launch_bar_title"),
description: t("command_palette.configure_launch_bar_description"),
icon: "bx bx-sidebar",
handler: () => appContext.triggerCommand("showLaunchBarSubtree")
});
}
private async loadKeyboardActionsAsync() {
try {
const actions = await keyboardActions.getActions();
this.registerKeyboardActions(actions);
} catch (error) {
console.error("Failed to load keyboard actions:", error);
}
}
private registerKeyboardActions(actions: Action[]) {
for (const action of actions) {
// Skip actions that we've already manually registered
if (this.commands.has(action.actionName)) {
continue;
}
// Skip actions that don't have a description (likely separators)
if (!action.description) {
continue;
}
// Skip Electron-only actions if not in Electron environment
if (action.isElectronOnly && !utils.isElectron()) {
continue;
}
// Get the primary shortcut (first one in the list)
const primaryShortcut = action.effectiveShortcuts?.[0];
let name = action.friendlyName;
if (action.scope === "note-tree") {
name = t("command_palette.tree-action-name", { name: action.friendlyName });
}
// Create a command definition from the keyboard action
const commandDef: CommandDefinition = {
id: action.actionName,
name,
description: action.description,
icon: action.iconClass,
shortcut: primaryShortcut ? this.formatShortcut(primaryShortcut) : undefined,
commandName: action.actionName as CommandNames,
source: "keyboard-action",
keyboardAction: action
};
this.register(commandDef);
}
}
private formatShortcut(shortcut: string): string {
// Convert electron accelerator format to display format
return shortcut
.replace(/CommandOrControl/g, 'Ctrl')
.replace(/\+/g, ' + ');
}
register(command: CommandDefinition) {
this.commands.set(command.id, command);
// Register aliases
if (command.aliases) {
for (const alias of command.aliases) {
this.aliases.set(alias.toLowerCase(), command.id);
}
}
}
getCommand(id: string): CommandDefinition | undefined {
return this.commands.get(id);
}
getAllCommands(): CommandDefinition[] {
const commands = Array.from(this.commands.values());
// Sort commands by name
commands.sort((a, b) => a.name.localeCompare(b.name));
return commands;
}
searchCommands(query: string): CommandDefinition[] {
const normalizedQuery = query.toLowerCase();
const results: { command: CommandDefinition; score: number }[] = [];
for (const command of this.commands.values()) {
let score = 0;
// Exact match on name
if (command.name.toLowerCase() === normalizedQuery) {
score = 100;
}
// Name starts with query
else if (command.name.toLowerCase().startsWith(normalizedQuery)) {
score = 80;
}
// Name contains query
else if (command.name.toLowerCase().includes(normalizedQuery)) {
score = 60;
}
// Description contains query
else if (command.description?.toLowerCase().includes(normalizedQuery)) {
score = 40;
}
// Check aliases
else if (command.aliases?.some(alias => alias.toLowerCase().includes(normalizedQuery))) {
score = 50;
}
if (score > 0) {
results.push({ command, score });
}
}
// Sort by score (highest first) and then by name
results.sort((a, b) => {
if (a.score !== b.score) {
return b.score - a.score;
}
return a.command.name.localeCompare(b.command.name);
});
return results.map(r => r.command);
}
async executeCommand(commandId: string) {
const command = this.getCommand(commandId);
if (!command) {
console.error(`Command not found: ${commandId}`);
return;
}
// Execute custom handler if provided
if (command.handler) {
await command.handler();
return;
}
// Handle keyboard action with scope-aware execution
if (command.keyboardAction && command.commandName) {
if (command.keyboardAction.scope === "note-tree") {
this.executeWithNoteTreeFocus(command.commandName);
} else {
appContext.triggerCommand(command.commandName);
}
return;
}
// Fallback for commands without keyboard action reference
if (command.commandName) {
appContext.triggerCommand(command.commandName);
return;
}
console.error(`Command ${commandId} has no handler or commandName`);
}
private executeWithNoteTreeFocus(actionName: CommandNames) {
const tree = document.querySelector(".tree-wrapper") as HTMLElement;
if (!tree) {
return;
}
const treeComponent = appContext.getComponentByEl(tree) as NoteTreeWidget;
treeComponent.triggerCommand(actionName, { ntxId: appContext.tabManager.activeNtxId });
}
}
const commandRegistry = new CommandRegistry();
export default commandRegistry;

View File

@@ -6,6 +6,11 @@ import type { Locale } from "@triliumnext/commons";
let locales: Locale[] | null;
/**
* A deferred promise that resolves when translations are initialized.
*/
export let translationsInitializedPromise = $.Deferred();
export async function initLocale() {
const locale = (options.get("locale") as string) || "en";
@@ -19,6 +24,8 @@ export async function initLocale() {
},
returnEmptyString: false
});
translationsInitializedPromise.resolve();
}
export function getAvailableLocales() {

View File

@@ -10,6 +10,10 @@ export interface Action {
actionName: CommandNames;
effectiveShortcuts: string[];
scope: string;
friendlyName: string;
description?: string;
iconClass?: string;
isElectronOnly?: boolean;
}
const keyboardActionsLoaded = server.get<Action[]>("keyboard-actions").then((actions) => {

View File

@@ -3,6 +3,7 @@ import appContext from "../components/app_context.js";
import noteCreateService from "./note_create.js";
import froca from "./froca.js";
import { t } from "./i18n.js";
import commandRegistry from "./command_registry.js";
import type { MentionFeedObjectItem } from "@triliumnext/ckeditor5";
// this key needs to have this value, so it's hit by the tooltip
@@ -29,9 +30,12 @@ export interface Suggestion {
notePathTitle?: string;
notePath?: string;
highlightedNotePathTitle?: string;
action?: string | "create-note" | "search-notes" | "external-link";
action?: string | "create-note" | "search-notes" | "external-link" | "command";
parentNoteId?: string;
icon?: string;
commandId?: string;
commandDescription?: string;
commandShortcut?: string;
}
interface Options {
@@ -44,6 +48,8 @@ interface Options {
hideGoToSelectedNoteButton?: boolean;
/** If set, hides all right-side buttons in the autocomplete dropdown */
hideAllButtons?: boolean;
/** If set, enables command palette mode */
isCommandPalette?: boolean;
}
async function autocompleteSourceForCKEditor(queryText: string) {
@@ -73,6 +79,31 @@ async function autocompleteSourceForCKEditor(queryText: string) {
}
async function autocompleteSource(term: string, cb: (rows: Suggestion[]) => void, options: Options = {}) {
// Check if we're in command mode
if (options.isCommandPalette && term.startsWith(">")) {
const commandQuery = term.substring(1).trim();
// Get commands (all if no query, filtered if query provided)
const commands = commandQuery.length === 0
? commandRegistry.getAllCommands()
: commandRegistry.searchCommands(commandQuery);
// Convert commands to suggestions
const commandSuggestions: Suggestion[] = commands.map(cmd => ({
action: "command",
commandId: cmd.id,
noteTitle: cmd.name,
notePathTitle: `>${cmd.name}`,
highlightedNotePathTitle: cmd.name,
commandDescription: cmd.description,
commandShortcut: cmd.shortcut,
icon: cmd.icon
}));
cb(commandSuggestions);
return;
}
const fastSearch = options.fastSearch === false ? false : true;
if (fastSearch === false) {
if (term.trim().length === 0) {
@@ -146,6 +177,12 @@ function showRecentNotes($el: JQuery<HTMLElement>) {
$el.trigger("focus");
}
function showAllCommands($el: JQuery<HTMLElement>) {
searchDelay = 0;
$el.setSelectedNotePath("");
$el.autocomplete("val", ">").autocomplete("open");
}
function fullTextSearch($el: JQuery<HTMLElement>, options: Options) {
const searchString = $el.autocomplete("val") as unknown as string;
if (options.fastSearch === false || searchString?.trim().length === 0) {
@@ -270,7 +307,24 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
},
displayKey: "notePathTitle",
templates: {
suggestion: (suggestion) => `<span class="${suggestion.icon ?? "bx bx-note"}"></span> ${suggestion.highlightedNotePathTitle}`
suggestion: (suggestion) => {
if (suggestion.action === "command") {
let html = `<div class="command-suggestion">`;
html += `<span class="command-icon ${suggestion.icon || "bx bx-terminal"}"></span>`;
html += `<div class="command-content">`;
html += `<div class="command-name">${suggestion.highlightedNotePathTitle}</div>`;
if (suggestion.commandDescription) {
html += `<div class="command-description">${suggestion.commandDescription}</div>`;
}
html += `</div>`;
if (suggestion.commandShortcut) {
html += `<kbd class="command-shortcut">${suggestion.commandShortcut}</kbd>`;
}
html += '</div>';
return html;
}
return `<span class="${suggestion.icon ?? "bx bx-note"}"></span> ${suggestion.highlightedNotePathTitle}`;
}
},
// we can't cache identical searches because notes can be created / renamed, new recent notes can be added
cache: false
@@ -280,6 +334,12 @@ function initNoteAutocomplete($el: JQuery<HTMLElement>, options?: Options) {
// TODO: Types fail due to "autocomplete:selected" not being registered in type definitions.
($el as any).on("autocomplete:selected", async (event: Event, suggestion: Suggestion) => {
if (suggestion.action === "command") {
$el.autocomplete("close");
$el.trigger("autocomplete:commandselected", [suggestion]);
return;
}
if (suggestion.action === "external-link") {
$el.setSelectedNotePath(null);
$el.setSelectedExternalLink(suggestion.externalLink);
@@ -396,6 +456,7 @@ export default {
autocompleteSourceForCKEditor,
initNoteAutocomplete,
showRecentNotes,
showAllCommands,
setText,
init
};

View File

@@ -1780,6 +1780,54 @@ textarea {
padding: 1rem;
}
/* Command palette styling */
.jump-to-note-dialog .command-suggestion {
display: flex;
align-items: center;
gap: 0.75rem;
font-size: 0.9em;
}
.jump-to-note-dialog .aa-suggestion .command-suggestion,
.jump-to-note-dialog .aa-suggestion .command-suggestion div {
padding: 0;
}
.jump-to-note-dialog .aa-cursor .command-suggestion,
.jump-to-note-dialog .aa-suggestion:hover .command-suggestion {
border-left-color: var(--link-color);
background-color: var(--hover-background-color);
}
.jump-to-note-dialog .command-icon {
color: var(--muted-text-color);
font-size: 1.125rem;
flex-shrink: 0;
margin-top: 0.125rem;
}
.jump-to-note-dialog .command-content {
flex-grow: 1;
min-width: 0;
}
.jump-to-note-dialog .command-name {
font-weight: bold;
}
.jump-to-note-dialog .command-description {
font-size: 0.8em;
line-height: 1.3;
opacity: 0.75;
}
.jump-to-note-dialog kbd.command-shortcut {
background-color: transparent;
color: inherit;
opacity: 0.75;
font-family: inherit !important;
}
.empty-table-placeholder {
text-align: center;
color: var(--muted-text-color);

View File

@@ -128,10 +128,15 @@ div.tn-tool-dialog {
.jump-to-note-dialog .modal-header {
padding: unset !important;
padding-bottom: 26px !important;
}
.jump-to-note-dialog .modal-body {
padding: 26px 0 !important;
padding: 0 !important;
}
.jump-to-note-dialog .modal-footer {
padding-top: 26px;
}
/* Search box wrapper */

View File

@@ -210,7 +210,7 @@
"okButton": "确定"
},
"jump_to_note": {
"search_placeholder": "按笔记名称搜索",
"search_placeholder": "",
"close": "关闭",
"search_button": "全文搜索 <kbd>Ctrl+回车</kbd>"
},

View File

@@ -210,7 +210,7 @@
"okButton": "OK"
},
"jump_to_note": {
"search_placeholder": "Suche nach einer Notiz anhand ihres Namens",
"search_placeholder": "",
"close": "Schließen",
"search_button": "Suche im Volltext: <kbd>Strg+Eingabetaste</kbd>"
},

View File

@@ -211,7 +211,7 @@
"okButton": "OK"
},
"jump_to_note": {
"search_placeholder": "search for note by its name",
"search_placeholder": "Search for note by its name or type > for commands...",
"close": "Close",
"search_button": "Search in full text <kbd>Ctrl+Enter</kbd>"
},
@@ -1987,5 +1987,20 @@
"delete-column-confirmation": "Are you sure you want to delete this column? The corresponding attribute will be deleted in the notes under this column as well.",
"new-item": "New item",
"add-column": "Add Column"
},
"command_palette": {
"tree-action-name": "Tree: {{name}}",
"export_note_title": "Export Note",
"export_note_description": "Export current note",
"show_attachments_title": "Show Attachments",
"show_attachments_description": "View note attachments",
"search_notes_title": "Search Notes",
"search_notes_description": "Open advanced search",
"search_subtree_title": "Search in Subtree",
"search_subtree_description": "Search within current subtree",
"search_history_title": "Show Search History",
"search_history_description": "View previous searches",
"configure_launch_bar_title": "Configure Launch Bar",
"configure_launch_bar_description": "Open the launch bar configuration, to add or remove items."
}
}

View File

@@ -211,7 +211,7 @@
"okButton": "Aceptar"
},
"jump_to_note": {
"search_placeholder": "buscar nota por su nombre",
"search_placeholder": "",
"close": "Cerrar",
"search_button": "Buscar en texto completo <kbd>Ctrl+Enter</kbd>"
},

View File

@@ -210,7 +210,7 @@
"okButton": "OK"
},
"jump_to_note": {
"search_placeholder": "rechercher une note par son nom",
"search_placeholder": "",
"close": "Fermer",
"search_button": "Rechercher dans le texte intégral <kbd>Ctrl+Entrée</kbd>"
},

View File

@@ -755,7 +755,7 @@
},
"jump_to_note": {
"search_button": "Caută în întregul conținut <kbd>Ctrl+Enter</kbd>",
"search_placeholder": "căutați o notiță după denumirea ei",
"search_placeholder": "",
"close": "Închide"
},
"left_pane_toggle": {

View File

@@ -194,7 +194,7 @@
"okButton": "確定"
},
"jump_to_note": {
"search_placeholder": "按筆記名稱搜尋",
"search_placeholder": "",
"search_button": "全文搜尋 <kbd>Ctrl+Enter</kbd>"
},
"markdown_import": {

View File

@@ -6,6 +6,7 @@ import BasicWidget from "../basic_widget.js";
import shortcutService from "../../services/shortcuts.js";
import { Modal } from "bootstrap";
import { openDialog } from "../../services/dialog.js";
import commandRegistry from "../../services/command_registry.js";
const TPL = /*html*/`<div class="jump-to-note-dialog modal mx-auto" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
@@ -34,7 +35,8 @@ export default class JumpToNoteDialog extends BasicWidget {
private modal!: bootstrap.Modal;
private $autoComplete!: JQuery<HTMLElement>;
private $results!: JQuery<HTMLElement>;
private $showInFullTextButton!: JQuery<HTMLElement>;
private $modalFooter!: JQuery<HTMLElement>;
private isCommandMode: boolean = false;
constructor() {
super();
@@ -48,13 +50,44 @@ export default class JumpToNoteDialog extends BasicWidget {
this.$autoComplete = this.$widget.find(".jump-to-note-autocomplete");
this.$results = this.$widget.find(".jump-to-note-results");
this.$showInFullTextButton = this.$widget.find(".show-in-full-text-button");
this.$showInFullTextButton.on("click", (e) => this.showInFullText(e));
this.$modalFooter = this.$widget.find(".modal-footer");
this.$modalFooter.find(".show-in-full-text-button").on("click", (e) => this.showInFullText(e));
shortcutService.bindElShortcut(this.$widget, "ctrl+return", (e) => this.showInFullText(e));
// Monitor input changes to detect command mode switches
this.$autoComplete.on("input", () => {
this.updateCommandModeState();
});
}
private updateCommandModeState() {
const currentValue = String(this.$autoComplete.val() || "");
const newCommandMode = currentValue.startsWith(">");
if (newCommandMode !== this.isCommandMode) {
this.isCommandMode = newCommandMode;
this.updateButtonVisibility();
}
}
private updateButtonVisibility() {
if (this.isCommandMode) {
this.$modalFooter.hide();
} else {
this.$modalFooter.show();
}
}
async jumpToNoteEvent() {
await this.openDialog();
}
async commandPaletteEvent() {
await this.openDialog(true);
}
private async openDialog(commandMode = false) {
const dialogPromise = openDialog(this.$widget);
if (utils.isMobile()) {
dialogPromise.then(($dialog) => {
@@ -81,42 +114,76 @@ export default class JumpToNoteDialog extends BasicWidget {
}
// first open dialog, then refresh since refresh is doing focus which should be visible
this.refresh();
this.refresh(commandMode);
this.lastOpenedTs = Date.now();
}
async refresh() {
async refresh(commandMode = false) {
noteAutocompleteService
.initNoteAutocomplete(this.$autoComplete, {
allowCreatingNotes: true,
hideGoToSelectedNoteButton: true,
allowJumpToSearchNotes: true,
container: this.$results[0]
container: this.$results[0],
isCommandPalette: true
})
// clear any event listener added in previous invocation of this function
.off("autocomplete:noteselected")
.off("autocomplete:commandselected")
.on("autocomplete:noteselected", function (event, suggestion, dataset) {
if (!suggestion.notePath) {
return false;
}
appContext.tabManager.getActiveContext()?.setNote(suggestion.notePath);
})
.on("autocomplete:commandselected", async (event, suggestion, dataset) => {
if (!suggestion.commandId) {
return false;
}
this.modal.hide();
await commandRegistry.executeCommand(suggestion.commandId);
});
// if you open the Jump To dialog soon after using it previously, it can often mean that you
// actually want to search for the same thing (e.g., you opened the wrong note at first try)
// so we'll keep the content.
// if it's outside of this time limit, then we assume it's a completely new search and show recent notes instead.
if (Date.now() - this.lastOpenedTs > KEEP_LAST_SEARCH_FOR_X_SECONDS * 1000) {
noteAutocompleteService.showRecentNotes(this.$autoComplete);
if (commandMode) {
// Start in command mode - manually trigger command search
this.$autoComplete.autocomplete("val", ">");
this.isCommandMode = true;
this.updateButtonVisibility();
// Manually populate with all commands immediately
noteAutocompleteService.showAllCommands(this.$autoComplete);
this.$autoComplete.trigger("focus");
} else {
this.$autoComplete
// hack, the actual search value is stored in <pre> element next to the search input
// this is important because the search input value is replaced with the suggestion note's title
.autocomplete("val", this.$autoComplete.next().text())
.trigger("focus")
.trigger("select");
// if you open the Jump To dialog soon after using it previously, it can often mean that you
// actually want to search for the same thing (e.g., you opened the wrong note at first try)
// so we'll keep the content.
// if it's outside of this time limit, then we assume it's a completely new search and show recent notes instead.
if (Date.now() - this.lastOpenedTs > KEEP_LAST_SEARCH_FOR_X_SECONDS * 1000) {
this.isCommandMode = false;
this.updateButtonVisibility();
noteAutocompleteService.showRecentNotes(this.$autoComplete);
} else {
this.$autoComplete
// hack, the actual search value is stored in <pre> element next to the search input
// this is important because the search input value is replaced with the suggestion note's title
.autocomplete("val", this.$autoComplete.next().text())
.trigger("focus")
.trigger("select");
// Update command mode state based on the restored value
this.updateCommandModeState();
// If we restored a command mode value, manually trigger command display
if (this.isCommandMode) {
// Clear the value first, then set it to ">" to trigger a proper change
this.$autoComplete.autocomplete("val", "");
noteAutocompleteService.showAllCommands(this.$autoComplete);
}
}
}
}
@@ -125,6 +192,11 @@ export default class JumpToNoteDialog extends BasicWidget {
e.preventDefault();
e.stopPropagation();
// Don't perform full text search in command mode
if (this.isCommandMode) {
return;
}
const searchString = String(this.$autoComplete.val());
this.triggerCommand("searchNotes", { searchString });

View File

@@ -3,7 +3,7 @@ import utils from "../../../services/utils.js";
import dialogService from "../../../services/dialog.js";
import OptionsWidget from "./options_widget.js";
import { t } from "../../../services/i18n.js";
import type { OptionNames, KeyboardShortcut } from "@triliumnext/commons";
import type { OptionNames, KeyboardShortcut, KeyboardShortcutWithRequiredActionName } from "@triliumnext/commons";
const TPL = /*html*/`
<div class="options-section shortcuts-options-section tn-no-card">
@@ -75,10 +75,10 @@ export default class KeyboardShortcutsOptions extends OptionsWidget {
for (const action of actions) {
const $tr = $("<tr>");
if (action.separator) {
if ("separator" in action) {
$tr.append($('<td class="separator" colspan="4">').attr("style", "background-color: var(--accented-background-color); font-weight: bold;").text(action.separator));
} else if (action.defaultShortcuts && action.actionName) {
$tr.append($("<td>").text(action.actionName))
$tr.append($("<td>").text(action.friendlyName))
.append(
$("<td>").append(
$(`<input type="text" class="form-control">`)
@@ -145,9 +145,9 @@ export default class KeyboardShortcutsOptions extends OptionsWidget {
return;
}
const action = globActions.find((act) => act.actionName === actionName);
const action = globActions.find((act) => "actionName" in act && act.actionName === actionName) as KeyboardShortcutWithRequiredActionName;
if (!action || !action.actionName) {
if (!action) {
this.$widget.find(el).hide();
return;
}
@@ -157,6 +157,7 @@ export default class KeyboardShortcutsOptions extends OptionsWidget {
.toggle(
!!(
action.actionName.toLowerCase().includes(filter) ||
(action.friendlyName && action.friendlyName.toLowerCase().includes(filter)) ||
(action.defaultShortcuts ?? []).some((shortcut) => shortcut.toLowerCase().includes(filter)) ||
(action.effectiveShortcuts ?? []).some((shortcut) => shortcut.toLowerCase().includes(filter)) ||
(action.description && action.description.toLowerCase().includes(filter))

View File

@@ -354,6 +354,9 @@
"build"
],
"command": "vitest --config {projectRoot}/vitest.build.config.mts"
},
"circular-deps": {
"command": "pnpx dpdm -T {projectRoot}/src/**/*.ts --tree=false --warning=false --skip-dynamic-imports=circular"
}
}
},

File diff suppressed because one or more lines are too long

View File

@@ -1,33 +0,0 @@
<figure class="image image-style-align-center">
<img style="aspect-ratio:991/403;" src="Jump to Note_image.png" width="991"
height="403">
</figure>
<p>The <em>Jump to Note</em> function allows easy navigation between notes
by searching for their title. In addition to that, it can also trigger
a full search or create notes.</p>
<h2>Entering jump to note</h2>
<ul>
<li>In the&nbsp;<a class="reference-link" href="#root/_help_xYmIYSP6wE3F">Launch Bar</a>,
press
<img src="1_Jump to Note_image.png">button.</li>
<li>Using the keyboard, press <kbd>Ctrl</kbd> + <kbd>J</kbd>.</li>
</ul>
<h2>Recent notes</h2>
<p>Jump to note also has the ability to show the list of recently viewed
/ edited notes and quickly jump to it.</p>
<p>To access this functionality, click on <code>Jump to</code> button on the
top. By default, (when nothing is entered into autocomplete), this dialog
will show the list of recent notes.</p>
<p>Alternatively you can click on the "time" icon on the right.</p>
<img src="Jump to Note_recent-notes.gif"
width="812" height="585">
<h2>Interaction</h2>
<ul>
<li>By default, when there is no text entered it will display the most recent
notes.</li>
<li>Using the keyboard, use the up or down arrow keys to navigate between
items. Press <kbd>Enter</kbd> to open the desired note.</li>
<li>If the note doesn't exist, it's possible to create it by typing the desired
note title and selecting the <em>Create and link child note</em> option.</li>
</ul>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

View File

@@ -0,0 +1,78 @@
<figure class="image image-style-align-center">
<img style="aspect-ratio:991/403;" src="1_Jump to_image.png" width="991"
height="403">
</figure>
<h2>Jump to Note</h2>
<p>The <em>Jump to Note</em> function allows easy navigation between notes
by searching for their title. In addition to that, it can also trigger
a full search or create notes.</p>
<p>To enter the “Jump to” dialog:</p>
<ul>
<li data-list-item-id="e32758a67e793732cf0a2b23559bf47e2">In the&nbsp;<a class="reference-link" href="#root/_help_xYmIYSP6wE3F">Launch Bar</a>,
press
<img src="2_Jump to_image.png">button.</li>
<li data-list-item-id="ef176c16aa548f5b60f83fbd571f8b2db">Using the keyboard, press <kbd>Ctrl</kbd> + <kbd>J</kbd>.</li>
</ul>
<p>In addition to searching for notes, it is also possible to search for
commands. See the dedicated section below for more information.</p>
<h3>Interaction</h3>
<ul>
<li data-list-item-id="e557396da361d4edc191507782cc3b0ec">By default, when there is no text entered it will display the most recent
notes.</li>
<li data-list-item-id="ead4c4587b1fcb9758a09696dc25da645">Using the keyboard, use the up or down arrow keys to navigate between
items. Press <kbd>Enter</kbd> to open the desired note.</li>
<li data-list-item-id="ed4a932ed462ca4a089abc4a268e21aad">If the note doesn't exist, it's possible to create it by typing the desired
note title and selecting the <em>Create and link child note</em> option.</li>
</ul>
<h2>Recent notes</h2>
<p>Jump to note also has the ability to show the list of recently viewed
/ edited notes and quickly jump to it.</p>
<p>To access this functionality, click on <code>Jump to</code> button on the
top. By default, (when nothing is entered into autocomplete), this dialog
will show the list of recent notes.</p>
<p>Alternatively you can click on the "time" icon on the right.</p>
<h2>Command Palette</h2>
<figure class="image image-style-align-center">
<img style="aspect-ratio:982/524;" src="Jump to_image.png" width="982"
height="524">
</figure>
<p>The command palette is a feature which allows easy execution of various
commands that can be found throughout the application, such as from menus
or keyboard shortcuts. This feature integrates directly into the “Jump
to” dialog.</p>
<h3>Interaction</h3>
<p>To trigger the command palette:</p>
<ul>
<li data-list-item-id="eace3b93758628f9dd7b554e6536d9e0f">Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>J</kbd> to display the command
palette directly.</li>
<li data-list-item-id="e848cc1df0264b1e4e766d6d35fd69336">If in the “Jump to” dialog, type <code>&gt;</code> in the search to switch
to the command palette.</li>
</ul>
<p>Interaction:</p>
<ul>
<li data-list-item-id="e53759821c15fdd85ec616172434c1bfe">Type a few words to filter between commands.</li>
<li data-list-item-id="e344bd271c6fc35f48b1fed1137ac8725">Use the up and down arrows on the keyboard or the mouse to select a command.</li>
<li
data-list-item-id="ea66008550eb3c827f2880c85b68bf861">Press <kbd>Enter</kbd> to execute the command.</li>
</ul>
<p>To exit the command palette:</p>
<ul>
<li data-list-item-id="ea31cb4776c2e8b13b0a19eea437512fe">Remove the <code>&gt;</code> in the search to go back to the note search.</li>
<li
data-list-item-id="e6b92147aba5dc5b1e329ad22a3336703">Press <kbd>Esc</kbd> to dismiss the dialog entirely.</li>
</ul>
<h3>Options available</h3>
<p>Currently the following options are displayed:</p>
<ul>
<li data-list-item-id="eac227ab112677ff1f1900322df6d9ce9">Most of the&nbsp;<a class="reference-link" href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/_help_A9Oc6YKKc65v">Keyboard Shortcuts</a>&nbsp;have
an entry, with the exception of those that are too specific to be run from
a dialog.</li>
<li data-list-item-id="e3e1230fdeeb3101a2b1fb08d8d578f4b">Some additional options which are not yet available as keyboard shortcuts,
but can be accessed from various menus such as: exporting a note, showing
attachments, searching for notes or configuring the&nbsp;<a class="reference-link"
href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/Vc8PjrjAGuOp/_help_xYmIYSP6wE3F">Launch Bar</a>.</li>
</ul>
<h3>Limitations</h3>
<p>Currently it's not possible to define custom actions that are displayed
in the command palette. In the future this might change by integrating
the options in the launch bar, which can be customized if needed.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@@ -4,31 +4,29 @@
child notes into one continuous view. This makes it ideal for reading extensive
information broken into smaller, manageable segments.</p>
<ul>
<li data-list-item-id="e7f3117635b8c3e905c71f2839e331942"><a class="reference-link" href="#root/_help_8QqnMzx393bx">Grid View</a>&nbsp;which
<li><a class="reference-link" href="#root/_help_8QqnMzx393bx">Grid View</a>&nbsp;which
is the default presentation method for child notes (see&nbsp;<a class="reference-link"
href="#root/_help_0ESUbbAxVnoK">Note List</a>), where the notes are displayed
as tiles with their title and content being visible.</li>
<li data-list-item-id="e27a2ec6976e44512c9c52ba8d7a2ef76"><a class="reference-link" href="#root/_help_mULW0Q3VojwY">List View</a>&nbsp;is
<li><a class="reference-link" href="#root/_help_mULW0Q3VojwY">List View</a>&nbsp;is
similar to&nbsp;<a class="reference-link" href="#root/_help_8QqnMzx393bx">Grid View</a>,
but it displays the notes one under the other with the content being expandable/collapsible,
but also works recursively.</li>
</ul>
<p>More specialized collections were introduced, such as the:</p>
<ul>
<li data-list-item-id="eae5c2f56f9a75e7ed813fe419d4a05a4"><a class="reference-link" href="#root/_help_xWbu3jpNWapp">Calendar View</a>&nbsp;which
<li><a class="reference-link" href="#root/_help_xWbu3jpNWapp">Calendar View</a>&nbsp;which
displays a week, month or year calendar with the notes being shown as events.
New events can be added easily by dragging across the calendar.</li>
<li
data-list-item-id="e24642a7a4c2443497fd814d78f1ca784"><a class="reference-link" href="#root/_help_81SGnPGMk7Xc">Geo Map View</a>&nbsp;which
<li><a class="reference-link" href="#root/_help_81SGnPGMk7Xc">Geo Map View</a>&nbsp;which
displays a geographical map in which the notes are represented as markers/pins
on the map. New events can be easily added by pointing on the map.</li>
<li
data-list-item-id="eaa80d024c07145aa8f4443d86b01295e"><a class="reference-link" href="#root/_help_2FvYrpmOXm29">Table View</a>&nbsp;displays
each note as a row in a table, with&nbsp;<a class="reference-link" href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;being
shown as well. This makes it easy to visualize attributes of notes, as
well as making them easily editable.</li>
<li data-list-item-id="ec7243729048b57d173e3f7dfb232adca"><a class="reference-link" href="#root/pOsGYCXsbNQG/KSZ04uQ2D1St/GTwFsgaA0lCt/_help_CtBQqbwXDx1w">Board View</a>&nbsp;(Kanban)
displays notes in columns, grouped by the value of a label.</li>
<li><a class="reference-link" href="#root/_help_2FvYrpmOXm29">Table View</a>&nbsp;displays
each note as a row in a table, with&nbsp;<a class="reference-link" href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;being
shown as well. This makes it easy to visualize attributes of notes, as
well as making them easily editable.</li>
<li><a class="reference-link" href="#root/_help_CtBQqbwXDx1w">Board View</a>&nbsp;(Kanban)
displays notes in columns, grouped by the value of a label.</li>
</ul>
<p>For a quick presentation of all the supported view types, see the child
notes of this help page, including screenshots.</p>
@@ -39,13 +37,13 @@
<h2>Use cases</h2>
<h3>Creating a new collection</h3>
<p>To create a new collections, right click in the&nbsp;<a class="reference-link"
href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/Vc8PjrjAGuOp/_help_oPVyFC7WL2Lp">Note Tree</a>&nbsp;and
look for the <em>Collections</em> entry and select the desired type.</p>
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>&nbsp;and look for the <em>Collections</em> entry
and select the desired type.</p>
<h3>Adding a description to a collection</h3>
<p>To add a text before the collection, for example to describe it:</p>
<ol>
<li data-list-item-id="e7eaebf201ba06033f72b0c556aa7bfb9">Create a new collection.</li>
<li data-list-item-id="ecf21cdac7d4b10dbf7015fa4811cae6a">In the&nbsp;<a class="reference-link" href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/Vc8PjrjAGuOp/_help_BlN9DFI679QC">Ribbon</a>,
<li>Create a new collection.</li>
<li>In the&nbsp;<a class="reference-link" href="#root/_help_BlN9DFI679QC">Ribbon</a>,
go to <em>Basic Properties</em> and change the note type from <em>Collection</em> to <em>Text</em>.</li>
</ol>
<p>Now the text will be displayed above while still maintaining the collection
@@ -60,13 +58,13 @@
<p>By default, collections come with a default configuration and sometimes
even sample notes. To create a collection completely from scratch:</p>
<ol>
<li data-list-item-id="ec1bab7b7f39744ea42e187c10b7d7216">Create a new note of type <em>Text</em> (or any type).</li>
<li data-list-item-id="edcd0acc96fef97ba37695cd69c19a1b6">In the&nbsp;<a class="reference-link" href="#root/pOsGYCXsbNQG/gh7bpGYxajRS/Vc8PjrjAGuOp/_help_BlN9DFI679QC">Ribbon</a>,
<li>Create a new note of type <em>Text</em> (or any type).</li>
<li>In the&nbsp;<a class="reference-link" href="#root/_help_BlN9DFI679QC">Ribbon</a>,
go to <em>Basic Properties</em> and select <em>Collection</em> as the note
type.</li>
<li data-list-item-id="e48769aec6e389d541c275f59220f032e">Still in the ribbon, go to <em>Collection Properties</em> and select the
<li>Still in the ribbon, go to <em>Collection Properties</em> and select the
desired view type.</li>
<li data-list-item-id="e5d79e0729f8daaae2c32cce773898464">Consult the help page of the corresponding view type in order to understand
<li>Consult the help page of the corresponding view type in order to understand
how to configure them.</li>
</ol>
<h2>Under the hood</h2>

View File

@@ -11,58 +11,57 @@
then groups each note by the value of the status attribute.</p>
<p>Notes are displayed recursively, so even the child notes of the child
notes will be displayed. However, unlike the&nbsp;<a class="reference-link"
href="#root/pOsGYCXsbNQG/KSZ04uQ2D1St/GTwFsgaA0lCt/_help_2FvYrpmOXm29">Table View</a>,
the notes are not displayed in a hierarchy.</p>
href="#root/_help_2FvYrpmOXm29">Table View</a>, the notes are not displayed
in a hierarchy.</p>
<h2>Interaction with columns</h2>
<ul>
<li data-list-item-id="e6753be6b26c46c035671af86289cf196">Create a new column by pressing <em>Add Column</em> near the last column.
<li>Create a new column by pressing <em>Add Column</em> near the last column.
<ul>
<li data-list-item-id="ea187c3f44d40774c710edf7d741a236c">Once pressed, a text box will be displayed to set the name of the column.
<li>Once pressed, a text box will be displayed to set the name of the column.
Press Enter to confirm.</li>
</ul>
</li>
<li data-list-item-id="e71e0e606cc30bcaac9c20ac2dd03a8a5">To reorder a column, simply hold the mouse over the title and drag it
<li>To reorder a column, simply hold the mouse over the title and drag it
to the desired position.</li>
<li data-list-item-id="eacc6f67c9dc1d0a1e7ac4ee510f7ed25">To delete a column, right click on its title and select <em>Delete column</em>.</li>
<li
data-list-item-id="e37fbd5727f5291bdec059d3fd4867ac6">To rename a column, click on the note title.
<li>To delete a column, right click on its title and select <em>Delete column</em>.</li>
<li>To rename a column, click on the note title.
<ul>
<li data-list-item-id="e1bfd26a676d955394313f50331408495">Press Enter to confirm.</li>
<li data-list-item-id="ec1c42fc21c88b816843f64edd695fde5">Upon renaming a column, the corresponding status attribute of all its
<li>Press Enter to confirm.</li>
<li>Upon renaming a column, the corresponding status attribute of all its
notes will be changed in bulk.</li>
</ul>
</li>
<li data-list-item-id="eb357e9f42fcf948eca6212aeb209a5a1">If there are many columns, use the mouse wheel to scroll.</li>
</li>
<li>If there are many columns, use the mouse wheel to scroll.</li>
</ul>
<h2>Interaction with notes</h2>
<ul>
<li data-list-item-id="e3acf3f583b9ed1a7e71bfe6cc9e1f3c1">Create a new note in any column by pressing <em>New item</em>
<li>Create a new note in any column by pressing <em>New item</em>
<ul>
<li data-list-item-id="eb77dd064c0073c486b6532937eb7d277">Enter the name of the note and press <em>Enter</em>.</li>
<li data-list-item-id="e114392d875aa7259c6a4d49de817e659">Doing so will create a new note. The new note will have an attribute (<code>status</code> label
<li>Enter the name of the note and press <em>Enter</em>.</li>
<li>Doing so will create a new note. The new note will have an attribute (<code>status</code> label
by default) set to the name of the column.</li>
</ul>
</li>
<li data-list-item-id="e18de462534a4514576912310181a6c5b">To change the state of a note, simply drag a note from one column to the
<li>To change the state of a note, simply drag a note from one column to the
other to change its state.</li>
<li data-list-item-id="eea36d097a82322804e0878e09b83d5dc">The order of the notes in each column corresponds to their position in
<li>The order of the notes in each column corresponds to their position in
the tree.
<ul>
<li data-list-item-id="ea374f8fd30bfbdeb07b98b8bb56c8565">It's possible to reorder notes simply by dragging them to the desired
<li>It's possible to reorder notes simply by dragging them to the desired
position within the same columns.</li>
<li data-list-item-id="ea65032b5bb4a4ace6b551877bf695831">It's also possible to drag notes across columns, at the desired position.</li>
<li>It's also possible to drag notes across columns, at the desired position.</li>
</ul>
</li>
<li data-list-item-id="e17382c245068b6f396d96240628efeaa">For more options, right click on a note to display a context menu with
<li>For more options, right click on a note to display a context menu with
the following options:
<ul>
<li data-list-item-id="eae617b894b3dad9d9efa0637eeae3a58">Open the note in a new tab/split/window or quick edit.</li>
<li data-list-item-id="e2d699e050e30c9b5f7b105fe613df26d">Move the note to any column.</li>
<li data-list-item-id="e10c62ae541b53d1dc224c57cdde27ace">Insert a new note above/below the current one.</li>
<li data-list-item-id="e2a66bb1230add7d14d1e7f90507bd138">Delete the current note.</li>
<li>Open the note in a new tab/split/window or quick edit.</li>
<li>Move the note to any column.</li>
<li>Insert a new note above/below the current one.</li>
<li>Delete the current note.</li>
</ul>
</li>
<li data-list-item-id="e8f9888bf5fcb78fd22511a5d6402e313">If there are many notes within the column, move the mouse over the column
<li>If there are many notes within the column, move the mouse over the column
and use the mouse wheel to scroll.</li>
</ul>
<h2>Configuration</h2>
@@ -78,7 +77,5 @@ class="admonition note">
<h2>Interaction</h2>
<h2>Limitations</h2>
<ul>
<li data-list-item-id="eadd96ee9c3bfbf8fd1ba282fffa0c5f1">It is not possible yet to use group by a relation, only by label.</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<li>It is not possible yet to use group by a relation, only by label.</li>
</ul>

View File

@@ -8,31 +8,31 @@
<h2>How it works</h2>
<p>The tabular structure is represented as such:</p>
<ul>
<li data-list-item-id="ea0418f143b93a19ec996f3e66444c23a">Each child note is a row in the table.</li>
<li data-list-item-id="e37df536f3b11b4294297e7b6134428f9">If child rows also have children, they will be displayed under an expander
<li>Each child note is a row in the table.</li>
<li>If child rows also have children, they will be displayed under an expander
(nested notes).</li>
<li data-list-item-id="ebd16c84c37c2d3782567cf4d23701354">Each column is a <a href="#root/_help_OFXdgB2nNk1F">promoted attribute</a> that
<li>Each column is a <a href="#root/_help_OFXdgB2nNk1F">promoted attribute</a> that
is defined on the Collection note.
<ul>
<li data-list-item-id="ea05f5ec1c0c315b37f05bbb3a045583a">Actually, both promoted and unpromoted attributes are supported, but it's
<li>Actually, both promoted and unpromoted attributes are supported, but it's
a requirement to use a label/relation definition.</li>
<li data-list-item-id="e2ef130cc4d15f788e50daf210847cbbb">The promoted attributes are usually defined as inheritable in order to
<li>The promoted attributes are usually defined as inheritable in order to
show up in the child notes, but it's not a requirement.</li>
</ul>
</li>
<li data-list-item-id="e1cb6afc55de7e7d038e5dc2592604e7d">If there are multiple attribute definitions with the same <code>name</code>,
<li>If there are multiple attribute definitions with the same <code>name</code>,
only one will be displayed.</li>
</ul>
<p>There are also a few predefined columns:</p>
<ul>
<li data-list-item-id="e0ee40aa88c6ec67050cf582e1de2a511">The current item number, identified by the <code>#</code> symbol.
<li>The current item number, identified by the <code>#</code> symbol.
<ul>
<li data-list-item-id="e0658c976040c3dd7d7d516f3e81b5dd6">This simply counts the note and is affected by sorting.</li>
<li>This simply counts the note and is affected by sorting.</li>
</ul>
</li>
<li data-list-item-id="ee40b5cf3b77d956abee6bbed0781c1aa"><a class="reference-link" href="#root/_help_m1lbrzyKDaRB">Note ID</a>,
<li><a class="reference-link" href="#root/_help_m1lbrzyKDaRB">Note ID</a>,
representing the unique ID used internally by Trilium</li>
<li data-list-item-id="e4e24776fc43d49b40924a55037bae164">The title of the note.</li>
<li>The title of the note.</li>
</ul>
<h2>Interaction</h2>
<h3>Creating a new table</h3>
@@ -43,18 +43,17 @@
is defined on the Collection note.</p>
<p>To create a new column, either:</p>
<ul>
<li data-list-item-id="e9d4c7b075e3f2fe9f6df45cd06a3a2b2">Press <em>Add new column</em> at the bottom of the table.</li>
<li data-list-item-id="ef66e5ebb0af38d4db86743365f6ec3a7">Right click on an existing column and select Add column to the left/right.</li>
<li
data-list-item-id="ecd0e68e741ce8bb304a40d878e5745a0">Right click on the empty space of the column header and select <em>Label</em> or <em>Relation</em> in
<li>Press <em>Add new column</em> at the bottom of the table.</li>
<li>Right click on an existing column and select Add column to the left/right.</li>
<li>Right click on the empty space of the column header and select <em>Label</em> or <em>Relation</em> in
the <em>New column</em> section.</li>
</ul>
<h3>Adding new rows</h3>
<p>Each row is actually a note that is a child of the Collection note.</p>
<p>To create a new note, either:</p>
<ul>
<li data-list-item-id="eba76a40653e728455961488b44e2c88a">Press <em>Add new row</em> at the bottom of the table.</li>
<li data-list-item-id="efcdd260648c64133366baaedbe9fae5e">Right click on an existing row and select <em>Insert row above, Insert child note</em> or <em>Insert row below</em>.</li>
<li>Press <em>Add new row</em> at the bottom of the table.</li>
<li>Right click on an existing row and select <em>Insert row above, Insert child note</em> or <em>Insert row below</em>.</li>
</ul>
<p>By default it will try to edit the title of the newly created note.</p>
<p>Alternatively, the note can be created from the&nbsp;<a class="reference-link"
@@ -62,28 +61,27 @@
<h3>Context menu</h3>
<p>There are multiple menus:</p>
<ul>
<li data-list-item-id="e10284169a0dc36c347245a6fc5a4a0d2">Right clicking on a column, allows:
<li>Right clicking on a column, allows:
<ul>
<li data-list-item-id="e959d44a502767362e7fc02e5eadae03e">Sorting by the selected column and resetting the sort.</li>
<li data-list-item-id="e457f7bc4d135083c2b4c6b4faaabc7fe">Hiding the selected column or adjusting the visibility of every column.</li>
<li
data-list-item-id="e64b21e19754d7d2e4b1c4f4099b3bacc">Adding new columns to the left or the right of the column.</li>
<li data-list-item-id="edde6b9b4713d8c7c0892be2f1165bde6">Editing the current column.</li>
<li data-list-item-id="edd1a26953073beefb0c103c57b513a08">Deleting the current column.</li>
</ul>
</li>
<li data-list-item-id="eb1288eb3e94b2bf5cd6b400039717edf">Right clicking on the space to the right of the columns, allows:
<ul>
<li data-list-item-id="ee3ff68651c4c766b15470344a2648860">Adjusting the visibility of every column.</li>
<li data-list-item-id="e00cc86778fa0fa85734fc01b74e25279">Adding new columns.</li>
<li>Sorting by the selected column and resetting the sort.</li>
<li>Hiding the selected column or adjusting the visibility of every column.</li>
<li>Adding new columns to the left or the right of the column.</li>
<li>Editing the current column.</li>
<li>Deleting the current column.</li>
</ul>
</li>
<li data-list-item-id="e913b95accaf874e109db9905b5b6f3b5">Right clicking on a row, allows:
<li>Right clicking on the space to the right of the columns, allows:
<ul>
<li data-list-item-id="e4e7e38228abfb58c37ffc68616a8da6e">Opening the corresponding note of the row in a new tab, split, window
<li>Adjusting the visibility of every column.</li>
<li>Adding new columns.</li>
</ul>
</li>
<li>Right clicking on a row, allows:
<ul>
<li>Opening the corresponding note of the row in a new tab, split, window
or quick editing it.</li>
<li data-list-item-id="ea949a04a7a9c9f5d7979140684218298">Inserting rows above, below or as a child note.</li>
<li data-list-item-id="e8d2f38f590deb56dce4bd880da02e2fa">Deleting the row.</li>
<li>Inserting rows above, below or as a child note.</li>
<li>Deleting the row.</li>
</ul>
</li>
</ul>
@@ -92,18 +90,17 @@
not only reflect in the table, but also as an attribute of the corresponding
note.</p>
<ul>
<li data-list-item-id="ef5625b0a34c060243caf9297a2c959d8">The editing will respect the type of the promoted attribute, by presenting
<li>The editing will respect the type of the promoted attribute, by presenting
a normal text box, a number selector or a date selector for example.</li>
<li
data-list-item-id="eccf0c928672039b793c4566d54ec8419">It also possible to change the title of a note.</li>
<li data-list-item-id="e50644ab190ff6911af490ca1ad732a53">Editing relations is also possible
<ul>
<li data-list-item-id="e6853711436a0f878786636d984df73e4">Simply click on a relation and it will become editable. Enter the text
to look for a note and click on it.</li>
<li data-list-item-id="e8d9cc912c0025ea78931b15979cbcfc6">To remove a relation, remove the title of the note from the text box and
click outside the cell.</li>
</ul>
</li>
<li>It also possible to change the title of a note.</li>
<li>Editing relations is also possible
<ul>
<li>Simply click on a relation and it will become editable. Enter the text
to look for a note and click on it.</li>
<li>To remove a relation, remove the title of the note from the text box and
click outside the cell.</li>
</ul>
</li>
</ul>
<h3>Editing columns</h3>
<p>It is possible to edit a column by right clicking it and selecting <em>Edit column.</em> This
@@ -117,19 +114,18 @@
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>. However, it is possible
to sort the data by the values of a column:</p>
<ul>
<li data-list-item-id="e9866b3e8697d3c7d480bb32d2df2fe4f">To do so, simply click on a column.</li>
<li data-list-item-id="e1315c18a23aabbdcc9c36641c4d22ed8">To switch between ascending or descending sort, simply click again on
<li>To do so, simply click on a column.</li>
<li>To switch between ascending or descending sort, simply click again on
the same column. The arrow next to the column will indicate the direction
of the sort.</li>
<li data-list-item-id="e8de6519ff78c55846e8ad949efdb1749">To disable sorting and fall back to the original order, right click any
<li>To disable sorting and fall back to the original order, right click any
column on the header and select <em>Clear sorting.</em>
</li>
</ul>
<h3>Reordering and hiding columns</h3>
<ul>
<li data-list-item-id="e9db498cf4b735211bfab6d8a897f0614">Columns can be reordered by dragging the header of the columns.</li>
<li
data-list-item-id="ec435139e49644765cc9fa36dee3f28ce">Columns can be hidden or shown by right clicking on a column and clicking
<li>Columns can be reordered by dragging the header of the columns.</li>
<li>Columns can be hidden or shown by right clicking on a column and clicking
the item corresponding to the column.</li>
</ul>
<h3>Reordering rows</h3>
@@ -140,12 +136,10 @@
href="#root/_help_oPVyFC7WL2Lp">Note Tree</a>.</p>
<p>Reordering does have some limitations:</p>
<ul>
<li data-list-item-id="e3ecbfd2eb395e49cf755279ed1ce96bc">If the parent note has <code>#sorted</code>, reordering will be disabled.</li>
<li
data-list-item-id="e74f74d42cf30cf51d548b25e68397e33">If using nested tables, then reordering will also be disabled.</li>
<li
data-list-item-id="e750f0e2ba77e7123a1a0390bb6138e51">Currently, it's possible to reorder notes even if column sorting is used,
but the result might be inconsistent.</li>
<li>If the parent note has <code>#sorted</code>, reordering will be disabled.</li>
<li>If using nested tables, then reordering will also be disabled.</li>
<li>Currently, it's possible to reorder notes even if column sorting is used,
but the result might be inconsistent.</li>
</ul>
<h3>Nested trees</h3>
<p>If the child notes of the collection also have their own child notes,
@@ -156,27 +150,27 @@
to a certain number of levels or even disable it completely. To do so,
either:</p>
<ul>
<li data-list-item-id="e48a95d7d971cadd6f1b53e25d567be7e">Go to <em>Collection Properties</em> in the&nbsp;<a class="reference-link"
<li>Go to <em>Collection Properties</em> in the&nbsp;<a class="reference-link"
href="#root/_help_BlN9DFI679QC">Ribbon</a>&nbsp;and look for the <em>Max nesting depth</em> section.
<ul>
<li data-list-item-id="e18de613a0eb1a49d8c1629ea99602d22">To disable nesting, type 0 and press Enter.</li>
<li data-list-item-id="e5d184ff1aa8a060900fd5a8e3cb78c56">To limit to a certain depth, type in the desired number (e.g. 2 to only
<li>To disable nesting, type 0 and press Enter.</li>
<li>To limit to a certain depth, type in the desired number (e.g. 2 to only
display children and sub-children).</li>
<li data-list-item-id="e9e083d9f55b6658e88651bc005d3519f">To re-enable unlimited nesting, remove the number and press Enter.</li>
<li>To re-enable unlimited nesting, remove the number and press Enter.</li>
</ul>
</li>
<li data-list-item-id="e6a4e204e9145abbceebcc96787a61183">Manually set <code>maxNestingDepth</code> to the desired value.</li>
<li>Manually set <code>maxNestingDepth</code> to the desired value.</li>
</ul>
<p>Limitations:</p>
<ul>
<li data-list-item-id="ea837ad3a83df0a8939a2cc0d586cf58f">While in this mode, it's not possible to reorder notes.</li>
<li>While in this mode, it's not possible to reorder notes.</li>
</ul>
<h2>Limitations</h2>
<ul>
<li data-list-item-id="efcbcbbae267cd2ed3ddac4d512a6c5a1">Multi-value labels and relations are not supported. If a&nbsp;<a class="reference-link"
<li>Multi-value labels and relations are not supported. If a&nbsp;<a class="reference-link"
href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;is defined
with a <em>Multi value</em> specificity, they will be ignored.</li>
<li data-list-item-id="e8eb7e91706b56513d6f85828a7afa02f">There is no support to filter the rows by a certain criteria. Consider
<li>There is no support to filter the rows by a certain criteria. Consider
using the table view in search for that use case.</li>
</ul>
<h2>Use in search</h2>
@@ -187,8 +181,8 @@
of the&nbsp;<a class="reference-link" href="#root/_help_eIg8jdvaoNNd">Search</a>.</p>
<p>However, there are also some limitations:</p>
<ul>
<li data-list-item-id="ee0798fde43ca865be18aef52b5a4adf4">It's not possible to reorder notes.</li>
<li data-list-item-id="e9a31c753b79285e3db51c4f71764a8ba">It's not possible to add a new row.</li>
<li>It's not possible to reorder notes.</li>
<li>It's not possible to add a new row.</li>
</ul>
<p>Columns are supported, by being defined as&nbsp;<a class="reference-link"
href="#root/_help_OFXdgB2nNk1F">Promoted Attributes</a>&nbsp;to the&nbsp;

View File

@@ -220,7 +220,6 @@
"go-to-next-note-title": "跳转到下一条笔记",
"new-note-title": "新建笔记",
"search-notes-title": "搜索笔记",
"jump-to-note-title": "跳转到笔记",
"calendar-title": "日历",
"recent-changes-title": "最近更改",
"bookmarks-title": "书签",

View File

@@ -212,7 +212,6 @@
"go-to-next-note-title": "Zur nächsten Notiz gehen",
"new-note-title": "Neue Notiz",
"search-notes-title": "Notizen durchsuchen",
"jump-to-note-title": "Zur Notiz springen",
"calendar-title": "Kalender",
"recent-changes-title": "neue Änderungen",
"bookmarks-title": "Lesezeichen",

View File

@@ -3,6 +3,7 @@
"back-in-note-history": "Navigate to previous note in history",
"forward-in-note-history": "Navigate to next note in history",
"open-jump-to-note-dialog": "Open \"Jump to note\" dialog",
"open-command-palette": "Open command palette",
"scroll-to-active-note": "Scroll note tree to active note",
"quick-search": "Activate quick search bar",
"search-in-subtree": "Search for notes in the active note's subtree",
@@ -21,8 +22,8 @@
"move-note-down-in-hierarchy": "Move note down in hierarchy",
"edit-note-title": "Jump from tree to the note detail and edit title",
"edit-branch-prefix": "Show \"Edit branch prefix\" dialog",
"cloneNotesTo": "Clone selected notes",
"moveNotesTo": "Move selected notes",
"clone-notes-to": "Clone selected notes",
"move-notes-to": "Move selected notes",
"note-clipboard": "Note clipboard",
"copy-notes-to-clipboard": "Copy selected notes to the clipboard",
"paste-notes-from-clipboard": "Paste notes from the clipboard into active note",
@@ -104,6 +105,103 @@
"export-as-pdf": "Export the current note as a PDF",
"toggle-zen-mode": "Enables/disables the zen mode (minimal UI for more focused editing)"
},
"keyboard_action_names": {
"back-in-note-history": "Back in Note History",
"forward-in-note-history": "Forward in Note History",
"jump-to-note": "Jump to...",
"command-palette": "Command Palette",
"scroll-to-active-note": "Scroll to Active Note",
"quick-search": "Quick Search",
"search-in-subtree": "Search in Subtree",
"expand-subtree": "Expand Subtree",
"collapse-tree": "Collapse Tree",
"collapse-subtree": "Collapse Subtree",
"sort-child-notes": "Sort Child Notes",
"create-note-after": "Create Note After",
"create-note-into": "Create Note Into",
"create-note-into-inbox": "Create Note Into Inbox",
"delete-notes": "Delete Notes",
"move-note-up": "Move Note Up",
"move-note-down": "Move Note Down",
"move-note-up-in-hierarchy": "Move Note Up in Hierarchy",
"move-note-down-in-hierarchy": "Move Note Down in Hierarchy",
"edit-note-title": "Edit Note Title",
"edit-branch-prefix": "Edit Branch Prefix",
"clone-notes-to": "Clone Notes To",
"move-notes-to": "Move Notes To",
"copy-notes-to-clipboard": "Copy Notes to Clipboard",
"paste-notes-from-clipboard": "Paste Notes from Clipboard",
"cut-notes-to-clipboard": "Cut Notes to Clipboard",
"select-all-notes-in-parent": "Select All Notes in Parent",
"add-note-above-to-selection": "Add Note Above to Selection",
"add-note-below-to-selection": "Add Note Below to Selection",
"duplicate-subtree": "Duplicate Subtree",
"open-new-tab": "Open New Tab",
"close-active-tab": "Close Active Tab",
"reopen-last-tab": "Reopen Last Tab",
"activate-next-tab": "Activate Next Tab",
"activate-previous-tab": "Activate Previous Tab",
"open-new-window": "Open New Window",
"toggle-system-tray-icon": "Toggle System Tray Icon",
"toggle-zen-mode": "Toggle Zen Mode",
"switch-to-first-tab": "Switch to First Tab",
"switch-to-second-tab": "Switch to Second Tab",
"switch-to-third-tab": "Switch to Third Tab",
"switch-to-fourth-tab": "Switch to Fourth Tab",
"switch-to-fifth-tab": "Switch to Fifth Tab",
"switch-to-sixth-tab": "Switch to Sixth Tab",
"switch-to-seventh-tab": "Switch to Seventh Tab",
"switch-to-eighth-tab": "Switch to Eighth Tab",
"switch-to-ninth-tab": "Switch to Ninth Tab",
"switch-to-last-tab": "Switch to Last Tab",
"show-note-source": "Show Note Source",
"show-options": "Show Options",
"show-revisions": "Show Revisions",
"show-recent-changes": "Show Recent Changes",
"show-sql-console": "Show SQL Console",
"show-backend-log": "Show Backend Log",
"show-help": "Show Help",
"show-cheatsheet": "Show Cheatsheet",
"add-link-to-text": "Add Link to Text",
"follow-link-under-cursor": "Follow Link Under Cursor",
"insert-date-and-time-to-text": "Insert Date and Time to Text",
"paste-markdown-into-text": "Paste Markdown into Text",
"cut-into-note": "Cut into Note",
"add-include-note-to-text": "Add Include Note to Text",
"edit-read-only-note": "Edit Read-Only Note",
"add-new-label": "Add New Label",
"add-new-relation": "Add New Relation",
"toggle-ribbon-tab-classic-editor": "Toggle Ribbon Tab Classic Editor",
"toggle-ribbon-tab-basic-properties": "Toggle Ribbon Tab Basic Properties",
"toggle-ribbon-tab-book-properties": "Toggle Ribbon Tab Book Properties",
"toggle-ribbon-tab-file-properties": "Toggle Ribbon Tab File Properties",
"toggle-ribbon-tab-image-properties": "Toggle Ribbon Tab Image Properties",
"toggle-ribbon-tab-owned-attributes": "Toggle Ribbon Tab Owned Attributes",
"toggle-ribbon-tab-inherited-attributes": "Toggle Ribbon Tab Inherited Attributes",
"toggle-ribbon-tab-promoted-attributes": "Toggle Ribbon Tab Promoted Attributes",
"toggle-ribbon-tab-note-map": "Toggle Ribbon Tab Note Map",
"toggle-ribbon-tab-note-info": "Toggle Ribbon Tab Note Info",
"toggle-ribbon-tab-note-paths": "Toggle Ribbon Tab Note Paths",
"toggle-ribbon-tab-similar-notes": "Toggle Ribbon Tab Similar Notes",
"toggle-right-pane": "Toggle Right Pane",
"print-active-note": "Print Active Note",
"export-active-note-as-pdf": "Export Active Note as PDF",
"open-note-externally": "Open Note Externally",
"render-active-note": "Render Active Note",
"run-active-note": "Run Active Note",
"toggle-note-hoisting": "Toggle Note Hoisting",
"unhoist-note": "Unhoist Note",
"reload-frontend-app": "Reload Frontend App",
"open-developer-tools": "Open Developer Tools",
"find-in-text": "Find In Text",
"toggle-left-pane": "Toggle Left Pane",
"toggle-full-screen": "Toggle Full Screen",
"zoom-out": "Zoom Out",
"zoom-in": "Zoom In",
"reset-zoom-level": "Reset Zoom Level",
"copy-without-formatting": "Copy Without Formatting",
"force-save-revision": "Force Save Revision"
},
"login": {
"title": "Login",
"heading": "Trilium Login",
@@ -229,7 +327,7 @@
"go-to-next-note-title": "Go to Next Note",
"new-note-title": "New Note",
"search-notes-title": "Search Notes",
"jump-to-note-title": "Jump to Note",
"jump-to-note-title": "Jump to...",
"calendar-title": "Calendar",
"recent-changes-title": "Recent Changes",
"bookmarks-title": "Bookmarks",

View File

@@ -229,7 +229,6 @@
"go-to-next-note-title": "Ir a nota siguiente",
"new-note-title": "Nueva nota",
"search-notes-title": "Buscar notas",
"jump-to-note-title": "Saltar a nota",
"calendar-title": "Calendario",
"recent-changes-title": "Cambios recientes",
"bookmarks-title": "Marcadores",

View File

@@ -216,7 +216,6 @@
"go-to-next-note-title": "Aller à la note suivante",
"new-note-title": "Nouvelle note",
"search-notes-title": "Rechercher des notes",
"jump-to-note-title": "Aller à la note",
"calendar-title": "Calendrier",
"recent-changes-title": "Modifications récentes",
"bookmarks-title": "Signets",

View File

@@ -209,7 +209,6 @@
"etapi-title": "ETAPI",
"go-to-previous-note-title": "Mergi la notița anterioară",
"images-title": "Imagini",
"jump-to-note-title": "Sari la notiță",
"launch-bar-title": "Bară de lansare",
"new-note-title": "Notiță nouă",
"note-launcher-title": "Lansator de notițe",

View File

@@ -0,0 +1,105 @@
import { describe, it, expect } from "vitest";
import cls from "./cls.js";
import hiddenSubtreeService from "./hidden_subtree.js";
import sql_init from "./sql_init.js";
import branches from "./branches.js";
import becca from "../becca/becca.js";
import { LOCALES } from "@triliumnext/commons";
import { changeLanguage } from "./i18n.js";
import { deferred } from "./utils.js";
describe("Hidden Subtree", () => {
describe("Launcher movement persistence", () => {
beforeAll(async () => {
sql_init.initializeDb();
await sql_init.dbReady;
cls.init(() => hiddenSubtreeService.checkHiddenSubtree());
});
it("should persist launcher movement between visible and available after integrity check", () => {
// Move backend log to visible launchers.
const backendLogBranch = becca.getBranchFromChildAndParent("_lbBackendLog", "_lbAvailableLaunchers");
expect(backendLogBranch).toBeDefined();
// Move launcher to visible launchers.
cls.init(() => {
branches.moveBranchToNote(backendLogBranch!, "_lbVisibleLaunchers");
hiddenSubtreeService.checkHiddenSubtree();
});
// Ensure the launcher is still in visible launchers.
const childBranches = backendLogBranch?.childNote.getParentBranches()
.filter((b) => !b.isDeleted);
expect(childBranches).toBeDefined();
expect(childBranches![0].parentNoteId).toStrictEqual("_lbVisibleLaunchers");
});
it("should enforce the correct placement of help", () => {
// First, verify the help note exists in its original correct location
const originalBranch = becca.getBranchFromChildAndParent("_help_Vc8PjrjAGuOp", "_help_gh7bpGYxajRS");
expect(originalBranch).toBeDefined();
expect(originalBranch?.parentNoteId).toBe("_help_gh7bpGYxajRS");
// Move the help note to an incorrect location (_help root instead of its proper parent)
cls.init(() => {
branches.moveBranchToNote(originalBranch!, "_help");
});
// Verify the note was moved to the wrong location
const movedBranches = becca.notes["_help_Vc8PjrjAGuOp"]?.getParentBranches()
.filter((b) => !b.isDeleted);
expect(movedBranches).toBeDefined();
expect(movedBranches![0].parentNoteId).toBe("_help");
// Run the hidden subtree integrity check
cls.init(() => {
hiddenSubtreeService.checkHiddenSubtree(true);
});
// Verify that the integrity check moved the help note back to its correct location
const correctedBranches = becca.notes["_help_Vc8PjrjAGuOp"]?.getParentBranches()
.filter((b) => !b.isDeleted);
expect(correctedBranches).toBeDefined();
expect(correctedBranches![0].parentNoteId).toBe("_help_gh7bpGYxajRS");
// Ensure the note is no longer under the incorrect parent
const helpRootChildren = becca.notes["_help"]?.getChildNotes();
const incorrectChild = helpRootChildren?.find(note => note.noteId === "_help_Vc8PjrjAGuOp");
expect(incorrectChild).toBeUndefined();
});
it("enforces renames of launcher notes", () => {
const jumpToNote = becca.getNote("_lbJumpTo");
expect(jumpToNote).toBeDefined();
jumpToNote!.title = "Renamed";
cls.init(() => {
jumpToNote!.save();
hiddenSubtreeService.checkHiddenSubtree(true);
});
const updatedJumpToNote = becca.getNote("_lbJumpTo");
expect(updatedJumpToNote).toBeDefined();
expect(updatedJumpToNote?.title).not.toBe("Renamed");
});
it("can restore names in all languages", async () => {
const done = deferred<void>();
cls.wrap(async () => {
for (const locale of LOCALES) {
if (locale.contentOnly) {
continue;
}
try {
await changeLanguage(locale.id);
} catch (error) {
done.reject(error);
}
}
done.resolve();
})();
await done;
});
});
});

View File

@@ -11,15 +11,15 @@ import { cleanUpHelp, getHelpHiddenSubtreeData } from "./in_app_help.js";
import buildLaunchBarConfig from "./hidden_subtree_launcherbar.js";
import buildHiddenSubtreeTemplates from "./hidden_subtree_templates.js";
const LBTPL_ROOT = "_lbTplRoot";
const LBTPL_BASE = "_lbTplBase";
const LBTPL_HEADER = "_lbTplHeader";
const LBTPL_NOTE_LAUNCHER = "_lbTplLauncherNote";
const LBTPL_WIDGET = "_lbTplLauncherWidget";
const LBTPL_COMMAND = "_lbTplLauncherCommand";
const LBTPL_SCRIPT = "_lbTplLauncherScript";
const LBTPL_SPACER = "_lbTplSpacer";
const LBTPL_CUSTOM_WIDGET = "_lbTplCustomWidget";
export const LBTPL_ROOT = "_lbTplRoot";
export const LBTPL_BASE = "_lbTplBase";
export const LBTPL_HEADER = "_lbTplHeader";
export const LBTPL_NOTE_LAUNCHER = "_lbTplLauncherNote";
export const LBTPL_WIDGET = "_lbTplLauncherWidget";
export const LBTPL_COMMAND = "_lbTplLauncherCommand";
export const LBTPL_SCRIPT = "_lbTplLauncherScript";
export const LBTPL_SPACER = "_lbTplSpacer";
export const LBTPL_CUSTOM_WIDGET = "_lbTplCustomWidget";
/*
* Hidden subtree is generated as a "predictable structure" which means that it avoids generating random IDs to always
@@ -369,16 +369,18 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
// Clean up any branches that shouldn't exist according to the meta definition
// For hidden subtree notes, we want to ensure they only exist in their designated locations
const expectedParents = getExpectedParentIds(item.id, hiddenSubtreeDefinition);
const currentBranches = note.getParentBranches();
if (item.enforceBranches || item.id.startsWith("_help")) {
const expectedParents = getExpectedParentIds(item.id, hiddenSubtreeDefinition);
const currentBranches = note.getParentBranches();
for (const currentBranch of currentBranches) {
// Only delete branches that are not in the expected locations
// and are within the hidden subtree structure (avoid touching user-created clones)
if (!expectedParents.includes(currentBranch.parentNoteId) &&
isWithinHiddenSubtree(currentBranch.parentNoteId)) {
log.info(`Removing unexpected branch for note '${item.id}' from parent '${currentBranch.parentNoteId}'`);
currentBranch.markAsDeleted();
for (const currentBranch of currentBranches) {
// Only delete branches that are not in the expected locations
// and are within the hidden subtree structure (avoid touching user-created clones)
if (!expectedParents.includes(currentBranch.parentNoteId) &&
isWithinHiddenSubtree(currentBranch.parentNoteId)) {
log.info(`Removing unexpected branch for note '${item.id}' from parent '${currentBranch.parentNoteId}'`);
currentBranch.markAsDeleted();
}
}
}
}
@@ -411,7 +413,8 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
}
}
if ((extraOpts.restoreNames || note.noteId.startsWith("_help")) && note.title !== item.title) {
const shouldRestoreNames = extraOpts.restoreNames || note.noteId.startsWith("_help") || item.id.startsWith("_lb");
if (shouldRestoreNames && note.title !== item.title) {
note.title = item.title;
note.save();
}
@@ -465,13 +468,5 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
}
export default {
checkHiddenSubtree,
LBTPL_ROOT,
LBTPL_BASE,
LBTPL_COMMAND,
LBTPL_NOTE_LAUNCHER,
LBTPL_WIDGET,
LBTPL_SCRIPT,
LBTPL_SPACER,
LBTPL_CUSTOM_WIDGET
checkHiddenSubtree
};

View File

@@ -3,7 +3,7 @@
import optionService from "./options.js";
import log from "./log.js";
import { isElectron, isMac } from "./utils.js";
import type { KeyboardShortcut } from "@triliumnext/commons";
import type { ActionKeyboardShortcut, KeyboardShortcut } from "@triliumnext/commons";
import { t } from "i18next";
function getDefaultKeyboardActions() {
@@ -17,6 +17,8 @@ function getDefaultKeyboardActions() {
},
{
actionName: "backInNoteHistory",
friendlyName: t("keyboard_action_names.back-in-note-history"),
iconClass: "bx bxs-chevron-left",
// Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376
defaultShortcuts: isMac ? ["CommandOrControl+Left"] : ["Alt+Left"],
description: t("keyboard_actions.back-in-note-history"),
@@ -24,6 +26,8 @@ function getDefaultKeyboardActions() {
},
{
actionName: "forwardInNoteHistory",
friendlyName: t("keyboard_action_names.forward-in-note-history"),
iconClass: "bx bxs-chevron-right",
// Mac has a different history navigation shortcuts - https://github.com/zadam/trilium/issues/376
defaultShortcuts: isMac ? ["CommandOrControl+Right"] : ["Alt+Right"],
description: t("keyboard_actions.forward-in-note-history"),
@@ -31,48 +35,72 @@ function getDefaultKeyboardActions() {
},
{
actionName: "jumpToNote",
friendlyName: t("keyboard_action_names.jump-to-note"),
iconClass: "bx bx-send",
defaultShortcuts: ["CommandOrControl+J"],
description: t("keyboard_actions.open-jump-to-note-dialog"),
scope: "window"
},
{
actionName: "commandPalette",
friendlyName: t("keyboard_action_names.command-palette"),
iconClass: "bx bx-terminal",
defaultShortcuts: ["CommandOrControl+Shift+J"],
description: t("keyboard_actions.open-command-palette"),
scope: "window"
},
{
actionName: "scrollToActiveNote",
friendlyName: t("keyboard_action_names.scroll-to-active-note"),
defaultShortcuts: ["CommandOrControl+."],
iconClass: "bx bx-current-location",
description: t("keyboard_actions.scroll-to-active-note"),
scope: "window"
},
{
actionName: "quickSearch",
friendlyName: t("keyboard_action_names.quick-search"),
iconClass: "bx bx-search",
defaultShortcuts: ["CommandOrControl+S"],
description: t("keyboard_actions.quick-search"),
scope: "window"
},
{
actionName: "searchInSubtree",
friendlyName: t("keyboard_action_names.search-in-subtree"),
defaultShortcuts: ["CommandOrControl+Shift+S"],
iconClass: "bx bx-search-alt",
description: t("keyboard_actions.search-in-subtree"),
scope: "note-tree"
},
{
actionName: "expandSubtree",
friendlyName: t("keyboard_action_names.expand-subtree"),
defaultShortcuts: [],
iconClass: "bx bx-layer-plus",
description: t("keyboard_actions.expand-subtree"),
scope: "note-tree"
},
{
actionName: "collapseTree",
friendlyName: t("keyboard_action_names.collapse-tree"),
defaultShortcuts: ["Alt+C"],
iconClass: "bx bx-layer-minus",
description: t("keyboard_actions.collapse-tree"),
scope: "window"
},
{
actionName: "collapseSubtree",
friendlyName: t("keyboard_action_names.collapse-subtree"),
iconClass: "bx bxs-layer-minus",
defaultShortcuts: ["Alt+-"],
description: t("keyboard_actions.collapse-subtree"),
scope: "note-tree"
},
{
actionName: "sortChildNotes",
friendlyName: t("keyboard_action_names.sort-child-notes"),
iconClass: "bx bx-sort-down",
defaultShortcuts: ["Alt+S"],
description: t("keyboard_actions.sort-child-notes"),
scope: "note-tree"
@@ -83,72 +111,96 @@ function getDefaultKeyboardActions() {
},
{
actionName: "createNoteAfter",
friendlyName: t("keyboard_action_names.create-note-after"),
iconClass: "bx bx-plus",
defaultShortcuts: ["CommandOrControl+O"],
description: t("keyboard_actions.create-note-after"),
scope: "window"
},
{
actionName: "createNoteInto",
friendlyName: t("keyboard_action_names.create-note-into"),
iconClass: "bx bx-plus",
defaultShortcuts: ["CommandOrControl+P"],
description: t("keyboard_actions.create-note-into"),
scope: "window"
},
{
actionName: "createNoteIntoInbox",
friendlyName: t("keyboard_action_names.create-note-into-inbox"),
iconClass: "bx bxs-inbox",
defaultShortcuts: ["global:CommandOrControl+Alt+P"],
description: t("keyboard_actions.create-note-into-inbox"),
scope: "window"
},
{
actionName: "deleteNotes",
friendlyName: t("keyboard_action_names.delete-notes"),
iconClass: "bx bx-trash",
defaultShortcuts: ["Delete"],
description: t("keyboard_actions.delete-note"),
scope: "note-tree"
},
{
actionName: "moveNoteUp",
friendlyName: t("keyboard_action_names.move-note-up"),
iconClass: "bx bx-up-arrow-alt",
defaultShortcuts: isMac ? ["Alt+Up"] : ["CommandOrControl+Up"],
description: t("keyboard_actions.move-note-up"),
scope: "note-tree"
},
{
actionName: "moveNoteDown",
friendlyName: t("keyboard_action_names.move-note-down"),
iconClass: "bx bx-down-arrow-alt",
defaultShortcuts: isMac ? ["Alt+Down"] : ["CommandOrControl+Down"],
description: t("keyboard_actions.move-note-down"),
scope: "note-tree"
},
{
actionName: "moveNoteUpInHierarchy",
friendlyName: t("keyboard_action_names.move-note-up-in-hierarchy"),
iconClass: "bx bx-arrow-from-bottom",
defaultShortcuts: isMac ? ["Alt+Left"] : ["CommandOrControl+Left"],
description: t("keyboard_actions.move-note-up-in-hierarchy"),
scope: "note-tree"
},
{
actionName: "moveNoteDownInHierarchy",
friendlyName: t("keyboard_action_names.move-note-down-in-hierarchy"),
iconClass: "bx bx-arrow-from-top",
defaultShortcuts: isMac ? ["Alt+Right"] : ["CommandOrControl+Right"],
description: t("keyboard_actions.move-note-down-in-hierarchy"),
scope: "note-tree"
},
{
actionName: "editNoteTitle",
friendlyName: t("keyboard_action_names.edit-note-title"),
iconClass: "bx bx-rename",
defaultShortcuts: ["Enter"],
description: t("keyboard_actions.edit-note-title"),
scope: "note-tree"
},
{
actionName: "editBranchPrefix",
friendlyName: t("keyboard_action_names.edit-branch-prefix"),
iconClass: "bx bx-rename",
defaultShortcuts: ["F2"],
description: t("keyboard_actions.edit-branch-prefix"),
scope: "note-tree"
},
{
actionName: "cloneNotesTo",
friendlyName: t("keyboard_action_names.clone-notes-to"),
iconClass: "bx bx-duplicate",
defaultShortcuts: ["CommandOrControl+Shift+C"],
description: t("keyboard_actions.clone-notes-to"),
scope: "window"
},
{
actionName: "moveNotesTo",
friendlyName: t("keyboard_action_names.move-notes-to"),
iconClass: "bx bx-transfer",
defaultShortcuts: ["CommandOrControl+Shift+X"],
description: t("keyboard_actions.move-notes-to"),
scope: "window"
@@ -160,42 +212,56 @@ function getDefaultKeyboardActions() {
{
actionName: "copyNotesToClipboard",
friendlyName: t("keyboard_action_names.copy-notes-to-clipboard"),
iconClass: "bx bx-copy",
defaultShortcuts: ["CommandOrControl+C"],
description: t("keyboard_actions.copy-notes-to-clipboard"),
scope: "note-tree"
},
{
actionName: "pasteNotesFromClipboard",
friendlyName: t("keyboard_action_names.paste-notes-from-clipboard"),
iconClass: "bx bx-paste",
defaultShortcuts: ["CommandOrControl+V"],
description: t("keyboard_actions.paste-notes-from-clipboard"),
scope: "note-tree"
},
{
actionName: "cutNotesToClipboard",
friendlyName: t("keyboard_action_names.cut-notes-to-clipboard"),
iconClass: "bx bx-cut",
defaultShortcuts: ["CommandOrControl+X"],
description: t("keyboard_actions.cut-notes-to-clipboard"),
scope: "note-tree"
},
{
actionName: "selectAllNotesInParent",
friendlyName: t("keyboard_action_names.select-all-notes-in-parent"),
iconClass: "bx bx-select-multiple",
defaultShortcuts: ["CommandOrControl+A"],
description: t("keyboard_actions.select-all-notes-in-parent"),
scope: "note-tree"
},
{
actionName: "addNoteAboveToSelection",
friendlyName: t("keyboard_action_names.add-note-above-to-selection"),
iconClass: "bx bx-chevron-up-square",
defaultShortcuts: ["Shift+Up"],
description: t("keyboard_actions.add-note-above-to-the-selection"),
scope: "note-tree"
},
{
actionName: "addNoteBelowToSelection",
friendlyName: t("keyboard_action_names.add-note-below-to-selection"),
iconClass: "bx bx-chevron-down-square",
defaultShortcuts: ["Shift+Down"],
description: t("keyboard_actions.add-note-below-to-selection"),
scope: "note-tree"
},
{
actionName: "duplicateSubtree",
friendlyName: t("keyboard_action_names.duplicate-subtree"),
iconClass: "bx bx-outline",
defaultShortcuts: [],
description: t("keyboard_actions.duplicate-subtree"),
scope: "note-tree"
@@ -206,109 +272,151 @@ function getDefaultKeyboardActions() {
},
{
actionName: "openNewTab",
friendlyName: t("keyboard_action_names.open-new-tab"),
iconClass: "bx bx-plus",
defaultShortcuts: isElectron ? ["CommandOrControl+T"] : [],
isElectronOnly: true,
description: t("keyboard_actions.open-new-tab"),
scope: "window"
},
{
actionName: "closeActiveTab",
friendlyName: t("keyboard_action_names.close-active-tab"),
iconClass: "bx bx-minus",
defaultShortcuts: isElectron ? ["CommandOrControl+W"] : [],
isElectronOnly: true,
description: t("keyboard_actions.close-active-tab"),
scope: "window"
},
{
actionName: "reopenLastTab",
friendlyName: t("keyboard_action_names.reopen-last-tab"),
iconClass: "bx bx-undo",
defaultShortcuts: isElectron ? ["CommandOrControl+Shift+T"] : [],
isElectronOnly: true,
description: t("keyboard_actions.reopen-last-tab"),
scope: "window"
},
{
actionName: "activateNextTab",
friendlyName: t("keyboard_action_names.activate-next-tab"),
iconClass: "bx bx-skip-next",
defaultShortcuts: isElectron ? ["CommandOrControl+Tab", "CommandOrControl+PageDown"] : [],
isElectronOnly: true,
description: t("keyboard_actions.activate-next-tab"),
scope: "window"
},
{
actionName: "activatePreviousTab",
friendlyName: t("keyboard_action_names.activate-previous-tab"),
iconClass: "bx bx-skip-previous",
defaultShortcuts: isElectron ? ["CommandOrControl+Shift+Tab", "CommandOrControl+PageUp"] : [],
isElectronOnly: true,
description: t("keyboard_actions.activate-previous-tab"),
scope: "window"
},
{
actionName: "openNewWindow",
friendlyName: t("keyboard_action_names.open-new-window"),
iconClass: "bx bx-window-open",
defaultShortcuts: [],
description: t("keyboard_actions.open-new-window"),
scope: "window"
},
{
actionName: "toggleTray",
friendlyName: t("keyboard_action_names.toggle-system-tray-icon"),
iconClass: "bx bx-show",
defaultShortcuts: [],
isElectronOnly: true,
description: t("keyboard_actions.toggle-tray"),
scope: "window"
},
{
actionName: "toggleZenMode",
friendlyName: t("keyboard_action_names.toggle-zen-mode"),
iconClass: "bx bxs-yin-yang",
defaultShortcuts: ["F9"],
description: t("keyboard_actions.toggle-zen-mode"),
scope: "window"
},
{
actionName: "firstTab",
friendlyName: t("keyboard_action_names.switch-to-first-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+1"],
description: t("keyboard_actions.first-tab"),
scope: "window"
},
{
actionName: "secondTab",
friendlyName: t("keyboard_action_names.switch-to-second-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+2"],
description: t("keyboard_actions.second-tab"),
scope: "window"
},
{
actionName: "thirdTab",
friendlyName: t("keyboard_action_names.switch-to-third-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+3"],
description: t("keyboard_actions.third-tab"),
scope: "window"
},
{
actionName: "fourthTab",
friendlyName: t("keyboard_action_names.switch-to-fourth-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+4"],
description: t("keyboard_actions.fourth-tab"),
scope: "window"
},
{
actionName: "fifthTab",
friendlyName: t("keyboard_action_names.switch-to-fifth-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+5"],
description: t("keyboard_actions.fifth-tab"),
scope: "window"
},
{
actionName: "sixthTab",
friendlyName: t("keyboard_action_names.switch-to-sixth-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+6"],
description: t("keyboard_actions.sixth-tab"),
scope: "window"
},
{
actionName: "seventhTab",
friendlyName: t("keyboard_action_names.switch-to-seventh-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+7"],
description: t("keyboard_actions.seventh-tab"),
scope: "window"
},
{
actionName: "eigthTab",
friendlyName: t("keyboard_action_names.switch-to-eighth-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+8"],
description: t("keyboard_actions.eight-tab"),
scope: "window"
},
{
actionName: "ninthTab",
friendlyName: t("keyboard_action_names.switch-to-ninth-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+9"],
description: t("keyboard_actions.ninth-tab"),
scope: "window"
},
{
actionName: "lastTab",
defaultShortcuts: [],
friendlyName: t("keyboard_action_names.switch-to-last-tab"),
iconClass: "bx bx-rectangle",
defaultShortcuts: ["CommandOrControl+0"],
description: t("keyboard_actions.last-tab"),
scope: "window"
},
@@ -317,49 +425,65 @@ function getDefaultKeyboardActions() {
separator: t("keyboard_actions.dialogs")
},
{
friendlyName: t("keyboard_action_names.show-note-source"),
actionName: "showNoteSource",
iconClass: "bx bx-code",
defaultShortcuts: [],
description: t("keyboard_actions.show-note-source"),
scope: "window"
},
{
friendlyName: t("keyboard_action_names.show-options"),
actionName: "showOptions",
iconClass: "bx bx-cog",
defaultShortcuts: [],
description: t("keyboard_actions.show-options"),
scope: "window"
},
{
friendlyName: t("keyboard_action_names.show-revisions"),
actionName: "showRevisions",
iconClass: "bx bx-history",
defaultShortcuts: [],
description: t("keyboard_actions.show-revisions"),
scope: "window"
},
{
friendlyName: t("keyboard_action_names.show-recent-changes"),
actionName: "showRecentChanges",
iconClass: "bx bx-history",
defaultShortcuts: [],
description: t("keyboard_actions.show-recent-changes"),
scope: "window"
},
{
friendlyName: t("keyboard_action_names.show-sql-console"),
actionName: "showSQLConsole",
iconClass: "bx bx-data",
defaultShortcuts: ["Alt+O"],
description: t("keyboard_actions.show-sql-console"),
scope: "window"
},
{
friendlyName: t("keyboard_action_names.show-backend-log"),
actionName: "showBackendLog",
iconClass: "bx bx-detail",
defaultShortcuts: [],
description: t("keyboard_actions.show-backend-log"),
scope: "window"
},
{
friendlyName: t("keyboard_action_names.show-help"),
actionName: "showHelp",
iconClass: "bx bx-help-circle",
defaultShortcuts: ["F1"],
description: t("keyboard_actions.show-help"),
scope: "window"
},
{
friendlyName: t("keyboard_action_names.show-cheatsheet"),
actionName: "showCheatsheet",
iconClass: "bx bxs-keyboard",
defaultShortcuts: ["Shift+F1"],
description: t("keyboard_actions.show-cheatsheet"),
scope: "window"
@@ -370,43 +494,57 @@ function getDefaultKeyboardActions() {
},
{
friendlyName: t("keyboard_action_names.add-link-to-text"),
actionName: "addLinkToText",
iconClass: "bx bx-link",
defaultShortcuts: ["CommandOrControl+L"],
description: t("keyboard_actions.add-link-to-text"),
scope: "text-detail"
},
{
friendlyName: t("keyboard_action_names.follow-link-under-cursor"),
actionName: "followLinkUnderCursor",
iconClass: "bx bx-link-external",
defaultShortcuts: ["CommandOrControl+Enter"],
description: t("keyboard_actions.follow-link-under-cursor"),
scope: "text-detail"
},
{
friendlyName: t("keyboard_action_names.insert-date-and-time-to-text"),
actionName: "insertDateTimeToText",
iconClass: "bx bx-calendar-event",
defaultShortcuts: ["Alt+T"],
description: t("keyboard_actions.insert-date-and-time-to-text"),
scope: "text-detail"
},
{
friendlyName: t("keyboard_action_names.paste-markdown-into-text"),
actionName: "pasteMarkdownIntoText",
iconClass: "bx bxl-markdown",
defaultShortcuts: [],
description: t("keyboard_actions.paste-markdown-into-text"),
scope: "text-detail"
},
{
friendlyName: t("keyboard_action_names.cut-into-note"),
actionName: "cutIntoNote",
iconClass: "bx bx-cut",
defaultShortcuts: [],
description: t("keyboard_actions.cut-into-note"),
scope: "text-detail"
},
{
friendlyName: t("keyboard_action_names.add-include-note-to-text"),
actionName: "addIncludeNoteToText",
iconClass: "bx bx-note",
defaultShortcuts: [],
description: t("keyboard_actions.add-include-note-to-text"),
scope: "text-detail"
},
{
friendlyName: t("keyboard_action_names.edit-read-only-note"),
actionName: "editReadOnlyNote",
iconClass: "bx bx-edit-alt",
defaultShortcuts: [],
description: t("keyboard_actions.edit-readonly-note"),
scope: "window"
@@ -417,13 +555,17 @@ function getDefaultKeyboardActions() {
},
{
friendlyName: t("keyboard_action_names.add-new-label"),
actionName: "addNewLabel",
iconClass: "bx bx-hash",
defaultShortcuts: ["Alt+L"],
description: t("keyboard_actions.add-new-label"),
scope: "window"
},
{
friendlyName: t("keyboard_action_names.add-new-relation"),
actionName: "addNewRelation",
iconClass: "bx bx-transfer",
defaultShortcuts: ["Alt+R"],
description: t("keyboard_actions.create-new-relation"),
scope: "window"
@@ -434,43 +576,57 @@ function getDefaultKeyboardActions() {
},
{
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-classic-editor"),
actionName: "toggleRibbonTabClassicEditor",
iconClass: "bx bx-text",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-classic-editor-toolbar"),
scope: "window"
},
{
actionName: "toggleRibbonTabBasicProperties",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-basic-properties"),
iconClass: "bx bx-slider",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-basic-properties"),
scope: "window"
},
{
actionName: "toggleRibbonTabBookProperties",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-book-properties"),
iconClass: "bx bx-book",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-book-properties"),
scope: "window"
},
{
actionName: "toggleRibbonTabFileProperties",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-file-properties"),
iconClass: "bx bx-file",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-file-properties"),
scope: "window"
},
{
actionName: "toggleRibbonTabImageProperties",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-image-properties"),
iconClass: "bx bx-image",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-image-properties"),
scope: "window"
},
{
actionName: "toggleRibbonTabOwnedAttributes",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-owned-attributes"),
iconClass: "bx bx-list-check",
defaultShortcuts: ["Alt+A"],
description: t("keyboard_actions.toggle-owned-attributes"),
scope: "window"
},
{
actionName: "toggleRibbonTabInheritedAttributes",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-inherited-attributes"),
iconClass: "bx bx-list-plus",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-inherited-attributes"),
scope: "window"
@@ -478,30 +634,40 @@ function getDefaultKeyboardActions() {
// TODO: Remove or change since promoted attributes have been changed.
{
actionName: "toggleRibbonTabPromotedAttributes",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-promoted-attributes"),
iconClass: "bx bx-star",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-promoted-attributes"),
scope: "window"
},
{
actionName: "toggleRibbonTabNoteMap",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-note-map"),
iconClass: "bx bxs-network-chart",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-link-map"),
scope: "window"
},
{
actionName: "toggleRibbonTabNoteInfo",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-note-info"),
iconClass: "bx bx-info-circle",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-note-info"),
scope: "window"
},
{
actionName: "toggleRibbonTabNotePaths",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-note-paths"),
iconClass: "bx bx-collection",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-note-paths"),
scope: "window"
},
{
actionName: "toggleRibbonTabSimilarNotes",
friendlyName: t("keyboard_action_names.toggle-ribbon-tab-similar-notes"),
iconClass: "bx bx-bar-chart",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-similar-notes"),
scope: "window"
@@ -513,108 +679,149 @@ function getDefaultKeyboardActions() {
{
actionName: "toggleRightPane",
friendlyName: t("keyboard_action_names.toggle-right-pane"),
iconClass: "bx bx-dock-right",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-right-pane"),
scope: "window"
},
{
actionName: "printActiveNote",
friendlyName: t("keyboard_action_names.print-active-note"),
iconClass: "bx bx-printer",
defaultShortcuts: [],
description: t("keyboard_actions.print-active-note"),
scope: "window"
},
{
actionName: "exportAsPdf",
friendlyName: t("keyboard_action_names.export-active-note-as-pdf"),
iconClass: "bx bxs-file-pdf",
defaultShortcuts: [],
description: t("keyboard_actions.export-as-pdf"),
scope: "window"
},
{
actionName: "openNoteExternally",
friendlyName: t("keyboard_action_names.open-note-externally"),
iconClass: "bx bx-file-find",
defaultShortcuts: [],
description: t("keyboard_actions.open-note-externally"),
scope: "window"
},
{
actionName: "renderActiveNote",
friendlyName: t("keyboard_action_names.render-active-note"),
iconClass: "bx bx-refresh",
defaultShortcuts: [],
description: t("keyboard_actions.render-active-note"),
scope: "window"
},
{
actionName: "runActiveNote",
friendlyName: t("keyboard_action_names.run-active-note"),
iconClass: "bx bx-play",
defaultShortcuts: ["CommandOrControl+Enter"],
description: t("keyboard_actions.run-active-note"),
scope: "code-detail"
},
{
actionName: "toggleNoteHoisting",
friendlyName: t("keyboard_action_names.toggle-note-hoisting"),
iconClass: "bx bx-chevrons-up",
defaultShortcuts: ["Alt+H"],
description: t("keyboard_actions.toggle-note-hoisting"),
scope: "window"
},
{
actionName: "unhoist",
friendlyName: t("keyboard_action_names.unhoist-note"),
iconClass: "bx bx-door-open",
defaultShortcuts: ["Alt+U"],
description: t("keyboard_actions.unhoist"),
scope: "window"
},
{
actionName: "reloadFrontendApp",
friendlyName: t("keyboard_action_names.reload-frontend-app"),
iconClass: "bx bx-refresh",
defaultShortcuts: ["F5", "CommandOrControl+R"],
description: t("keyboard_actions.reload-frontend-app"),
scope: "window"
},
{
actionName: "openDevTools",
friendlyName: t("keyboard_action_names.open-developer-tools"),
iconClass: "bx bx-bug-alt",
defaultShortcuts: isElectron ? ["CommandOrControl+Shift+I"] : [],
isElectronOnly: true,
description: t("keyboard_actions.open-dev-tools"),
scope: "window"
},
{
actionName: "findInText",
friendlyName: t("keyboard_action_names.find-in-text"),
iconClass: "bx bx-search",
defaultShortcuts: isElectron ? ["CommandOrControl+F"] : [],
isElectronOnly: true,
description: t("keyboard_actions.find-in-text"),
scope: "window"
},
{
actionName: "toggleLeftPane",
friendlyName: t("keyboard_action_names.toggle-left-pane"),
iconClass: "bx bx-sidebar",
defaultShortcuts: [],
description: t("keyboard_actions.toggle-left-note-tree-panel"),
scope: "window"
},
{
actionName: "toggleFullscreen",
friendlyName: t("keyboard_action_names.toggle-full-screen"),
iconClass: "bx bx-fullscreen",
defaultShortcuts: ["F11"],
description: t("keyboard_actions.toggle-full-screen"),
scope: "window"
},
{
actionName: "zoomOut",
friendlyName: t("keyboard_action_names.zoom-out"),
iconClass: "bx bx-zoom-out",
defaultShortcuts: isElectron ? ["CommandOrControl+-"] : [],
isElectronOnly: true,
description: t("keyboard_actions.zoom-out"),
scope: "window"
},
{
actionName: "zoomIn",
friendlyName: t("keyboard_action_names.zoom-in"),
iconClass: "bx bx-zoom-in",
description: t("keyboard_actions.zoom-in"),
defaultShortcuts: isElectron ? ["CommandOrControl+="] : [],
isElectronOnly: true,
scope: "window"
},
{
actionName: "zoomReset",
friendlyName: t("keyboard_action_names.reset-zoom-level"),
iconClass: "bx bx-search-alt",
description: t("keyboard_actions.reset-zoom-level"),
defaultShortcuts: isElectron ? ["CommandOrControl+0"] : [],
isElectronOnly: true,
scope: "window"
},
{
actionName: "copyWithoutFormatting",
friendlyName: t("keyboard_action_names.copy-without-formatting"),
iconClass: "bx bx-copy-alt",
defaultShortcuts: ["CommandOrControl+Alt+C"],
description: t("keyboard_actions.copy-without-formatting"),
scope: "text-detail"
},
{
actionName: "forceSaveRevision",
friendlyName: t("keyboard_action_names.force-save-revision"),
iconClass: "bx bx-save",
defaultShortcuts: [],
description: t("keyboard_actions.force-save-revision"),
scope: "window"
@@ -627,7 +834,7 @@ function getDefaultKeyboardActions() {
const platformModifier = isMac ? "Meta" : "Ctrl";
for (const action of DEFAULT_KEYBOARD_ACTIONS) {
if (action.defaultShortcuts) {
if ("defaultShortcuts" in action && action.defaultShortcuts) {
action.defaultShortcuts = action.defaultShortcuts.map((shortcut) => shortcut.replace("CommandOrControl", platformModifier));
}
}
@@ -639,7 +846,9 @@ function getKeyboardActions() {
const actions: KeyboardShortcut[] = JSON.parse(JSON.stringify(getDefaultKeyboardActions()));
for (const action of actions) {
action.effectiveShortcuts = action.defaultShortcuts ? action.defaultShortcuts.slice() : [];
if ("effectiveShortcuts" in action && action.effectiveShortcuts) {
action.effectiveShortcuts = action.defaultShortcuts ? action.defaultShortcuts.slice() : [];
}
}
for (const option of optionService.getOptions()) {
@@ -647,7 +856,7 @@ function getKeyboardActions() {
let actionName = option.name.substring(17);
actionName = actionName.charAt(0).toLowerCase() + actionName.slice(1);
const action = actions.find((ea) => ea.actionName === actionName);
const action = actions.find((ea) => "actionName" in ea && ea.actionName === actionName) as ActionKeyboardShortcut;
if (action) {
try {

View File

@@ -251,7 +251,7 @@ function initStartupOptions() {
}
function getKeyboardDefaultOptions() {
return (keyboardActions.getDefaultKeyboardActions().filter((ka) => !!ka.actionName) as KeyboardShortcutWithRequiredActionName[]).map((ka) => ({
return (keyboardActions.getDefaultKeyboardActions().filter((ka) => "actionName" in ka) as KeyboardShortcutWithRequiredActionName[]).map((ka) => ({
name: `keyboardShortcuts${ka.actionName.charAt(0).toUpperCase()}${ka.actionName.slice(1)}`,
value: JSON.stringify(ka.defaultShortcuts),
isSynced: false

View File

@@ -7,10 +7,9 @@ import log from "./log.js";
import hoistedNoteService from "./hoisted_note.js";
import searchService from "./search/services/search.js";
import SearchContext from "./search/search_context.js";
import hiddenSubtree from "./hidden_subtree.js";
import { LBTPL_NOTE_LAUNCHER, LBTPL_CUSTOM_WIDGET, LBTPL_SPACER, LBTPL_SCRIPT } from "./hidden_subtree.js";
import { t } from "i18next";
import { BNote } from "./backend_script_entrypoint.js";
const { LBTPL_NOTE_LAUNCHER, LBTPL_CUSTOM_WIDGET, LBTPL_SPACER, LBTPL_SCRIPT } = hiddenSubtree;
function getInboxNote(date: string) {
const workspaceNote = hoistedNoteService.getWorkspaceNote();

View File

@@ -295,7 +295,7 @@ async function registerGlobalShortcuts() {
const allActions = keyboardActionsService.getKeyboardActions();
for (const action of allActions) {
if (!action.effectiveShortcuts) {
if (!("effectiveShortcuts" in action) || !action.effectiveShortcuts) {
continue;
}

View File

@@ -3784,7 +3784,7 @@
"wArbEsdSae6g",
"F1r9QtzQLZqm"
],
"title": "Jump to Note",
"title": "Jump to...",
"notePosition": 50,
"prefix": null,
"isExpanded": false,
@@ -3804,26 +3804,33 @@
"value": "bx bx-send",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "A9Oc6YKKc65v",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",
"dataFileName": "Jump to Note.md",
"dataFileName": "Jump to.md",
"attachments": [
{
"attachmentId": "7IU5WrneDsfi",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Jump to_image.png"
},
{
"attachmentId": "P9veX5eFZdPp",
"title": "image.png",
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "Jump to Note_image.png"
},
{
"attachmentId": "xA1F6kynr4YU",
"title": "recent-notes.gif",
"role": "image",
"mime": "image/gif",
"position": 10,
"dataFileName": "Jump to Note_recent-notes.gif"
"dataFileName": "1_Jump to_image.png"
},
{
"attachmentId": "y8yxomaf1Gkz",
@@ -3831,7 +3838,7 @@
"role": "image",
"mime": "image/png",
"position": 10,
"dataFileName": "1_Jump to Note_image.png"
"dataFileName": "2_Jump to_image.png"
}
]
},
@@ -7869,31 +7876,45 @@
{
"type": "relation",
"name": "internalLink",
"value": "BlN9DFI679QC",
"value": "CtBQqbwXDx1w",
"isInheritable": false,
"position": 80
},
{
"type": "relation",
"name": "internalLink",
"value": "m523cpzocqaD",
"value": "BlN9DFI679QC",
"isInheritable": false,
"position": 90
},
{
"type": "relation",
"name": "internalLink",
"value": "KC1HB96bqqHX",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 100
},
{
"type": "relation",
"name": "internalLink",
"value": "2mUhVmZK8RF3",
"value": "m523cpzocqaD",
"isInheritable": false,
"position": 110
},
{
"type": "relation",
"name": "internalLink",
"value": "KC1HB96bqqHX",
"isInheritable": false,
"position": 120
},
{
"type": "relation",
"name": "internalLink",
"value": "2mUhVmZK8RF3",
"isInheritable": false,
"position": 130
},
{
"type": "label",
"name": "shareAlias",
@@ -7907,20 +7928,6 @@
"value": "bx bx-book",
"isInheritable": false,
"position": 20
},
{
"type": "relation",
"name": "internalLink",
"value": "CtBQqbwXDx1w",
"isInheritable": false,
"position": 120
},
{
"type": "relation",
"name": "internalLink",
"value": "oPVyFC7WL2Lp",
"isInheritable": false,
"position": 130
}
],
"format": "markdown",
@@ -8530,19 +8537,19 @@
"type": "text",
"mime": "text/html",
"attributes": [
{
"type": "relation",
"name": "internalLink",
"value": "2FvYrpmOXm29",
"isInheritable": false,
"position": 10
},
{
"type": "label",
"name": "iconClass",
"value": "bx bx-columns",
"isInheritable": false,
"position": 10
},
{
"type": "relation",
"name": "internalLink",
"value": "2FvYrpmOXm29",
"isInheritable": false,
"position": 20
}
],
"format": "markdown",

View File

@@ -1,25 +0,0 @@
# Jump to Note
<figure class="image image-style-align-center"><img style="aspect-ratio:991/403;" src="Jump to Note_image.png" width="991" height="403"></figure>
The _Jump to Note_ function allows easy navigation between notes by searching for their title. In addition to that, it can also trigger a full search or create notes.
## Entering jump to note
* In the <a class="reference-link" href="../UI%20Elements/Launch%20Bar.md">Launch Bar</a>, press ![](1_Jump%20to%20Note_image.png) button.
* Using the keyboard, press <kbd>Ctrl</kbd> + <kbd>J</kbd>.
## Recent notes
Jump to note also has the ability to show the list of recently viewed / edited notes and quickly jump to it.
To access this functionality, click on `Jump to` button on the top. By default, (when nothing is entered into autocomplete), this dialog will show the list of recent notes.
Alternatively you can click on the "time" icon on the right.
<img src="Jump to Note_recent-notes.gif" width="812" height="585">
## Interaction
* By default, when there is no text entered it will display the most recent notes.
* Using the keyboard, use the up or down arrow keys to navigate between items. Press <kbd>Enter</kbd> to open the desired note.
* If the note doesn't exist, it's possible to create it by typing the desired note title and selecting the _Create and link child note_ option.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 KiB

View File

@@ -0,0 +1,62 @@
# Jump to...
<figure class="image image-style-align-center"><img style="aspect-ratio:991/403;" src="1_Jump to_image.png" width="991" height="403"></figure>
## Jump to Note
The _Jump to Note_ function allows easy navigation between notes by searching for their title. In addition to that, it can also trigger a full search or create notes.
To enter the “Jump to” dialog:
* In the <a class="reference-link" href="../UI%20Elements/Launch%20Bar.md">Launch Bar</a>, press ![](2_Jump%20to_image.png) button.
* Using the keyboard, press <kbd>Ctrl</kbd> + <kbd>J</kbd>.
In addition to searching for notes, it is also possible to search for commands. See the dedicated section below for more information.
### Interaction
* By default, when there is no text entered it will display the most recent notes.
* Using the keyboard, use the up or down arrow keys to navigate between items. Press <kbd>Enter</kbd> to open the desired note.
* If the note doesn't exist, it's possible to create it by typing the desired note title and selecting the _Create and link child note_ option.
## Recent notes
Jump to note also has the ability to show the list of recently viewed / edited notes and quickly jump to it.
To access this functionality, click on `Jump to` button on the top. By default, (when nothing is entered into autocomplete), this dialog will show the list of recent notes.
Alternatively you can click on the "time" icon on the right.
## Command Palette
<figure class="image image-style-align-center"><img style="aspect-ratio:982/524;" src="Jump to_image.png" width="982" height="524"></figure>
The command palette is a feature which allows easy execution of various commands that can be found throughout the application, such as from menus or keyboard shortcuts. This feature integrates directly into the “Jump to” dialog.
### Interaction
To trigger the command palette:
* Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>J</kbd> to display the command palette directly.
* If in the “Jump to” dialog, type `>` in the search to switch to the command palette.
Interaction:
* Type a few words to filter between commands.
* Use the up and down arrows on the keyboard or the mouse to select a command.
* Press <kbd>Enter</kbd> to execute the command.
To exit the command palette:
* Remove the `>` in the search to go back to the note search.
* Press <kbd>Esc</kbd> to dismiss the dialog entirely.
### Options available
Currently the following options are displayed:
* Most of the <a class="reference-link" href="../Keyboard%20Shortcuts.md">Keyboard Shortcuts</a> have an entry, with the exception of those that are too specific to be run from a dialog.
* Some additional options which are not yet available as keyboard shortcuts, but can be accessed from various menus such as: exporting a note, showing attachments, searching for notes or configuring the <a class="reference-link" href="../UI%20Elements/Launch%20Bar.md">Launch Bar</a>.
### Limitations
Currently it's not possible to define custom actions that are displayed in the command palette. In the future this might change by integrating the options in the launch bar, which can be customized if needed.

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@@ -13,4 +13,4 @@ This works identically to browser backwards / forwards, it's actually using buil
This is useful to quickly find and view arbitrary notes - click on `Jump to` button on the top or press <kbd>Ctrl</kbd> + <kbd>J</kbd> . Then type part of the note name and autocomplete will help you pick the desired note.
See <a class="reference-link" href="Jump%20to%20Note.md">Jump to Note</a> for more information.
See <a class="reference-link" href="Jump%20to.md">Jump to Note</a> for more information.

View File

@@ -5,7 +5,7 @@ The _Quick search_ function does a full-text search (that is, it searches throug
The alternative to the quick search is the <a class="reference-link" href="Search.md">Search</a> function, which opens in a dedicated tab and has support for advanced queries.
For even faster navigation, it's possible to use <a class="reference-link" href="Jump%20to%20Note.md">Jump to Note</a> which will only search through the note titles instead of the content.
For even faster navigation, it's possible to use <a class="reference-link" href="Jump%20to.md">Jump to Note</a> which will only search through the note titles instead of the content.
## Layout

View File

@@ -43,4 +43,10 @@ export interface HiddenSubtreeItem {
| "quickSearch"
| "aiChatLauncher";
command?: keyof typeof Command;
/**
* If set to true, then branches will be enforced to be in the correct place.
* This is useful for ensuring that the launcher is always in the correct place, even if
* the user moves it around.
*/
enforceBranches?: boolean;
}

View File

@@ -2,6 +2,7 @@ const enum KeyboardActionNamesEnum {
backInNoteHistory,
forwardInNoteHistory,
jumpToNote,
commandPalette,
scrollToActiveNote,
quickSearch,
searchInSubtree,
@@ -97,12 +98,21 @@ const enum KeyboardActionNamesEnum {
export type KeyboardActionNames = keyof typeof KeyboardActionNamesEnum;
export interface KeyboardShortcut {
separator?: string;
actionName?: KeyboardActionNames;
export interface KeyboardShortcutSeparator {
separator: string;
}
export interface ActionKeyboardShortcut {
actionName: KeyboardActionNames;
friendlyName: string;
description?: string;
defaultShortcuts?: string[];
effectiveShortcuts?: string[];
/**
* An icon describing the action.
* This is currently only used in the command palette.
*/
iconClass: string;
/**
* Scope here means on which element the keyboard shortcuts are attached - this means that for the shortcut to work,
* the focus has to be inside the element.
@@ -112,8 +122,15 @@ export interface KeyboardShortcut {
* e.g. CTRL-C in note tree does something a bit different from CTRL-C in the text editor.
*/
scope?: "window" | "note-tree" | "text-detail" | "code-detail";
/**
* Whether the action is only available for the desktop application.
* This is used to hide actions that are not available in the web version.
*/
isElectronOnly?: boolean;
}
export interface KeyboardShortcutWithRequiredActionName extends KeyboardShortcut {
export type KeyboardShortcut = ActionKeyboardShortcut | KeyboardShortcutSeparator;
export interface KeyboardShortcutWithRequiredActionName extends ActionKeyboardShortcut {
actionName: KeyboardActionNames;
}