本文整理汇总了TypeScript中front-end/state.updateWorkspace函数的典型用法代码示例。如果您正苦于以下问题:TypeScript updateWorkspace函数的具体用法?TypeScript updateWorkspace怎么用?TypeScript updateWorkspace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updateWorkspace函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: switch
const dndReducer = (state: ApplicationState, event: BaseEvent) => {
switch(event.type) {
case DND_STARTED: {
const { ref } = event as DNDEvent;
return updateWorkspace(state, state.selectedWorkspaceId, {
draggingRefs: [ref]
})
}
case DND_HANDLED: {
return updateWorkspace(state, state.selectedWorkspaceId, {
draggingRefs: []
});
}
}
return state;
}
示例2: createApplicationState
export const applicationReducer = (state: ApplicationState = createApplicationState(), event: BaseEvent) => {
switch(event.type) {
case LOADED_SAVED_STATE: {
const { state: newState } = event as LoadedSavedState;
state = merge({}, state, JSON.parse(JSON.stringify(newState)));
break;
}
case TREE_NODE_LABEL_CLICKED: {
const { node } = event as TreeNodeLabelClicked;
state = updateWorkspace(state, state.selectedWorkspaceId, {
selectedFileId: node.$id
});
break;
}
case TOGGLE_TARGET_CSS_TARGET_SELECTOR_CLICKED: {
console.warn("TODO CSS ")
// const { itemId, artboardId } = event as ToggleCSSTargetSelectorClicked;
// const artboard = getArtboardById(artboardId, state);
// const item = getNestedObjectById(itemId, artboard.document);
// const workspace = getArtboardWorkspace(artboard.$id, state);;
// state = toggleWorkspaceTargetCSSSelector(state, workspace.$id, item.source.uri, (item as any as SyntheticCSSStyleRule).selectorText);
break;
}
}
state = artboardReducer(state, event);
state = stageReducer(state, event);
state = cssInspectorReducer(state, event);
state = workspaceReducer(state, event);
state = artboardPaneReducer(state, event);
state = componentsPaneReducer(state, event);
state = shortcutReducer(state, event);
state = apiReducer(state, event);
state = dndReducer(state, event);
return state;
};