Skip to content

Commit e34df7f

Browse files
authored
fix: set maxHeight on TextEditor TinyMce widget [FC-0090] (#2024) (#2030)
Sets a max_height=500px for the TinyMCE editor when editing a Text/Html component. This prevents the autoresize plugin from expanding the editor textarea beyond the bounds of the editor modal. ⚠️ Because the max height can only be a numeric pixel value, we can't use clever settings like vh or %, and so we're forced to limit the height of the editor to a fixed size for all screen sizes in order to address this issue. (cherry picked from commit c5f7d0c)
1 parent 317bc75 commit e34df7f

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/editors/containers/TextEditor/__snapshots__/index.test.jsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ exports[`TextEditor snapshots block failed to load, Toast is shown 1`] = `
5050
}
5151
editorType="text"
5252
enableImageUpload={true}
53-
height="100%"
5453
id={null}
5554
images={{}}
5655
initializeEditor={[MockFunction args.intializeEditor]}
5756
isLibrary={null}
5857
learningContextId="course+org+run"
5958
lmsEndpointUrl=""
59+
maxHeight={500}
6060
minHeight={500}
6161
onChange={[Function]}
6262
setEditorRef={[MockFunction hooks.prepareEditorRef.setEditorRef]}
@@ -226,13 +226,13 @@ exports[`TextEditor snapshots renders as expected with default behavior 1`] = `
226226
}
227227
editorType="text"
228228
enableImageUpload={true}
229-
height="100%"
230229
id={null}
231230
images={{}}
232231
initializeEditor={[MockFunction args.intializeEditor]}
233232
isLibrary={null}
234233
learningContextId="course+org+run"
235234
lmsEndpointUrl=""
235+
maxHeight={500}
236236
minHeight={500}
237237
onChange={[Function]}
238238
setEditorRef={[MockFunction hooks.prepareEditorRef.setEditorRef]}
@@ -292,13 +292,13 @@ exports[`TextEditor snapshots renders static images with relative paths 1`] = `
292292
}
293293
editorType="text"
294294
enableImageUpload={true}
295-
height="100%"
296295
id={null}
297296
images={{}}
298297
initializeEditor={[MockFunction args.intializeEditor]}
299298
isLibrary={null}
300299
learningContextId="course+org+run"
301300
lmsEndpointUrl=""
301+
maxHeight={500}
302302
minHeight={500}
303303
onChange={[Function]}
304304
setEditorRef={[MockFunction hooks.prepareEditorRef.setEditorRef]}

src/editors/containers/TextEditor/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const TextEditor = ({
6565
editorContentHtml={editorContent}
6666
setEditorRef={setEditorRef}
6767
minHeight={500}
68-
height="100%"
68+
maxHeight={500}
6969
initializeEditor={initializeEditor}
7070
{...{
7171
images,

src/editors/sharedComponents/TinyMceWidget/hooks.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ export const editorConfig = ({
304304
updateContent,
305305
content,
306306
minHeight,
307+
maxHeight,
307308
learningContextId,
308309
staticRootUrl,
309310
enableImageUpload,
@@ -335,6 +336,7 @@ export const editorConfig = ({
335336
content_css: false,
336337
content_style: tinyMCEStyles + a11ycheckerCss,
337338
min_height: minHeight,
339+
max_height: maxHeight,
338340
contextmenu: 'link table',
339341
directionality: isLocaleRtl ? 'rtl' : 'ltr',
340342
document_base_url: baseURL,

0 commit comments

Comments
 (0)