From 516bcbca0594fe51e6e0e8347066f4addf591637 Mon Sep 17 00:00:00 2001 From: muerwre Date: Fri, 30 Nov 2018 17:53:38 +0700 Subject: [PATCH] route: fixed empty route cancellation --- src/modules/Editor.js | 5 +++-- src/redux/user/sagas.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/modules/Editor.js b/src/modules/Editor.js index 9375f9d..029429f 100644 --- a/src/modules/Editor.js +++ b/src/modules/Editor.js @@ -283,18 +283,19 @@ export class Editor { stopEditing = () => { const { path } = getUrlData(); + pushPath(`/${(this.initialData && this.initialData.path) || path}`); - // this.changeMode(MODES.NONE); this.poly.poly.disableEdit(); this.stickers.stopEditing(); - // this.setEditing(false); }; cancelEditing = () => { if (this.hasEmptyHistory) { this.clearAll(); this.startEditing(); + this.clearChanged(); + return; } else { this.setData(this.initialData); } diff --git a/src/redux/user/sagas.js b/src/redux/user/sagas.js index a49417d..e7dd3fd 100644 --- a/src/redux/user/sagas.js +++ b/src/redux/user/sagas.js @@ -76,6 +76,7 @@ function* stopEditingSaga() { } yield editor.cancelEditing(); + yield put(setMode(MODES.NONE)); yield put(setChanged(false));