Strip external formatting but keep indentation and carriage returns on element input

I’m using the following: In Chrome, I’m given the option to “Paste” (undesired result) or “Paste and match style” (desired result), but in other browsers only “Paste” is offered. A regular “Paste” keeps the original content formatting that I don’t want, like text colors and background colors. This is creating an undesirable result for my use case. What I want to do is always force a paste to match the style of the <pre> element. One idea that I had is to intercept the pasted text, pass it to an invisible textarea element then get that value. But that seems