1.2.1 • Published 4 months ago

simple-rich-text-editor v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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);
}
1.2.0

4 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.1.9

4 months ago

1.1.8

4 months ago

1.0.9

4 months ago

1.1.7

4 months ago

1.0.8

4 months ago

1.1.6

4 months ago

1.0.7

4 months ago

1.1.5

4 months ago

1.0.6

4 months ago

1.1.4

4 months ago

1.0.5

4 months ago

1.1.3

4 months ago

1.0.4

4 months ago

1.2.1

4 months ago

1.1.2

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago