소스 검색

fix: clear prettyprinted class when re-rendering as plaintext/markdown

prettyPrint() adds the 'prettyprinted' marker class to signal it has
processed the element. When the viewer is re-used (e.g. clone flow or
same-page re-render) and the format changes away from syntaxhighlighting,
parsePaste() was removing 'prettyprint' (the styling class) but not
'prettyprinted' (the processed marker), leaving isPrettyPrinted()
returning true stale. This also caused the PasteViewer fast-check test
to fail across iterations when syntaxhighlighting ran before plaintext.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rugk 3 달 전
부모
커밋
eb58717657
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      js/privatebin.js

+ 1 - 1
js/privatebin.js

@@ -2651,7 +2651,7 @@ window.PrivateBin = (function () {
                     Helper.urls2links(prettyPrintEl, format !== 'syntaxhighlighting');
                     prettyPrintEl.style.whiteSpace = 'pre-wrap';
                     prettyPrintEl.style.wordBreak = 'normal';
-                    prettyPrintEl.classList.remove('prettyprint');
+                    prettyPrintEl.classList.remove('prettyprint', 'prettyprinted');
                 }
             }
         }