v4.4.1
- 🐞 fix: Fix extensions bundled version issue (#267). cde4438 @jaywcjlove
npm i @uiw/[email protected]
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://unpkg.com/[email protected]/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" crossorigin></script>
<script src="https://codemirror.net/6/codemirror.js"></script>
<script src="https://unpkg.com/@uiw/[email protected]/dist/codemirror.min.js"></script>
</head>
<body>
<div id="container" style="padding: 24px"></div>
<script>
const {javascript} = CM["@codemirror/lang-javascript"];
const ReactCodeMirror = codemirror.default;
const e = React.createElement;
const Demo = () => {
return e('div', {},
e(ReactCodeMirror, {
value: console.log('hello world!'),
height: '200px',
extensions: [javascript({ jsx: true })],
onChange: (value, viewUpdate) => {
console.log('value:', value);
}
})
);
}
ReactDOM.render(e(Demo), document.getElementById("container"));
</script>
</body>
</html>