ver
verbum
npm i verbum
ver

verbum

Verbum is a fully flexible text editor based on lexical framework.

by Ozan Yurtsever

0.4.1 (see all)License:MITTypeScript:Built-In
npm i verbum
Readme

Verbum

Verbum - Flexible Text Editor for React

Verbum is a fully flexible rich text editor based on lexical-playground and lexical framework.

⚠️ As the Lexical framework is currently in early development, this component library is also likely to change quite often

Installation

npm install verbum --save

Demo

Demo Live demo is coming soon...

Usage

import { FC } from 'react';
import {
  EditorComposer,
  Editor,
  ToolbarPlugin,
  AlignDropdown,
  BackgroundColorPicker,
  BoldButton,
  CodeFormatButton,
  FloatingLinkEditor,
  FontFamilyDropdown,
  FontSizeDropdown,
  InsertDropdown,
  InsertLinkButton,
  ItalicButton,
  TextColorPicker,
  TextFormatDropdown,
  UnderlineButton,
  Divider,
} from 'verbum';

const NoteViewer: FC = () => {
  return (
    <EditorComposer>
      <Editor hashtagsEnabled={true}>
        <ToolbarPlugin defaultFontSize="20px">
          <FontFamilyDropdown />
          <FontSizeDropdown />
          <Divider />
          <BoldButton />
          <ItalicButton />
          <UnderlineButton />
          <CodeFormatButton />
          <InsertLinkButton />
          <TextColorPicker />
          <BackgroundColorPicker />
          <TextFormatDropdown />
          <Divider />
          <InsertDropdown enablePoll={true} />
          <Divider />
          <AlignDropdown />
        </ToolbarPlugin>
      </Editor>
    </EditorComposer>
  );
};

export default NoteViewer;

API

<Editor />

PropertyTypedescription
childrenReactNodeoptionalNested child components, like the ToolbarPlugin
hashtagsEnabledbooleanoptionalEnables the automatic hashtag highlighting, default is false
autoLinkEnabledbooleanoptionalEnables the automatic link highlighting, default is false
emojisEnabledbooleanoptionalReplaces the emoji combiniations with its corresponding symbol, default is false
actionsEnabledbooleanoptionalEnables the actions toolbar, default is false
placeholderstringoptionalThe default content of the editor when it is first loaded
listMaxIndentnumberoptionalThe maximum indent capacity of any listed element, the default is 7
isEditablebooleanoptionalEnables read-only mode for the editor, default is false
initialEditorStatestringoptionalJSON string to initialize the initial content of the editor.
onChange(editorState: string, editorInstance?: LexicalEditor) => voidoptionalAccessing the current editor state and the active editor instance
locale`enfrnull`

Automatic browser language detection Support

Verbum supports automatic browser language detection by default if locale not provided. If the browser language is set to fr, the editor will be automatically localized in French. If the browser language is set to en, the editor will be automatically localized in English. If the browser language is set to any other language, the editor will be automatically localized in English.


<ToolbarPlugin />

PropertyTypedescription
childrenReact.ReactElement[]optionalNested child components, like the InsertDropdown
defaultFontSizestringoptionalThe default font size selected when the editor first loaded, default value is 15px
defaultFontColorstringoptionalThe default font color selected when the editor first loaded, default value is #000
defaultBgColorstringoptionalThe default text background color selected when the editor first loaded, default value is #fff
defaultFontFamilystringoptionalThe default font family selected when the editor first loaded, default value is Arial

<InsertDropdown />

PropertyTypedescription
enableTablebooleanoptionalEnables table inserting feature
enableYoutubebooleanoptionalEnables youtube video inserting feature
enableTwitterbooleanoptionalEnables tweet inserting feature
enablePollbooleanoptionalEnables poll inserting feature
enableImagebooleanoptionalEnables image inserting feature
enableEquationsbooleanoptionalEnables equation inserting feature
enableExcalidrawbooleanoptionalEnables diagram inserting feature
enableHorizontalRulebooleanoptionalEnables the horizontal rule inserting for layout
enableStickyNotebooleanoptionalEnables stick note inserting for layout

Development

For development use:

$ npm install (in case of an error, run `npm install --legacy-peer-deps`)
$ npm start
$ npm run storybook

Future plans

  • Test coverage
  • Programmatic access to the editor input as JSON
  • Localization
  • Ready templates with different options (MUI, Bootstrap, etc...)
  • Dark/Light modes
  • Custom styling flexibility
  • Disassembling all of the toolbar to enable using them as nested components, increasing the flexibility
  • Enabling adjusting editor settings such read-only mode and etc. programmatically

License

Licensed under MIT License.

No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate