84 lines
4.2 KiB
JavaScript
84 lines
4.2 KiB
JavaScript
/**
|
|
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
|
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
*/
|
|
|
|
/**
|
|
* @fileOverview Special Character plugin
|
|
*/
|
|
|
|
CKEDITOR.plugins.add( 'specialchar', {
|
|
// List of available localizations.
|
|
// jscs:disable
|
|
availableLangs: { af:1,ar:1,az:1,bg:1,ca:1,cs:1,cy:1,da:1,de:1,'de-ch':1,el:1,en:1,'en-au':1,'en-ca':1,'en-gb':1,eo:1,es:1,'es-mx':1,et:1,eu:1,fa:1,fi:1,fr:1,'fr-ca':1,gl:1,he:1,hr:1,hu:1,id:1,it:1,ja:1,km:1,ko:1,ku:1,lt:1,lv:1,nb:1,nl:1,no:1,oc:1,pl:1,pt:1,'pt-br':1,ro:1,ru:1,si:1,sk:1,sl:1,sq:1,sv:1,th:1,tr:1,tt:1,ug:1,uk:1,vi:1,zh:1,'zh-cn':1 },
|
|
lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
|
|
// jscs:enable
|
|
requires: 'dialog',
|
|
icons: 'specialchar', // %REMOVE_LINE_CORE%
|
|
hidpi: true, // %REMOVE_LINE_CORE%
|
|
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() {
|
|
var langCode = editor.langCode;
|
|
langCode =
|
|
plugin.availableLangs[ langCode ] ? langCode :
|
|
plugin.availableLangs[ langCode.replace( /-.*/, '' ) ] ? langCode.replace( /-.*/, '' ) :
|
|
'en';
|
|
|
|
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( plugin.path + 'dialogs/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 && editor.ui.addButton( 'SpecialChar', {
|
|
label: editor.lang.specialchar.toolbar,
|
|
command: pluginName,
|
|
toolbar: 'insert,50'
|
|
} );
|
|
}
|
|
} );
|
|
|
|
/**
|
|
* The list of special characters visible in the "Special Character" dialog window.
|
|
*
|
|
* config.specialChars = [ '"', '’', [ '&custom;', 'Custom label' ] ];
|
|
* config.specialChars = config.specialChars.concat( [ '"', [ '’', 'Custom label' ] ] );
|
|
*
|
|
* @cfg
|
|
* @member CKEDITOR.config
|
|
*/
|
|
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',
|
|
'{', '|', '}', '~',
|
|
'€', '‘', '’', '“', '”', '–', '—', '¡', '¢', '£',
|
|
'¤', '¥', '¦', '§', '¨', '©', 'ª', '«', '¬', '®', '¯',
|
|
'°', '²', '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»',
|
|
'¼', '½', '¾', '¿', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å',
|
|
'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï',
|
|
'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '×', 'Ø', 'Ù',
|
|
'Ú', 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã',
|
|
'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í',
|
|
'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', '÷',
|
|
'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 'ÿ', 'Œ', 'œ',
|
|
'Ŵ', 'Ŷ', 'ŵ', 'ŷ', '‚', '‛', '„', '…', '™', '►', '•',
|
|
'→', '⇒', '⇔', '♦', '≈'
|
|
];
|