editable
editable-content logo
content
  • Main Demo
  • Stateful and Propful Components
  • Propful Only Components
  • Styling and Callbacks
  • Documentation

editable-content

Welcome to the editable-content demo! This library is designed to give developers the ability to create rich-text editors which include React Components as elements.

As a demonstration, please feel free to play around with the editable text container below. It should work like a normal rich text field, but with one key distinction: there are two types of styling buttons: Standard Wrappers and Unbreakable Components.

Standard Wrappers work as you would normally expect from a word processor; when text is selected and the button is clicked, the selected text will take on that text style. Click the button again, and the selected text will lose that given text decoration. Text can have multiple standard wrappers in effect at the same time, such as text which is in italics and in bold while inside of other text which is bold. When the cursor is in just one space, clicking the button will make future text from the cursor have that decoration, or lose that style if the button was already clicked.

Unbreakable Components are different: Unlike Standard Wrappers, no other style can “nest” within an Unbreakable Component, and an Unbreakable Component cannot be inside of any other decoration. From a user standpoint, this means two things:

All React Components are unbreakable!

Lastly, take a look at some of what's below the editable text container. There's a “Clear” button to clear the contents, as well as a “Render Text” button you can click. The Clear button will reset the content of the editable text container, and the Render Text button will make the content no longer editable. This means that a user can go back and forth between Editable Text and a Rendered (and non-editable) version of what they've written. If you want to take a look at some of the state changes going on under the hood, take a look at some of the accordion menus underneath, which should give you an idea as to how as a developer, you can save and rehydrate user-created React data. When you're all done, click the NEXT button to head to the next example.

Standard Wrappers

Unbreakable Components

Selection Text (selectionToString)


Dehydrated HTML


All Props


NEXT