本文整理匯總了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;
};