Skip to content

Commit

Permalink
website: monaco loading improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
hediet committed Jul 16, 2024
1 parent 5eb2aba commit 5181be1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions website/src/monaco-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ async function _loadMonaco(setup: IMonacoSetup): Promise<typeof monaco> {
return new Promise((res) => {
// First load editor.main. If it inlines the plugins, we don't want to try to load them from the server.
req(["vs/editor/editor.main"], () => {
if ((setup as any).onlyCore) {
res(monaco);
return;
}
req(
[
"vs/basic-languages/monaco.contribution",
Expand Down
4 changes: 4 additions & 0 deletions website/src/website/components/monaco/MonacoEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export class ControlledMonacoEditor extends React.Component<{

private lastSubscription: monaco.IDisposable | undefined;

componentDidMount(): void {
this.componentDidUpdate({ value: "" });
}

componentDidUpdate(lastProps: this["props"]) {
const newOnDidValueChange = this.props.onDidValueChange;
if (newOnDidValueChange !== lastProps.onDidValueChange) {
Expand Down

0 comments on commit 5181be1

Please sign in to comment.