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
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,6 @@ Supported attributes are:
43
43
-`args`: arguments sent unchanged to Compiler Explorer.
44
44
-`theme`: `auto`, `light`, or `dark`.
45
45
-`debug`: show the basic/full editor and light/dark switches. These are hidden by default.
46
-
-`status`: show the optional user-facing code-help status.
47
46
-`width`: any valid CSS width for the complete block.
48
47
-`height`: any valid CSS height for the editor area, such as `280px`, `40vh`, or `clamp(240px, 50vh, 600px)`.
49
48
-`min-height`: any valid CSS minimum height for the editor area.
@@ -74,7 +73,7 @@ Supported attributes are:
74
73
</script>
75
74
```
76
75
77
-
Call `CodeBlocks.configure(options)` before a block is upgraded to set defaults for later blocks. The available options are `theme`, `showDebugControls`, `showStatus`, `compiler`, `args`, `compilerExplorerUrl`, `editorOptions`, `styles`, and `onStatus`.
76
+
Call `CodeBlocks.configure(options)` before a block is upgraded to set defaults for later blocks. The available options are `theme`, `showDebugControls`, `compiler`, `args`, `compilerExplorerUrl`, `editorOptions`, `styles`, and `onStatus`.
78
77
79
78
`CodeBlocks.get(element)` returns the upgraded block instance. It exposes `getValue`, `setValue`, `getTabs`, `selectTab`, `focus`, `run`, `setTheme`, `dispose`, `onDidChange`, `editorReady`, `monacoReady`, and `clangdReady`. `getValue` and `setValue` act on the active tab. `monacoReady` resolves to the underlying Monaco standalone editor for integrations that need the native editor API.
80
79
@@ -93,6 +92,16 @@ codeblock {
93
92
94
93
The editor observes its container and relayouts whenever its width or height changes, including flexbox, grid, responsive, and script-driven resizing.
95
94
95
+
Debug mode also writes lifecycle messages to the browser console, including Monaco loading/loaded, clangd download progress, clangd starting/loaded/activated, and complete clangd error messages. Add `data-debug` to the loader script to include loader, HTTPS, service-worker, and isolation messages:
96
+
97
+
```html
98
+
<script
99
+
src="./codeblocks.js"
100
+
data-coi-serviceworker="./coi-serviceworker.js"
101
+
data-debug
102
+
></script>
103
+
```
104
+
96
105
The lower-level ES module entries remain available as `editor.js`, `fallback.js`, and `ansi.js`.
97
106
98
107
## Cross-origin isolation
@@ -115,6 +124,8 @@ The reusable loader does not register a service worker by default. Hosts such as
115
124
116
125
That opt-in registers a host-owned service worker and reloads once. Do not use the attribute when the server already sends the headers.
117
126
127
+
WebAssembly threads, service workers, and cross-origin isolation require a secure context. Enable "Enforce HTTPS" for a GitHub Pages custom domain. When the isolation helper is enabled, the loader also redirects non-local HTTP pages to the same HTTPS URL as a fallback. The included `clangd.cpp.social` example redirects before loading its external CSS or JavaScript.
128
+
118
129
If assets are hosted on another origin, that origin must allow CORS and send `Cross-Origin-Resource-Policy: cross-origin` or an equivalent policy accepted by the embedding page.
0 commit comments