redux: fixed bugs

This commit is contained in:
muerwre 2018-11-26 17:40:49 +07:00
parent 0f3217f5df
commit 5d14a753f7
6 changed files with 20 additions and 31 deletions

View file

@ -11,10 +11,10 @@ type Props = {
export class CancelDialog extends React.Component<Props, void> {
cancel = () => {
editor.cancelEditing();
// this.props.stopEditing();
this.props.setEditing(false);
this.props.setMode(MODES.NONE);
this.props.stopEditing();
// editor.cancelEditing();
// this.props.setEditing(false);
// this.props.setMode(MODES.NONE);
};
proceed = () => {

View file

@ -20,6 +20,12 @@
z-index: 10;
transition: opacity 1s;
}
body {
overflow: hidden;
padding: 0;
margin: 0;
}
</style>
</head>
<body>

View file

@ -1,7 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { App } from '$containers/App';
import '$styles/main.less';

View file

@ -244,7 +244,6 @@ export class Editor {
};
startEditing = () => {
console.log('ED START');
const { path } = getUrlData();
const { random_url, id } = this.getUser();
@ -257,13 +256,9 @@ export class Editor {
if (this.poly.latlngs && this.poly.latlngs.length > 1) this.poly.poly.enableEdit();
this.stickers.startEditing();
// this.setEditing(true);
// console.log(this.initialData);
};
stopEditing = () => {
console.log('ED STOP');
const { path } = getUrlData();
pushPath(`/${(this.initialData && this.initialData.path) || path}`);
@ -274,20 +269,14 @@ export class Editor {
};
cancelEditing = () => {
this.stopEditing();
console.log('trying to set initial data');
if (this.hasEmptyHistory()) {
console.log('empty history');
this.clearAll();
this.startEditing();
} else {
console.log('setting initial');
this.setData(this.initialData);
console.log('setting initial - done');
}
this.stopEditing();
this.clearChanged();
return true;

View file

@ -57,9 +57,9 @@ export class Stickers {
startEditing = () => {
this.stickers.map(sticker => sticker.startEditing());
}
};
stopEditing = () => {
this.stickers.map(sticker => sticker.stopEditing());
}
};
}

View file

@ -48,16 +48,14 @@ function* stopEditingSaga() {
const { changed, editing, mode } = yield select(getState);
if (!editing) return;
if (changed && mode !== MODES.CONFIRM_CANCEL) {
yield put(setMode(MODES.CONFIRM_CANCEL));
return;
}
if (!changed) {
yield editor.cancelEditing();
yield put(setEditing(false));
yield put(setMode(MODES.NONE));
} else {
// editor.changeMode(MODES.CONFIRM_CANCEL);
// this.props.setMode(MODES.CONFIRM_CANCEL);
yield put(setMode(MODES.CONFIRM_CANCEL));
}
}
function* mapInitSaga() {
@ -67,8 +65,6 @@ function* mapInitSaga() {
const map = yield call(getStoredMap, { name: path });
if (map) {
console.log('setting!', map, mode);
yield editor.setData(map);
yield put(setChanged(false));
@ -77,10 +73,9 @@ function* mapInitSaga() {
// yield put(setEditing(true));
// editor.startEditing();
} else {
console.log('stopping edit');
yield put(setEditing(false));
// yield call(stopEditingSaga);
// editor.stopEditing();
editor.stopEditing();
}
return hideLoader();