fck_docprops.html中出現(xiàn)start tag ([option]) not closed
在fck_docprops.html中將如下語句:“
<option value='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'>HTML 4.01 Transitional</option>”,改為:
<option value='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'>HTML 4.01 Transitional</option>
表單提交時中文亂碼
request.setCharacterEncoding("gb2312");
上傳中文文件名的文件會出現(xiàn)亂碼
分別對SimpleUploaderServlet.java和ConnectorServlet.java做如下修改:
找到2個程序文件中的DiskFileUpload upload = new DiskFileUpload();,在該行下面添加upload.setHeaderEncoding("UTF-8");
添加字體
默認情況下,FCKEditor在進行文本編輯時,無法使用中文字體。
(1)打開 fckconfig.js 文件,將FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;修改為:FCKConfig.FontNames = '宋體;黑體;幼圓;楷體_GB2312;仿宋_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;
(2)打開editor/css/fck_editorarea.css 文件,將font-family: Arial, Verdana, sans-serif;修改為:font-family: 宋體, 黑體, 幼圓, 楷體, 仿宋, Arial, Verdana, sans-serif;
XML request error 404
將fckconfig.js文件中的
var _FileBrowserLanguage = ‘php’ ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = ‘php’ ; // asp | aspx | cfm | lasso | perl | php | py
改成
var _FileBrowserLanguage = ‘jsp’ ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = ‘jsp’ ; // asp | aspx | cfm | lasso | perl | php | py
圖片預覽中的英文如何去掉
在fckeditor/editor/dialog/fck_image下面的fck_image_preview.html中把英文去掉就可以了。
還有圖片上傳成功后彈出的提示框里面是英文,要想改成中文,在fckeditor/editor/dialog/fck_image下面的fck_image.js里面修改就OK了
中文文件在瀏覽器引用時會以uri格式(%)出現(xiàn)
在fckeditor/editor/filemanager/browser/default下面的fck_image_preview.html中把window.top.opener.SetUrl( encodeURI( fileUrl ).replace( '#', '%23' ) ) ;改為window.top.opener.SetUrl( fileUrl ) ;
Times附近有語法錯誤
http://m.tkk7.com/wangbbs2007/articles/298057.html即“TImes……ROMAN”字體格式錯誤,這個錯誤是很多網(wǎng)頁在線編輯器(如:FCK,FreeTextBox)的BUG
三種解決方法:
一、把要發(fā)布的內容粘貼到記事本里面,然后在粘貼到網(wǎng)頁在線編輯器里面,這樣可以避免格式錯誤。
二、以FreeTextBox為例,將FreeTextBox1.Text替換為FreeTextBox1.Text.Replace("'", "''")問題就可以得到解決,其他網(wǎng)頁編輯器的方法也是一樣的。
三、提供一種暫時的Client端的解決辦法:發(fā)布內容時,會提示是否刪除word格式,選“是”,并選擇將Css,字體格式全部清除。
一種一勞永逸的辦法,將FCKEditor1.value替換為FCKEDitor1.value.Replace("'","'")問題就可以解決,例如content = content.Replace("'", "''");
非空驗證
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<script type="text/javascript">
function checkZSForm(){
var content = FCKeditorAPI.GetInstance("content").GetXHTML(true);
if(rbContent == null || rbContent == ""){
alert("請輸入內容");
return false;
}
document.form1.submit(); //不為空則提交表單
}
</script>
content即FCK的實例名(instanceName)
頁面中的表單內容:
<FCK:editor id="content" basePath="FCKeditor/" height="500">
</FCK:editor>
內容重置
function reset_fck(){
//form1.reset();
FCKeditorAPI.GetInstance("content").EditorDocument.body.innerHTML="";
}
另外,fck工具欄第4個按鈕,“新建”相當于“清空”。
添加刪除上傳到服務器上的文件(圖片可預覽)功能
參考:http://www.cnblogs.com/Ghost-Chow/archive/2009/10/15/1584052.html修改:fckeditor/editor/filemanager/browser/default/frmresourceslist.html
在body區(qū)域增加如下代碼:
<div id="showFile" style="float:left; display:none; background-color:#999999"></div>//作用是當鼠標移到所上傳的文件時顯示其相關信息
<iframe id="iframe_del" name="iframe_del" width="0" height="0" scrolling="no"></iframe>//作用是供我們刪除上傳文件時做動作響應窗口,即是將刪除動作在iframe中運行,目的是實現(xiàn)偽無刷新刪除效果
<div id="body_content"></div>//作用是顯示上傳文件及文件夾列表
(1) 在js代碼區(qū)域中加入:
//顯示文件顯示層
function showDiv(fileUrl)
{
var name = fileUrl;
//獲取文件類型
var suffix = name.substring(name.lastIndexOf(".")+1);
var div = document.getElementById("showFile");
div.content = "";
div.style.position = "absolute";
div.content += "<table width='256' border='0' cellpadding='3' cellspacing='1' bgcolor='#737357'><tbody><tr><td height='23' align='left' bgcolor='#c7c78f'><table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tbody><tr><td width='47%'> <a href='javascript:void(0);' onClick='hiddenDiv();'><font color='#000000' style='text-decoration:none;'>關閉</font></a></td><td width='53%' align='right'><a href='javascript:void(0);' onClick='if (!confirm(\"確定要刪除此文件夾及其子目錄嗎?\")){return false;}else{DelFile(\""+fileUrl+"\");}'><font color='#000000' style='text-decoration:none;'>刪除</font></a> </td></tr></tbody></table></td></tr>";
if(suffix == 'gif' || suffix == 'jpg' || suffix == 'jpeg' || suffix == 'bmp' || suffix == 'png'){
div.content += "<tr><td align='center' bgcolor='#c7c78f'><img src='"+fileUrl+"' onload='if(this.width>250) this.width=250' style='margin:3px;'></td></tr>";
}else{
div.content += "<tr><td height='35' align='center' bgcolor='#c7c78f'><strong>該類型不能預覽</strong></td></tr>";
}
div.content +="</tbody></table>";
div.innerHTML = div.content;
div.style.display ="";
div.style.top = event.y+document.body.scrollTop+10;
div.style.left= event.x+document.body.scrollLeft+30;
}
//隱藏文件顯示層
function hiddenDiv()
{
var div = document.getElementById("showFile");
div.style.display="none";
}
//====Add by BaoSight kwan==2011-03-18==start====
//這里添加兩個function,用于提交刪除操作,在刪除成功后刷新頁面
function DelFile(fileUrl){
if ( fileUrl == null )
return;
oConnector.SendCommand( 'DelFile', 'FileName=' + encodeURI(encodeURI(fileUrl)) , DelFileCallBack ) ;
}
function DelFileCallBack(fckXml ){
if (oConnector.CheckError(fckXml ) == 0 )
window.parent.frames['frmResourcesList'].Refresh() ;
}
//====Add by BaoSight kwan==2011-03-18== end ====
(2) 修改本頁面原有js
oListManager.Clear = function()
{
//document.body.innerHTML = '' ;原有
hiddenDiv();//修改的
document.getElementById("body_content").innerHTML = '';//修改的
}
oListManager.GetFolderRowHtml = function( folderName, folderPath )
{
// Build the link to view the folder.
var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ;
return '<tr>' +
'<td width="16">' +
sLink +
'<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' +
'<\/td><td nowrap colspan="2"> ' +
sLink +
folderName +
'<\/a>' +
'<\/td><td align="center" width="10%"><a href="#" onclick="if (!confirm(\'確定要刪除此文件夾及其子目錄嗎?\')){return false;}else{DelFile(\''+ProtectPath( folderPath )+ '\');}">delete</a><\/td><\/tr>' ;
//====Add by BaoSight kwan==2011-03-18==start====
//此function將在頁面展示一級文件夾,這里添加執(zhí)行刪除文件夾的鏈接,就是添加一列<TD>
//【】標記當中為添加內容(使用時將標記去掉即可)
//====Add by BaoSight kwan==2011-03-18== end ====
}
oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize )
{
// Build the link to view the folder.
//var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ;
var sLink = '<a href="#" onmouseover="showDiv(\''+ProtectPath(fileUrl)+'\');" onclick="OpenFile(\''+ProtectPath( fileUrl )+'\'); return false;">';//修改后
// Get the file icon.
var sIcon = oIcons.GetIcon( fileName ) ;
return '<tr>' +
'<td width="16">' +
sLink +
'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' +
'<\/td><td> ' +
sLink +
fileName +
'<\/a>' +
'<\/td><td align="right" nowrap> ' +
fileSize +
' KB' +'<\/td><td align="center" width="10%"><a href="#" onclick="if (!confirm(\'確定要刪除此文件嗎?\')){return false;}else{DelFile(\''+ProtectPath( fileUrl )+ '\');}">delete</a><\/td><\/tr>' ;
//====Add by BaoSight kwan==2011-03-18==start====
//此function將在頁面展示與一級文件夾同級的文件,這里添加執(zhí)行刪除文件的鏈接,同樣是添加一列<TD>
//【】標記當中為添加內容(使用時將標記去掉即可)
//====Add by BaoSight kwan==2011-03-18== end ====
}
function Refresh()
{
//LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ;//原有
hiddenDiv();//所作修改,為了刷新列表時默認隱藏文件顯示層
LoadResources( oConnector.ResourceType, oConnector.CurrentFolder );
}
修改函數(shù):GetFoldersAndFilesCallBack 找到:
//document.body.innerHTML = oHtml.ToString() ;//原有
document.getElementById("body_content").innerHTML = oHtml.ToString() ;//修改后
FCKeditor添加刪除功能.rar
另類技巧
修改Fckeditor圖片上傳功能:http://itxiaoqiang.iteye.com/blog/644756
導入word到Fckeditor:http://itxiaoqiang.iteye.com/blog/643684
支持中文圖片名稱方案:http://windywindy.iteye.com/blog/551458
posted on 2011-10-18 16:01
飛翔天使 閱讀(1644)
評論(0) 編輯 收藏 所屬分類:
ajax