Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/editors/slate/keyboard/select-all.ts
1697 views
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { Editor, Transforms } from "slate";
7
import { register, IS_MACOS } from "./register";
8
import { rangeAll } from "../slate-util";
9
10
// We use this to support windowing.
11
12
export function selectAll(editor: Editor) {
13
Transforms.setSelection(editor, rangeAll(editor));
14
}
15
16
register({ key: "a", meta: IS_MACOS, ctrl: !IS_MACOS }, ({ editor }) => {
17
selectAll(editor);
18
return true;
19
});
20
21