Skip to main content
Version: Next

Web Component Editor

Dedicated capability reference for the editora-editor custom element including attributes, runtime API, events, and multi-instance patterns.

Installation

npm i @editora/core @editora/plugins @editora/themes

Load the bundle

<script type="module" src="https://cdn.jsdelivr.net/npm/@editora/core/dist/webcomponent.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@editora/core/dist/webcomponent.min.css" />

Core bundle (lighter)

<script type="module" src="https://cdn.jsdelivr.net/npm/@editora/core/dist/webcomponent-core.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@editora/core/dist/webcomponent-core.min.css" />

Configuration priority

Config resolution order:

  1. JS runtime config (setConfig(...)) - highest priority
  2. Element attributes
  3. Editor defaults

Capability matrix

CapabilityWeb component surface
Plugin loadingplugins="..."
Toolbar layouttoolbar-items="...", toolbar-floating, toolbar-sticky
Theme scope`theme="light\
Readonly mode`readonly="true\
Placeholderplaceholder="..."
Status metricsstatusbar="true"
Autosaveautosave JSON object or flattened autosave attributes
Security sanitizationsecurity JSON object or flattened security attributes
Accessibilityaccessibility JSON object or flattened accessibility attributes
Performance tuningperformance JSON object or flattened performance attributes
Language directionlanguage JSON object
Spellcheck provider`spellcheck.provider='browser\

Complete attribute reference

Core attributes

AttributeTypeNotes
height, widthnumber | stringEditor dimensions
readonly, disabledbooleanInteraction restrictions
themestringTheme class scope (editora-theme-*)
placeholderstringEmpty content hint
autofocusbooleanFocus on mount
pluginsstringSpace-separated plugin IDs
toolbarboolean | object | stringToolbar enable/config
toolbar-itemsstringToolbar item layout string
toolbar-floatingbooleanEnable floating toolbar behavior
toolbar-stickybooleanSticky main toolbar
menubarboolean | objectMenubar config
statusbarboolean | objectStatusbar config

Runtime/operational attributes

AttributeTypeNotes
autosaveboolean | objectAutosave config object
autosave-enabled, autosave-interval-ms, autosave-storage-key, autosave-provider, autosave-api-urlflattened attrsAutosave bridge fields
accessibilityobjectARIA/keyboard/checker config
accessibility-enable-aria, accessibility-keyboard-navigation, accessibility-checkerflattened attrsAccessibility bridge fields
performanceobjectPerformance tuning config
performance-debounce-input-ms, performance-viewport-only-scanflattened attrsPerformance bridge fields
languagestring | objectLocale/direction
language-locale, language-directionflattened attrsLanguage bridge fields
spellcheckboolean | objectSpellcheck provider config
spellcheck-enabled, spellcheck-provider, spellcheck-api-urlflattened attrsSpellcheck bridge fields
context-menuboolean | objectContext menu behavior
context-menu-enabledbooleanFlattened bridge field
pasteobjectPaste handling config
paste-clean, paste-keep-formatting, paste-convert-wordflattened attrsPaste bridge fields
securityobjectSecurity sanitization config
security-sanitize-on-paste, security-sanitize-on-inputflattened attrsSecurity bridge fields

Runtime API

Direct element methods

MethodSignature
getContent() => string
setContent(html: string) => void
execCommand(name: string, value?: any) => boolean
focus() => void
blur() => void

Rich API object

Use editorElement.getAPI() to access:

  • getContent, setContent, execCommand
  • focus, blur, destroy
  • on(event, handler)
  • getConfig()
  • setReadonly(readonly: boolean)

Runtime config updates

<editora-editor id="editorA"></editora-editor>
<script>
const editor = document.getElementById("editorA");
editor.setConfig({
theme: "dark",
toolbar: { items: "undo redo | bold italic underline", floating: true, sticky: true, showMoreOptions: false },
autosave: { enabled: true, intervalMs: 5000, storageKey: "doc-a", provider: "localStorage" },
security: { sanitizeOnPaste: true, sanitizeOnInput: true },
accessibility: { enableARIA: true, keyboardNavigation: true, checker: false },
performance: { debounceInputMs: 120, viewportOnlyScan: true },
});
</script>

Events

EventDetailTrigger
editor-readyapi objectEditor initialized
content-changehtml payloadInput/blur change emit
editor-focusnoneContent receives focus
editor-blurnoneContent loses focus
editor-destroynoneInstance teardown

Dedicated capability demo

<editora-editor
id="editorA"
theme="light"
plugins="bold italic underline strikethrough textColor backgroundColor fontSize history checklist"
toolbar-items="undo redo | bold italic underline strikethrough | textColor backgroundColor fontSize | bullist numlist checklist"
toolbar-floating="true"
toolbar-sticky="true"
statusbar="true"
placeholder="Editor A..."
autosave='{"enabled":true,"intervalMs":5000,"storageKey":"doc-a"}'
security='{"sanitizeOnPaste":true,"sanitizeOnInput":true}'
accessibility='{"enableARIA":true,"keyboardNavigation":true,"checker":false}'
performance='{"debounceInputMs":120,"viewportOnlyScan":true}'
></editora-editor>

<editora-editor
id="editorB"
theme="dark"
plugins="bold italic link table spellCheck comments"
toolbar-items="undo redo | bold italic link table | spellCheck comments"
statusbar="true"
placeholder="Editor B..."
></editora-editor>

Multi-instance production checks

  • Clicking toolbar in editor A never opens/mounts panel in editor B.
  • Closing panel in one editor does not toggle same panel in another editor.
  • Status bar updates only for active editor.
  • Spellcheck/comments sidebars are mounted to the clicked editor container.
  • Theme of dialogs and sidebars follows local editor theme.
  • React wrapper capabilities: /docs/editor/react
  • Side-by-side capabilities playground: /docs/examples/capabilities-playground
  • Embedded live demos: /docs/examples/live-examples