Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@mischnic/codemirror-preact

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mischnic/codemirror-preact

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

npmnpm
Version
0.0.5
Version published
Weekly downloads
15
-58.33%
Maintainers
1
Weekly downloads
 
Created
Source

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

FAQs

Package last updated on 13 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts