如标题所说,在使用ueditor编辑器插件时,出现了问题。添加文章还好说,排版好并保存,在前台页面查看没有问题。可当编辑时,插入的代码语言,就格式乱了,或者丢失了。这样奇葩的问题,在查询一大圈之后。发现,只因应用的html标签不正确。
ueditor建议我们使用script标签而非textarea。
所以在我的项目中,我做了如下改变。
将
<textarea style="height:400px" id="editor" name="content"> {$infos['content']} </textarea>
修改为
<script style="height:400px" id="editor" name="content" type="text/plain"> {$infos['content']} </script>