Przeglądaj źródła

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 1 miesiąc temu
rodzic
commit
eb58717657
1 zmienionych plików z 1 dodań i 1 usunięć
  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');
                 }
             }
         }