Skip to content

Commit 2696969

Browse files
authored
feat: disable chart's context menu (#194)
1 parent 2365664 commit 2696969

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/App.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ const App = () => {
113113
return () => window.removeEventListener("resize", updateSize);
114114
}, []);
115115

116+
const targetDom = document.getElementsByClassName('echarts-for-react');
117+
if (targetDom[0]) {
118+
// Disable mouse right-click menu events
119+
targetDom[0].oncontextmenu = () => { return false };
120+
}
121+
116122
React.useEffect(() => {
117123
const width = size[0];
118124
if (width > 996) {
@@ -219,14 +225,14 @@ const App = () => {
219225
>
220226
{!inIframe() &&
221227
<div
222-
className="titleBox"
223-
style={{
224-
margin: '30px 0',
225-
display: "block",
226-
}}
227-
>
228-
<h1 style={{ fontSize: '1.8em', textAlign: 'center', margin: '0' }}>GitHub Contributor Over Time</h1>
229-
</div>}
228+
className="titleBox"
229+
style={{
230+
margin: '30px 0',
231+
display: "block",
232+
}}
233+
>
234+
<h1 style={{ fontSize: '1.8em', textAlign: 'center', margin: '0' }}>GitHub Contributor Over Time</h1>
235+
</div>}
230236
<div style={searchStyle}>
231237
<Paper className={classes.root} elevation={0}>
232238
<Autocomplete
@@ -367,7 +373,7 @@ const App = () => {
367373
</TabPanel>
368374
</div>
369375
</div>
370-
{ !inIframe() && <Footer />}
376+
{!inIframe() && <Footer />}
371377
</div>
372378
</>
373379
);

0 commit comments

Comments
 (0)