Skip to content

EditorOptions

EditorOptions<T> = object

Defined in: types.ts:10

T extends object = { }

optional class: string

Defined in: types.ts:38

Additional classes for the root container. Useful to style individual editors. The .prism-code-editor selector can be used to style all editors.


optional insertSpaces: boolean

Defined in: types.ts:19

Whether the editor should insert spaces for indentation.

true

language: string

Defined in: types.ts:15

Language used for syntax highlighting. If the language doesn’t have a registered Prism grammar, syntax highlighting will be disabled.

"text"

optional lineNumbers: boolean

Defined in: types.ts:21

Whether line numbers should be shown.

true

optional readOnly: boolean

Defined in: types.ts:23

Whether the editor should be read only.

false

optional rtl: boolean

Defined in: types.ts:33

Whether the editor uses right to left directionality. Requires styles from prism-code-editor/rtl-layout.css to work unless the setups are used.

false

optional tabSize: number

Defined in: types.ts:17

Tabsize for the editor.

2

value: string

Defined in: types.ts:27

Code to display in the editor.


optional wordWrap: boolean

Defined in: types.ts:25

Whether the editor should have word wrap.

false

optional onSelectionChange(selection, value, editor): void

Defined in: types.ts:42

Function called when the selection changes in the editor.

InputSelection

string

PrismEditor<T>

void


optional onTokenize(tokens, language, value, editor): void

Defined in: types.ts:44

Function called before the tokens are stringified to HTML.

TokenStream

string

string

PrismEditor<T>

void


optional onUpdate(value, editor): void

Defined in: types.ts:40

Function called when the code of the editor changes.

string

PrismEditor<T>

void