Skip to main content
Version: Next

@editora/light-code-editor

@editora/light-code-editor is a small, extensible code editor focused on source editing flows.

Installation

npm i @editora/light-code-editor
import { createEditor } from "@editora/light-code-editor";
import "@editora/light-code-editor/dist/light-code-editor.css";

Search And Replace (Advanced)

The built-in SearchExtension now supports robust find/replace controls:

  • Aa: case-sensitive matching
  • Whole: whole-word-only matching
  • .*: regex matching
  • replaceAndFindNext: config flag controlling replace navigation
import { createEditor, SearchExtension } from "@editora/light-code-editor";

const editor = createEditor(container, {
value: initialCode,
extensions: [
new SearchExtension({
// default true
replaceAndFindNext: true,
}),
],
});

editor.executeCommand("find");
editor.executeCommand("replace");

SearchExtension Config

OptionTypeDefaultDescription
replaceAndFindNextbooleantrueIn replace mode, Enter replaces current match and jumps to next match.

Replace UX Notes

  • Enter in replace input: replace current match
  • Shift + Enter in replace input: replace all matches
  • Regex patterns are validated. Invalid regex input is not executed and shows an inline status.

Commands

CommandPurpose
findOpen search panel
findNextMove to next match
findPrevMove to previous match
replaceOpen replace mode

Performance Notes

  • Matching uses normalized text offsets to avoid marker-related range drift.
  • Search highlights use native CSS Highlight API when available, with fallback behavior where not supported.