Skip to content

Commit 81d22da

Browse files
marslanabdulraufxitij2000
authored andcommitted
fix: broken Course Overview editor on Schedule & Details page (openedx#2599)
1 parent 18027c5 commit 81d22da

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/schedule-and-details/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ const ScheduleAndDetails = ({ intl, courseId }) => {
116116
license,
117117
language,
118118
subtitle,
119-
overview,
120119
duration,
121120
selfPaced,
122121
startDate,
@@ -127,7 +126,6 @@ const ScheduleAndDetails = ({ intl, courseId }) => {
127126
instructorInfo,
128127
enrollmentStart,
129128
shortDescription,
130-
aboutSidebarHtml,
131129
preRequisiteCourses,
132130
entranceExamEnabled,
133131
courseImageAssetPath,
@@ -139,6 +137,12 @@ const ScheduleAndDetails = ({ intl, courseId }) => {
139137
} = editedValues;
140138

141139
useScrollToHashElement({ isLoading });
140+
// No need to get overview and aboutSidebarHtml from editedValues
141+
// As updating them re-renders TinyMCE
142+
// Which causes issues with TinyMCE editor cursor position
143+
// https://www.tiny.cloud/docs/tinymce/5/react/#initialvalue
144+
const { overview: initialOverview } = courseDetails || {};
145+
const { aboutSidebarHtml: initialAboutSidebarHtml } = courseDetails || {};
142146

143147
if (isLoading) {
144148
// eslint-disable-next-line react/jsx-no-useless-fragment
@@ -276,12 +280,12 @@ const ScheduleAndDetails = ({ intl, courseId }) => {
276280
)}
277281
<IntroducingSection
278282
title={title}
279-
overview={overview}
283+
overview={initialOverview}
280284
duration={duration}
281285
subtitle={subtitle}
282286
introVideo={introVideo}
283287
description={description}
284-
aboutSidebarHtml={aboutSidebarHtml}
288+
aboutSidebarHtml={initialAboutSidebarHtml}
285289
shortDescription={shortDescription}
286290
aboutPageEditable={aboutPageEditable}
287291
sidebarHtmlEnabled={sidebarHtmlEnabled}

0 commit comments

Comments
 (0)