eWebEditor (飛魚修改版) 實戰中遇到的三大棘手問題及解決方案,涵蓋瀏覽器相容、伺服器穩定性、部署路徑遷移。
原因:IE8 屏蔽了 `anonymous()` 方法呼叫方式。
修復:編輯 `include/editor.js`,針對 IE8 切換為 `onclick(event)` 呼叫:
if (navigator.appVersion.match(/MSIE (8)\./i) != null) {
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "onclick(event)");
} else {
if (element.YUSERONCLICK) eval(element.YUSERONCLICK + "anonymous()");
}
注意:IE7/IE6 無此問題,IE8 Beta 版 User-Agent 可能無法識別,需進一步特徵檢測。
現象:編輯器提交空白內容後,Tomcat 直接關閉。
根因:`upload.jsp` 中存在 `System.exit(0)` 硬編碼:
if (sTemp.equals("")) {
System.exit(0); // 直接殺掉 JVM 進程!
}
修復:改為賦值空白字串:
if (sTemp.equals("")) {
sTemp = " ";
}
前端 `getHTML()` 也可增加空內容防護:
if ((html.toLowerCase() == "<p> </p>") || (html.toLowerCase() == "<p></p>")) {
html = ".";
}
場景:專案結構 `webapp/jpkc/eWebEditor/`

修復兩處路徑:
String sUploadFilePath = "jpkc/eWebEditor/UploadFile/";
sStyleNameAdd = config.getServletContext().getRealPath("/")
+ "jpkc/eWebEditor/" + sUploadFilePath
+ year + "/" + month + "/" + day + "/";
| 缺陷 | 影響 |
|---|---|
| 商業授權收費 | 企業專案多不採用 |
| 不支援 Firefox/Opera | 跨瀏覽器相容性差,FCKeditor/CKEditor 更優 |
建議新專案優先評估 CKEditor、TinyMCE 等開源現代編輯器,僅維護舊系統時參考本文修復。