-
Notifications
You must be signed in to change notification settings - Fork 337
Expand file tree
/
Copy pathinspector.tsx
More file actions
48 lines (44 loc) · 1018 Bytes
/
inspector.tsx
File metadata and controls
48 lines (44 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React from "react";
import { observer } from "mobx-react";
import { RichMedia, Media } from "@nteract/outputs";
import { INSPECTOR_URI } from "../utils";
import type Kernel from "../kernel";
import { Markdown } from "./result-view/markdown";
type Props = {
store: {
kernel: Kernel | null | undefined;
};
};
function hide() {
atom.workspace.hide(INSPECTOR_URI);
return null;
}
const Inspector = observer(({ store: { kernel } }: Props) => {
if (!kernel) {
return hide();
}
const bundle = kernel.inspector.bundle;
if (
!bundle["text/html"] &&
!bundle["text/markdown"] &&
!bundle["text/plain"]
) {
return hide();
}
return (
<div
className="native-key-bindings"
tabIndex={-1}
style={{
fontSize: atom.config.get(`Hydrogen.outputAreaFontSize`) || "inherit",
}}
>
<RichMedia data={bundle}>
<Media.HTML />
<Markdown />
<Media.Plain />
</RichMedia>
</div>
);
});
export default Inspector;