From 1f37d00e426ce30b62ea661cba2a62ecec0589ae Mon Sep 17 00:00:00 2001
From: zadam
Date: Sun, 24 Nov 2019 10:14:30 +0100
Subject: [PATCH] updating also shortcuts in element titles
---
package-lock.json | 14 +++++++++++
.../javascripts/services/context_menu.js | 2 +-
.../javascripts/services/keyboard_actions.js | 19 +++++++++++---
.../javascripts/services/tree_context_menu.js | 8 +++---
src/views/desktop.ejs | 19 ++++++++------
src/views/dialogs/help.ejs | 25 ++++++++++---------
src/views/mobile.ejs | 4 +--
7 files changed, 62 insertions(+), 29 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 4825557ec..c1be10961 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -725,6 +725,12 @@
"temp-file": "^3.3.4"
},
"dependencies": {
+ "ejs": {
+ "version": "2.7.4",
+ "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz",
+ "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==",
+ "dev": true
+ },
"hosted-git-info": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.2.tgz",
@@ -2432,6 +2438,14 @@
"sanitize-filename": "^1.6.2",
"semver": "^6.3.0",
"temp-file": "^3.3.4"
+ },
+ "dependencies": {
+ "ejs": {
+ "version": "2.7.4",
+ "resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.4.tgz",
+ "integrity": "sha512-7vmuyh5+kuUyJKePhQfRQBhXV5Ce+RnaeeQArKu1EAMpL3WbgMt5WG6uQZpEVvYSSsxMXRKOewtDk9RaTKXRlA==",
+ "dev": true
+ }
}
},
"builder-util": {
diff --git a/src/public/javascripts/services/context_menu.js b/src/public/javascripts/services/context_menu.js
index 4622b980e..713490a55 100644
--- a/src/public/javascripts/services/context_menu.js
+++ b/src/public/javascripts/services/context_menu.js
@@ -70,7 +70,7 @@ async function initContextMenu(event, contextMenu) {
addItems($contextMenuContainer, await contextMenu.getContextMenuItems());
- keyboardActionService.updateKbdElements($contextMenuContainer);
+ keyboardActionService.updateDisplayedShortcuts($contextMenuContainer);
// code below tries to detect when dropdown would overflow from page
// in such case we'll position it above click coordinates so it will fit into client
diff --git a/src/public/javascripts/services/keyboard_actions.js b/src/public/javascripts/services/keyboard_actions.js
index 1a77688cc..886e7b094 100644
--- a/src/public/javascripts/services/keyboard_actions.js
+++ b/src/public/javascripts/services/keyboard_actions.js
@@ -78,7 +78,7 @@ async function getAction(actionName, silent = false) {
return action;
}
-function updateKbdElements($container) {
+function updateDisplayedShortcuts($container) {
$container.find('kbd[data-kb-action]').each(async (i, el) => {
const actionName = $(el).attr('data-kb-action');
const action = await getAction(actionName, true);
@@ -87,13 +87,26 @@ function updateKbdElements($container) {
$(el).text(action.effectiveShortcuts.join(', '));
}
});
+
+ $container.find('button[data-kb-action],a.icon-action[data-kb-action]').each(async (i, el) => {
+ const actionName = $(el).attr('data-kb-action');
+ const action = await getAction(actionName, true);
+
+ if (action) {
+ const title = $(el).attr('title');
+ const shortcuts = action.effectiveShortcuts.join(', ');
+ const newTitle = !title || !title.trim() ? shortcuts : `${title} (${shortcuts})`;
+
+ $(el).attr('title', newTitle);
+ }
+ });
}
-$(() => updateKbdElements($(document)));
+$(() => updateDisplayedShortcuts($(document)));
export default {
setActionHandler,
triggerAction,
getAction,
- updateKbdElements
+ updateDisplayedShortcuts
};
\ No newline at end of file
diff --git a/src/public/javascripts/services/tree_context_menu.js b/src/public/javascripts/services/tree_context_menu.js
index 344083608..fbf5b7fdc 100644
--- a/src/public/javascripts/services/tree_context_menu.js
+++ b/src/public/javascripts/services/tree_context_menu.js
@@ -72,9 +72,9 @@ class TreeContextMenu {
enabled: isNotRoot && !isHoisted },
{ title: 'Cut ', cmd: "cut", uiIcon: "cut",
enabled: isNotRoot && !isHoisted && parentNotSearch },
- { title: 'Move to ... Ctrl+Shift+X ', cmd: "moveTo", uiIcon: "empty",
+ { title: 'Move to ... ', cmd: "moveTo", uiIcon: "empty",
enabled: isNotRoot && !isHoisted && parentNotSearch },
- { title: 'Paste into Ctrl+V ', cmd: "pasteInto", uiIcon: "paste",
+ { title: 'Paste into ', cmd: "pasteInto", uiIcon: "paste",
enabled: !clipboard.isClipboardEmpty() && notSearch && noSelectedNotes },
{ title: 'Paste after', cmd: "pasteAfter", uiIcon: "paste",
enabled: !clipboard.isClipboardEmpty() && isNotRoot && !isHoisted && parentNotSearch && noSelectedNotes },
@@ -86,9 +86,9 @@ class TreeContextMenu {
{ title: "Import into note", cmd: "importIntoNote", uiIcon: "empty",
enabled: notSearch && noSelectedNotes },
{ title: "----" },
- { title: 'Collapse subtree Alt+- ', cmd: "collapseSubtree", uiIcon: "align-justify", enabled: noSelectedNotes },
+ { title: 'Collapse subtree ', cmd: "collapseSubtree", uiIcon: "align-justify", enabled: noSelectedNotes },
{ title: "Force note sync", cmd: "forceNoteSync", uiIcon: "recycle", enabled: noSelectedNotes },
- { title: 'Sort alphabetically Alt+S ', cmd: "sortAlphabetically", uiIcon: "empty", enabled: noSelectedNotes && notSearch }
+ { title: 'Sort alphabetically ', cmd: "sortAlphabetically", uiIcon: "empty", enabled: noSelectedNotes && notSearch }
].filter(row => row !== null);
}
diff --git a/src/views/desktop.ejs b/src/views/desktop.ejs
index 84071e1ff..2ab23a61d 100644
--- a/src/views/desktop.ejs
+++ b/src/views/desktop.ejs
@@ -18,24 +18,29 @@
-
+
Jump to note
-
+
Recent changes
-
+
Enter protected session
-
+
Leave protected session
@@ -117,11 +122,11 @@
diff --git a/src/views/dialogs/help.ejs b/src/views/dialogs/help.ejs
index 02ddd80a2..ab4b4a50a 100644
--- a/src/views/dialogs/help.ejs
+++ b/src/views/dialogs/help.ejs
@@ -18,7 +18,7 @@
UP , DOWN - go up/down in the list of notes
LEFT , RIGHT - collapse/expand node
- , ALT+RIGHT - go back / forwards in the history
+ , - go back / forwards in the history
- show "Jump to" dialog
- scroll to active note
- jumps to parent note
@@ -42,8 +42,8 @@
opens empty tab
closes active tab
- CTRL+Tab activates next tab
- CTRL+Shift+Tab activates previous tab
+ activates next tab
+ activates previous tab
@@ -72,12 +72,12 @@
, - move note up/down in the note list
, - move note up in the hierarchy
, - multi-select note above/below
- CTRL+A - select all notes in the current level
+ - select all notes in the current level
Shift+click - select note
- CTRL+C - copies active note (or current selection) into clipboard (used for cloning )
- CTRL+X - cuts current (or current selection) note into clipboard (used for moving notes)
- CTRL+V - pastes note(s) as sub-note into active note (which is either move or clone depending on whether it was copied or cut into clipboard)
- DEL - delete note / sub-tree
+ - copies active note (or current selection) into clipboard (used for cloning )
+ - cuts current (or current selection) note into clipboard (used for moving notes)
+ - pastes note(s) as sub-note into active note (which is either move or clone depending on whether it was copied or cut into clipboard)
+ - delete note / sub-tree
@@ -89,7 +89,8 @@
- in tree pane switches from tree pane into note title. Enter from note title switches focus to text editor. CTRL+. switches back from editor to tree pane.
+ in tree pane switches from tree pane into note title. Enter from note title switches focus to text editor.
+ switches back from editor to tree pane.
Ctrl+K - create / edit external link
- create internal link
- inserts current date and time at caret position
@@ -122,7 +123,7 @@
- reloads Trilium frontend
- show developer tools
- ALT+O - show SQL console
+ - show SQL console
@@ -136,8 +137,8 @@
- Zen mode - display only note editor, everything else is hidden
- toggle search form in tree pane
- CTRL+F - in page search
- ALT+A - show note attributes dialog
+ - in page search
+ - show note attributes dialog
diff --git a/src/views/mobile.ejs b/src/views/mobile.ejs
index 9f82bbf7b..349091583 100644
--- a/src/views/mobile.ejs
+++ b/src/views/mobile.ejs
@@ -17,9 +17,9 @@