Commit 04b5ffcf authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[BUGFIX] Observe GridEditor visibility to refresh codeMirror

In case a TCA field with renderType=belayoutwizard
is configured to be not in the initially visible tab, the
CodeMirror editor remains empty, when switching to
the tab, containing the editor. The reason is, CodeMirror
needs to be refreshed, after becoming visible.

Therefore, the GridEditor, holding the configuration,
is now observed, if not initially visible. As soon as it
becomes visible, the CodeMirror instance - if any -
is refreshed.

Can be tested with `tx_styleguide_elements_basic.text_20`.

Resolves: #96062
Releases: master, 11.5
Change-Id: Ic03c315e8f12bc2f3623fdb11a1782d5c1081a23

Tested-by: core-ci's avatarcore-ci <>
Tested-by: Jochen's avatarJochen <>
Tested-by: Nikita Hovratov's avatarNikita Hovratov <>
Tested-by: Benni Mack's avatarBenni Mack <>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <>
Reviewed-by: Jochen's avatarJochen <>
Reviewed-by: Nikita Hovratov's avatarNikita Hovratov <>
Reviewed-by: Benni Mack's avatarBenni Mack <>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <>
parent 709deb86
......@@ -95,6 +95,7 @@ export class GridEditor {
this.targetElement = $(this.selectorEditor);
......@@ -920,4 +921,24 @@ export class GridEditor {
result += '\t}\n}\n';
return result;
* Observe the editors' visibility, since codeMirror needs to be refreshed as soon as it becomes
* visible in the viewport. Otherwise, if this element is not in the first visible FormEngine tab,
* it will not display any value, unless the grid gets manually updated.
protected addVisibilityObserver(gridEditor: HTMLElement) {
if (gridEditor.offsetParent !== null) {
// In case the editor is already visible, we don't have to add the observer
new IntersectionObserver((entries: IntersectionObserverEntry[], observer: IntersectionObserver) => {
entries.forEach(entry => {
const codemirror: any = document.querySelector(this.selectorCodeMirror);
if (entry.intersectionRatio > 0 && codemirror) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment