問題描述:
在內容里面插入代碼高亮顯示,后臺編輯器中是可以自動換行的,但是發表后,在前臺查看,發現代碼不能自動換行,直接超出了內容頁的邊界,極不美觀,雖然復制是可以完整的。
解決辦法:
找到高亮代碼顯示的css文件 /e/data/ecmseditor/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css
具體的路徑根據你的ueditor做改動
找到
復制代碼 代碼如下:
.syntaxhighlighter{width:100%!important;margin:.3em 0 .3em 0!important;position:relative!important;overflow:auto!important;background-color:#f5f5f5!important;border:1px solid #ccc!important;
改成
復制代碼 代碼如下:
.syntaxhighlighter{width:100%!important;margin:.3em 0 .3em 0!important;position:relative!important;overflow:auto!important;background-color:#f5f5f5!important;border:1px solid #ccc!important;word-break:break-all;
就是加上 word-break:break-all;
可能不同的ueditor版本css寫法不一樣,只要對應的位置加上這個強制換行就可以了
最終效果

您可能感興趣的文章:- 免費開源百度編輯器(UEditor)使用方法
- ASP.NET中集成百度編輯器UEditor
- yii2整合百度編輯器umeditor及umeditor圖片上傳問題的解決辦法