🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

simple-rich-text-editor

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-rich-text-editor

a rich text editor for react

latest
Source
npmnpm
Version
1.2.1
Version published
Weekly downloads
1
-96.97%
Maintainers
1
Weekly downloads
 
Created
Source

Simple Rich Text Editor

A simple text input for react applications which can change your input text into bold, italic, strikethrough , and more. This package wouldn't been possible to make without @tiptap/react

Installation

Install Simple Rich Text Editor with npm

  npm i simple-rich-text-editor

Usage

  import { useState } from "react";
  import { RichTextEditor } from "simple-rich-text-editor";
  import "./App.css";


  export default function App() {
  const [data, setData] = useState("");
  return (
       <div>
       <RichTextEditor onchange={(data) => setData(data)} editorClass="card" />
       </div>
  )
}

API

PropertyTypeDescription
boldIconReact.ReactNodeIcon for the bold formatting
italicIconReact.ReactNodeIcon for italic formatting
strikethroughIconReact.ReactNodeIcon for strikethrough formatting
codeIconReact.ReactNodeIcon for code formatting
heading1IconReact.ReactNodeIcon for heading level 1 formatting
heading2IconReact.ReactNodeIcon for heading level 2 formatting
heading3IconReact.ReactNodeIcon for heading level 3 formatting
bulletListIconReact.ReactNodeIcon for bullet list formatting
orderedListIconReact.ReactNodeIcon for ordered list formatting
codeBlockIconReact.ReactNodeIcon for code block formatting
blockquoteIconReact.ReactNodeIcon for blockquote formatting
undoIconReact.ReactNodeIcon for undo action
redoIconReact.ReactNodeIcon for redo action
showBoldbooleanShow/hide the bold formatting option
showItalicbooleanShow/hide the italic formatting option
showStrikethroughbooleanShow/hide the strikethrough formatting option
showCodebooleanShow/hide the code formatting option
showHeading1booleanShow/hide the heading level 1 formatting option
showHeading2booleanShow/hide the heading level 2 formatting option
showHeading3booleanShow/hide the heading level 3 formatting option
showBulletListbooleanShow/hide the bullet list formatting option
showOrderedListbooleanShow/hide the ordered list formatting option
showCodeBlockbooleanShow/hide the code block formatting option
showBlockquotebooleanShow/hide the blockquote formatting option
showUndoIconbooleanShow/hide the undo action icon
showRedoIconbooleanShow/hide the redo action icon
onchange(text: string) => voidCallback function triggered on text change
editorClassstringCustom CSS style for the text input
buttonStylestringCustom CSS style for the editor buttons

Troubleshooting

If you're facing any issues while enabling setting showCodeBlock = true, showBlockquote = true you can customize its appearance by adding the following CSS styles to your main CSS file:

Example

.tiptap pre {
  background-color: #0d0d0d;
  color: #fff;
  font-family: "JetBrainsMono", monospace;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
}

.tiptap pre code {
  color: inherit;
  padding: 0;
  background: none;
  font-size: 0.8rem;
}

.tiptap blockquote {
  padding-left: 1rem;
  border-left: 2px solid rgba(13, 13, 13, 0.1);
}

Keywords

editor

FAQs

Package last updated on 26 Jan 2024

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