在CKEditor中的不同语言环境中添加特殊符号

时间:2012-04-20 05:34:22

标签: ckeditor

我想使用CKEditor中的下拉菜单列表添加更多不同语言环境的符号选择特殊字符颜色框。但是,我无法找到可以添加下拉菜单的相应HTML代码。 请指导我......

1 个答案:

答案 0 :(得分:1)

修改specialchar插件的js

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

/**
 * @file Special Character plugin
 */



CKEDITOR.plugins.add( 'specialchar',
{
    // List of available localizations.
    availableLangs : { en:1 , lat:2 , math:3},

    init : function( editor )
    {
        var pluginName = 'specialchar',
            plugin = this;
        // Register the dialog.
        CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/specialchar.js' );
        editor.addCommand( pluginName,
            {
                exec : function()
                {   
                    if(CKEDITOR.dialog.getCurrent())
                    {
                        CKEDITOR.dialog.getCurrent().hide();
                    }    

                    var langCode = editor.langCode;     
                    langCode = plugin.availableLangs[ langCode ] ? langCode : 'en';

                    CKEDITOR.scriptLoader.load(
                            CKEDITOR.getUrl( plugin.path + 'lang/' + langCode + '.js' ),
                            function()
                            {
                                CKEDITOR.tools.extend( editor.lang.specialChar, plugin.langEntries[ langCode ] );                                   
                                editor.openDialog( pluginName );                                                    
                            });
                },
                modes : { wysiwyg:1 },
                canUndo : false             
            });

        // Register the toolbar button.
        editor.ui.addButton( 'SpecialChar',
            {
                label : editor.lang.specialChar.toolbar,
                command : pluginName
            });
    }
} );

