
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@courselit/rich-text
Advanced tools
Edit and display rich text in React apps. Built using DraftJS.
Deprecated: Since Draftjs is no longer maintained, we will not be providing updates to this editor. Please use @courselit/text-editor instead.
A full-fledged rich text editor and displayer for React apps, built using Draft.js.
Pass in an object containing styling information to the styles
prop in order to override the default styles.
<TextEditor
initialContentState={TextEditor.hydrate({ data: course.description })}
readOnly={true}
styles={{text: {fontSize: 30}}}
/>
The following object details the default styles and what all components you can target from your custom styles.
{
controls: {
container: {
display: "flex",
flexDirection: "column",
border: "1px solid #eee",
},
editor: {
maxHeight: "50vh",
overflowX: "none",
overflowY: "scroll",
padding: 10,
},
toolbar: {
padding: 10,
background: "#f7f7f7",
display: "flex",
flexDirection: "row",
alignItems: "center",
},
toolbarInput: {
background: "rgb(179 188 255)",
padding: 10,
},
toolbarButton: {
border: "none",
background: "transparent",
padding: 10,
"&:hover": {
background: "#585858",
},
fontWeight: "bold",
fontSize: 16,
},
},
media: {
container: {
display: "flex",
justifyContent: "center",
},
img: {
maxWidth: "100%",
},
},
code: {
background: "rgb(45, 45, 45)",
color: "#e2e7ff",
padding: "10px 16px",
borderRadius: 2,
fontFamily: '"Fira Code", monospace',
},
blockquote: {
fontStyle: "italic",
fontFamily: "serif",
marginTop: 10,
marginBottom: 10,
borderLeft: "5px solid rgb(179 188 255)",
paddingLeft: 10,
fontSize: "1.6em",
color: "rgb(58 58 58)",
}
}
Paste video's URL in to the editor and it will be embedded.
Paste any tweet's URL in the editor and the tweet will be embedded.
The editor uses Prism for syntax highlighting. You can change the default language from javascript
to something else using the following syntax.
TextEditor.hydrate({ data, prismDefaultLanguage: "rust" })
FAQs
Edit and display rich text in React apps. Built using DraftJS.
We found that @courselit/rich-text demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.