2019-01-09 22:08:24 +01:00
|
|
|
/**
|
|
|
|
* Mac specific initialization
|
|
|
|
*/
|
|
|
|
import utils from "./utils.js";
|
2022-12-01 00:17:15 +01:00
|
|
|
import shortcutService from "./shortcuts.js";
|
2019-01-09 22:08:24 +01:00
|
|
|
|
|
|
|
function init() {
|
|
|
|
if (utils.isElectron() && utils.isMac()) {
|
2025-01-09 18:07:02 +02:00
|
|
|
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"));
|
2019-01-09 22:08:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-21 22:37:38 +02:00
|
|
|
function exec(cmd: string) {
|
2019-01-09 22:08:24 +01:00
|
|
|
document.execCommand(cmd);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
init
|
2025-01-09 18:07:02 +02:00
|
|
|
};
|