Common Issues
Editor is not rendering
Editor is not rendering
If the editor container appears blank or the toolbar is missing, work through the following checks in order.1. Ensure the target element exists before initialisationLumen attaches to a DOM element you supply. If that element does not exist at the time you call 2. Import the theme stylesheetWithout 3. Give the container a heightThe editor fills the height of its container. If the container has no explicit height — and no content to stretch it — the editor will not be visible.
new Editor(), initialisation silently fails.theme.css, the editor’s toolbar and content area have no layout styles and may collapse to zero height.Styles are not applied
Styles are not applied
If the editor renders but looks unstyled — toolbar icons are missing, fonts are wrong, or the content area has no border — the most common cause is a missing CSS import.Make sure you import the Lumen theme before your own stylesheets so you can override individual rules where needed:If you are using a bundler that processes CSS (Vite, webpack, Parcel), confirm the import resolves correctly by checking your bundler’s output or the Network panel in DevTools.
Content is not saving
Content is not saving
autoSave key collisionThe Reading the latest content on changeIf you are manually saving content, call
autoSave feature persists content to localStorage using a key you provide. If two editor instances share the same key, they will overwrite each other’s data.getHTML() inside the change event handler — not outside it. Calling it at a fixed point in time will return a stale snapshot.Images are not uploading
Images are not uploading
uploadImage must return a URL stringIf your Listen to the error event for diagnosticsUpload failures surface through the Image validation rulesLumen validates images before calling
uploadImage handler throws an error or returns undefined, Lumen silently skips the image insertion. Make sure the function always resolves to a URL string.error event. Attach a listener during development to catch issues early:uploadImage. An image is rejected if it fails any of the following checks:- MIME type is not an accepted image type
- Magic bytes do not match the declared MIME type
- File size exceeds the limit (default 5 MB)
Pasted content loses formatting
Pasted content loses formatting
Sanitization is intentionalWhen you paste HTML into Lumen Editor, the content passes through a built-in, DOM-based sanitizer that strips any tags and attributes not on the allowlist. This is a security feature, not a bug — it prevents XSS payloads from entering the editor via the clipboard.Plain text pasted from any source is always safe and is never modified.Allowing additional tags and attributesIf your workflow requires preserving specific tags or attributes that Lumen strips by default, configure the
sanitize option:Extend the allowlist only for tags and attributes you fully trust. Adding permissive rules — such as allowing
style or event handler attributes — can reintroduce XSS risk.TypeScript errors
TypeScript errors
Types are included in the packageLumen Editor ships its own TypeScript type definitions — you do not need to install a separate Exported typesThe following types are available for import alongside If your editor reports that the module cannot be found, confirm that
@types/lumen-editor package. The named export works directly:Editor:moduleResolution in your tsconfig.json is set to "bundler", "node16", or "nodenext" — older "node" resolution may not pick up the exports field in package.json.CSP violations
CSP violations
Lumen Editor is CSP-compatible by designLumen does not use If you are seeing CSP violations in the console while using Lumen, the violation is most likely originating from another library, a browser extension, or an inline script elsewhere on the page — not from Lumen Editor itself.
eval, new Function, inline <script> tags, or dynamic script injection. This means it works with strict Content Security Policies without any special exceptions.If you use strict-dynamic in your CSP header, you do not need to add a nonce or hash for Lumen Editor itself.A policy such as the following is fully compatible:Debugging Tips
When an issue is not immediately obvious, use theerror event as your first diagnostic tool. Lumen surfaces internal errors — upload failures, sanitizer rejections, plugin faults — with a structured code and message:
e.code values to watch for:
| Code | Meaning |
|---|---|
UPLOAD_FAILED | uploadImage threw or returned a non-string value |
INVALID_MIME | Image file failed MIME type validation |
MAGIC_BYTE_MISMATCH | File bytes do not match the declared MIME type |
SIZE_EXCEEDED | Image exceeds the configured size limit |