mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-01 04:12:58 +08:00
27 lines
752 B
TypeScript
27 lines
752 B
TypeScript
/**
|
|
* Mac specific initialization
|
|
*/
|
|
import utils from "./utils.js";
|
|
import shortcutService from "./shortcuts.js";
|
|
|
|
function init() {
|
|
if (utils.isElectron() && utils.isMac()) {
|
|
shortcutService.bindGlobalShortcut("meta+c", () => exec("copy"));
|
|
shortcutService.bindGlobalShortcut("meta+v", () => exec("paste"));
|
|
shortcutService.bindGlobalShortcut("meta+x", () => exec("cut"));
|
|
shortcutService.bindGlobalShortcut("meta+a", () => exec("selectAll"));
|
|
shortcutService.bindGlobalShortcut("meta+z", () => exec("undo"));
|
|
shortcutService.bindGlobalShortcut("meta+y", () => exec("redo"));
|
|
}
|
|
}
|
|
|
|
function exec(cmd: string) {
|
|
document.execCommand(cmd);
|
|
|
|
return false;
|
|
}
|
|
|
|
export default {
|
|
init
|
|
};
|