From c557b051f7411f9cf476b8fdf575403396d49cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 4 Mar 2024 20:19:43 +0100 Subject: [PATCH] clipboard: fix broken style if block code is in table #790 --- static/js/theme.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/js/theme.js b/static/js/theme.js index db1892e055..bfd1025403 100644 --- a/static/js/theme.js +++ b/static/js/theme.js @@ -594,7 +594,8 @@ function initCodeClipboard(){ var text = getCodeText( code ); var inPre = code.parentNode.tagName.toLowerCase() == 'pre'; 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 var isFirstLineCell = inTable && code.parentNode.parentNode.parentNode.querySelector( 'td:first-child > pre > code' ) == code;