問題描述:
在內容里面插入代碼高亮顯示,后臺編輯器中是可以自動換行的,但是發表后,在前臺查看,發現代碼不能自動換行,直接超出了內容頁的邊界,極不美觀,雖然復制是可以完整的。
解決辦法:
找到高亮代碼顯示的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寫法不一樣,只要對應的位置加上這個強制換行就可以了
最終效果