mirror of
https://github.com/xibyte/jsketcher
synced 2026-02-11 18:03:44 +01:00
fix wizard cancel behaviour
This commit is contained in:
parent
b4305c5a16
commit
bb0705221f
2 changed files with 8 additions and 4 deletions
|
|
@ -3,14 +3,15 @@ import Wizard from './Wizard';
|
|||
import connect from 'ui/connect';
|
||||
import decoratorChain from 'ui/decoratorChain';
|
||||
import mapContext from 'ui/mapContext';
|
||||
import {finishHistoryEditing} from '../../craftHistoryUtils';
|
||||
|
||||
function WizardManager({wizardContext, type, changingHistory, cancel, cancelHistoryEdit, applyWorkingRequest}) {
|
||||
function WizardManager({wizardContext, type, cancel, cancelHistoryEdit, applyWorkingRequest}) {
|
||||
if (!wizardContext) {
|
||||
return null;
|
||||
}
|
||||
return <Wizard key={wizardContext.ID}
|
||||
context={wizardContext}
|
||||
onCancel={changingHistory ? cancelHistoryEdit : cancel}
|
||||
onCancel={wizardContext.changingHistory ? cancelHistoryEdit : cancel}
|
||||
onOK={applyWorkingRequest} />
|
||||
}
|
||||
|
||||
|
|
@ -18,6 +19,7 @@ export default decoratorChain(
|
|||
connect(streams => streams.wizard.wizardContext.map(wizardContext => ({wizardContext}))),
|
||||
mapContext(ctx => ({
|
||||
cancel: ctx.services.wizard.cancel,
|
||||
cancelHistoryEdit: () => ctx.streams.craft.modifications.update(modifications => finishHistoryEditing(modifications)),
|
||||
applyWorkingRequest: ctx.services.wizard.applyWorkingRequest
|
||||
}))
|
||||
)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ export function activate(ctx) {
|
|||
let operation = ctx.services.operation.get(opRequest.type);
|
||||
|
||||
let params;
|
||||
if (opRequest.changingHistory) {
|
||||
let changingHistory = opRequest.changingHistory;
|
||||
if (changingHistory) {
|
||||
params = clone(opRequest.params)
|
||||
} else {
|
||||
params = initializeBySchema(operation.schema, ctx);
|
||||
|
|
@ -86,7 +87,8 @@ export function activate(ctx) {
|
|||
const updateState = mutator => state$.mutate(state => mutator(state));
|
||||
const disposerList = createFunctionList();
|
||||
wizCtx = {
|
||||
workingRequest$, materializedWorkingRequest$, state$, operation, updateParams, updateState,
|
||||
workingRequest$, materializedWorkingRequest$, state$, updateParams, updateState,
|
||||
operation, changingHistory,
|
||||
addDisposer: disposerList.add,
|
||||
dispose: disposerList.call,
|
||||
ID: ++REQUEST_COUNTER,
|
||||
|
|
|
|||
Loading…
Reference in a new issue