Force a refresh of CodeMirror on tab navigation
authorAlexander Ebert <ebert@woltlab.com>
Thu, 2 Jun 2022 14:02:02 +0000 (16:02 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 2 Jun 2022 14:02:02 +0000 (16:02 +0200)
See https://www.woltlab.com/community/thread/295824-codemirror-gerne-mal-nicht-initialisiert/

wcfsetup/install/files/acp/templates/codemirror.tpl

index 5a27c7e6f730bdf61ad8e54d10af8edd06059982..d4ce5863c4ecd73434b91abd885feb5c8026e5f6 100644 (file)
                                                scrollPosition = element.codemirror.getScrollInfo().top;
                                        }
                                });
+
+                               const parentTabMenu = tabMenu.closest(".tabMenuContainer")
+                               if (parentTabMenu) {
+                                       EventHandler.add("com.woltlab.wcf.simpleTabMenu_" + parentTabMenu.id, "select", (data) => {
+                                               if (data.activeName === tabMenu.dataset.name) {
+                                                       element.codemirror.refresh();
+                                               }
+                                       });
+                               }
                        }
                        
                        var scrollOffsetStorage = element;