mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +01:00 
			
		
		
		
	setup keyboard shortcuts on the setup page as well, closes #267
This commit is contained in:
		
							parent
							
								
									3ff3021acd
								
							
						
					
					
						commit
						4b977a3306
					
				@ -36,6 +36,7 @@ import hoistedNoteService from './services/hoisted_note.js';
 | 
				
			|||||||
import noteTypeService from './services/note_type.js';
 | 
					import noteTypeService from './services/note_type.js';
 | 
				
			||||||
import linkService from './services/link.js';
 | 
					import linkService from './services/link.js';
 | 
				
			||||||
import noteAutocompleteService from './services/note_autocomplete.js';
 | 
					import noteAutocompleteService from './services/note_autocomplete.js';
 | 
				
			||||||
 | 
					import macInit from './services/mac_init.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// required for CKEditor image upload plugin
 | 
					// required for CKEditor image upload plugin
 | 
				
			||||||
window.glob.getCurrentNode = treeService.getCurrentNode;
 | 
					window.glob.getCurrentNode = treeService.getCurrentNode;
 | 
				
			||||||
@ -110,21 +111,6 @@ if (utils.isElectron()) {
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function exec(cmd) {
 | 
					 | 
				
			||||||
    document.execCommand(cmd);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if (utils.isElectron() && utils.isMac()) {
 | 
					 | 
				
			||||||
    utils.bindShortcut('meta+c', () => exec("copy"));
 | 
					 | 
				
			||||||
    utils.bindShortcut('meta+v', () => exec('paste'));
 | 
					 | 
				
			||||||
    utils.bindShortcut('meta+x', () => exec('cut'));
 | 
					 | 
				
			||||||
    utils.bindShortcut('meta+a', () => exec('selectAll'));
 | 
					 | 
				
			||||||
    utils.bindShortcut('meta+z', () => exec('undo'));
 | 
					 | 
				
			||||||
    utils.bindShortcut('meta+y', () => exec('redo'));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$("#export-note-button").click(function () {
 | 
					$("#export-note-button").click(function () {
 | 
				
			||||||
    if ($(this).hasClass("disabled")) {
 | 
					    if ($(this).hasClass("disabled")) {
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
@ -133,6 +119,8 @@ $("#export-note-button").click(function () {
 | 
				
			|||||||
    exportDialog.showDialog('single');
 | 
					    exportDialog.showDialog('single');
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					macInit.init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
treeService.showTree();
 | 
					treeService.showTree();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
entrypoints.registerEntrypoints();
 | 
					entrypoints.registerEntrypoints();
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										25
									
								
								src/public/javascripts/services/mac_init.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/public/javascripts/services/mac_init.js
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Mac specific initialization
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					import utils from "./utils.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function init() {
 | 
				
			||||||
 | 
					    if (utils.isElectron() && utils.isMac()) {
 | 
				
			||||||
 | 
					        utils.bindShortcut('meta+c', () => exec("copy"));
 | 
				
			||||||
 | 
					        utils.bindShortcut('meta+v', () => exec('paste'));
 | 
				
			||||||
 | 
					        utils.bindShortcut('meta+x', () => exec('cut'));
 | 
				
			||||||
 | 
					        utils.bindShortcut('meta+a', () => exec('selectAll'));
 | 
				
			||||||
 | 
					        utils.bindShortcut('meta+z', () => exec('undo'));
 | 
				
			||||||
 | 
					        utils.bindShortcut('meta+y', () => exec('redo'));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function exec(cmd) {
 | 
				
			||||||
 | 
					    document.execCommand(cmd);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default {
 | 
				
			||||||
 | 
					    init
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,4 +1,7 @@
 | 
				
			|||||||
import utils from "./services/utils.js";
 | 
					import utils from "./services/utils.js";
 | 
				
			||||||
 | 
					import macInit from './services/mac_init.js';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					macInit.init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function SetupModel() {
 | 
					function SetupModel() {
 | 
				
			||||||
    if (syncInProgress) {
 | 
					    if (syncInProgress) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user