Skip to main content
Version: Next

@editora/core

Runtime architecture, commands, lifecycle, and configuration model for @editora/core.

Responsibilities​

  • ContentEditable orchestration and command execution
  • Plugin manager and command registration lifecycle
  • Web component bootstrapping and custom element behavior
  • Selection/mutation and history integration points
  • Runtime config updates (setConfig) in web component mode

Installation​

npm i @editora/core

Typical Usage​

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

<editora-editor
height="320"
plugins="heading bold italic underline list link history"
toolbar="undo redo | heading | bold italic underline | bullist numlist | link"
placeholder="Start writing..."
>
<h2>Hello, Editora</h2>
<p>This is a <strong>web component</strong>. Select some text and use the toolbar.</p>
</editora-editor>

List the plugins you want in plugins: only those are loaded. Leave the attribute out and every plugin in the bundle is loaded, including ones that need setup (the collaboration plugin, for example, needs your own server).

With a bundler, import "@editora/core/webcomponent" and import "@editora/core/webcomponent.css" instead of the CDN tags.

API Surface​

SurfaceTypeNotes
createEditor(options)FunctionCreates a low-level vanilla adapter. It takes plugin objects, not plugin names; prefer <editora-editor>
initWebComponent()FunctionRegisters <editora-editor> when needed
EditorClass exportLegacy runtime class export
EditorStateClass exportEditor state model
EditorSelectionType exportSelection typing
SchemaClass exportNode schema model
Node, NodeSpecType exportsSchema node contracts
PluginManagerClass exportPlugin registration + command routing
Plugin, ToolbarItemType exportsPlugin contracts
PluginRuntime, createPluginRuntimeRuntime exportsPlugin runtime context APIs
PluginRuntimeContextType exportRuntime context typing
KeyboardShortcutManagerClass exportKeyboard shortcut orchestration
KeyboardShortcut, KeyboardShortcutConfigType exportsShortcut contracts
SpellcheckPlugin, MediaPluginDeprecated exportsNon-functional scaffolds (commands only log). Use @editora/spell-check and @editora/media-manager instead; removal planned for a future major release
SpellcheckConfig, MediaConfigDeprecated type exportsConfig types for the scaffolds above
export * from './core'Module re-exportCore architecture layer
export * from './ui'Module re-exportUI layer exports used by editor
export * from './utils/statusBarUtils'Module re-exportStatus bar utility exports
export * from './config'Module re-exportRuntime config exports
export * from './adapters'Module re-exportAdapter layer exports
export * from './webcomponent'Module re-exportWeb component class + helpers
@editora/core/webcomponentPackage subpathWeb component runtime entry
@editora/core/webcomponent-corePackage subpathMinimal web component entry
@editora/core/plugin-loaderPackage subpathPlugin loader entry
@editora/core/webcomponent.cssPackage subpathWeb component stylesheet

Config Groups​

Config GroupPurpose
toolbarToolbar layout and behavior
autosaveSave interval and persistence target
securitySanitization and policy controls
performanceInput debounce and scanning controls
accessibilityARIA and keyboard options

Best Practices​

  • Scope command execution to active instance only.
  • Preserve selection for dialog-driven commands.
  • Validate multi-instance panel/dialog host behavior.

Accessibility​

Enable ARIA + keyboard navigation and verify focus flow across toolbar/content/dialogs.

Performance Notes​

Use debounced input handling and viewport-only scan for large documents and multi-editor pages.