code/editor/environment
import { … } from 'zidane-ui'ui/src/code/editor/environment.tsx
Components#
EditorEnvironmentProviderComponent#
Sets the environment of every editor surface below.
function EditorEnvironmentProvider(props: EditorEnvironmentProviderProps): ElementParameters
| Name | Type | Description |
|---|---|---|
| props | EditorEnvironmentProviderProps | The environment and the tree that reads it. |
Returns
ElementProps
| Name | Type | Description |
|---|---|---|
| children | ReactNode | The subtree it applies to. |
| value | EditorEnvironment | The environment the editors below read. |
Functions#
useEditorEnvironmentFunction#
Returns the editor environment in effect.
function useEditorEnvironment(): EditorEnvironmentReturns
Constants#
DEFAULT_EDITOR_SETTINGSConstant#
The settings without an EditorEnvironmentProvider: editable, manual saves, 2-space tabs, no wrap.
const DEFAULT_EDITOR_SETTINGS: EditorSettingsInterfaces#
EditorEnvironmentInterface#
The value of EditorEnvironmentProvider.
interface EditorEnvironmentProperties
| Name | Type | Description |
|---|---|---|
| appearance | Appearance | Light or dark: picks pierre's palette to match the theme. |
| reducedMotion | boolean | Scrolls jump instead of gliding (find, reveal). |
| settings | EditorSettings | How the editors behave. |
| shikiTheme | string | A bundled code theme id. |
EditorEnvironmentProviderPropsInterface#
Props for EditorEnvironmentProvider.
interface EditorEnvironmentProviderPropsProperties
| Name | Type | Description |
|---|---|---|
| children | ReactNode | The subtree it applies to. |
| value | EditorEnvironment | The environment the editors below read. |
EditorSettingsInterface#
How the editor behaves.
interface EditorSettingsProperties
| Name | Type | Description |
|---|---|---|
| autoSurround | 'quotes' | 'default' | 'never' | 'brackets' | Which pairs typing an opener wraps around a selection: the language's default, none, brackets only or quotes only. |
| editing | boolean | Files are editable (⌘S saves). Off: every editor stays read-only. |
| matchBrackets | boolean | Highlight the bracket matching the one at the caret. |
| roundedSelection | boolean | Round the corners of selection highlights. |
| saveOn | 'manual' | 'blur' |
|
| tabSize | number | How many columns a tab character paints across. |
| wordWrap | boolean | Wrap long lines instead of scrolling sideways. |