CKEditor 3.0 配置

來源:互聯網
上載者:User

CKEditor 3.0安裝配置,感覺比較簡單,但本次沒有涉及上傳檔案的配置,下篇文章將寫一下如何將CKEditor的兄弟產品:ckfinder 功能強大的上傳檔案管理工具整合進 CKEditor3.0

下載CKEditor 3.0,地址:http://ckeditor.com/

首先,下載下來解壓後,把檔案夾ckeditor放到你的網站。

其次,在你的網頁裡面加入下面指令碼:

<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>

注意紅色部分,這雷根據你自己的編輯器路徑修改,請務必配置正確。

再次,在需要引用CKEditor編輯器的地方加入下面代碼:

            <textarea class="ckeditor" cols="80" id="editor1" name="editor1" rows="10">
                這裡是內容
            </textarea>
            如果你是ASP.NET開發人員 可以寫成:
            <textarea class="ckeditor" id="txtContent" runat="server" name="txtContent"></textarea>

或者:

      <textarea cols="80" id="editor1" name="editor1" rows="10">
                這裡是內容
      </textarea>
     <script type="text/javascript">
      CKEDITOR.replace( 'editor1' );
     </script>

 

這樣,一個編輯器就基本可以使用了。

--------------------------------------------------

配置屬於自己的編輯器,配置Config.js檔案(官方給出配置的幾種方法,詳見參考官方文檔)如下:

http://docs.fckeditor.net/ckeditor_api/symbols/CKEDITOR.config.html#.autoUpdateElement
用記事本開啟config.js檔案,可看到下面代碼:

CKEDITOR.editorConfig = function( config )
{
// Define changes to default configuration here. For example:
 config.language = 'zh-cn'; //配置語言
//config.uiColor = '#FFF'; //背景顏色
//config.width = 500; //寬度
config.height = 400; //高度
config.skin='v2';
//工具列
config.toolbar =
[
    ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
    ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    ['Link','Unlink','Anchor'],
    ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
    '/',
    ['Styles','Format','Font','FontSize'],
    ['TextColor','BGColor'],
    ['Maximize', 'ShowBlocks','-','Source','-','Undo','Redo']

];
};

為了減少編輯器的大小,可以刪除一些不必要的檔案,如把_samples、_source、_tests三個檔案夾刪除,進入lang檔案目錄,保留en.js、zh.js、zh-cn.js三個檔案,其餘的語言檔案如果你用不到,可以刪除。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.