0.2.0 • Published 21 days ago

@snack-uikit/code-editor v0.2.0

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
21 days ago

Code Editor

Installation

npm i @snack-uikit/code-editor

Changelog

CodeEditor

Props

nametypedefault valuedescription
themeClassNamestring-Класснейм подключенной темы (из хука useThemeConfig() или ThemeProvider) По дефолту берется значение из useTheme внутри
hasBackgroundbooleantrueВключение/отключение псевдобекграунда
defaultValuestring-Default value of the current model
defaultLanguagestring-Default language of the current model
defaultPathstring-Default path of the current model Will be passed as the third argument to .createModel method monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))
valuestring-Value of the current model
languagestring-Language of the current model
pathstring-Path of the current model Will be passed as the third argument to .createModel method monaco.editor.createModel(..., ..., monaco.Uri.parse(defaultPath))
themestring"light"The theme for the monaco Available options "vs-dark" | "light" Define new themes by monaco.editor.defineTheme
linenumber-The line to jump on it
loadingReactNode"Loading..."The loading screen before the editor will be mounted
optionsIStandaloneEditorConstructionOptions-IStandaloneEditorConstructionOptions
overrideServicesIEditorOverrideServices-IEditorOverrideServices
saveViewStateboolean-Indicator whether to save the models' view states between model changes or not Defaults to true
keepCurrentModelbooleanfalseIndicator whether to dispose the current model when the Editor is unmounted or not
widthstring \| number"100%"Width of the editor wrapper
heightstring \| number"100%"Height of the editor wrapper
classNamestring-Class name for the editor container
wrapperPropsobject-Props applied to the wrapper element
beforeMountBeforeMount-Signature: function(monaco: Monaco) => void An event is emitted before the editor is mounted It gets the monaco instance as a first argument Defaults to "noop"
onMountOnMount-Signature: function(editor: monaco.editor.IStandaloneCodeEditor, monaco: Monaco) => void An event is emitted when the editor is mounted It gets the editor instance as a first argument and the monaco instance as a second Defaults to "noop"
onChangeOnChange-Signature: function(value: string | undefined, ev: monaco.editor.IModelContentChangedEvent) => void An event is emitted when the content of the current model is changed
onValidateOnValidate-Signature: function(markers: monaco.editor.IMarker[]) => void An event is emitted when the content of the current model is changed and the current model markers are ready Defaults to "noop"