theme: fix bottom margin for block code in FF #175

This commit is contained in:
Sören Weber 2022-02-22 20:38:09 +01:00
parent d850ea528d
commit 48a56ddefd
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 9 additions and 3 deletions

View file

@ -671,7 +671,7 @@ code {
white-space: nowrap; white-space: nowrap;
} }
.copy-to-clipboard { span.copy-to-clipboard {
display: inline-block; display: inline-block;
} }

View file

@ -368,9 +368,15 @@ jQuery(function() {
} }
var parent = code.parent(); var parent = code.parent();
var inPre = parent.prop('tagName') == 'PRE';
code.addClass('copy-to-clipboard-code'); code.addClass('copy-to-clipboard-code');
code.replaceWith($('<span/>', {'class': 'copy-to-clipboard'}).append(code.clone() )); if( inPre ){
code = parent.children('.copy-to-clipboard').last().children('.copy-to-clipboard-code'); parent.addClass( 'copy-to-clipboard' );
}
else{
code.replaceWith($('<span/>', {'class': 'copy-to-clipboard'}).append(code.clone() ));
code = parent.children('.copy-to-clipboard').last().children('.copy-to-clipboard-code');
}
code.after( $('<span>').addClass("copy-to-clipboard-button").attr("title", window.T_Copy_to_clipboard).append("<i class='fas fa-copy'></i>") ); code.after( $('<span>').addClass("copy-to-clipboard-button").attr("title", window.T_Copy_to_clipboard).append("<i class='fas fa-copy'></i>") );
code.next('.copy-to-clipboard-button').on('mouseleave', function() { code.next('.copy-to-clipboard-button').on('mouseleave', function() {
$(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w'); $(this).attr('aria-label', null).removeClass('tooltipped tooltipped-s tooltipped-w');