gui/components/CodeEditor

A small controlled CodeMirror 6 editor for plain text / code — used by Manage for JS sidecars and raw list editing (where the DPL-specific DplEditor would be wrong). It behaves like a textarea (value + onChange), takes an optional language extension, and is built for large documents (CodeMirror only renders the viewport, so multi-thousand-line lists stay smooth).

Description:
  • A small controlled CodeMirror 6 editor for plain text / code — used by Manage for JS sidecars and raw list editing (where the DPL-specific DplEditor would be wrong). It behaves like a textarea (value + onChange), takes an optional language extension, and is built for large documents (CodeMirror only renders the viewport, so multi-thousand-line lists stay smooth).

Source:

Methods

(inner) CodeEditor(props) → {JSX.Element}

Source:
Parameters:
Name Type Description
props object
Properties
Name Type Attributes Description
value string

Controlled text.

onChange function

(next) on edits.

language function <optional>

A CodeMirror language extension factory (e.g. javascript).

lineNumbers boolean <optional>

Show a line-number gutter.

wrap boolean <optional>

Soft-wrap long lines.

placeholder string <optional>

Placeholder when empty.

className string <optional>

Extra wrapper class.

ariaLabel string <optional>

Accessible label.

Returns:
Type
JSX.Element