Skip to content

Commit aefb908

Browse files
committed
fix: enable publish btn when an xblock is edited
1 parent db8a0aa commit aefb908

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/course-unit/data/slice.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ const slice = createSlice({
8888
updateMovedXBlockParams: (state, { payload }) => {
8989
state.movedXBlockParams = { ...state.movedXBlockParams, ...payload };
9090
},
91+
setXBlockPublishState: (state, { payload }) => {
92+
state.courseSectionVertical.xblockInfo.published = payload;
93+
state.courseSectionVertical.xblockInfo.hasChanges = !payload;
94+
},
9195
},
9296
});
9397

@@ -108,6 +112,7 @@ export const {
108112
updateCourseOutlineInfo,
109113
updateCourseOutlineInfoLoadingStatus,
110114
updateMovedXBlockParams,
115+
setXBlockPublishState,
111116
} = slice.actions;
112117

113118
export const {

src/course-unit/xblock-container-iframe/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { useIframeContent } from '../../generic/hooks/useIframeContent';
3737
import { useIframeMessages } from '../../generic/hooks/useIframeMessages';
3838
import VideoSelectorPage from '../../editors/VideoSelectorPage';
3939
import EditorPage from '../../editors/EditorPage';
40+
import { setXBlockPublishState } from '../data/slice';
4041

4142
const XBlockContainerIframe: FC<XBlockContainerIframeProps> = ({
4243
courseId, blockId, unitXBlockActions, courseVerticalChildren, handleConfigureSubmit, isUnitVerticalType,
@@ -74,6 +75,8 @@ const XBlockContainerIframe: FC<XBlockContainerIframeProps> = ({
7475
closeXBlockEditorModal();
7576
closeVideoSelectorModal();
7677
sendMessageToIframe(messageTypes.completeXBlockEditing, { locator: newBlockId });
78+
// This ensures the publish button is able
79+
dispatch(setXBlockPublishState(false));
7780
}, [closeXBlockEditorModal, closeVideoSelectorModal, sendMessageToIframe, newBlockId]);
7881

7982
const handleEditXBlock = useCallback((type: string, id: string) => {

0 commit comments

Comments
 (0)