<!-- Generated by npm run gen:skill from ui/CodeEditor/skill.md - do not edit. -->

# CodeEditor

## `<codeeditor>`

- `mode` (xml, html, css, js, json, text), `footer`, `modeselect`, `readonly`, `update-enabled`, `reformat`, `validate`, `highlight`
- actions: focus, activate, unbind
- events: Updated, Changed, Saved, OnInput, Select, ContextMenu, SelectionMenu, ValidXml, InvalidXml, MimeIsXml, MimeIsNonXml, XpathResult, LastUndo, EnableUndo, LastRedo, EnableRedo, Drop
- methods: updateData, setUpdateEnabled, reformat, search, searchAndReplace, searchCount, clearHighlights, takeEnter, releaseEnter, gotoLine, setCursor, highlightNode, getSelectionValue, getSelectionXPath, haveSelection, setFont, executeCommand, doCopy, doCut, toggleComment, deleteNodeAtCaret, emitCtrlZ, emitCtrlY

## Guidance

```xml
<codeeditor name="src" label="Source" height="fill"/>
<operation name="bind" value="#doc"><component view="v" name="src" select="/"/></operation>
<operation name="callMethod" value="#v#src" wait="true"><method name="updateData"/></operation>
```

- The bound document's type picks the mode. Edits are written back on leaving or after a second's pause: before a Save, call `updateData` with `wait="true"`, as above.
- `readonly="true"` shows only; `update-enabled="false"` edits without writing back. No enable/disable; `highlight` has no effect.
- Changed can fire several times per edit - treat it as "check the document"; ValidXml/InvalidXml follow each update.
- `label` is its only accessible name. Tab indents; Escape then Tab leaves - say so in a help text.
