0.3.8-alpha • Published 3 years ago

react-richmon v0.3.8-alpha

Weekly downloads
9
License
MIT
Repository
-
Last release
3 years ago

Richmon

Richmon is a new rich text editor for React that is very easy to use and customize, it's currently on the alpha release - new features are listed to be added in future releases.

NPM JavaScript Style Guide

Install

npm install --save richmon

Getting started

import React, { useState } from 'react'

import { Richmon } from 'richmon'

export default () => {
  const [content, setContent] = useState('')

  return (
    <Richmon
      content={content}
      onChange={setContent}
      tools={[
        'BIUS',
        'thin-seperator',
        'sub',
        'sup',
        'thin-seperator',
        'fontSize',
        'textColor',
        'textHighlight',
        'textShadow',
        'thin-seperator',
        'orderedList',
        'unOrderedList',
        'table'
      ]}
    />
  )
}

If you don't want a smooth caret, just include the disableSmoothCaret prop.

Customization

Basic customization can be done by providing props to the main Richmon Component, check the list of available props below.

If you want to customize more, like providing custom buttons or custom menus there's components like RichButton, RichMenu, FontSizeMenu, TableMenu and more, they are listed to be documented soon.

Props

ProptypeRequiredWhat it does?
contentstringtrueSets initial content for the Editor.
onChangecallback functiontruesets the content for the editor
toolsarray of strings and/or componentstruesets the ttols in the toolbar like bold, textColor..etc.
widthstringfalsethe width of the entire component.
heightstringfalsethe height of the enire component.
cssstringfalsethe css for the entire component (styled components css syntax)
editorCssstringfalsethe css for the Editor (styled components css syntax)
toolbarCssstringfalsethe css for the Editor (styled components css syntax)
caretColorstringfalsesets the color of the caret
disableSmoothCaretstringfalsedisables the smooth caret on the editor, defaults to false.
defaultTextColorstringfalsethe default text color in the editor.
defaultFontSizestringfalsethe default font size in the editor.
defaultButtonWidthstringfalsethe default width of buttons in the toolbar.
defaultHighlightColorstringfalsethe default highlight color for the text in the editor.
defaultButtonWidthstringfalsethe default width of buttons in the toolbar.
defaultButtonHeightstringfalsethe default height of buttons in the toolbar.
defaultButtonCssstringfalsethe default css of buttons in the toolbar.
defaultActionButtonCssstringfalsethe default css of action buttons in the toolbar, action buttons is in the left of the arrow button in menus like text color menu, text highlight menu..etc.
defaultButtonWrapperCssstringfalsethe default css for the button that wraps action button and arrow button on menus.
caretDelaystringfalsethe caret transition delay, defaults to '55ms'.
defaultBasicTextColorsRowsnumberfalsethe number of rows of the basic colors group in text colors menu.
defaultBasicTextColorsColsnumberfalsethe number of columns of the basic colors group in text colors menu.
defaultBasicTextHighlightColorsRowsnumberfalsethe number of rows of the basic colors group in text highlight menu.
defaultBasicTextHighlightColorsColsnumberfalsethe number of columns of the basic colors group in text highlight menu.
defaultBasicTextShadowColorsRowsnumberfalsethe number of rows of the basic colors group in text shadow menu.
defaultBasicTextShadowColorsColsnumberfalsethe number of columns of the basic colors group in text shadow menu.
defaultFeaturedTextColorsRowsnumberfalsethe number of rows of the featured colors group (at the top of the basic colors group) in text colors menu.
defaultFeaturedTextColorsColsnumberfalsethe number of columns of the featured colors group (at the top of the basic colors group) in text colors menu.
defaultFeaturedTextHighlightColorsRowsnumberfalsethe number of rows of the featured colors group (at the top of the basic colors group) in text highlight number.
defaultFeaturedTextHighlightColorsColsnumberfalsethe number of columns of the featured colors group (at the top of the basic colors group) in text highlight menu.
defaultFeaturedTextShadowColorsRowsnumberfalsethe number of rows of the featured colors group (at the top of the basic colors group) in text shadow menu.
defaultFeaturedTextShadowColorsColsnumberfalsethe number of columns of the featured colors group (at the top of the basic colors group) in text shadow menu.
defaultCustomTextColorsRowsnumberfalsethe number of rows of the custom colors group in text colors menu.
defaultCustomTextColorsColsnumberfalsethe number of columns of the custom colors group in text colors menu.
defaultCustomTextHighlightColorsRowsnumberfalsethe number of rows of the custom colors group in text highlight menu.
defaultCustomTextHighlightColorsColsnumberfalsethe number of columns of the custom colors group in text highlight menu.
defaultCustomTextShadowColorsRowsnumberfalsethe number of rows of the custom colors group in text shadow menu.
defaultCustomTextShadowColorsColsnumberfalsethe number of columns of the custom colors group in text shadow menu.
textColorsHasCustombooleanfalsesets if the text colors menu has custom colors group.
textHighlightColorsHasCustombooleanfalsesets if the text highlight menu has custom colors group.
textShadowColorsHasCustombooleanfalsesets if the text shadow menu has custom colors group.
defaultBasicTextColorsCssstringfalsesets the css of the basic color palletes in the text color menu.
defaultFeaturedTextColorsCssarray of stringsfalsesets the css of the featured color palletes in the text color menu.
defaultBasicTextHighlightColorsCssarray of stringsfalsesets the css of the featured color palletes in the text highlight menu.
defaultBasicTextShadowColorsCssarray of stringsfalsesets the css of the basic color palletes in the text shadow menu.
defaultFeaturedTextShadowColorsCssarray of stringsfalsesets the css of the featured color palletes in the text shadow menu.
defaultBasicTextHighlightColorsCssarray of stringsfalsesets the css of the basic color palletes in the text highlight menu.
defaultFeaturedTextHighlightColorsarray of stringsfalsesets the css of the featured color palletes in the text highlight menu.
defaultBasicTextColorsarray of stringsfalsesets the basic color pallets for the text color menu (hex, rgb..etc).
defaultFeaturedTextColorsarray of stringsfalsesets the featured color pallets for the text color menu (hex, rgb..etc).
defaultBasicTextHighlightColorsarray of stringsfalsesets the basic color pallets for the text highlight menu (hex, rgb..etc).
defaultFeaturedTextHighlightColorsarray of stringsfalsesets the featured color pallets for the text highlight menu (hex, rgb..etc).
defaultBasicTextShadowColorsarray of stringsfalsesets the basic color pallets for the text shadow menu (hex, rgb..etc).
defaultFeaturedTextShadowColorsarray of stringsfalsesets the featured color pallets for the text shadow menu (hex, rgb..etc).

Todos

  • add image and file upload support
  • write full documentation
  • provide inline tools for tables and images

For suggestions just open an issue.

License

MIT © fayez-nazzal