Skip to content

Commit 7a2c1fb

Browse files
committed
demos add isRemoteChange
1 parent 698a996 commit 7a2c1fb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/demo/src/pages/PageDemoComponent.tsx

Lines changed: 3 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 Container from '@mui/material/Container'
34
import Box from '@mui/material/Box'
@@ -129,8 +130,8 @@ const DemoComponentReadOnly = () => {
129130
const [readOnly, setReadOnly] = React.useState(false)
130131
const [value, setValue] = React.useState('')
131132

132-
const onChange: CodeMirrorOnChange = React.useCallback((editor, newValue) => {
133-
if(!editor.docChanged || typeof newValue !== 'string') {
133+
const onChange: CodeMirrorOnChange = React.useCallback((update, newValue) => {
134+
if(!update.docChanged || typeof newValue !== 'string' || isRemoteChange(update)) {
134135
return
135136
}
136137
setValue(newValue)

packages/demo/src/pages/PageDemoComponentMui.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Button from '@mui/material/Button'
2-
import { isRemoteChange } from '@ui-schema/kit-codemirror'
2+
import { isRemoteChange } from '@ui-schema/kit-codemirror/isRemoteChange'
33
import React from 'react'
44
import Container from '@mui/material/Container'
55
import Box from '@mui/material/Box'

0 commit comments

Comments
 (0)