mirror of
https://github.com/zadam/trilium.git
synced 2024-12-28 02:43:54 +08:00
shortcut fixes
This commit is contained in:
parent
1e979d71c7
commit
dbd2040bee
4 changed files with 37 additions and 22 deletions
|
@ -127,7 +127,7 @@ $noteTabContainer.on("click", ".export-note-button", function () {
|
|||
$noteTabContainer.on("click", ".import-files-button",
|
||||
() => import('./dialogs/import.js').then(d => d.showDialog(treeService.getActiveNode())));
|
||||
|
||||
$noteTabContainer.on("click", ".print-note-button", async function () {
|
||||
async function printActiveNote() {
|
||||
if ($(this).hasClass("disabled")) {
|
||||
return;
|
||||
}
|
||||
|
@ -145,7 +145,11 @@ $noteTabContainer.on("click", ".print-note-button", async function () {
|
|||
loadCSS: "libraries/codemirror/codemirror.css",
|
||||
debug: true
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
keyboardActionService.setGlobalActionHandler("PrintActiveNote", printActiveNote);
|
||||
|
||||
$noteTabContainer.on("click", ".print-note-button", printActiveNote);
|
||||
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
html: true
|
||||
|
|
|
@ -162,19 +162,23 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
|||
},
|
||||
{
|
||||
actionName: "OpenNewTab",
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+T"] : []
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+T"] : [],
|
||||
description: "Opens new tab"
|
||||
},
|
||||
{
|
||||
actionName: "CloseActiveTab",
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+W"] : []
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+W"] : [],
|
||||
description: "Closes active tab"
|
||||
},
|
||||
{
|
||||
actionName: "ActivateNextTab",
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+Tab"] : []
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+Tab"] : [],
|
||||
description: "Activates tab on the right"
|
||||
},
|
||||
{
|
||||
actionName: "ActivatePreviousTab",
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+Shift+Tab"] : []
|
||||
defaultShortcuts: isElectron ? ["CommandOrControl+Shift+Tab"] : [],
|
||||
description: "Activates tab on the left"
|
||||
},
|
||||
|
||||
|
||||
|
@ -183,39 +187,48 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
|||
},
|
||||
{
|
||||
actionName: "ShowAttributes",
|
||||
defaultShortcuts: ["Alt+A"]
|
||||
defaultShortcuts: ["Alt+A"],
|
||||
description: "Shows Attributes dialog"
|
||||
},
|
||||
{
|
||||
actionName: "ShowNoteInfo",
|
||||
defaultShortcuts: []
|
||||
defaultShortcuts: [],
|
||||
description: "Shows Note Info dialog"
|
||||
},
|
||||
{
|
||||
actionName: "ShowNoteSource",
|
||||
defaultShortcuts: []
|
||||
defaultShortcuts: [],
|
||||
description: "Shows Note Source dialog"
|
||||
},
|
||||
{
|
||||
actionName: "ShowLinkMap",
|
||||
defaultShortcuts: []
|
||||
defaultShortcuts: [],
|
||||
description: "Shows Link Map dialog"
|
||||
},
|
||||
{
|
||||
actionName: "ShowOptions",
|
||||
defaultShortcuts: []
|
||||
defaultShortcuts: [],
|
||||
description: "Shows Options dialog"
|
||||
},
|
||||
{
|
||||
actionName: "ShowNoteRevisions",
|
||||
defaultShortcuts: []
|
||||
defaultShortcuts: [],
|
||||
description: "Shows Note Revisions dialog"
|
||||
},
|
||||
{
|
||||
actionName: "ShowRecentChanges",
|
||||
defaultShortcuts: []
|
||||
defaultShortcuts: [],
|
||||
description: "Shows Recent Changes dialog"
|
||||
},
|
||||
{
|
||||
actionName: "ShowSQLConsole",
|
||||
defaultShortcuts: ["Alt+O"]
|
||||
defaultShortcuts: ["Alt+O"],
|
||||
description: "Shows SQL Console dialog"
|
||||
},
|
||||
{
|
||||
actionName: "ShowHelp",
|
||||
defaultShortcuts: ["F1"]
|
||||
defaultShortcuts: ["F1"],
|
||||
description: "Shows built-in Help / cheatsheet"
|
||||
},
|
||||
|
||||
|
||||
|
@ -251,10 +264,6 @@ const DEFAULT_KEYBOARD_ACTIONS = [
|
|||
defaultShortcuts: ["Alt+H"],
|
||||
description: "Toggles note hoisting of active note"
|
||||
},
|
||||
{
|
||||
actionName: "RunSQL",
|
||||
defaultShortcuts: ["CommandOrControl+Enter"]
|
||||
},
|
||||
{
|
||||
actionName: "ReloadFrontendApp",
|
||||
defaultShortcuts: ["F5", "CommandOrControl+R"]
|
||||
|
|
|
@ -141,7 +141,7 @@ async function createNewNoteWithTarget(target, targetBranchId, params) {
|
|||
return await createNewNote(params);
|
||||
}
|
||||
else if (target === 'after') {
|
||||
const afterNote = await sql.getRow('SELECT notePosition FROM branches WHERE branchId = ?', [noteData.target_branchId]);
|
||||
const afterNote = await sql.getRow('SELECT notePosition FROM branches WHERE branchId = ?', [targetBranchId]);
|
||||
|
||||
// not updating utcDateModified to avoig having to sync whole rows
|
||||
await sql.execute('UPDATE branches SET notePosition = notePosition + 10 WHERE parentNoteId = ? AND notePosition > ? AND isDeleted = 0',
|
||||
|
@ -149,9 +149,11 @@ async function createNewNoteWithTarget(target, targetBranchId, params) {
|
|||
|
||||
params.notePosition = afterNote.notePosition + 10;
|
||||
|
||||
await createNewNote(params);
|
||||
const retObject = await createNewNote(params);
|
||||
|
||||
await syncTableService.addNoteReorderingSync(params.parentNoteId);
|
||||
|
||||
return retObject;
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unknown target ${target}`);
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
</a>
|
||||
<a class="dropdown-item import-files-button">Import files</a>
|
||||
<a class="dropdown-item export-note-button" data-bind="css: { disabled: type() != 'text' }">Export note</a>
|
||||
<a class="dropdown-item print-note-button"><kdb data-kb-action="PrintActiveNote"></kdb> Print note</a>
|
||||
<a class="dropdown-item print-note-button"><kbd data-kb-action="PrintActiveNote"></kbd> Print note</a>
|
||||
<a class="dropdown-item show-note-info-button"><kbd data-kb-action="ShowNoteInfo"></kbd> Note info</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue