-
Notifications
You must be signed in to change notification settings - Fork 317
/
Copy pathContentPreview.js
42 lines (38 loc) · 1.11 KB
/
ContentPreview.js
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
/**
* @flow
* @file Base class for the Content Preview ES6 wrapper
* @author Box
*/
import * as React from 'react';
// TODO switch to createRoot when upgrading to React 18
// eslint-disable-next-line react/no-deprecated
import { render } from 'react-dom';
import ES6Wrapper from './ES6Wrapper';
import ContentPreviewResponsive from '../content-preview';
class ContentPreview extends ES6Wrapper {
/**
* Helper to programmatically refresh the preview's sidebar panel
* @returns {void}
*/
refreshSidebar(): void {
this.getComponent().refreshSidebar();
}
/** @inheritdoc */
render() {
render(
<ContentPreviewResponsive
componentRef={this.setComponent}
fileId={this.id}
language={this.language}
messages={this.messages}
onInteraction={this.onInteraction}
token={this.token}
{...this.options}
/>,
this.container,
);
}
}
global.Box = global.Box || {};
global.Box.ContentPreview = ContentPreview;
export default ContentPreview;