-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add crosshairs, destroy globals, and tweak updates for code editor (#…
…17302) * Add crosshairs, destroy globals, and tweak updates for code editor * Define update listener as arrow function * Ensure editor is recreated on reconnection * Don't create code mirror multiple times * Remove creation in update * Leverage lit lifecycle for editor creation and destruction * Bump @codemirror packages --------- Co-authored-by: Paul Bottein <[email protected]>
- Loading branch information
Showing
4 changed files
with
51 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
let loaded: Promise<typeof import("./codemirror")>; | ||
export type CodeMirror = typeof import("./codemirror"); | ||
|
||
export const loadCodeMirror = async (): Promise< | ||
typeof import("./codemirror") | ||
> => { | ||
if (!loaded) { | ||
loaded = import("./codemirror"); | ||
} | ||
let loaded: CodeMirror; | ||
|
||
export const loadCodeMirror = async () => { | ||
loaded ??= await import("./codemirror"); | ||
return loaded; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters