Skip to content

Commit 1b357cb

Browse files
fix: broken Course Overview editor on Schedule & Details page (#2599)
1 parent 2de987b commit 1b357cb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/schedule-and-details/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ const ScheduleAndDetails = ({ courseId }) => {
117117
license,
118118
language,
119119
subtitle,
120-
overview,
121120
duration,
122121
selfPaced,
123122
startDate,
@@ -128,7 +127,6 @@ const ScheduleAndDetails = ({ courseId }) => {
128127
instructorInfo,
129128
enrollmentStart,
130129
shortDescription,
131-
aboutSidebarHtml,
132130
preRequisiteCourses,
133131
entranceExamEnabled,
134132
courseImageAssetPath,
@@ -140,6 +138,12 @@ const ScheduleAndDetails = ({ courseId }) => {
140138
} = editedValues;
141139

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

144148
if (isLoading) {
145149
// eslint-disable-next-line react/jsx-no-useless-fragment
@@ -277,12 +281,12 @@ const ScheduleAndDetails = ({ courseId }) => {
277281
)}
278282
<IntroducingSection
279283
title={title}
280-
overview={overview}
284+
overview={initialOverview}
281285
duration={duration}
282286
subtitle={subtitle}
283287
introVideo={introVideo}
284288
description={description}
285-
aboutSidebarHtml={aboutSidebarHtml}
289+
aboutSidebarHtml={initialAboutSidebarHtml}
286290
shortDescription={shortDescription}
287291
aboutPageEditable={aboutPageEditable}
288292
sidebarHtmlEnabled={sidebarHtmlEnabled}

0 commit comments

Comments
 (0)