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

Related tags

Editors verbum
Overview

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 />

Property Type description
children ReactNode optional Nested child components, like the ToolbarPlugin
hashtagsEnabled boolean optional Enables the automatic hashtag highlighting, default is false
autoLinkEnabled boolean optional Enables the automatic link highlighting, default is false
emojisEnabled boolean optional Replaces the emoji combiniations with its corresponding symbol, default is false
placeholder string optional The default content of the editor when it is first loaded
listMaxIndent number optional The maximum indent capacity of any listed element, the default is 7
initialEditorState string optional JSON string to initialize the initial content of the editor.
onChange (state) => void optional Accessing the current editor state

<ToolbarPlugin />

Property Type description
children React.ReactElement[] optional Nested child components, like the InsertDropdown
defaultFontSize string optional The default font size selected when the editor first loaded, default value is 15px
defaultFontColor string optional The default font color selected when the editor first loaded, default value is #000
defaultBgColor string optional The default text background color selected when the editor first loaded, default value is #fff
defaultFontFamily string optional The default font family selected when the editor first loaded, default value is Arial

<InsertDropdown />

Property Type description
enableTable boolean optional Enables table inserting feature
enableYoutube boolean optional Enables youtube video inserting feature
enableTwitter boolean optional Enables tweet inserting feature
enablePoll boolean optional Enables poll inserting feature
enableImage boolean optional Enables image inserting feature
enableEquations boolean optional Enables equation inserting feature
enableExcalidraw boolean optional Enables diagram inserting feature
enableHorizontalRule boolean optional Enables the horizontal rule inserting for layout
enableStickyNote boolean optional Enables 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.

