Skip to content

Commit f97b894

Browse files
committed
Update docs for the codeeditor
1 parent 4f73c68 commit f97b894

1 file changed

Lines changed: 14 additions & 25 deletions

File tree

  • modules/backend/formwidgets/codeeditor

modules/backend/formwidgets/codeeditor/README.md

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ modules/backend/formwidgets/codeeditor/
139139
│ ├── fonts/
140140
│ │ └── codicon.ttf - Monaco icons font
141141
│ ├── js/
142-
│ │ ├── index.js - Main Monaco integration
142+
│ │ ├── codeeditor.js - Main Monaco integration
143143
│ │ └── build/
144144
│ │ ├── codeeditor.bundle.js - Main bundle (19 MB)
145145
│ │ ├── css.worker.js - CSS language worker
@@ -194,35 +194,24 @@ Workers are loaded asynchronously and run in separate threads for better perform
194194

195195
### Theme System
196196

197-
Supports two theme formats:
197+
Themes are loaded directly as static assets via HTTP fetch (no PHP handler required). Theme preference values include the file extension (e.g., `twilight.tmTheme`, `one-dark-pro.json`).
198198

199-
#### 1. TextMate Themes (.tmTheme)
200-
Legacy XML-based themes used by Ace Editor. Converted to Monaco format at runtime using `fast-plist` library.
199+
#### Supported Formats
201200

202-
```php
203-
// CodeEditor.php
204-
public function onLoadTheme() {
205-
// Loads .tmTheme files and returns XML content
206-
return ['format' => 'tmTheme', 'data' => $xml];
207-
}
208-
```
209-
210-
#### 2. JSON Themes (.json)
211-
Modern VS Code theme format. Loaded directly without conversion.
201+
**1. TextMate Themes (.tmTheme)**
202+
Legacy XML-based themes. Converted to Monaco format at runtime using `fast-plist` library.
212203

213-
```php
214-
// CodeEditor.php
215-
public function onLoadTheme() {
216-
// Loads .json files and returns JSON content
217-
return ['format' => 'json', 'data' => $json];
218-
}
219-
```
204+
**2. JSON Themes (.json)**
205+
Modern VS Code theme format. Parsed and mapped to Monaco's theme structure.
220206

221207
```javascript
222-
// index.js
223-
convertJsonTheme(jsonContent) {
224-
// Converts VS Code JSON theme to Monaco theme
225-
// Maps tokenColors and UI colors
208+
// codeeditor.js - Themes loaded via static fetch
209+
async fetchTheme(themeName) {
210+
// Theme name includes extension (e.g., "twilight.tmTheme", "one-dark-pro.json")
211+
// Legacy values without extension default to .tmTheme
212+
const basePath = window.Snowboard.url().asset('/modules/backend/formwidgets/codeeditor/assets/themes/');
213+
const response = await fetch(`${basePath}${themeName}`);
214+
// Format determined from file extension
226215
}
227216
```
228217

0 commit comments

Comments
 (0)