Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/editors/slate/keyboard/find.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 { register } from "./register";
7
8
register(
9
[
10
{ key: "f", ctrl: true },
11
{ key: "f", meta: true },
12
{ key: "h", ctrl: true }, // also include H, which is shortcut for
13
{ key: "h", meta: true }, // replace, since find/replace are unified in our editor.
14
],
15
({ extra }) => {
16
extra.search.focus(getSelection()?.toString());
17
return true;
18
}
19
);
20
21
register(
22
[
23
{ key: "g", ctrl: true },
24
{ key: "g", meta: true },
25
],
26
({ extra }) => {
27
extra.search.next();
28
return true;
29
}
30
);
31
32
register(
33
[
34
{ key: "g", ctrl: true, shift: true },
35
{ key: "g", meta: true, shift: true },
36
],
37
({ extra }) => {
38
extra.search.previous();
39
return true;
40
}
41
);
42
43