Keyboard first
The toolbar follows the ARIA toolbar pattern, one tab stop with arrow keys between buttons, and every shortcut you would expect from a text field.
Free and MIT licensed
EnterraEdit drops into any page with one script tag. No build step, no framework,
no dependencies. Mark up a <textarea> and it upgrades in place,
and your form still submits normal HTML.
Try it
Every editor on this page is the real product running from our CDN. Type in one. Select text and press Ctrl+B. Paste a screenshot.
The content above is a plain <textarea> that has been upgraded
in place. View source and you will see it is still the original field.
How it works
Add the script, mark up a textarea. There is no initialisation call, no options object and no build step.
More detail in the support guide: Serving it from the CDN, including the one thing that differs from a self-hosted copy.
1. Add the script
<script src="https://cdn.enterrahost.com/enterraedit/v1/enterraedit.min.js"></script>
One file, no dependencies, no other requests at runtime.
2. Mark up a textarea
<form method="post">
<textarea name="body" data-enterraedit>
<p>Hello</p>
</textarea>
<button>Save</button>
</form>
The textarea stays in the DOM and stays in sync. Your server code does not change.
Prefer JavaScript? new EnterraEdit({ element: el }) does the same thing and
returns an instance you can drive.
Fit to the job
A comment box needs eight buttons. A page editor needs nineteen. Modes scale the toolbar to the task, and you can name exact buttons if the presets do not fit.
More detail in the support guide: Choosing which buttons show, by named mode or by exact key.
Or pick the exact buttons
<textarea data-enterraedit
data-toolbar-keys="bold,italic,link,bulletList,orderedList"></textarea>
Every button has a key. Name the ones you want, in any order, and the
toolbar is built from exactly those. Pass the same list in JavaScript
with toolbarKeys if you prefer.
| Group | Keys |
|---|---|
| Inline |
bold italic underline
strike link unlink
|
| Blocks |
heading1 heading2 heading3
paragraph bulletList
orderedList blockquote
codeBlock horizontalRule
|
| Insert | image table |
| History | undo redo |
A misspelled key is reported rather than silently dropped, because a
toolbar quietly missing the button you asked for is worse than an error.
The list is also readable at runtime: EnterraEdit.ALL_KEYS,
EnterraEdit.BUTTONS and EnterraEdit.keysByGroup(),
so a configuration screen can build itself.
Theming
Themes are CSS custom properties, so an accent color is one attribute. Tokens inherit through the whole UI including dialogs.
This is one example. How to customize the toolbar, theme and accent has a live picker, and explains why one hex becomes two colors.
Four themes and any accent hex. The full guide has a live accent picker and explains why one hex resolves to two colors.
Built in, not bolted on
The toolbar follows the ARIA toolbar pattern, one tab stop with arrow keys between buttons, and every shortcut you would expect from a text field.
Every button has an accessible name from the same string table that supplies its tooltip, so the two cannot drift apart.
Set lang="ar" and direction follows automatically, with logical CSS
properties throughout rather than left and right.
Honest note. The structure is tested, but we have not yet driven this with a screen reader ourselves. If you use one, we would like to hear how it goes.
Two ways to run it
Both are available today. Use the CDN, or take the source and serve it yourself.
More detail in the support guide: Run it from the CDN or build it yourself, and what changes either way.
One script tag, nothing to download, nothing to update. The hosted build adds a small attribution badge, which is the whole of the difference.
<script src="https://cdn.enterrahost.com/enterraedit/v1/enterraedit.min.js"></script>
Build it yourself and serve it from your own infrastructure. No external dependency and no badge. The self-hosted build adds nothing to your page at all.
git clone https://github.com/enterrahost/enterraedit
cd enterraedit && npm install && npm run build
Both are MIT licensed, so the badge can be removed either way. The hosted build sets it because that is what pays for the CDN, not because the license requires it.
Content Security Policy
The editor injects its stylesheet at runtime, so style-src needs to allow
it. Without that the editor still works but renders unstyled.
This is the short version. How to enable it under a strict CSP covers both fixes and what each one measures.
script-src 'self' https://cdn.enterrahost.com;
style-src 'self' 'sha256-orTVCowD4pMvRhB1nyRLk7JNj6cB7ytzJp5JppCur/E=';
The hash covers the stylesheet this version injects, and it changes whenever the styles
do, so pin it to a version rather than copying it once. Adding
'unsafe-inline' instead works too, but is a wider permission than needed.
Links and images are restricted to safe URL schemes at the schema level, so a pasted
javascript: URL cannot be stored whatever your CSP says.
Free and open source
MIT licensed with no attribution required from the self-hosted build. Issues and pull requests are welcome.