Hi! Sorry for delay in reply.
Thanks a lot for the script. Unfortunately it is not fully helps - it is only removing empty paragraphs like "<p></p>"
Unfortunately there is some automatic inserts of paragraphs around content like <p>Something</p> and also <br />
So, they stayed and crashed frontend layout.
Regarding the sandbox - it require quite more time. Is it possible to import my layouts to sandbox in some way?
Also I'm not very sure about the purpose - we already disable (and could remove) all 3rd party plugins from my staging to exclude them from the issue, why it not the same?
Well, it is basically our process for escalating issues to developers. Before soliciting a developer we need to reproduce the issue on a clean install. This way, we exclude any compatibility issues(related to 3rd party plugins), and any issue that can come from the site's data. Sometimes, we encounter issues only the website, and we can't reproduce it on a clean install. In that case, we call it an exception rather than a bug. When the issue is reproduced on a clean install, we qualify it as a bug.
We need to make sure that this happens on a clean install, so we must not import your website to the sandbox. But we can still import the layouts. For that matter your can use the Toolset Module Manager plugin. Read more about it here https://toolset.com/home/module-manager/
And you can download it from here https://toolset.com/download/toolset-module-manager/