mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
removed CTRL-ALT-C global shortcut with pasting from clipboard, keeping only CTRL-ALT-P without clipboard
This commit is contained in:
parent
1efac99828
commit
1cef0ce5f9
26
electron.js
26
electron.js
@ -70,34 +70,16 @@ app.on('activate', () => {
|
|||||||
app.on('ready', () => {
|
app.on('ready', () => {
|
||||||
mainWindow = createMainWindow();
|
mainWindow = createMainWindow();
|
||||||
|
|
||||||
const date_notes = require('./src/services/date_notes');
|
|
||||||
const utils = require('./src/services/utils');
|
|
||||||
|
|
||||||
globalShortcut.register('CommandOrControl+Alt+P', async () => {
|
globalShortcut.register('CommandOrControl+Alt+P', async () => {
|
||||||
|
const date_notes = require('./src/services/date_notes');
|
||||||
|
const utils = require('./src/services/utils');
|
||||||
|
|
||||||
const parentNoteId = await date_notes.getDateNoteId(utils.nowDate());
|
const parentNoteId = await date_notes.getDateNoteId(utils.nowDate());
|
||||||
|
|
||||||
// window may be hidden / not in focus
|
// window may be hidden / not in focus
|
||||||
mainWindow.focus();
|
mainWindow.focus();
|
||||||
|
|
||||||
mainWindow.webContents.send('create-sub-note', JSON.stringify({
|
mainWindow.webContents.send('create-day-sub-note', parentNoteId);
|
||||||
parentNoteId: parentNoteId,
|
|
||||||
content: ''
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
|
|
||||||
globalShortcut.register('CommandOrControl+Alt+C', async () => {
|
|
||||||
const parentNoteId = await date_notes.getDateNoteId(utils.nowDate());
|
|
||||||
|
|
||||||
// window may be hidden / not in focus
|
|
||||||
mainWindow.focus();
|
|
||||||
|
|
||||||
let content = clipboard.readText();
|
|
||||||
content = content.replace(/(\r\n|\n)/g, "<p>");
|
|
||||||
|
|
||||||
mainWindow.webContents.send('create-sub-note', JSON.stringify({
|
|
||||||
parentNoteId: parentNoteId,
|
|
||||||
content: content
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -199,9 +199,8 @@ $(document).ready(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (isElectron()) {
|
if (isElectron()) {
|
||||||
require('electron').ipcRenderer.on('create-sub-note', async function(event, message) {
|
require('electron').ipcRenderer.on('create-day-sub-note', async function(event, parentNoteId) {
|
||||||
const {parentNoteId, content} = JSON.parse(message);
|
// this might occur when day note had to be created
|
||||||
|
|
||||||
if (!noteTree.noteExists(parentNoteId)) {
|
if (!noteTree.noteExists(parentNoteId)) {
|
||||||
await noteTree.reload();
|
await noteTree.reload();
|
||||||
}
|
}
|
||||||
@ -211,7 +210,5 @@ if (isElectron()) {
|
|||||||
const node = noteTree.getCurrentNode();
|
const node = noteTree.getCurrentNode();
|
||||||
|
|
||||||
await noteTree.createNote(node, node.data.noteId, 'into', node.data.isProtected);
|
await noteTree.createNote(node, node.data.noteId, 'into', node.data.isProtected);
|
||||||
|
|
||||||
setTimeout(() => noteEditor.setContent(content), 1000);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user