From 764489e30bea99830f04bcee1bd479c6e62d3d7a Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 10 Aug 2022 13:51:54 +0100 Subject: [PATCH] Improved WYSWYG editor code block layout update To help prevent against empty areas during inital empty-cache loads. This delays the original layout update a little to give time for the layout to render as expected. For #3637 --- resources/js/wysiwyg/plugin-codeeditor.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/js/wysiwyg/plugin-codeeditor.js b/resources/js/wysiwyg/plugin-codeeditor.js index 82052a40d..b9fc355e1 100644 --- a/resources/js/wysiwyg/plugin-codeeditor.js +++ b/resources/js/wysiwyg/plugin-codeeditor.js @@ -111,10 +111,8 @@ function defineCodeBlockCustomElement(editor) { const container = this.shadowRoot.querySelector('.CodeMirrorContainer'); const renderCodeMirror = (Code) => { this.cm = Code.wysiwygView(container, content, this.getLanguage()); - Code.updateLayout(this.cm); - setTimeout(() => { - this.style.height = null; - }, 1); + setTimeout(() => Code.updateLayout(this.cm), 10); + setTimeout(() => this.style.height = null, 12); }; window.importVersioned('code').then((Code) => {