You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+74-3Lines changed: 74 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@
21
21
• <ahref="#typescript">TypeScript</a>
22
22
• <ahref="#hiding--folding">Hiding & Folding</a>
23
23
• <ahref="#custom-layouts">Custom layouts</a>
24
+
• <ahref="#extending-the-editor">Extending the editor</a>
24
25
• <ahref="#bundling">Bundling</a>
25
26
• <ahref="#sandbox-security">Sandbox security</a>
26
27
• <ahref="#components">Components</a>
@@ -517,6 +518,60 @@ Finally, add a little style:
517
518
</style>
518
519
```
519
520
521
+
## Extending the editor
522
+
523
+
Playground's code editor is built on [CodeMirror 6](https://codemirror.net/), and can be extended with any CodeMirror extension. This allows for deep customization of the editor's behavior, such as adding new themes, keymaps, autocompletion sources, and more.
524
+
525
+
There are two ways to apply extensions: programmatically and declaratively.
526
+
527
+
### Programmatic extensions
528
+
529
+
The `<playground-ide>`, `<playground-file-editor>`, and `<playground-code-editor>` components all have an `extensions` property which accepts a CodeMirror `Extension` object (or an array of them).
For simpler use-cases, or for when you want to package an extension as a reusable HTML element, you can use declarative extensions.
546
+
547
+
A declarative extension is a custom element that provides one or more CodeMirror extensions. Playground elements will automatically find any declarative extension elements placed in their `extensions` slot and apply them.
548
+
549
+
Here's an example of a custom theme packaged as a declarative extension:
0 commit comments