File size: 577 Bytes
bc1328f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const CodeEditorView = () => {
  const iframeRef = React.useRef(null);

  const sendKey = () => {
    const url = window.getAmdUrl ? window.getAmdUrl() : '';
    if (url && iframeRef.current?.contentWindow) {
      iframeRef.current.contentWindow.postMessage({ type: 'AMD_URL', url }, '*');
    }
  };

  return (
    <iframe
      ref={iframeRef}
      src="vscode.html"
      style={{ width: "100%", height: "100%", border: "none", display: "block" }}
      title="VS Code — meridian-platform"
      onLoad={sendKey}
    />
  );
};

window.CodeEditorView = CodeEditorView;