今天要用到編輯器,看到網上好多人都說CKEDITOR好用,所以在網上下了最新的版本 Ckeditor 3.6.2。怎麼配置它我的部落格裡面有,這裡給一個連結好了,不詳述了
http://blog.csdn.net/gzas1989/article/details/6845785
然後我有需要用到圖片上傳功能,晚上說要Ckfinder的配合,所以果斷插入~我下的版本是Ckfinder 2.1。問題就來了~怎麼配置呢~預設是沒有上傳按鈕的啊~朋友有建議自己做上傳功能繞過Ckfinder 的~自己還是想研究一下~
方法如下,請需要的朋友跟上~(部分內容轉載):
首先把Ckfinder 和Ckeditor都解壓到同一個檔案夾,然後神馬引用到Bin檔案夾之類的我就不說了,網上有,和Ckeditor的一樣
ckeditor裡面的config.js 配置
CKEDITOR.editorConfig = function( config ){ config.language = 'zh-cn';//設定中文語言 config.uiColor = '#AADC6E';//編輯器顏色 config.font_names = '宋體;楷體_GB2312;新宋體;黑體;隸書;幼圓;微軟雅黑;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana'; config.toolbar_Full = [ ['Source','-','Preview','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], '/', ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor'], ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'], '/', ['Styles','Format','Font','FontSize'], ['TextColor','BGColor'], ['Maximize', 'ShowBlocks','-','About'] ]; config.toolbar_Basic = [ ['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','About'] ]; config.width =700; config.height = 300; };
ckfinder 裡面的config.ascx的配置:
public override bool CheckAuthentication(){ // 表單驗證時用 return Request.IsAuthenticated; //reture true; 不推薦使用}
使用的時候直接拖放一個CKEditorControl,同時引用<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>//視個人修改啊!因為我是直接放CKEditorControl,沒有用替換的方法,所以沒有引用ckfinder.js。最後還有一個問題,就是點瀏覽或者上傳功能的時候路徑出錯
比如我的根目錄是http://localhost:1234/root/index.aspx
則應該開啟的是http://localhost:1234/root/ckfinder/ckfinder.html
但是每次開啟的都是http://localhost:1234/ckfinder/ckfinder.html
晚上辦法五花八門,而且複雜
其實很簡單,開啟ckeditor下的config.js
config.filebrowserBrowseUrl = './ckfinder/ckfinder.html'; //上傳檔案時瀏覽服務檔案夾 config.filebrowserImageBrowseUrl = './ckfinder/ckfinder.html?Type=Images'; //上傳圖片時瀏覽服務檔案夾 config.filebrowserFlashBrowseUrl = './ckfinder/ckfinder.html?Type=Flash'; //上傳Flash時瀏覽服務檔案夾 config.filebrowserUploadUrl = './ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files'; //上傳檔案按鈕(標籤) config.filebrowserImageUploadUrl = './ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images'; //上傳圖片按鈕(標籤) config.filebrowserFlashUploadUrl = './ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash'; //上傳Flash按鈕(標籤)
和原來的不同在於我在目錄最前面加了一個.
問題解決~
最後還有一個DOME浮水印問題,這個好像不影響使用,而且是八進位和十六進位的代碼~網上說全部改成\x20,沒有嘗試,事兒還多得很~有時間再說吧,祝大家用的愉快!