Comments
  • No way to use EditorContext nor LexicalComposerContext

    No way to use EditorContext nor LexicalComposerContext

    Describe the bug I couldn't find a way to get the editor value.

    To Reproduce Steps to reproduce the behavior:

    1. Use an example from README
    2. Attach the following "plugin"
    const MyComponent = () => {
      const [editor] = useLexicalComposerContext();
      return <div onClick={() => console.log(editor)}>Show Editor</div>
    }
    

    Expected behavior

    editor object should be printed

    I also couldn't use useContext(EditorContext) because EditorContext doesn't seem to be exported properly.

    Maybe that's an XY problem, but I was trying to get the current state of the editor to just send it via POST request and couldn't find a way to do that.

    opened by DiggesT 6
  • Editor instance

    Editor instance

    Is your feature request related to a problem? Please describe. No way to use editor instance.

    Describe the solution you'd like Maybe should use context to get the instance of editor.

    Additional context Example how i can do this with lexical editor:

    import { $convertToMarkdownString, TRANSFORMERS } from '@lexical/markdown'
    
    const MyComponent = () => {
      const [editor] = useLexicalComposerContext()
    
      const onClick = () => {
        editor.getEditorState().read(() => {
        const a = $convertToMarkdownString(TRANSFORMERS)
      }
    
      return <div onClick={onClick}>Foobar</div>
    }
    
    const Editor = (props: { taskId: number }) => {
    
      return (
        <LexicalComposer initialConfig={initialConfig}>
          <RichTextPlugin />
          <MyComponent />
        </LexicalComposer>
      )
    }
    
    
    enhancement 
    opened by DiggesT 3
  • feat: enable localization in Editor

    feat: enable localization in Editor

    This PR:

    add support for French and English localization. enable json module add support for browser-based language detector enable transpile-only to skip type checking on i18next initialization

    opened by lohnsonok 1
  • Fix for Equation Node Serialization

    Fix for Equation Node Serialization

    Hi there!

    This pull is a very small fix to enable equation nodes (math/latex) to be serialized. Currently the exportJSON() method fails client-side due to the type property of the serialized return object being emoji instead of equation.

    Screen Shot 2022-08-15 at 11 46 51 PM

    To test:

    1. In the storybook component, add enableEquations to <InsertDropdown/> component and add a console log to the onChange event. For convenience:
    export const FullEditor = () => (
      <EditorComposer>
        <Editor onChange={stringifiedNodes => console.log(stringifiedNodes)}>
          <ToolbarPlugin>
            <FontFamilyDropdown />
            <FontSizeDropdown />
            <Divider />
            <BoldButton />
            <ItalicButton />
            <UnderlineButton />
            <CodeFormatButton />
            <InsertLinkButton />
            <TextColorPicker />
            <BackgroundColorPicker />
            <TextFormatDropdown />
            <Divider />
            <InsertDropdown enableEquations />
            <Divider />
            <AlignDropdown />
          </ToolbarPlugin>
        </Editor>
      </EditorComposer>
    );
    
    1. Add any equation to the Storybook playground
    2. Profit!
    opened by nofurtherinformation 1
  • Added type button on buttons to avoid submit form

    Added type button on buttons to avoid submit form

    Hi,

    This pull request is converting all buttons from submit to button. It is required to avoid submit when use the editor inside a form.

    <form>
        <Editor />
    </form>
    
    

    Thanks.

    opened by felipehertzer 0
  • Fix storybook build error

    Fix storybook build error

    Currently we can't run npm run storybook because the build fails.

    Error Log:

    ERROR in ./stories/Verbum.stories.tsx
    Module not found: Error: Can't resolve '../src/App' in '~/verbum/stories'
     @ ./stories/Verbum.stories.tsx 48:0-39 56:13-26
    
    opened by omkarshelar 0
  • Error Global CSS cannot be imported from within node_modules when using next.js

    Error Global CSS cannot be imported from within node_modules when using next.js

    Describe the bug Error Global CSS cannot be imported from within node_modules when using next.js

    Expected behavior I think verbum need work with next.js

    Screenshots Cheese_22 12 29_19 22 49

    opened by karyanayandi 0
  • Can't get the html value using $generateHtmlFromNodes on onChange Editor prop

    Can't get the html value using $generateHtmlFromNodes on onChange Editor prop

    Describe the bug Uncaught Error: Unable to find an active editor state. State helpers or node methods can only be used synchronously during the callback of editor.update() or editorState.read().

    To Reproduce

    ....
    const handleChange = (state, editor) => {
        editor.update(() => {
          const htmlString = $generateHtmlFromNodes(editor, null);
          console.log(htmlString);
        });
      };
    
      return (
        <EditorComposer>
          <Editor hashtagsEnabled={true} onChange={handleChange}>
    ....
    

    Expected behavior To return the HTML value from the text editor when onChange is called

    Screenshots image

    Desktop (please complete the following information):

    • OS: Windows 11
    • Browser Chrome
    opened by Nhed1 0
  • Custom css (styles or classNames) to customize editor and toolbar

    Custom css (styles or classNames) to customize editor and toolbar

    Is your feature request related to a problem? Please describe. I am about to give Verbum a try because It's easy to set up but I got one issue. This issue is I can't style the Toolbar as I want. For example, the height of the toolbar component is 32px but I want to change it to 50px so that will fit my components but Ican't

    Describe the solution you'd like I think you can add default styles and class names, and concatenate the styles props and classnames props so anyone can customize the toolbar and the editor.

    enhancement 
    opened by gh4m21 3
  • InsertDropDown > Image > Sample  insert empty block

    InsertDropDown > Image > Sample insert empty block

    Maybe a default image is needed or we can remove the sample item.

    https://github.com/ozanyurtsever/verbum/blob/07cd283aadb2ca05ddc51a23582e38313b0aeaaa/src/plugins/ToolbarPlugin/components/InsertDropdown.tsx#L64

    refactoring 
    opened by evolify 0
  • Error: Global CSS cannot be imported from within node_modules.

    Error: Global CSS cannot be imported from within node_modules.

    Describe the bug I just installed the package in a next.js project and I get this error:

    error - ../../node_modules/katex/dist/katex.css
    Global CSS cannot be imported from within node_modules.
    Read more: https://nextjs.org/docs/messages/css-npm
    Location: ../../node_modules/verbum/dist/verbum.esm.js
    

    To Reproduce

    1. start a new next.js app with yarn create next-app <name>
    2. install verbum: yarn add verbum
    3. copy the example in the README
    4. start the development server with yarn dev
    opened by ahhshm 8
Releases(v0.4.1)
  • v0.4.1(Dec 4, 2022)

    • (feat#16) add initialEditorState support 1222665
    • fix compilation error for i18next 664e1f9
    • Merge pull request #14 from lohnsonok/doc/readme 11f7355
    • fix:add transpileOnly for build command 43b0856
    • Merge pull request #15 from lohnsonok/feat/localization ece69c3
    • feat: enable localization in Editor 1260909
    • doc: Deprecated isReadOnly in v 0.4 ac0f011

    https://github.com/ozanyurtsever/verbum/compare/v0.4.0...v0.4.1

    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Oct 2, 2022)

    • Merge pull request #13 from DiggesT/master fb47735
    • Update Lexical to 0.5.0 c102f11
    • UPGRADE lexical version to 0.3.11 07cd283

    https://github.com/ozanyurtsever/verbum/compare/v0.3.5...v0.4.0

    Source code(tar.gz)
    Source code(zip)
  • v0.3.5(Aug 18, 2022)

    • Merge branch 'master' of https://github.com/ozanyurtsever/verbum 47b44c2
    • Merge pull request #10 from nofurtherinformation/equation-serialization-fix 0b91dc0
    • Fix type in equation node return d464261
    • Merge pull request #9 from felipehertzer/master db06a8d
    • Added type button on buttons to stop submit form 15b492a

    https://github.com/ozanyurtsever/verbum/compare/v0.3.4...v0.3.5

    Source code(tar.gz)
    Source code(zip)
  • v0.3.4(Aug 5, 2022)

  • v0.3.3(Jul 25, 2022)

    • UPGRADE lexical version to 0.3.8 4c738b1
    • docs: Update readme for editor api 9ced392
    • feat: Add read only option to editor * enable read only mode option through props * disable actions toolbar defaultly c498eba
    • fix(readme): Fix markdown styling f4a3267
    • docs: Update README 19a8559
    • feat: add new functionalities to editor api 21247d4
    • Merge branch 'master' of https://github.com/ozanyurtsever/verbum 3e1a599
    • refactor: Remove unused imports 990fb80
    • Merge pull request #5 from ahhshm/fix/typo cf4fa88
    • fix(readme): fix typos 15e5a6a

    https://github.com/ozanyurtsever/verbum/compare/v0.3.2...v0.3.3

    Source code(tar.gz)
    Source code(zip)
  • v0.3.2(Jun 27, 2022)

    • API is updated with a more flexible Toolbar eadc0bf
    • Refactoring: toolbar component reconstructed with extracting nested components 7912540

    https://github.com/ozanyurtsever/verbum/compare/v0.3.1...v0.3.2

    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Jun 24, 2022)

    • some toolbar elements are extracted as seperate components 4fd95ca
    • InsertDropdown and AlignDropdown components exported as well 0aa4ff0
    • Previous build errors resolved f09580e
    • linting removed from the workflow temporarily df1e6bf
    • linting problem is resolved 3a349ee
    • Merge branch 'master' of https://github.com/ozanyurtsever/verbum 1edeb7d
    • prettier formating applied to avoid CI errors 010e87c
    • Update issue templates b685421
    • Update README.md 684dc5c
    • Merge pull request #2 from omkarshelar/storybook-fix 357f848
    • Merge pull request #3 from elv1n/patch-1 fc2b677
    • a local dependency error caused by npm link is resolved. read-me is updated ae1af53
    • Credit the authors of the library and the playground 6b9ef33
    • Fix storybook build error c283d8f
    • Merge pull request #1 from adwilk/consistent-punctuation bc5d6c7
    • consistent punctuation cf57ce4
    • Update README.md 04a16e7
    • image is added for demo b22a7c6

    https://github.com/ozanyurtsever/verbum/compare/v0.3.0...v0.3.1

    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Jun 20, 2022)

    • minor version upgrade 41e3e95
    • Update Read.me 904b128
    • read.me is edited 683e795
    • All of the sub component dependencies are moved to a higher context to allow nesting sub modules inside the editor and toolbar 3f54802
    • Packages are upgraded for the new lexical release 0.3.1 bfac388
    • readme file is updated 960c227
    • build time bugs are resolved. b06dff2

    https://github.com/ozanyurtsever/verbum/compare/65799f688b3c8e8980799d86260dfd61fdbb7ca1...v0.3.0

    Source code(tar.gz)
    Source code(zip)
Owner
Ozan Yurtsever
Software Engineer and Entrepreneur primarily working on web technologies.
Ozan Yurtsever
Open source rich text editor based on HTML5 and the progressive-enhancement approach. Uses a sophisticated security concept and aims to generate fully valid HTML5 markup by preventing unmaintainable tag soups and inline styles.

This project isn’t maintained anymore Please check out this fork. wysihtml5 0.3.0 wysihtml5 is an open source rich text editor based on HTML5 technolo

Christopher Blum 6.5k Dec 30, 2022
Override the rich text editor in Strapi admin with ToastUI Editor.

strapi-plugin-wysiwyg-tui-editor ⚠️ This is a strapi v4 plugin which does not support any earlier version! A Strapi plugin to replace the default rich

Zhuo Chen 12 Dec 23, 2022
Typewriter is a simple, FOSS, Web-based text editor that aims to provide a simple and intuitive environment for you to write in.

Typewriter Typewriter is a simple, FOSS, Web-based text editor that aims to provide a simple and intuitive environment for you to write in. Features S

Isla 2 May 24, 2022
The best enterprise-grade WYSIWYG editor. Fully customizable with countless features and plugins.

CKEditor 4 - Smart WYSIWYG HTML editor A highly configurable WYSIWYG HTML editor with hundreds of features, from creating rich text content with capti

CKEditor Ecosystem 5.7k Dec 27, 2022
A markdown editor. http://lab.lepture.com/editor/

Editor A markdown editor you really want. Sponsors Editor is sponsored by Typlog. Overview Editor is not a WYSIWYG editor, it is a plain text markdown

Hsiaoming Yang 2.8k Dec 19, 2022
A chrome extension which helps change ace editor to monaco editor in web pages, supporting all features including autocompletes.

Monaco-It Monaco-It is a chrome extension turning Ace Editor into Monaco Editor, supporting all features including autocompletes. 一些中文说明 Supported Lan

null 3 May 17, 2022
Simple rich text editor (contentEditable) for jQuery UI

Hallo - contentEditable for jQuery UI Hallo is a very simple in-place rich text editor for web pages. It uses jQuery UI and the HTML5 contentEditable

Henri Bergius 2.4k Dec 17, 2022
A modern, simple and elegant WYSIWYG rich text editor.

jQuery-Notebook A simple, clean and elegant WYSIWYG rich text editor for web aplications Note: Check out the fully functional demo and examples here.

Raphael Cruzeiro 1.7k Dec 12, 2022
Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

If you would be interested in helping to maintain one of the most successful WYSIWYG text editors on github, let us know! (See issue #1503) MediumEdit

yabwe 15.7k Jan 4, 2023
Tiny bootstrap-compatible WISWYG rich text editor

bootstrap-wysiwyg Important information for Github requests/issues Please do not submit issues/comments to this repo. Instead, submit it to https://gi

MindMup 5.6k Jan 3, 2023
HTML5 rich text editor. Try the demo integration at

Squire Squire is an HTML5 rich text editor, which provides powerful cross-browser normalisation in a flexible lightweight package (only 16.5KB of JS a

Neil Jenkins 4.4k Dec 28, 2022
A rich text editor for everyday writing

Trix A Rich Text Editor for Everyday Writing Compose beautifully formatted text in your web application. Trix is a WYSIWYG editor for writing messages

Basecamp 17.3k Jan 3, 2023
Popline is an HTML5 Rich-Text-Editor Toolbar

popline Popline is a non-intrusive WYSIWYG editor that shows up only after selecting a piece of text on the page, inspired by popclip. Usage Load jQue

kenshin 1k Nov 4, 2022
A powerful WYSIWYG rich text web editor by pure javascript

KothingEditor A powerful WYSIWYG rich text web editor by pure javascript Demo : kothing.github.io/editor The KothingEditor is a lightweight, flexible,

Kothing 34 Dec 25, 2022
An Open, Extensible Framework for building Web3D Engine, Editor

Meta3D (Meta3D is under development, not product ready) Meta3D is an Open, Extensible Framework for building Web3D Engine, Editor. read Meta3D介绍 for m

Wonder Technology 54 Dec 29, 2022
A browser based code editor

Monaco Editor The Monaco Editor is the code editor which powers VS Code, with the features better described here. Please note that this repository con

Microsoft 32.4k Jan 3, 2023
A browser based code editor

Monaco Editor The Monaco Editor is the code editor which powers VS Code, with the features better described here. Please note that this repository con

Microsoft 24.6k May 17, 2021
Browser-based code editor created to edit local or server files online

notIDE Browser-based code editor created to edit local or server files online. Features Autosave while editing Syntax highlight using ace editor Creat

Mr Crypster 15 Nov 21, 2022
Get warnings and error messages in monaco editor based on a unified processor.

monaco-unified Get warnings and error messages in monaco editor based on a unified processor. Installation npm install monaco-unified Usage First, cre

Remco Haszing 15 Nov 4, 2022