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

import { createEditor } from "@editora/core";

const editor = createEditor({
element: document.getElementById("editor"),
plugins: "bold italic link",
toolbar: "undo redo | bold italic | link",
});

API Surface

SurfaceTypeNotes
createEditor(options)FunctionCreates vanilla runtime adapter instance
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, MediaPluginEnterprise exportsEnterprise plugin bridges
SpellcheckConfig, MediaConfigType exportsEnterprise config types
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.