From f308d0be6c78be5148e8cd8646a9a36241ee8380 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 29 Aug 2017 23:53:18 +0300 Subject: [PATCH] increase height of a single code box upon pasting --- edit/edit.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/edit/edit.js b/edit/edit.js index 927d2ca1..e9d5fba3 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -396,6 +396,16 @@ function setupCodeMirror(textarea, index) { hotkeyRerouter.setState(false); wrapper.classList.add('CodeMirror-active'); }); + cm.on('paste', () => { + if (editors.length === 1) { + setTimeout(() => { + if (cm.display.sizer.clientHeight > cm.display.wrapper.clientHeight) { + maximizeCodeHeight.stats = null; + maximizeCodeHeight(cm.getSection(), true); + } + }); + } + }); if (!FIREFOX) { cm.on('mousedown', (cm, event) => toggleContextMenuDelete.call(cm, event)); }