viveeditor
v1.1.0
Published
Free, open-source rich text editor that drops into any website. One script tag turns a textarea into an editor.
Maintainers
Readme
viveeditor
Free, open-source rich text editor that drops into any website. One script tag turns a textarea into an editor.
Part of viveEditor, a free, open-source rich text editor.
Install
npm install viveeditorUsage
No build step:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/viveeditor.css" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/viveeditor.classic.iife.js"></script>
<textarea name="body" data-editor required></textarea>Replace x.y.z with the exact version you use. With a bundler:
import { upgradeAll } from 'viveeditor'
import 'viveeditor/style.css'
upgradeAll()Every <textarea data-editor> becomes an editor with the toolbar; forms post clean HTML under the textarea's name. Always sanitize it again on the server.
Live collaboration
<textarea
name="body"
data-editor
data-collab-document="report-2026"
data-collab-token-url="/collab-token"
></textarea>The CDN script loads viveeditor.collab.iife.js and connects to your @viveeditor/collab-server, which must be created with classicExtensions from viveeditor so both sides use the same document schema. data-collab-token-url is an address on the page's own origin; the editor asks it with POST, a JSON body { "document": "…" } and no redirects, and it answers JSON { "url": "wss://…", "token": "…" } (see the collab-server README). The editor connects only to that url, so an attribute in the page can never send the document or the token to another server. Other people's cursors and a people button appear, data-threads comments are shared through the server (the threads field is not written, so a form post cannot change comments), and a form reset does not change the shared text. In a shared document the lasting copy is the collaboration server's: do not save what the form posts without your own permission check. When the attributes are incomplete, the token address is on another origin, its answer is not valid or the add-on cannot load, the editor stays read-only and the reason is logged in the console; after a 401 or 403, or five failed requests in a row, it stops asking.
License
MIT
