From 9cd7a6bfc8e907c09beb9785f50ae097035a99b5 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Tue, 5 Mar 2019 14:53:18 +0000
Subject: [PATCH] Bug 21307: (follow-up) Change the way Codemirror height is
 calculated

This follow-up changes the way the height of the Codemirror editor is
calculated. Using offset() instead of position() returns the correct
values with the changed markup.

To test, apply the patch and load the advanced MARC editor. The "status
bar" should display correctly a the bottom of the editor and there
should be no double scrollbar.
---
 koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
index 5bf7472..6c7f79f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc
@@ -785,7 +785,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
             if ( resizeTimer == null ) resizeTimer = setTimeout( function() {
                 resizeTimer = null;
 
-                var pos = $('#editor .CodeMirror').position();
+                var pos = $('#editor .CodeMirror').offset();
                 $('#editor .CodeMirror').height( $(window).height() - pos.top - 24 - $('#changelanguage').height() ); // 24 is hardcoded value but works well
 
                 $('.modal-body').each( function() {
-- 
2.1.4