You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/kit-codemirror/kit-codemirror.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,11 @@ Contains only the minimal necessities for CodeMirror to work in ReactJS, nothing
16
16
17
17
> [!CAUTION]
18
18
>
19
-
> It is important to only supply safely referenced props! Always use `useMemo`/`useCallback` and so on for extensions, function and other complex values.
19
+
> It is important to only supply safely referenced props! Always use e.g. `useMemo`/`useCallback` for extensions, function and other complex values.
20
20
>
21
21
> Otherwise, the editors extension are unnecessarily destroyed and will cause significant performance degradation or even subtle bugs.
22
22
>
23
-
> For granular control of reactive extension reconfiguration, use the `useCodeMirror` and `useExtension` hooks, check the [`CodeMirror` base component](https://github.com/ui-schema/react-codemirror/blob/main/packages/kit-codemirror/src/CodeMirror/CodeMirror.tsx) as reference.
23
+
> For granular control of reactive extension reconfiguration, use the `useCodeMirror` and `useExtension` hooks, check the [`CodeMirror` base component](../../packages/kit-codemirror/src/CodeMirror/CodeMirror.tsx) as reference.
24
24
25
25
## Components
26
26
@@ -32,13 +32,13 @@ Check the `CustomCodeMirror` in [`demo/src/pages/PageDemoComponent.tsx`](../../p
32
32
33
33
### useCodeMirror
34
34
35
-
The `useCodeMirror` hookis used by the `CodeMirror` componentand can be used to built more advanced customizations easily.
35
+
Create a custom editor component with the `useCodeMirror` hook, it is internally used by the `CodeMirror` component. With it, you have more control on extension setup and customization of the container the editor is rendered in.
36
36
37
-
Check the [`CodeMirror` component as an example](../../packages/kit-codemirror/src/CodeMirror/CodeMirror.tsx).
37
+
Check the [`CodeMirror` component as an example](../../packages/kit-codemirror/src/CodeMirror/CodeMirror.tsx).
38
38
39
39
### useExtension
40
40
41
-
The `useExtension` hook allows to define a setup function, which returns a configured CodeMirror extension.
41
+
The `useExtension` hook sets up a codemirror extension, with easy reactive reconfiguration.
42
42
43
43
> [!IMPORTANT]
44
44
>
@@ -50,7 +50,7 @@ The `useExtension` hook allows to define a setup function, which returns a confi
50
50
51
51
It automatically enables the extension and reconfigures it whenever the setup function changes. Always use `useCallback` for the setup function to prevent unnecessary reconfigurations.
52
52
53
-
The extension is added to the end of the editors configuration, to control the order use the `Prec` to set the precedence.
53
+
The extension is added to the end of the editors configuration, to control the order use `Prec` to set the precedence.
[](https://join.slack.com/t/ui-schema/shared_invite/zt-smbsybk5-dFIRLEPCJerzDwtycaA71w)
7
+
[](https://discord.gg/MAjgpwnm36)
0 commit comments