I've only tested the Windows version. And I don't claim to completely understand why this works. I added a line to prevent MathJax from trying to render edit fields thinking that other fixes would be needed too, but this seems to fix everything.
In particular, (1) LaTeX does not disappear after any length of time while a new message is being created, (2) when you edit an existing message, the LaTeX code is restored within $ delimiters and no duplication of LaTeX happens.
I've only tested the Windows version. And I don't claim to completely understand why this works. I added a line to prevent MathJax from trying to render edit fields thinking that other fixes would be needed too, but this seems to fix everything.
In particular, (1) LaTeX does not disappear after any length of time while a new message is being created, (2) when you edit an existing message, the LaTeX code is restored within $ delimiters and no duplication of LaTeX happens.