Created
March 12, 2025 16:22
-
-
Save magnum/e3e98c308614e0fdadcb9781d18c810c to your computer and use it in GitHub Desktop.
purge trix-editor from extra br, ie. when pasting from chatgpt to basecamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| document.querySelectorAll("trix-editor").forEach(el => { | |
| el.style.border = "1px solid green"; | |
| el.innerHTML = el.innerHTML.replaceAll("<div><!--block--><br></div>", "") | |
| el.innerHTML = el.innerHTML.replaceAll("<div><!--block--><br>","<div>") | |
| el.innerHTML = el.innerHTML.replaceAll("<br></strong><br>","</strong><br>"); | |
| el.innerHTML = el.innerHTML.replaceAll("<br></div>", "</div>") | |
| //console.log(el.innerHTML) | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment