From 1ff5e5bdae1cc2b1f166628cc67206b446a264bb Mon Sep 17 00:00:00 2001 From: Muhammad Anas <88967643+Anas12091101@users.noreply.github.com> Date: Wed, 4 Jun 2025 17:59:24 +0100 Subject: [PATCH] fix: markdown editor issues in modal (#2076) This PR resolves rendering issues with the Markdown editor inside the modal. The problem began after a PR [1] introduced the use of modals for the editor. The EditorPage [2] component expects a `isMarkdownEditorEnabledForCourse` prop, which was missing in that implementation. [1] https://github.com/openedx/frontend-app-authoring/pull/1838 [2] https://github.com/openedx/frontend-app-authoring/pull/1838/files#diff-147218ef88726880178ea895988a5d3feaf2c0c4459086a8de7a4080cbe37de7R226 Backports https://github.com/openedx/frontend-app-authoring/pull/2074 --- src/course-unit/add-component/AddComponent.jsx | 3 ++- src/course-unit/xblock-container-iframe/index.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/course-unit/add-component/AddComponent.jsx b/src/course-unit/add-component/AddComponent.jsx index 9e0fd850f..2b169965a 100644 --- a/src/course-unit/add-component/AddComponent.jsx +++ b/src/course-unit/add-component/AddComponent.jsx @@ -44,7 +44,7 @@ const AddComponent = ({ const [selectedComponents, setSelectedComponents] = useState([]); const [usageId, setUsageId] = useState(null); const { sendMessageToIframe } = useIframe(); - const { useVideoGalleryFlow } = useSelector(getWaffleFlags); + const { useVideoGalleryFlow, useReactMarkdownEditor } = useSelector(getWaffleFlags); const receiveMessage = useCallback(({ data: { type, payload } }) => { if (type === messageTypes.showMultipleComponentPicker) { @@ -264,6 +264,7 @@ const AddComponent = ({ courseId={courseId} blockType={blockType} blockId={newBlockId} + isMarkdownEditorEnabledForCourse={useReactMarkdownEditor} studioEndpointUrl={getConfig().STUDIO_BASE_URL} lmsEndpointUrl={getConfig().LMS_BASE_URL} onClose={closeXBlockEditorModal} diff --git a/src/course-unit/xblock-container-iframe/index.tsx b/src/course-unit/xblock-container-iframe/index.tsx index 0c1ab91e2..dac95c96a 100644 --- a/src/course-unit/xblock-container-iframe/index.tsx +++ b/src/course-unit/xblock-container-iframe/index.tsx @@ -49,7 +49,7 @@ const XBlockContainerIframe: FC = ({ const [isVideoSelectorModalOpen, showVideoSelectorModal, closeVideoSelectorModal] = useToggle(); const [isXBlockEditorModalOpen, showXBlockEditorModal, closeXBlockEditorModal] = useToggle(); const [blockType, setBlockType] = useState(''); - const { useVideoGalleryFlow } = useSelector(getWaffleFlags); + const { useVideoGalleryFlow, useReactMarkdownEditor } = useSelector(getWaffleFlags); const [newBlockId, setNewBlockId] = useState(''); const [accessManagedXBlockData, setAccessManagedXBlockData] = useState({}); const [iframeOffset, setIframeOffset] = useState(0); @@ -230,6 +230,7 @@ const XBlockContainerIframe: FC = ({ courseId={courseId} blockType={blockType} blockId={newBlockId} + isMarkdownEditorEnabledForCourse={useReactMarkdownEditor} studioEndpointUrl={getConfig().STUDIO_BASE_URL} lmsEndpointUrl={getConfig().LMS_BASE_URL} onClose={closeXBlockEditorModal}