Skip to content

Commit 86162bb

Browse files
committed
docs, release prep; add isRemoteChange to widgets;
1 parent f01e161 commit 86162bb

File tree

12 files changed

+61
-30
lines changed

12 files changed

+61
-30
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
blank_issues_enabled: true
22
contact_links:
3-
- name: UI-Schema Slack
4-
url: https://join.slack.com/t/ui-schema/shared_invite/zt-smbsybk5-dFIRLEPCJerzDwtycaA71w
5-
about: Ask questions and discuss in our Slack Community
6-
- name: Material-UI
3+
- name: UI-Schema Discord
4+
url: https://discord.gg/MAjgpwnm36
5+
about: Ask questions and discuss in our Discord Community
6+
- name: CodeMirror GitHub
7+
url: https://github.com/codemirror
8+
about: "More about the underlying editor framework."
9+
- name: Material-UI GitHub
710
url: https://github.com/mui-org/material-ui
8-
about: "When you got question not about the design-system bindings: docs + project of **Material-UI**"
11+
about: "Documentation and more for the design framework."

CONTRIBUTING.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
2. Install dependencies (like lerna, webpack): `npm i`
55
3. Start dev-server: `npm start`
66
- (will clean-dist + start demo app)
7-
4. Open browser on [localhost:4200](http://localhost:4203) for demo
8-
5. Explore [packages](packages)
7+
4. Open browser on [localhost:4203](http://localhost:4203) for demo
8+
5. Explore [packages](packages) and there [demo/src/pages](packages/demo/src/pages)
99
6. Code -> Commit -> Pull Request -> Being Awesome!
1010

1111
Changes from any package are reflected inside the demo package.
@@ -19,9 +19,7 @@ Changes from any package are reflected inside the demo package.
1919
- with `--testPathPattern` to run all tests in a specific folder / path
2020
- `npm run tdd -- --testPathPattern=PatternValidator -t patternValidator` for only one test and often only one file
2121
- Testing: `npm test`
22-
- needs manual bootstrapping, linking and update handling
2322
- Build: `npm run build`
24-
- needs manual bootstrapping and update handling
2523
- Clean node_modules and build dirs: `npm run clean`
2624
- Clean build dirs: `npm run clean-dist`
2725

docs/Index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Documentation
2+
3+
- [kit-codemirror](./kit-codemirror/kit-codemirror.md)
4+
- [material-code](./material-code/material-code.md)

docs/kit-codemirror/kit-codemirror.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ Contains only the minimal necessities for CodeMirror to work in ReactJS, nothing
1616

1717
> [!CAUTION]
1818
>
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.
2020
>
2121
> Otherwise, the editors extension are unnecessarily destroyed and will cause significant performance degradation or even subtle bugs.
2222
>
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.
2424
2525
## Components
2626

@@ -32,13 +32,13 @@ Check the `CustomCodeMirror` in [`demo/src/pages/PageDemoComponent.tsx`](../../p
3232

3333
### useCodeMirror
3434

35-
The `useCodeMirror` hook is used by the `CodeMirror` component and 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.
3636

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).
3838

3939
### useExtension
4040

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.
4242

4343
> [!IMPORTANT]
4444
>
@@ -50,7 +50,7 @@ The `useExtension` hook allows to define a setup function, which returns a confi
5050
5151
It automatically enables the extension and reconfigures it whenever the setup function changes. Always use `useCallback` for the setup function to prevent unnecessary reconfigurations.
5252

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.
5454

5555
```tsx
5656
import { Prec } from '@codemirror/state'

package-lock.json

Lines changed: 20 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/kit-codemirror/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
Thin-wrapper for CodeMirror v6 to use as React Component, with hooks and stuff to build more advanced editors easily.
44

5-
- [Documentation, Examples](https://ui-schema.bemit.codes/docs/kit-codemirror/kit-codemirror)
5+
- [Documentation](https://github.com/ui-schema/react-codemirror/blob/main/docs)
6+
- [Demo](https://github.com/ui-schema/react-codemirror/blob/main/packages/demo/src/pages/PageDemoComponent.tsx)
67
- [Repository](https://github.com/ui-schema/react-codemirror)
78

89
## License

packages/kit-codemirror/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"react-dom": "^17.0 || ^18.0 || ^19.0"
6363
},
6464
"publishConfig": {
65-
"access": "public"
65+
"access": "public",
66+
"tag": "next"
6667
}
6768
}

packages/material-code/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Code Editor (codemirror) to work with [@ui-schema/ui-schema](https://github.com/
44

55
[![Documentation](https://img.shields.io/badge/Component%20Documentation-blue?labelColor=fff&style=for-the-badge&logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIGhlaWdodD0iMzJweCIgaWQ9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jA3LTAuMjAyLDAuNDI0LTAuMjcxLDAuNjUzSDE4djJoMS42NjJjMC4wNzMsMC4yNDYsMC4xNzIsMC40NzksMC4yOTUsMC42OThsLTEuMTY1LDEuMTYzbDEuNDEzLDEuNDE2bDEuMTg4LTEuMTg3ICAgYzAuMTkyLDAuMTAxLDAuMzk0LDAuMTgyLDAuNjA1LDAuMjQ1VjI4SDI0di0xLjY2NWMwLjIyOS0wLjA2OCwwLjQ0NS0wLjE1OCwwLjY1MS0wLjI3bDEuMjEyLDEuMjEybDEuNDE0LTEuNDE2bC0xLjIxMi0xLjIxICAgYzAuMTExLTAuMjA2LDAuMjAxLTAuNDIzLDAuMjctMC42NTFIMjh6IE0yMi45OTksMjQuNDk5Yy0wLjgyOS0wLjAwMi0xLjQ5OC0wLjY3MS0xLjUwMS0xLjVjMC4wMDMtMC44MjksMC42NzItMS40OTgsMS41MDEtMS41MDEgICBjMC44MjksMC4wMDMsMS40OTgsMC42NzIsMS41LDEuNTAxQzI0LjQ5NywyMy44MjgsMjMuODI4LDI0LjQ5NywyMi45OTksMjQuNDk5eiIvPjwvZz48L3N2Zz4=)](https://ui-schema.bemit.codes/docs/material-code/material-code)
66

7-
[![Join UI-Schema on Slack](https://img.shields.io/badge/Join%20UI%20Schema%20on%20Slack-blue?labelColor=fff&logoColor=505050&color=7B16FF&style=for-the-badge&logo=slack)](https://join.slack.com/t/ui-schema/shared_invite/zt-smbsybk5-dFIRLEPCJerzDwtycaA71w)
7+
[![Join UI-Schema on Discord](https://img.shields.io/badge/Join%20UI%20Schema%20on%20Discord-blue?labelColor=fff&logoColor=505050&color=7B16FF&style=for-the-badge&logo=discord)](https://discord.gg/MAjgpwnm36)
88

99
Supports:
1010

packages/material-code/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ui-schema/material-code",
3-
"version": "0.4.7",
3+
"version": "0.5.0-alpha.0",
44
"description": "Code editor widgets using CodeMirror, with Material-UI styling for UI-Schema",
55
"homepage": "https://ui-schema.bemit.codes/docs/material-code/material-code",
66
"author": {
@@ -60,7 +60,7 @@
6060
},
6161
"peerDependencies": {
6262
"@mui/material": "^5.1 || ^6.1",
63-
"@mui/icons-material": "^6.1",
63+
"@mui/icons-material": "^5.10 || ^6.1",
6464
"@codemirror/state": "^6.0.0",
6565
"@codemirror/view": "^6.0.0",
6666
"@codemirror/language": "^6.1.0",
@@ -71,6 +71,7 @@
7171
"react": "^17.0 || ^18.0 || ^19.0"
7272
},
7373
"publishConfig": {
74-
"access": "public"
74+
"access": "public",
75+
"tag": "next"
7576
}
7677
}

packages/material-code/src/WidgetCode/WidgetCode.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { isRemoteChange } from '@ui-schema/kit-codemirror/isRemoteChange'
12
import React from 'react'
23
import { WithScalarValue } from '@ui-schema/ui-schema/UIStore'
34
import { WidgetProps } from '@ui-schema/ui-schema/Widget'
@@ -39,8 +40,11 @@ export const WidgetCode: React.ComponentType<WidgetProps & WithScalarValue & Wid
3940
CodeBar: CustomCodeBar,
4041
},
4142
) => {
42-
const handleOnChange: CodeMirrorOnChange = React.useCallback((v, newValue) => {
43-
if(!v.docChanged || typeof newValue !== 'string') {
43+
const handleOnChange: CodeMirrorOnChange = React.useCallback((update, newValue) => {
44+
if(!update.docChanged || typeof newValue !== 'string') {
45+
return
46+
}
47+
if(isRemoteChange(update)) {
4448
return
4549
}
4650
onChange({

0 commit comments

Comments
 (0)