Scribe Editor
A modern, inline-first rich text editor with a simple API. Use direct methods like editor.bold() — no complex commands needed.
Simple API
Direct methods like .bold(), .italic(), .link()
Lightweight
< 50KB gzipped, zero dependencies
Universal
Works with React, Vue, Svelte, or Vanilla JS
Secure
Built-in XSS protection & sanitization
Iframe Ready
Edit content inside iframes
Extensible
Plugin architecture for custom features
Quick Start
Get started with Scribe in seconds. Choose your framework:
<!-- One-line initialization -->
<div id="editor">
<p>Start editing...</p>
</div>
<script type="module">
import { Scribe } from './scribe.js';
const editor = Scribe.init('#editor');
// Direct methods - no exec() needed
editor.bold();
editor.link('https://example.com');
</script>Installation
NPM / Yarn / PNPM
npm install scribejs-editor
# or
yarn add scribejs-editor
# or
pnpm add scribejs-editorCDN (Script Tag)
<script src="https://unpkg.com/scribejs-editor"></script>
<script>
const editor = Scribe.init('#editor');
</script>Live Demo
Select text to see the floating toolbar. Try formatting, links, and more.
Documentation
Getting Started
Install via npm or CDN and initialize the editor in one line with Vanilla JS, React or Vue 3.
Core Concepts
Architecture behind Scribe: contenteditable vs virtual DOM, the selection lifecycle, DOM normalization, clipboard and undo.
Framework Guides
Integrate with Vanilla JS, React, Vue 3, Svelte and Web Components, plus SSR with Next.js and Nuxt.
Features
Feature matrix: links, images, tokens, inline widgets, toolbar positioning, mobile, paste sanitization and shortcuts.
Advanced
Performance, the plugin architecture, real-time collaboration, XSS hardening and accessibility.
API Reference
Every method and event: init(), bold(), link(), getHTML(), selection methods, toolbar state and sanitization config.
Migration
Move from TinyMCE, Quill or a legacy editor: plugins, toolbar API, selection and content model.
How-to guides
- Keep contenteditable selection when clicking a toolbar button
Why clicking a toolbar button clears the selection in a contenteditable editor, and the mousedown preventDefault + saved Range fix.
- Paste as plain text in contenteditable
Strip Word and Google Docs formatting on paste: insert text/plain at the caret, or rebuild pasted HTML from an allowlist.
- document.execCommand is deprecated: what to use instead
The Clipboard API for copy, beforeinput and Range for formatting, selection-based toolbar state, and when to keep execCommand.
- Placeholder for a contenteditable div
Show placeholder text with :empty::before and data-placeholder, fix the leftover <br> that hides it, keep the caret at the start.
Demo Gallery
Inline Editor
Document Mode
Iframe Editor
Textarea + Fixed Toolbar
Editor Comparison
| Feature | Scribe | TinyMCE | Quill | Tiptap |
|---|---|---|---|---|
| Bundle size | < 50KB | ~400KB | ~100KB | ~150KB |
| Direct API methods | ✓ | ✗ | ✗ | ✓ |
| Iframe editing | ✓ | ✓ | ✗ | ✗ |
| Floating toolbar | ✓ | ✓ | ✓ | ✓ |
| Plugin system | ✓ | ✓ | ✓ | ✓ |
| TypeScript | ✓ | ✓ | Partial | ✓ |
| Framework agnostic | ✓ | ✓ | ✓ | React focus |
| Zero dependencies | ✓ | ✗ | ✗ | ✗ |
| Built-in sanitization | ✓ | ✓ | ✗ | ✗ |
| CRDT ready | Prepared | ✗ | ✗ | Via Yjs |