We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent de3af7f commit 1fc54fbCopy full SHA for 1fc54fb
src/views/EditorView/EditorView.tsx
@@ -1,4 +1,4 @@
1
-import React from 'react';
+import React, { useEffect } from 'react';
2
import './EditorView.scss';
3
import EditorContainer from './EditorContainer/EditorContainer';
4
import {PopupWindowType} from '../../data/enums/PopupWindowType';
@@ -22,6 +22,19 @@ const EditorView: React.FC<IProps> = ({activePopupType}) => {
22
);
23
};
24
25
+ useEffect(() => {
26
+ const handleBeforeUnload = (event: BeforeUnloadEvent) => {
27
+ event.preventDefault();
28
+ event.returnValue = '';
29
+ };
30
+
31
+ window.addEventListener('beforeunload', handleBeforeUnload);
32
33
+ return () => {
34
+ window.removeEventListener('beforeunload', handleBeforeUnload);
35
36
+ }, []);
37
38
return (
39
<div
40
className={getClassName()}
0 commit comments