From bd719e5ebc9929fcbdfbcef7fa5dfced1765f420 Mon Sep 17 00:00:00 2001 From: Timo Reymann Date: Sat, 24 Apr 2021 16:20:41 +0200 Subject: [PATCH] fix(#10): Fix preview showing empty panel when resizing terminal --- .../mjml_support/editor/MjmlPreviewFileEditor.kt | 12 +++++++----- src/main/resources/META-INF/plugin.xml | 5 +++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/de/timo_reymann/mjml_support/editor/MjmlPreviewFileEditor.kt b/src/main/kotlin/de/timo_reymann/mjml_support/editor/MjmlPreviewFileEditor.kt index 33a5bbc..496a655 100644 --- a/src/main/kotlin/de/timo_reymann/mjml_support/editor/MjmlPreviewFileEditor.kt +++ b/src/main/kotlin/de/timo_reymann/mjml_support/editor/MjmlPreviewFileEditor.kt @@ -74,13 +74,15 @@ class MjmlPreviewFileEditor(project: Project, private val virtualFile: VirtualFi it.setResizeEnabled(false) } - val comp = getPanel()?.component ?: return - val size = Dimension(previewWidthStatus!!.width + 5, comp.size.height) - comp.size = size - comp.preferredSize = size + val panelComponent = getPanel()?.component ?: return - htmlPanelWrapper.minimumSize = size + // Set size for all components to make sure the rendering is smooth + // height is set to 1 to prevent the preview from showing an empty panel + val size = Dimension(previewWidthStatus!!.width + 5, 1) + panelComponent.size = size + panelComponent.preferredSize = size htmlPanelWrapper.preferredSize = size + htmlPanelWrapper.minimumSize = size } override fun getPreferredFocusedComponent(): JComponent? = panel?.component diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 8cc237e..21fe98b 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -37,6 +37,11 @@ ]]> +
  • 1.8.1 +
      +
    • Fix preview showing empty panel when resizing terminal over a specific point
    • +
    +
  • 1.8.0
    • Add support for es6 custom components