@liteeditor/editor
v1.3.0
Published
Lightweight JavaScript WYSIWYG editor — vanilla JS, no jQuery, no dependencies. A modern TinyMCE alternative.
Maintainers
Readme
@liteeditor/editor
Lightweight JavaScript WYSIWYG editor — pure vanilla JS, no jQuery, zero runtime dependencies. A modern, minimal alternative to TinyMCE, CKEditor and Quill.
- ~33 KB gzipped (JS + CSS), zero dependencies
- Iframe-isolated editing surface (host-page CSS never leaks in)
- 13 built-in plugins:
anchor autolink charmap codesample emoticons image link lists media searchreplace table visualblocks wordcount - Full formatting toolbar, tables, media/video embeds, drag-resize responsive images, source-code view
- Self-contained saved HTML (inline styles), paste sanitization
- Works via
<script>, ESMimport, or CJSrequire
Requires a LiteEditor API key. Get a free lifetime key at https://liteeditor.com.
Install
npm install @liteeditor/editorOr via CDN (no build step):
<link rel="stylesheet" href="https://cdn.liteeditor.com/1.0.0/liteeditor.min.css">
<script src="https://cdn.liteeditor.com/YOUR_API_KEY/liteeditor.min.js"></script>Usage (bundler)
import liteeditor from '@liteeditor/editor';
import '@liteeditor/editor/style.css';
liteeditor.init({
selector: '#editor',
apiKey: 'le_pub_your_key',
plugins: 'link lists table image media codesample',
toolbar: 'bold italic underline | link image media table | numlist bullist | sourcecode',
height: 400,
});
const editor = liteeditor.get('#editor');
editor.getContent(); // -> HTML string
editor.setContent('<p>Hello</p>');
editor.destroy();API
| Method | Description |
| --- | --- |
| liteeditor.init(config) | Initialize editor(s) on the selector |
| liteeditor.get(ref) | Get an instance by id, element, or selector |
| liteeditor.getAll(selector?) | All instances (optionally filtered) |
| liteeditor.getAllInstances() | Array of every active instance |
| liteeditor.remove(ref) | Destroy instance(s) |
| liteeditor.configure({ apiKey, apiBase }) | Set the key/base globally |
| editor.getContent() / setContent(html) | Read / replace content |
| editor.execCommand(cmd, value?) | Run an editing command |
| editor.destroy() | Tear down the instance |
Config options
selector, plugins, toolbar, height, apiKey, apiBase, default_styles, paste_keep_classes.
Frameworks
- React:
@liteeditor/react - Vue 3:
@liteeditor/vue
License
Proprietary. See LICENSE. A free lifetime plan is available.
