mirror of
https://github.com/zadam/trilium.git
synced 2025-01-14 19:19:28 +08:00
fixed CTRL-ALT-P shortcut
This commit is contained in:
parent
209551a205
commit
04af8a3a96
4 changed files with 13 additions and 17 deletions
|
@ -3,6 +3,7 @@
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const log = require('./src/services/log');
|
const log = require('./src/services/log');
|
||||||
|
const cls = require('./src/services/cls');
|
||||||
const url = require("url");
|
const url = require("url");
|
||||||
const port = require('./src/services/port');
|
const port = require('./src/services/port');
|
||||||
|
|
||||||
|
@ -68,10 +69,10 @@ app.on('activate', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.on('ready', () => {
|
app.on('ready', async () => {
|
||||||
mainWindow = createMainWindow();
|
mainWindow = await createMainWindow();
|
||||||
|
|
||||||
const result = globalShortcut.register('CommandOrControl+Alt+P', async () => {
|
const result = globalShortcut.register('CommandOrControl+Alt+P', cls.wrap(async () => {
|
||||||
const dateNoteService = require('./src/services/date_notes');
|
const dateNoteService = require('./src/services/date_notes');
|
||||||
const dateUtils = require('./src/services/date_utils');
|
const dateUtils = require('./src/services/date_utils');
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ app.on('ready', () => {
|
||||||
mainWindow.focus();
|
mainWindow.focus();
|
||||||
|
|
||||||
mainWindow.webContents.send('create-day-sub-note', parentNote.noteId);
|
mainWindow.webContents.send('create-day-sub-note', parentNote.noteId);
|
||||||
});
|
}));
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
log.error("Could not register global shortcut CTRL+ALT+P");
|
log.error("Could not register global shortcut CTRL+ALT+P");
|
||||||
|
|
10
package-lock.json
generated
10
package-lock.json
generated
|
@ -937,11 +937,6 @@
|
||||||
"chainsaw": "~0.1.0"
|
"chainsaw": "~0.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bindings": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw=="
|
|
||||||
},
|
|
||||||
"bl": {
|
"bl": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
|
"resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
|
||||||
|
@ -6579,11 +6574,6 @@
|
||||||
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
|
"integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"nan": {
|
|
||||||
"version": "2.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz",
|
|
||||||
"integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA=="
|
|
||||||
},
|
|
||||||
"nanomatch": {
|
"nanomatch": {
|
||||||
"version": "1.2.13",
|
"version": "1.2.13",
|
||||||
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
|
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
|
||||||
|
|
9
src/public/javascripts/services/bootstrap.js
vendored
9
src/public/javascripts/services/bootstrap.js
vendored
|
@ -90,10 +90,13 @@ if (utils.isElectron()) {
|
||||||
|
|
||||||
await treeService.activateNote(parentNoteId);
|
await treeService.activateNote(parentNoteId);
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(async () => {
|
||||||
const node = treeService.getCurrentNode();
|
const parentNode = treeService.getCurrentNode();
|
||||||
|
|
||||||
|
const {note} = await treeService.createNote(parentNode, parentNode.data.noteId, 'into', parentNode.data.isProtected);
|
||||||
|
|
||||||
|
await treeService.activateNote(note.noteId);
|
||||||
|
|
||||||
treeService.createNote(node, node.data.noteId, 'into', node.data.isProtected);
|
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -522,6 +522,8 @@ async function createNote(node, parentNoteId, target, isProtected, saveSelection
|
||||||
clearSelectedNodes(); // to unmark previously active node
|
clearSelectedNodes(); // to unmark previously active node
|
||||||
|
|
||||||
infoService.showMessage("Created!");
|
infoService.showMessage("Created!");
|
||||||
|
|
||||||
|
return {note, branch};
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If first element is heading, parse it out and use it as a new heading. */
|
/* If first element is heading, parse it out and use it as a new heading. */
|
||||||
|
|
Loading…
Reference in a new issue