diff --git a/static/css/theme.css b/static/css/theme.css index e042a7bc83..783946c809 100644 --- a/static/css/theme.css +++ b/static/css/theme.css @@ -548,10 +548,11 @@ pre { position: relative; } -pre.pre-code, -pre:has( code ){ - /* the :has() operator isn't available in FF yet, so we patch this by JS */ +/* pre:has( code ), */ +/* the :has() operator isn't available in FF yet, so we patch this by JS */ +pre.pre-code { direction: ltr; + text-align: left; } pre code { diff --git a/static/js/theme.js b/static/js/theme.js index d79243772a..75afadd4fd 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -368,13 +368,11 @@ function initCodeClipboard(){ clip.on( 'success', function( e ){ e.clearSelection(); - var inPre = e.trigger.parentNode.tagName.toLowerCase() == 'pre'; e.trigger.setAttribute( 'aria-label', window.T_Copied_to_clipboard ); e.trigger.classList.add( 'tooltipped', 'tooltipped-' + (inPre ? 'w' : 's'+(isRtl?'e':'w')) ); }); clip.on( 'error', function( e ){ - var inPre = e.trigger.parentNode.tagName.toLowerCase() == 'pre'; e.trigger.setAttribute( 'aria-label', fallbackMessage(e.action) ); e.trigger.classList.add( 'tooltipped', 'tooltipped-' + (inPre ? 'w' : 's'+(isRtl?'e':'w')) ); var f = function(){ @@ -388,7 +386,7 @@ function initCodeClipboard(){ code.classList.add( 'copy-to-clipboard-code' ); if( inPre ){ code.classList.add( 'copy-to-clipboard' ); - code.classList.add( 'pre-code' ); + code.parentNode.classList.add( 'pre-code' ); } else{ var clone = code.cloneNode( true );