Skip to content

Commit

Permalink
fix(#10): Fix preview showing empty panel when resizing terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
timo-reymann committed Apr 24, 2021
1 parent 2b6b461 commit bd719e5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
]]></description>
<change-notes><![CDATA[
<ul>
<li>1.8.1
<ul>
<li>Fix preview showing empty panel when resizing terminal over a specific point</li>
</ul>
</li>
<li>1.8.0
<ul>
<li>Add support for es6 custom components</li>
Expand Down

0 comments on commit bd719e5

Please sign in to comment.