]>
git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blob - sources/plugins/wsc/plugin.js
1 // Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
2 // For licensing, see LICENSE.md or http://ckeditor.com/license
4 CKEDITOR
. plugins
. add ( 'wsc' , {
6 lang : 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en-au,en-ca,en-gb,en,eo,es,et,eu,fa,fi,fo,fr-ca,fr,gl,gu,he,hi,hr,hu,is,it,ja,ka,km,ko,lt,lv,mk,mn,ms,nb,nl,no,pl,pt-br,pt,ro,ru,sk,sl,sr-latn,sr,sv,th,tr,ug,uk,vi,zh-cn,zh' , // %REMOVE_LINE_CORE%
7 icons : 'spellchecker' , // %REMOVE_LINE_CORE%
8 hidpi : true , // %REMOVE_LINE_CORE%
9 parseApi : function ( editor
) {
10 editor
. config
. wsc_onFinish
= ( typeof editor
. config
. wsc_onFinish
=== 'function' ) ? editor
. config
. wsc_onFinish : function () {};
11 editor
. config
. wsc_onClose
= ( typeof editor
. config
. wsc_onClose
=== 'function' ) ? editor
. config
. wsc_onClose : function () {};
13 parseConfig : function ( editor
) {
14 editor
. config
. wsc_customerId
= editor
. config
. wsc_customerId
|| CKEDITOR
. config
. wsc_customerId
|| '1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk' ;
15 editor
. config
. wsc_customDictionaryIds
= editor
. config
. wsc_customDictionaryIds
|| CKEDITOR
. config
. wsc_customDictionaryIds
|| '' ;
16 editor
. config
. wsc_userDictionaryName
= editor
. config
. wsc_userDictionaryName
|| CKEDITOR
. config
. wsc_userDictionaryName
|| '' ;
17 editor
. config
. wsc_customLoaderScript
= editor
. config
. wsc_customLoaderScript
|| CKEDITOR
. config
. wsc_customLoaderScript
;
19 CKEDITOR
. config
. wsc_cmd
= editor
. config
. wsc_cmd
|| CKEDITOR
. config
. wsc_cmd
|| 'spell' ; // spell, thes or grammar. default tab
20 CKEDITOR
. config
. wsc_version
= "v4.3.0-master-d769233" ;
21 CKEDITOR
. config
. wsc_removeGlobalVariable
= true ;
23 init : function ( editor
) {
24 var commandName
= 'checkspell' ;
26 var strNormalDialog
= 'dialogs/wsc.js' ,
27 strIeDialog
= 'dialogs/wsc_ie.js' ,
32 self
. parseConfig ( editor
);
33 self
. parseApi ( editor
);
34 var command
= editor
. addCommand ( commandName
, new CKEDITOR
. dialogCommand ( commandName
) );
36 // SpellChecker doesn't work in Opera, with custom domain, IE Compatibility Mode and IE (8 & 9) Quirks Mode
37 command
. modes
= { wysiwyg : ( ! CKEDITOR
. env
. opera
&& ! CKEDITOR
. env
. air
&& document
. domain
== window
. location
. hostname
&&
38 !( env
. ie
&& ( env
. version
< 8 || env
. quirks
) ) ) };
40 if ( typeof editor
. plugins
. scayt
== 'undefined' ){
41 editor
. ui
. addButton
&& editor
. ui
. addButton ( 'SpellChecker' , {
42 label : editor
. lang
. wsc
. toolbar
,
43 click : function ( editor
) {
44 var inlineMode
= ( editor
. elementMode
== CKEDITOR
. ELEMENT_MODE_INLINE
),
45 text
= inlineMode
? editor
. container
. getText () : editor
. document
. getBody (). getText ();
47 text
= text
. replace ( /\s/g , '' );
50 editor
. execCommand ( 'checkspell' );
52 alert ( 'Nothing to check!' );
55 toolbar : 'spellchecker,10'
60 if ( CKEDITOR
. env
. ie
&& CKEDITOR
. env
. version
<= 7 ){
61 strDialog
= strIeDialog
;
63 if (! window
. postMessage
) {
64 strDialog
= strIeDialog
;
66 strDialog
= strNormalDialog
;
69 CKEDITOR
. dialog
. add ( commandName
, this . path
+ strDialog
);
75 * The parameter sets the customer ID for WSC. It is used for hosted users only. It is required for migration from free
76 * to trial or paid versions.
78 * config.wsc_customerId = 'encrypted-customer-id';
80 * @cfg {String} [wsc_customerId='1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk']
81 * @member CKEDITOR.config
85 * It links WSC to custom dictionaries. It should be a string with dictionary IDs
86 * separated by commas (`','`). Available only for the licensed version.
88 * Further details at [http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:customdictionaries:licensed](http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:customdictionaries:licensed)
90 * config.wsc_customDictionaryIds = '1,3001';
92 * @cfg {String} [wsc_customDictionaryIds='']
93 * @member CKEDITOR.config
97 * It activates a user dictionary for WSC. The user dictionary name should be used. Available only for the licensed version.
99 * config.wsc_userDictionaryName = 'MyUserDictionaryName';
101 * @cfg {String} [wsc_userDictionaryName='']
102 * @member CKEDITOR.config
106 * The parameter sets the URL to WSC file. It is required to the licensed version of WSC application.
108 * Further details available at [http://wiki.webspellchecker.net/doku.php?id=migration:hosredfreetolicensedck](http://wiki.webspellchecker.net/doku.php?id=migration:hosredfreetolicensedck)
110 * config.wsc_customLoaderScript = "http://my-host/spellcheck/lf/22/js/wsc_fck2plugin.js";
112 * @cfg {String} [wsc_customLoaderScript='']
113 * @member CKEDITOR.config
117 * The parameter sets the default spellchecking language for WSC.
118 * Possible values are:
119 * `'en_US'`, `'en_GB'`, `'pt_BR'`, `'da_DK'`,
120 * `'nl_NL'`, `'en_CA'`, `'fi_FI'`, `'fr_FR'`,
121 * `'fr_CA'`, `'de_DE'`, `'el_GR'`, `'it_IT'`,
122 * `'nb_NO'`, `'pt_PT'`, `'es_ES'`, `'sv_SE'`.
124 * Further details available at [http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:supportedlanguages](http://wiki.webspellchecker.net/doku.php?id=installationandconfiguration:supportedlanguages)
126 * config.wsc_lang = 'de_DE';
128 * @cfg {String} [wsc_lang='en_US']
129 * @member CKEDITOR.config
133 * The parameter sets the active tab, when the WSC dialog is opened.
134 * Possible values are:
135 * `'spell'`, `'thes'`, `'grammar'`.
137 * // Sets active tab thesaurus.
138 * config.wsc_cmd = 'thes';
140 * @cfg {String} [wsc_cmd='spell']
141 * @member CKEDITOR.config