| 230 | ]; |
| 231 | |
| 232 | async connectedCallback() { |
| 233 | let doc = |
| 234 | await (codeFromUrl.has() |
| 235 | ? codeFromUrl.get() |
| 236 | : codeFromLocal.has() |
| 237 | ? codeFromLocal.get() |
| 238 | : this.textContent); |
| 239 | this.view = new EditorView({ |
| 240 | extensions: this.extensions, |
| 241 | parent: this.shadowRoot, |
| 242 | root: this.shadowRoot, |
| 243 | doc, |
| 244 | }); |
| 245 | requestAnimationFrame(() => |
| 246 | this.dispatchEvent(new EditorChangeEvent(this.code)) |
| 247 | ); |
| 248 | this.ownerDocument.addEventListener("diagnostic", this); |
| 249 | this.ownerDocument.addEventListener("viewer-highlight", this); |
| 250 | this.ownerDocument.addEventListener("load-code", this); |
| 251 | this.addEventListener("focusout", this); |
| 252 | this.addEventListener("focusin", this); |
| 253 | } |
| 254 | |
| 255 | handleEvent(event) { |
| 256 | if (event.type == "diagnostic") { |