0.3.0 • Published 1 year ago

@mischnic/codemirror-preact v0.3.0

Weekly downloads
10
License
MIT
Repository
-
Last release
1 year 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

1 year ago

0.2.0

2 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago