clipboard: fix broken style if block code is in table #790

This commit is contained in:
Sören Weber 2024-03-04 20:19:43 +01:00
parent 3425f3956a
commit c557b051f7
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D

View file

@ -594,7 +594,8 @@ function initCodeClipboard(){
var text = getCodeText( code ); var text = getCodeText( code );
var inPre = code.parentNode.tagName.toLowerCase() == 'pre'; var inPre = code.parentNode.tagName.toLowerCase() == 'pre';
var inTable = inPre && var inTable = inPre &&
code.parentNode.parentNode.tagName.toLowerCase() == 'td'; code.parentNode.parentNode.tagName.toLowerCase() == 'td' &&
code.parentNode.parentNode.classList.contains('lntd');
// avoid copy-to-clipboard for highlight shortcode in table lineno mode // avoid copy-to-clipboard for highlight shortcode in table lineno mode
var isFirstLineCell = inTable && var isFirstLineCell = inTable &&
code.parentNode.parentNode.parentNode.querySelector( 'td:first-child > pre > code' ) == code; code.parentNode.parentNode.parentNode.querySelector( 'td:first-child > pre > code' ) == code;