EditorOptions
EditorOptions<
T> =object
Defined in: types.ts:10
Type Parameters
Section titled “Type Parameters”T extends object = { }
Properties
Section titled “Properties”class?
Section titled “class?”
optionalclass: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.
insertSpaces?
Section titled “insertSpaces?”
optionalinsertSpaces:boolean
Defined in: types.ts:19
Whether the editor should insert spaces for indentation.
Default
Section titled “Default”truelanguage
Section titled “language”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.
Default
Section titled “Default”"text"lineNumbers?
Section titled “lineNumbers?”
optionallineNumbers:boolean
Defined in: types.ts:21
Whether line numbers should be shown.
Default
Section titled “Default”truereadOnly?
Section titled “readOnly?”
optionalreadOnly:boolean
Defined in: types.ts:23
Whether the editor should be read only.
Default
Section titled “Default”false
optionalrtl: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.
Default
Section titled “Default”falsetabSize?
Section titled “tabSize?”
optionaltabSize:number
Defined in: types.ts:17
Tabsize for the editor.
Default
Section titled “Default”2value:
string
Defined in: types.ts:27
Code to display in the editor.
wordWrap?
Section titled “wordWrap?”
optionalwordWrap:boolean
Defined in: types.ts:25
Whether the editor should have word wrap.
Default
Section titled “Default”falseMethods
Section titled “Methods”onSelectionChange()?
Section titled “onSelectionChange()?”
optionalonSelectionChange(selection,value,editor):void
Defined in: types.ts:42
Function called when the selection changes in the editor.
Parameters
Section titled “Parameters”selection
Section titled “selection”string
editor
Section titled “editor”PrismEditor<T>
Returns
Section titled “Returns”void
onTokenize()?
Section titled “onTokenize()?”
optionalonTokenize(tokens,language,value,editor):void
Defined in: types.ts:44
Function called before the tokens are stringified to HTML.
Parameters
Section titled “Parameters”tokens
Section titled “tokens”language
Section titled “language”string
string
editor
Section titled “editor”PrismEditor<T>
Returns
Section titled “Returns”void
onUpdate()?
Section titled “onUpdate()?”
optionalonUpdate(value,editor):void
Defined in: types.ts:40
Function called when the code of the editor changes.
Parameters
Section titled “Parameters”string
editor
Section titled “editor”PrismEditor<T>
Returns
Section titled “Returns”void