parent
8605af2b54
commit
66938ae5c6
@ -645,6 +645,7 @@ const ELEMENT_TRANSLATE_AMOUNT = 1;
|
|||||||
class App extends React.Component<{}, AppState> {
|
class App extends React.Component<{}, AppState> {
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
document.addEventListener("keydown", this.onKeyDown, false);
|
document.addEventListener("keydown", this.onKeyDown, false);
|
||||||
|
window.addEventListener("resize", this.onResize, false);
|
||||||
|
|
||||||
const savedState = restore();
|
const savedState = restore();
|
||||||
if (savedState) {
|
if (savedState) {
|
||||||
@ -654,6 +655,7 @@ class App extends React.Component<{}, AppState> {
|
|||||||
|
|
||||||
public componentWillUnmount() {
|
public componentWillUnmount() {
|
||||||
document.removeEventListener("keydown", this.onKeyDown, false);
|
document.removeEventListener("keydown", this.onKeyDown, false);
|
||||||
|
window.removeEventListener("resize", this.onResize, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public state: AppState = {
|
public state: AppState = {
|
||||||
@ -669,6 +671,10 @@ class App extends React.Component<{}, AppState> {
|
|||||||
scrollY: 0
|
scrollY: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onResize = () => {
|
||||||
|
this.forceUpdate();
|
||||||
|
};
|
||||||
|
|
||||||
private onKeyDown = (event: KeyboardEvent) => {
|
private onKeyDown = (event: KeyboardEvent) => {
|
||||||
if ((event.target as HTMLElement).nodeName === "INPUT") {
|
if ((event.target as HTMLElement).nodeName === "INPUT") {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user