Skip to content

Commit fc7a3d0

Browse files
committed
Document ACE Editor usage for editable code blocks
Added Code Editor Pattern section to design system: - When to use ACE Editor (request body editing, interactive JSON/YAML) - Implementation example with initialization code - Styling guidelines using design tokens - Note that read-only code blocks should use standard <pre><code> This clarifies the distinction between editable code (ACE Editor) and static code examples (standard HTML elements).
1 parent 90f7fae commit fc7a3d0

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

docs/design-system.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,50 @@ input::placeholder {
399399
}
400400
```
401401

402+
### Code Editor Pattern (ACE Editor)
403+
404+
For editable code blocks, the portal uses **ACE Editor** (https://ace.c9.io/).
405+
406+
**When to use ACE Editor:**
407+
- Request body editing in "Try It Out" panels
408+
- Interactive JSON/YAML editing
409+
- Any code input that requires syntax highlighting and validation
410+
411+
**Implementation:**
412+
413+
```html
414+
<!-- Container for ACE Editor -->
415+
<div id="editor-{{ operation_id }}" class="ace-editor-container"></div>
416+
417+
<script>
418+
// Initialize ACE Editor
419+
const editor = ace.edit('editor-{{ operation_id }}');
420+
editor.setTheme('ace/theme/chrome');
421+
editor.session.setMode('ace/mode/json');
422+
editor.setOptions({
423+
fontSize: '13px',
424+
showPrintMargin: false,
425+
enableBasicAutocompletion: true,
426+
enableLiveAutocompletion: true,
427+
});
428+
</script>
429+
```
430+
431+
**Styling:**
432+
433+
```css
434+
.ace-editor-container {
435+
width: 100%;
436+
min-height: 200px;
437+
border: 1px solid var(--color-border-primary);
438+
border-radius: var(--radius-small);
439+
font-family: var(--font-mono);
440+
font-size: var(--font-size-3);
441+
}
442+
```
443+
444+
**Read-only code blocks** (non-editable examples) should use standard `<pre><code>` with syntax highlighting via a lightweight library, not ACE Editor.
445+
402446
---
403447

404448
## Core Design Principles

0 commit comments

Comments
 (0)