0.3.0 • Published 3 years ago

@mischnic/codemirror-preact v0.3.0

Weekly downloads
10
License
MIT
Repository
-
Last release
3 years ago

codemirror-preact

Use https://github.com/codemirror/codemirror.next with Preact.

import { Codemirror } from "@mischnic/codemirror-preact";

<Codemirror
	value={"<b>Hello!</b>"}
	extensions={extensions}
	onHandleUpdate={(view, t) => view.update(t)}
	onTextChange={(view) => console.log(view.state.doc.toString())}
	readOnly={false},
	...rest //, other props for the wrapper <div>
/>;

useMemo the props to prevent unnecessary updates!

  • Use onHandleUpdate if you want to efficiently prevent updates to the editor (apart from readOnly).
  • You can use onTextChange for a "controlled input" by updating the state that sets value (might be less performant).
0.3.0

3 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago