Skip to content

code/editor/environment

import { … } from 'zidane-ui'ui/src/code/editor/environment.tsx

Components#

EditorEnvironmentProviderComponent#

Sets the environment of every editor surface below.

TypeScript
function EditorEnvironmentProvider(props: EditorEnvironmentProviderProps): Element
Parameters
NameTypeDescription
propsEditorEnvironmentProviderProps

The environment and the tree that reads it.

Element
EditorEnvironmentProvider props
NameTypeDescription
childrenReactNode

The subtree it applies to.

valueEditorEnvironment

The environment the editors below read.

ui/src/code/editor/environment.tsx:70

Functions#

useEditorEnvironmentFunction#

Returns the editor environment in effect.

TypeScript
function useEditorEnvironment(): EditorEnvironment

ui/src/code/editor/environment.tsx:75

Constants#

DEFAULT_EDITOR_SETTINGSConstant#

The settings without an EditorEnvironmentProvider: editable, manual saves, 2-space tabs, no wrap.

TypeScript
const DEFAULT_EDITOR_SETTINGS: EditorSettings

ui/src/code/editor/environment.tsx:33

Interfaces#

EditorEnvironmentInterface#

The value of EditorEnvironmentProvider.

TypeScript
interface EditorEnvironment
EditorEnvironment properties
NameTypeDescription
appearanceAppearance

Light or dark: picks pierre's palette to match the theme.

reducedMotionboolean

Scrolls jump instead of gliding (find, reveal).

settingsEditorSettings

How the editors behave.

shikiThemestring

A bundled code theme id.

ui/src/code/editor/environment.tsx:44

EditorEnvironmentProviderPropsInterface#

Props for EditorEnvironmentProvider.

TypeScript
interface EditorEnvironmentProviderProps
EditorEnvironmentProviderProps properties
NameTypeDescription
childrenReactNode

The subtree it applies to.

valueEditorEnvironment

The environment the editors below read.

ui/src/code/editor/environment.tsx:58

EditorSettingsInterface#

How the editor behaves.

TypeScript
interface EditorSettings
EditorSettings properties
NameTypeDescription
autoSurround'quotes' | 'default' | 'never' | 'brackets'

Which pairs typing an opener wraps around a selection: the language's default, none, brackets only or quotes only.

editingboolean

Files are editable (⌘S saves). Off: every editor stays read-only.

matchBracketsboolean

Highlight the bracket matching the one at the caret.

roundedSelectionboolean

Round the corners of selection highlights.

saveOn'manual' | 'blur'

blur: save when the editor loses focus too.

tabSizenumber

How many columns a tab character paints across.

wordWrapboolean

Wrap long lines instead of scrolling sideways.

ui/src/code/editor/environment.tsx:15