新版 FCKEditor for wordpress

之前曾經介紹一篇如何修改 FCKEditor 搭配 WP-Codebox 

https://www.pigo.idv.tw/archives/161

現在 Dean’s FCKEditor for WordPress plugin 已經不是使用 FCKEditor , 而是用新名稱的 CKEditor 下去改的 ' "

這一版的變動很大 , 因此之前所介紹的如何修改 Style 的方式也不同 , 不過仍是很簡單 , 花了我一些時間而已

首先先安裝好新版的 plugin 之後 , 去這個 plugin 下找 ckeditor/plugins/stylescombo/styles/default.js

不難發現原本使用 XML 結構已經改成以 javascript 資料型態來取代

所以並不難改 , 像我是改成這樣

/*
Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

// == defualt style ==
// CKEDITOR.addStylesSet('default',[{name:'Blue Title',element:'h3',styles:{color:'Blue'}},{name:'Red Title',element:'h3',styles:{color:'Red'}},{name:'Marker: Yellow',element:'span',styles:{'background-color':'Yellow'}},{name:'Marker: Green',element:'span',styles:{'background-color':'Lime'}},{name:'Big',element:'big'},{name:'Small',element:'small'},{name:'Typewriter',element:'tt'},{name:'Computer Code',element:'code'},{name:'Keyboard Phrase',element:'kbd'},{name:'Sample Text',element:'samp'},{name:'Variable',element:'var'},{name:'Deleted Text',element:'del'},{name:'Inserted Text',element:'ins'},{name:'Cited Work',element:'cite'},{name:'Inline Quotation',element:'q'},{name:'Language: RTL',element:'span',attributes:{dir:'rtl'}},{name:'Language: LTR',element:'span',attributes:{dir:'ltr'}},{name:'Image on Left',element:'img',attributes:{style:'padding: 5px; margin-right: 5px',border:'2',align:'left'}},{name:'Image on Right',element:'img',attributes:{style:'padding: 5px; margin-left: 5px',border:'2',align:'right'}}]);
// ===================
CKEDITOR.addStylesSet('default',[
    {name:'Blue Title',element:'h3',styles:{color:'Blue'}},{name:'Red Title',element:'h3',styles:{color:'Red'}},{name:'Marker: Yellow',element:'span',styles:{'background-color':'Yellow'}},{name:'Marker: Green',element:'span',styles:{'background-color':'Lime'}},{name:'Big',element:'big'},{name:'Small',element:'small'},{name:'Typewriter',element:'tt'},{name:'Computer Code',element:'code'},{name:'Keyboard Phrase',element:'kbd'},{name:'Sample Text',element:'samp'},{name:'Variable',element:'var'},{name:'Deleted Text',element:'del'},{name:'Inserted Text',element:'ins'},{name:'Cited Work',element:'cite'},{name:'Inline Quotation',element:'q'},{name:'Language: RTL',element:'span',attributes:{dir:'rtl'}},{name:'Language: LTR',element:'span',attributes:{dir:'ltr'}},{name:'Image on Left',element:'img',attributes:{style:'padding: 5px; margin-right: 5px',border:'2',align:'left'}},{name:'Image on Right',element:'img',attributes:{style:'padding: 5px; margin-left: 5px',border:'2',align:'right'}},
    {
        name: 'Code HTML',
        element: 'pre',
        attributes:{lang:'html4strict' , colla:'+',line:'1' }
    },
    {
        name: 'Code HTML(no line)',
        element: 'pre',
        attributes:{lang:'html4strict' , colla:'+',line:'' }
    },
    {
        name: 'Code JavaScript',
        element: 'pre',
        attributes:{lang:'javascript' , colla:'+',line:'1' }
    },
    {
        name: 'Code JavaScript(no line)',
        element: 'pre',
        attributes:{lang:'javascript' , colla:'+',line:'' }
    },
    {
        name: 'Code XML',
        element: 'pre',
        attributes:{lang:'xml' , colla:'+',line:'1' }
    },
    {
        name: 'Code XML(no line)',
        element: 'pre',
        attributes:{lang:'xml' , colla:'+',line:'' }
    },
    {
        name: 'Code SQL(no line)',
        element: 'pre',
        attributes:{lang:'sql' , colla:'+',line:'' }
    },
    {
        name: 'Code PHP',
        element: 'pre',
        attributes:{lang:'php' , colla:'+',line:'1' }
    },
    {
        name: 'Code PHP(no line)',
        element: 'pre',
        attributes:{lang:'php' , colla:'+',line:'' }
    },
    {
        name: 'Code C#',
        element: 'pre',
        attributes:{lang:'csharp' , colla:'+',line:'1' }
    },
    {
        name: 'Code C#(no line)',
        element: 'pre',
        attributes:{lang:'csharp' , colla:'+',line:'' }
    },
    {
        name: 'Code VB',
        element: 'pre',
        attributes:{lang:'vb' , colla:'+',line:'1' }
    },
    {
        name: 'Code VB(no line)',
        element: 'pre',
        attributes:{lang:'vb' , colla:'+',line:'' }
    },
    {
        name: 'Code Java',
        element: 'pre',
        attributes:{lang:'java' , colla:'+',line:'1' }
    },
    {
        name: 'Code Java(no line)',
        element: 'pre',
        attributes:{lang:'java' , colla:'+',line:'' }
    },
    {
        name: 'Code C',
        element: 'pre',
        attributes:{lang:'c' , colla:'+',line:'1' }
    },
    {
        name: 'Code C(no line)',
        element: 'pre',
        attributes:{lang:'c' , colla:'+',line:'' }
    },
    {
        name: 'Code C++',
        element: 'pre',
        attributes:{lang:'cpp' , colla:'+',line:'1' }
    },
    {
        name: 'Code C++(no line)',
        element: 'pre',
        attributes:{lang:'cpp' , colla:'+',line:'' }
    },
    {
        name: 'Code Apache',
        element: 'pre',
        attributes:{lang:'apache' , colla:'+',line:'1' }
    },
    {
        name: 'Code Apache(no line)',
        element: 'pre',
        attributes:{lang:'apache' , colla:'+',line:'' }
    },

    {
        name: 'Text(no line)',
        element: 'pre',
        attributes:{lang:'text' , colla:'+',line:'' }
    }
    
    
]);

3 則評論在 新版 FCKEditor for wordpress.

  1. 請問大大是修改
    C:\AppServ\www\wordpress\wp-content\plugins\fckeditor-for-wordpress-plugin\ckeditor\plugins\stylescombo\styles\default.js
    我照著大大給的全部貼上,並將元件重新啟用過還是沒有改變
    是不是我有什麼步驟少掉了??

發佈留言