From 184b6d4f7c4aed15f04d4c6eb4919877f674de10 Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 13 Nov 2020 18:59:59 +0300 Subject: [PATCH] fix fitToContent when applies-to is taller than window --- edit/sections-editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/edit/sections-editor.js b/edit/sections-editor.js index 9fbc8bc5..1279845b 100644 --- a/edit/sections-editor.js +++ b/edit/sections-editor.js @@ -160,7 +160,8 @@ function SectionsEditor() { contentHeight += 9; // border & resize grip cm.off('update', resize); const cmHeight = wrapper.offsetHeight; - const maxHeight = (window.innerHeight - headerOffset) - (section.el.offsetHeight - cmHeight); + const appliesToHeight = Math.min(section.el.offsetHeight - cmHeight, window.innerHeight / 2); + const maxHeight = (window.innerHeight - headerOffset) - appliesToHeight; const fit = Math.min(contentHeight, maxHeight); if (Math.abs(fit - cmHeight) > 1) { cm.setSize(null, fit);