Panel Inspect: use monaco for json display (#25251)

This commit is contained in:
Ryan McKinley
2020-06-29 10:58:47 -07:00
committed by GitHub
parent dcd5752086
commit 1a711e7df0
16 changed files with 341 additions and 56 deletions

View File

@ -0,0 +1,29 @@
import React from 'react';
import { useAsyncDependency } from '../../utils/useAsyncDependency';
import { ErrorWithStack, LoadingPlaceholder } from '..';
import { CodeEditorProps } from './CodeEditor';
export type CodeEditorChangeHandler = (value: string) => void;
export const CodeEditor: React.FC<CodeEditorProps> = props => {
const { loading, error, dependency } = useAsyncDependency(
import(/* webpackChunkName: "code-editor" */ './CodeEditor')
);
if (loading) {
return <LoadingPlaceholder text={'Loading...'} />;
}
if (error) {
return (
<ErrorWithStack
title="Code editor failed to load"
error={error}
errorInfo={{ componentStack: error?.stack || '' }}
/>
);
}
const CodeEditor = dependency.default;
return <CodeEditor {...props} />;
};