问题描述
当我尝试跑步时
editor.setData("<p>test comment</p><code class=\"python-code\">def withCodeBlock:<br /> print('test')</code>");
生成的编辑器包含 html:
<p>test comment</p>
<p>def withCodeBlock:
<br>print('test')</p>
它去掉了 <code>
标签,我该如何阻止?
解决方法
我发现了我的问题,我的消毒剂正在移除代码块周围的 <pre>
包装标签
editor.setData("<p>test comment</p><pre><code class=\"python-code\">def withCodeBlock:<br /> print('test')</code></pre>");
完美运行