Bug 31863: Account for changelanguage element when adjusting editor height

To test:
1. Turn on 'EnableAdvancedCatalogingEditor'
2. Go to a record with enough MARC data that it should take up the entire width of your screen,
3. The CodeMirror editor will only be 300px.
4. Resize your screen, nothing happens to the editor height
5. Apply patch
6. Look at the same record in your editor, the editor should go to the bottom of the page now. Resizing your screen should resize the editor.
7. Have some additional language packs installed, and change the language system pref so the '#changelanguage' option will appear.
8. Make sure the editor height is still being properly set.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2022-10-18 20:53:03 +00:00 committed by Tomas Cohen Arazi
parent 56abcd184c
commit 9bee75e107
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -1020,8 +1020,11 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
resizeTimer = null;
var pos = $('#editor .CodeMirror').offset();
$('#editor .CodeMirror').height( $(window).height() - pos.top - 24 - $('#changelanguage').height() ); // 24 is hardcoded value but works well
if ( $('#changelanguage').length ) {
$('#editor .CodeMirror').height( $(window).height() - pos.top - 24 - $('#changelanguage').height() ); // 24 is hardcoded value but works well
} else {
$('#editor .CodeMirror').height( $(window).height() - pos.top - 24 );
}
$('.modal-body').each( function() {
$(this).height( $(window).height() * .8 - $(this).prevAll('.modal-header').height() );
} );