/**
  * The list of special characters visible in the Special Character dialog window.
  * @type Array
  * @example
  * config.specialChars = [ '"', '’', [ '&custom;', 'Custom label' ] ];
  * config.specialChars = config.specialChars.concat( [ '"', [ '’', 'Custom label' ] ] );
  */

    CKEDITOR.config.specialChars =
        [
            '!','"','#','$','%','&',"'",'(',')','*','+','-','.','/',
            '0','1','2','3','4','5','6','7','8','9',':',';',
            '<','=','>','?','@',
            'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
            'P','Q','R','S','T','U','V','W','X','Y','Z',
            '[',']','^','_','`',
            'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',
            'q','r','s','t','u','v','w','x','y','z',
            '{','|','}','~',
            "€", "‘", "’", "“", "”", "–", "—", "¡", "¢", "£", "¤", "¥", "¦", "§", "¨", "©", "ª", "«", "¬", "®", "¯", "°", "²", "³", "´", "µ", "¶", "·", "¸", "¹", "º", "»", "¼", "½", "¾", "¿", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï", "Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "×", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "Þ", "ß", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô", "õ", "ö", "÷", "ø", "ù", "ú", "û", "ü", "ý", "þ", "ÿ", "Œ", "œ", "Ŵ", "&#374", "&#373", "ŷ", "‚", "‛", "„", "…", "™", "►", "•", "→", "⇒", "⇔", "♦", "≈"
        ];


    var latin = ['ƀ','Ɓ','Ƃ','ƃ','Ƅ','ƅ','Ɔ','Ƈ','ƈ','Ɖ','Ɗ','Ƌ','ƌ','ƍ','Ǝ','Ə','Ɛ','Ƒ','ƒ','Ɠ','Ɣ','ƕ','Ɩ','Ɨ','Ƙ','ƙ','ƚ','ƛ','Ɯ','Ɲ','ƞ','Ɵ','Ơ','ơ','Ƣ','ƣ','Ƥ','ƥ','Ʀ','Ƨ','ƨ','Ʃ','ƪ','ƫ','Ƭ','ƭ','Ʈ','Ư','ư','Ʊ','Ʋ','Ƴ','ƴ','Ƶ','ƶ','Ʒ','Ƹ','ƹ','ƺ','ƻ','Ƽ','ƽ','ƾ','ƿ','ǀ','ǁ','ǂ','ǃ','DŽ','Dž','dž','LJ','Lj','lj','NJ','Nj','nj','Ǎ','ǎ','Ǐ','ǐ','Ǒ','ǒ','Ǔ','ǔ','Ǖ','ǖ','Ǘ','ǘ','Ǚ','ǚ','Ǜ','ǜ','ǝ','Ǟ','ǟ','Ǡ','ǡ','Ǣ','ǣ','Ǥ','ǥ','Ǧ','ǧ','Ǩ','ǩ','Ǫ','ǫ','Ǭ','ǭ','Ǯ','ǯ','ǰ','DZ','Dz','dz','Ǵ','ǵ','Ƕ','Ƿ','Ǹ','ǹ','Ǻ','ǻ','Ǽ','ǽ','Ǿ','ǿ','Ȁ','ȁ','Ȃ','ȃ','Ȅ','ȅ','Ȇ','ȇ','Ȉ','ȉ','Ȋ','ȋ','Ȍ','ȍ','Ȏ','ȏ','Ȑ','ȑ','Ȓ','ȓ','Ȕ','ȕ','Ȗ','ȗ','Ș','ș','Ț','ț','Ȝ','ȝ','Ȟ','ȟ','Ƞ','','Ȣ','ȣ','Ȥ','ȥ','Ȧ','ȧ','Ȩ','ȩ','Ȫ','ȫ','Ȭ','ȭ','Ȯ','ȯ','Ȱ','ȱ','Ȳ','ȳ','ȷ','ȸ','ȹ','Ⱥ','Ȼ','ȼ','Ƚ','Ⱦ','ȿ','ɀ','Ɂ','ɂ','Ƀ','Ʉ','Ʌ','Ɇ','ɇ','Ɉ','ɉ','Ɋ','ɋ','Ɍ','ɍ','Ɏ','ɏ'];

    var math_operator = ['∀','∁','∂','∃','∄','∅','Δ','∇','∈','∉','ε','∋','∌','∍','∎','Π','∐','Σ','−','∓','∔','∕','','∗','∘','∙','√','∛','∜','∝','∞','∟','∠','∡','∢','∣','∤','∥','∦','∧','∨','∩','∪','∫','∬','∭','∮','∯','∰','∱','∲','∳','∴','∵','∶','∷','∸','∹','∺','∻','∼','∽','∾','∿','≀','≁','≂','≃','≄','≅','≆','≇','≈','≉','≊','≋','≌','≍','≎','≏','≐','≑','≒','≓','≔','≕','≖','≗','≘','≙','≚','≛','≜','≝','≞','≟','≠','≡','≢','≣','≤','≥','≦','≧','≨','≩','≪','≫','≬','≭','≮','≯','≰','≱','≲','≳','≴','≵','≶','≷','','','≺','≻','≼','≽','≾','≿','⊀','⊁','⊂','⊃','⊄','⊅','⊆','⊇','⊈','⊉','⊊','⊋','⊌','⊍','⊎','⊏','⊐','⊑','⊓','⊔','⊕','⊖','⊗','⊘','⊙','⊚','⊛','⊜','⊝','⊞','⊟','⊠','⊡','⊢','⊣','⊤','⊥','⊦','⊧','⊨','⊩','⊪','⊫','⊬','⊭','⊮','⊯','⊰','⊱','⊲','⊳','⊴','⊵','','','','⊹','⊺','⊻','⊼','⊽','⊿','⋀','⋁','⋂','⋃','⋄','⋅','⋆','⋇','','','⋍','⋎','⋏','⋐','⋑','⋒','⋓','⋔','⋕','⋖','⋗','⋘','⋙','⋚','⋛','⋜','⋝','⋞','⋟','⋠','⋡','⋢','⋣','⋤','⋥','⋦','⋧','⋨','⋩','⋪','⋫','⋬','⋭','⋮','⋯','⋰','⋱',];