2 Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
7 * @fileOverview Spell Check As You Type (SCAYT).
\r
8 * Button name : Scayt.
\r
13 var commandName = 'scaytcheck',
\r
16 // Checks if a value exists in an array
\r
17 function in_array( needle, haystack )
\r
21 for ( key in haystack )
\r
23 if ( haystack[ key ] == needle )
\r
32 var onEngineLoad = function()
\r
36 var createInstance = function() // Create new instance every time Document is created.
\r
38 var config = editor.config;
\r
39 // Initialise Scayt instance.
\r
42 oParams.srcNodeRef = editor.document.getWindow().$.frameElement;
\r
43 // syntax : AppName.AppVersion@AppRevision
\r
44 oParams.assocApp = 'CKEDITOR.' + CKEDITOR.version + '@' + CKEDITOR.revision;
\r
45 oParams.customerid = config.scayt_customerid || '1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';
\r
46 oParams.customDictionaryIds = config.scayt_customDictionaryIds || '';
\r
47 oParams.userDictionaryName = config.scayt_userDictionaryName || '';
\r
48 oParams.sLang = config.scayt_sLang || 'en_US';
\r
50 // Introduce SCAYT onLoad callback. (#5632)
\r
51 oParams.onLoad = function()
\r
53 // Draw down word marker to avoid being covered by background-color style.(#5466)
\r
54 if ( !( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) )
\r
55 this.addStyle( this.selectorCss(), 'padding-bottom: 2px !important;' );
\r
57 // Call scayt_control.focus when SCAYT loaded
\r
58 // and only if editor has focus and scayt control creates at first time (#5720)
\r
59 if ( editor.focusManager.hasFocus && !plugin.isControlRestored( editor ) )
\r
64 oParams.onBeforeChange = function()
\r
66 if ( plugin.getScayt( editor ) && !editor.checkDirty() )
\r
67 setTimeout( function(){ editor.resetDirty(); }, 0 );
\r
70 var scayt_custom_params = window.scayt_custom_params;
\r
71 if ( typeof scayt_custom_params == 'object' )
\r
73 for ( var k in scayt_custom_params )
\r
74 oParams[ k ] = scayt_custom_params[ k ];
\r
76 // needs for restoring a specific scayt control settings
\r
77 if ( plugin.getControlId( editor ) )
\r
78 oParams.id = plugin.getControlId( editor );
\r
80 var scayt_control = new window.scayt( oParams );
\r
82 scayt_control.afterMarkupRemove.push( function( node )
\r
84 ( new CKEDITOR.dom.element( node, scayt_control.document ) ).mergeSiblings();
\r
88 var lastInstance = plugin.instances[ editor.name ];
\r
91 scayt_control.sLang = lastInstance.sLang;
\r
92 scayt_control.option( lastInstance.option() );
\r
93 scayt_control.paused = lastInstance.paused;
\r
96 plugin.instances[ editor.name ] = scayt_control;
\r
98 //window.scayt.uiTags
\r
99 var menuGroup = 'scaytButton';
\r
100 var uiTabs = window.scayt.uiTags;
\r
103 for ( var i = 0, l=4; i < l; i++ )
\r
104 fTabs.push( uiTabs[i] && plugin.uiTabs[i] );
\r
106 plugin.uiTabs = fTabs;
\r
108 scayt_control.setDisabled( plugin.isPaused( editor ) === false );
\r
111 editor.fire( 'showScaytState' );
\r
114 editor.on( 'contentDom', createInstance );
\r
115 editor.on( 'contentDomUnload', function()
\r
118 var scripts = CKEDITOR.document.getElementsByTag( 'script' ),
\r
119 scaytIdRegex = /^dojoIoScript(\d+)$/i,
\r
120 scaytSrcRegex = /^https?:\/\/svc\.spellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;
\r
122 for ( var i=0; i < scripts.count(); i++ )
\r
124 var script = scripts.getItem( i ),
\r
125 id = script.getId(),
\r
126 src = script.getAttribute( 'src' );
\r
128 if ( id && src && id.match( scaytIdRegex ) && src.match( scaytSrcRegex ))
\r
133 editor.on( 'beforeCommandExec', function( ev ) // Disable SCAYT before Source command execution.
\r
135 if ( ( ev.data.name == 'source' || ev.data.name == 'newpage' ) && editor.mode == 'wysiwyg' )
\r
137 var scayt_instance = plugin.getScayt( editor );
\r
138 if ( scayt_instance )
\r
140 plugin.setPaused( editor, !scayt_instance.disabled );
\r
141 // store a control id for restore a specific scayt control settings
\r
142 plugin.setControlId( editor, scayt_instance.id );
\r
143 scayt_instance.destroy( true );
\r
144 delete plugin.instances[ editor.name ];
\r
147 // Catch on source mode switch off (#5720)
\r
148 else if ( ev.data.name == 'source' && editor.mode == 'source' )
\r
149 plugin.markControlRestore( editor );
\r
152 editor.on( 'afterCommandExec', function( ev )
\r
154 if ( !plugin.isScaytEnabled( editor ) )
\r
157 if ( editor.mode == 'wysiwyg' && ( ev.data.name == 'undo' || ev.data.name == 'redo' ) )
\r
158 window.setTimeout( function() { plugin.getScayt( editor ).refresh(); }, 10 );
\r
161 editor.on( 'destroy', function( ev )
\r
163 var editor = ev.editor,
\r
164 scayt_instance = plugin.getScayt( editor );
\r
166 // SCAYT instance might already get destroyed by mode switch (#5744).
\r
167 if ( !scayt_instance )
\r
170 delete plugin.instances[ editor.name ];
\r
171 // store a control id for restore a specific scayt control settings
\r
172 plugin.setControlId( editor, scayt_instance.id );
\r
173 scayt_instance.destroy( true );
\r
176 // Listen to data manipulation to reflect scayt markup.
\r
177 editor.on( 'afterSetData', function()
\r
179 if ( plugin.isScaytEnabled( editor ) ) {
\r
180 window.setTimeout( function()
\r
182 var instance = plugin.getScayt( editor );
\r
183 instance && instance.refresh();
\r
188 // Reload spell-checking for current word after insertion completed.
\r
189 editor.on( 'insertElement', function()
\r
191 var scayt_instance = plugin.getScayt( editor );
\r
192 if ( plugin.isScaytEnabled( editor ) )
\r
194 // Unlock the selection before reload, SCAYT will take
\r
195 // care selection update.
\r
196 if ( CKEDITOR.env.ie )
\r
197 editor.getSelection().unlock( true );
\r
199 // Return focus to the editor and refresh SCAYT markup (#5573).
\r
200 window.setTimeout( function()
\r
202 scayt_instance.focus();
\r
203 scayt_instance.refresh();
\r
206 }, this, null, 50 );
\r
208 editor.on( 'insertHtml', function()
\r
210 var scayt_instance = plugin.getScayt( editor );
\r
211 if ( plugin.isScaytEnabled( editor ) )
\r
213 // Unlock the selection before reload, SCAYT will take
\r
214 // care selection update.
\r
215 if ( CKEDITOR.env.ie )
\r
216 editor.getSelection().unlock( true );
\r
218 // Return focus to the editor (#5573)
\r
219 // Refresh SCAYT markup
\r
220 window.setTimeout( function()
\r
222 scayt_instance.focus();
\r
223 scayt_instance.refresh();
\r
226 }, this, null, 50 );
\r
228 editor.on( 'scaytDialog', function( ev ) // Communication with dialog.
\r
230 ev.data.djConfig = window.djConfig;
\r
231 ev.data.scayt_control = plugin.getScayt( editor );
\r
232 ev.data.tab = openPage;
\r
233 ev.data.scayt = window.scayt;
\r
236 var dataProcessor = editor.dataProcessor,
\r
237 htmlFilter = dataProcessor && dataProcessor.htmlFilter;
\r
241 htmlFilter.addRules(
\r
245 span : function( element )
\r
247 if ( element.attributes[ 'data-scayt_word' ]
\r
248 && element.attributes[ 'data-scaytid' ] )
\r
250 delete element.name; // Write children, but don't write this node.
\r
259 // Override Image.equals method avoid CK snapshot module to add SCAYT markup to snapshots. (#5546)
\r
260 var undoImagePrototype = CKEDITOR.plugins.undo.Image.prototype;
\r
261 undoImagePrototype.equals = CKEDITOR.tools.override( undoImagePrototype.equals, function( org )
\r
263 return function( otherImage )
\r
265 var thisContents = this.contents,
\r
266 otherContents = otherImage.contents;
\r
267 var scayt_instance = plugin.getScayt( this.editor );
\r
268 // Making the comparison based on content without SCAYT word markers.
\r
269 if ( scayt_instance && plugin.isScaytReady( this.editor ) )
\r
271 // scayt::reset might return value undefined. (#5742)
\r
272 this.contents = scayt_instance.reset( thisContents ) || '';
\r
273 otherImage.contents = scayt_instance.reset( otherContents ) || '';
\r
276 var retval = org.apply( this, arguments );
\r
278 this.contents = thisContents;
\r
279 otherImage.contents = otherContents;
\r
284 if ( editor.document )
\r
288 CKEDITOR.plugins.scayt =
\r
290 engineLoaded : false,
\r
292 // Data storage for SCAYT control, based on editor instances
\r
294 setControlInfo : function( editor, o )
\r
296 if ( editor && editor.name && typeof ( this.controlInfo[ editor.name ] ) != 'object' )
\r
297 this.controlInfo[ editor.name ] = {};
\r
299 for ( var infoOpt in o )
\r
300 this.controlInfo[ editor.name ][ infoOpt ] = o[ infoOpt ];
\r
302 isControlRestored : function( editor )
\r
306 this.controlInfo[ editor.name ] )
\r
308 return this.controlInfo[ editor.name ].restored ;
\r
312 markControlRestore : function( editor )
\r
314 this.setControlInfo( editor, { restored:true } );
\r
316 setControlId: function( editor, id )
\r
318 this.setControlInfo( editor, { id:id } );
\r
320 getControlId: function( editor )
\r
324 this.controlInfo[ editor.name ] &&
\r
325 this.controlInfo[ editor.name ].id )
\r
327 return this.controlInfo[ editor.name ].id;
\r
331 setPaused: function( editor , bool )
\r
333 this.setControlInfo( editor, { paused:bool } );
\r
335 isPaused: function( editor )
\r
339 this.controlInfo[editor.name] )
\r
341 return this.controlInfo[editor.name].paused;
\r
345 getScayt : function( editor )
\r
347 return this.instances[ editor.name ];
\r
349 isScaytReady : function( editor )
\r
351 return this.engineLoaded === true &&
\r
352 'undefined' !== typeof window.scayt && this.getScayt( editor );
\r
354 isScaytEnabled : function( editor )
\r
356 var scayt_instance = this.getScayt( editor );
\r
357 return ( scayt_instance ) ? scayt_instance.disabled === false : false;
\r
359 loadEngine : function( editor )
\r
361 // SCAYT doesn't work with Firefox2, Opera and AIR.
\r
362 if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 || CKEDITOR.env.opera || CKEDITOR.env.air )
\r
363 return editor.fire( 'showScaytState' );
\r
365 if ( this.engineLoaded === true )
\r
366 return onEngineLoad.apply( editor ); // Add new instance.
\r
367 else if ( this.engineLoaded == -1 ) // We are waiting.
\r
368 return CKEDITOR.on( 'scaytReady', function(){ onEngineLoad.apply( editor ); } ); // Use function(){} to avoid rejection as duplicate.
\r
370 CKEDITOR.on( 'scaytReady', onEngineLoad, editor );
\r
371 CKEDITOR.on( 'scaytReady', function()
\r
373 this.engineLoaded = true;
\r
378 ); // First to run.
\r
380 this.engineLoaded = -1; // Loading in progress.
\r
382 // compose scayt url
\r
383 var protocol = document.location.protocol;
\r
384 // Default to 'http' for unknown.
\r
385 protocol = protocol.search( /https?:/) != -1? protocol : 'http:';
\r
386 var baseUrl = 'svc.spellchecker.net/scayt26/loader__base.js';
\r
388 var scaytUrl = editor.config.scayt_srcUrl || ( protocol + '//' + baseUrl );
\r
389 var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + '/';
\r
391 if( window.scayt == undefined )
\r
393 CKEDITOR._djScaytConfig =
\r
395 baseUrl: scaytConfigBaseUrl,
\r
400 CKEDITOR.fireOnce( 'scaytReady' );
\r
405 // Append javascript code.
\r
406 CKEDITOR.document.getHead().append(
\r
407 CKEDITOR.document.createElement( 'script',
\r
411 type : 'text/javascript',
\r
419 CKEDITOR.fireOnce( 'scaytReady' );
\r
423 parseUrl : function ( data )
\r
426 if ( data.match && ( match = data.match(/(.*)[\/\\](.*?\.\w+)$/) ) )
\r
427 return { path: match[1], file: match[2] };
\r
433 var plugin = CKEDITOR.plugins.scayt;
\r
435 // Context menu constructing.
\r
436 var addButtonCommand = function( editor, buttonName, buttonLabel, commandName, command, menugroup, menuOrder )
\r
438 editor.addCommand( commandName, command );
\r
440 // If the "menu" plugin is loaded, register the menu item.
\r
441 editor.addMenuItem( commandName,
\r
443 label : buttonLabel,
\r
444 command : commandName,
\r
450 var commandDefinition =
\r
452 preserveState : true,
\r
453 editorFocus : false,
\r
456 exec: function( editor )
\r
458 if ( plugin.isScaytReady( editor ) )
\r
460 var isEnabled = plugin.isScaytEnabled( editor );
\r
462 this.setState( isEnabled ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_ON );
\r
464 var scayt_control = plugin.getScayt( editor );
\r
465 // the place where the status of editor focus should be restored
\r
466 // after there will be ability to store its state before SCAYT button click
\r
467 // if (storedFocusState is focused )
\r
468 // scayt_control.focus();
\r
470 // now focus is set certainly
\r
471 scayt_control.focus();
\r
472 scayt_control.setDisabled( isEnabled );
\r
474 else if ( !editor.config.scayt_autoStartup && plugin.engineLoaded >= 0 ) // Load first time
\r
476 this.setState( CKEDITOR.TRISTATE_DISABLED );
\r
477 plugin.loadEngine( editor );
\r
482 // Add scayt plugin.
\r
483 CKEDITOR.plugins.add( 'scayt',
\r
485 requires : [ 'menubutton' ],
\r
487 beforeInit : function( editor )
\r
489 var items_order = editor.config.scayt_contextMenuItemsOrder
\r
490 || 'suggest|moresuggest|control',
\r
491 items_order_str = "";
\r
493 items_order = items_order.split( '|' );
\r
495 if ( items_order && items_order.length )
\r
497 for ( var pos = 0 ; pos < items_order.length ; pos++ )
\r
498 items_order_str += 'scayt_' + items_order[ pos ] + ( items_order.length != parseInt( pos, 10 ) + 1 ? ',' : '' );
\r
501 // Put it on top of all context menu items (#5717)
\r
502 editor.config.menu_groups = items_order_str + ',' + editor.config.menu_groups;
\r
505 init : function( editor )
\r
507 var moreSuggestions = {},
\r
508 mainSuggestions = {};
\r
511 var command = editor.addCommand( commandName, commandDefinition );
\r
513 // Add Options dialog.
\r
514 CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) );
\r
516 var confuiTabs = editor.config.scayt_uiTabs || '1,1,1';
\r
518 // string to array convert
\r
519 confuiTabs = confuiTabs.split( ',' );
\r
520 // check array length ! always must be 3 filled with 1 or 0
\r
521 for ( var i=0, l=3; i < l; i++ )
\r
523 var flag = parseInt( confuiTabs[i] || '1', 10 );
\r
524 uiTabs.push( flag );
\r
527 var menuGroup = 'scaytButton';
\r
528 editor.addMenuGroup( menuGroup );
\r
529 // combine menu items to render
\r
530 var uiMuneItems = {};
\r
532 var lang = editor.lang.scayt;
\r
535 uiMuneItems.scaytToggle =
\r
537 label : lang.enable,
\r
538 command : commandName,
\r
542 if ( uiTabs[0] == 1 )
\r
543 uiMuneItems.scaytOptions =
\r
545 label : lang.options,
\r
547 onClick : function()
\r
549 openPage = 'options';
\r
550 editor.openDialog( commandName );
\r
554 if ( uiTabs[1] == 1 )
\r
555 uiMuneItems.scaytLangs =
\r
557 label : lang.langs,
\r
559 onClick : function()
\r
561 openPage = 'langs';
\r
562 editor.openDialog( commandName );
\r
565 if ( uiTabs[2] == 1 )
\r
566 uiMuneItems.scaytDict =
\r
568 label : lang.dictionariesTab,
\r
570 onClick : function()
\r
572 openPage = 'dictionaries';
\r
573 editor.openDialog( commandName );
\r
577 uiMuneItems.scaytAbout =
\r
579 label : editor.lang.scayt.about,
\r
581 onClick : function()
\r
583 openPage = 'about';
\r
584 editor.openDialog( commandName );
\r
588 uiTabs[3] = 1; // about us tab is always on
\r
589 plugin.uiTabs = uiTabs;
\r
591 editor.addMenuItems( uiMuneItems );
\r
593 editor.ui.add( 'Scayt', CKEDITOR.UI_MENUBUTTON,
\r
595 label : lang.title,
\r
596 title : CKEDITOR.env.opera ? lang.opera_title : lang.title,
\r
597 className : 'cke_button_scayt',
\r
598 modes : { wysiwyg : 1 },
\r
599 onRender: function()
\r
601 command.on( 'state', function()
\r
603 this.setState( command.state );
\r
607 onMenu : function()
\r
609 var isEnabled = plugin.isScaytEnabled( editor );
\r
611 editor.getMenuItem( 'scaytToggle' ).label = lang[ isEnabled ? 'disable' : 'enable' ];
\r
614 scaytToggle : CKEDITOR.TRISTATE_OFF,
\r
615 scaytOptions : isEnabled && plugin.uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
616 scaytLangs : isEnabled && plugin.uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
617 scaytDict : isEnabled && plugin.uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
618 scaytAbout : isEnabled && plugin.uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
\r
623 // If the "contextmenu" plugin is loaded, register the listeners.
\r
624 if ( editor.contextMenu && editor.addMenuItems )
\r
626 editor.contextMenu.addListener( function( element, selection )
\r
628 if ( !plugin.isScaytEnabled( editor )
\r
629 || selection.getRanges()[ 0 ].checkReadOnly() )
\r
632 var scayt_control = plugin.getScayt( editor ),
\r
633 node = scayt_control.getScaytNode();
\r
638 var word = scayt_control.getWord( node );
\r
643 var sLang = scayt_control.getLang(),
\r
645 items_suggestion = window.scayt.getSuggestion( word, sLang );
\r
646 if ( !items_suggestion || !items_suggestion.length )
\r
648 // Remove unused commands and menuitems
\r
649 for ( i in moreSuggestions )
\r
651 delete editor._.menuItems[ i ];
\r
652 delete editor._.commands[ i ];
\r
654 for ( i in mainSuggestions )
\r
656 delete editor._.menuItems[ i ];
\r
657 delete editor._.commands[ i ];
\r
659 moreSuggestions = {}; // Reset items.
\r
660 mainSuggestions = {};
\r
662 var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || 'on';
\r
663 var moreSuggestionsUnableAdded = false;
\r
665 var maxSuggestions = editor.config.scayt_maxSuggestions;
\r
666 ( typeof maxSuggestions != 'number' ) && ( maxSuggestions = 5 );
\r
667 !maxSuggestions && ( maxSuggestions = items_suggestion.length );
\r
669 var contextCommands = editor.config.scayt_contextCommands || 'all';
\r
670 contextCommands = contextCommands.split( '|' );
\r
672 for ( var i = 0, l = items_suggestion.length; i < l; i += 1 )
\r
674 var commandName = 'scayt_suggestion_' + items_suggestion[i].replace( ' ', '_' );
\r
675 var exec = ( function( el, s )
\r
680 scayt_control.replace( el, s );
\r
683 })( node, items_suggestion[i] );
\r
685 if ( i < maxSuggestions )
\r
687 addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
\r
688 commandName, exec, 'scayt_suggest', i + 1 );
\r
689 _r[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
690 mainSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
692 else if ( moreSuggestionsUnable == 'on' )
\r
694 addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
\r
695 commandName, exec, 'scayt_moresuggest', i + 1 );
\r
696 moreSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
697 moreSuggestionsUnableAdded = true;
\r
701 if ( moreSuggestionsUnableAdded )
\r
703 // Register the More suggestions group;
\r
704 editor.addMenuItem( 'scayt_moresuggest',
\r
706 label : lang.moreSuggestions,
\r
707 group : 'scayt_moresuggest',
\r
709 getItems : function()
\r
711 return moreSuggestions;
\r
714 mainSuggestions[ 'scayt_moresuggest' ] = CKEDITOR.TRISTATE_OFF;
\r
717 if ( in_array( 'all', contextCommands ) || in_array( 'ignore', contextCommands) )
\r
719 var ignore_command = {
\r
721 scayt_control.ignore( node );
\r
724 addButtonCommand( editor, 'ignore', lang.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1 );
\r
725 mainSuggestions[ 'scayt_ignore' ] = CKEDITOR.TRISTATE_OFF;
\r
728 if ( in_array( 'all', contextCommands ) || in_array( 'ignoreall', contextCommands ) )
\r
730 var ignore_all_command = {
\r
732 scayt_control.ignoreAll( node );
\r
735 addButtonCommand(editor, 'ignore_all', lang.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2);
\r
736 mainSuggestions['scayt_ignore_all'] = CKEDITOR.TRISTATE_OFF;
\r
739 if ( in_array( 'all', contextCommands ) || in_array( 'add', contextCommands ) )
\r
741 var addword_command = {
\r
743 window.scayt.addWordToUserDictionary( node );
\r
746 addButtonCommand(editor, 'add_word', lang.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3);
\r
747 mainSuggestions['scayt_add_word'] = CKEDITOR.TRISTATE_OFF;
\r
750 if ( scayt_control.fireOnContextMenu )
\r
751 scayt_control.fireOnContextMenu( editor );
\r
753 return mainSuggestions;
\r
757 var showInitialState = function()
\r
759 editor.removeListener( 'showScaytState', showInitialState );
\r
761 if ( !CKEDITOR.env.opera && !CKEDITOR.env.air )
\r
762 command.setState( plugin.isScaytEnabled( editor ) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
\r
764 command.setState( CKEDITOR.TRISTATE_DISABLED );
\r
767 editor.on( 'showScaytState', showInitialState );
\r
769 if ( CKEDITOR.env.opera || CKEDITOR.env.air )
\r
771 editor.on( 'instanceReady', function()
\r
773 showInitialState();
\r
778 if ( editor.config.scayt_autoStartup )
\r
780 editor.on( 'instanceReady', function()
\r
782 plugin.loadEngine( editor );
\r
787 afterInit : function( editor )
\r
789 // Prevent word marker line from displaying in elements path and been removed when cleaning format. (#3570) (#4125)
\r
790 var elementsPathFilters,
\r
791 scaytFilter = function( element )
\r
793 if ( element.hasAttribute( 'data-scaytid' ) )
\r
797 if ( editor._.elementsPath && ( elementsPathFilters = editor._.elementsPath.filters ) )
\r
798 elementsPathFilters.push( scaytFilter );
\r
800 editor.addRemoveFormatFilter && editor.addRemoveFormatFilter( scaytFilter );
\r
807 * If enabled (true), turns on SCAYT automatically after loading the editor.
\r
808 * @name CKEDITOR.config.scayt_autoStartup
\r
812 * config.scayt_autoStartup = true;
\r
816 * Defines the number of SCAYT suggestions to show in the main context menu.
\r
817 * The possible values are:
\r
819 * <li>0 (zero): All suggestions are displayed in the main context menu.</li>
\r
820 * <li>Positive number: The maximum number of suggestions to shown in context
\r
821 * menu. Other entries will be shown in "More Suggestions" sub-menu.</li>
\r
822 * <li>Negative number: No suggestions are shown in the main context menu. All
\r
823 * entries will be listed in the "Suggestions" sub-menu.</li>
\r
825 * @name CKEDITOR.config.scayt_maxSuggestions
\r
829 * // Display only three suggestions in the main context menu.
\r
830 * config.scayt_maxSuggestions = 3;
\r
832 * // Do not show the suggestions directly.
\r
833 * config.scayt_maxSuggestions = -1;
\r
837 * Sets the customer ID for SCAYT. Required for migration from free version
\r
838 * with banner to paid version.
\r
839 * @name CKEDITOR.config.scayt_customerid
\r
843 * // Load SCAYT using my customer ID.
\r
844 * config.scayt_customerid = 'your-encrypted-customer-id';
\r
848 * Enables/disables the "More Suggestions" sub-menu in the context menu.
\r
849 * The possible values are "on" or "off".
\r
850 * @name CKEDITOR.config.scayt_moreSuggestions
\r
854 * // Disables the "More Suggestions" sub-menu.
\r
855 * config.scayt_moreSuggestions = 'off';
\r
859 * Customizes the display of SCAYT context menu commands ("Add Word", "Ignore"
\r
860 * and "Ignore All"). It must be a string with one or more of the following
\r
861 * words separated by a pipe ("|"):
\r
863 * <li>"off": disables all options.</li>
\r
864 * <li>"all": enables all options.</li>
\r
865 * <li>"ignore": enables the "Ignore" option.</li>
\r
866 * <li>"ignoreall": enables the "Ignore All" option.</li>
\r
867 * <li>"add": enables the "Add Word" option.</li>
\r
869 * @name CKEDITOR.config.scayt_contextCommands
\r
873 * // Show only "Add Word" and "Ignore All" in the context menu.
\r
874 * config.scayt_contextCommands = 'add|ignoreall';
\r
878 * Sets the default spellchecking language for SCAYT.
\r
879 * @name CKEDITOR.config.scayt_sLang
\r
883 * // Sets SCAYT to German.
\r
884 * config.scayt_sLang = 'de_DE';
\r
888 * Sets the visibility of the SCAYT tabs in the settings dialog and toolbar
\r
889 * button. The value must contain a "1" (enabled) or "0" (disabled) number for
\r
890 * each of the following entries, in this precise order, separated by a
\r
891 * comma (","): "Options", "Languages" and "Dictionary".
\r
892 * @name CKEDITOR.config.scayt_uiTabs
\r
896 * // Hide the "Languages" tab.
\r
897 * config.scayt_uiTabs = '1,0,1';
\r
902 * Set the URL to SCAYT core. Required to switch to licensed version of SCAYT application.
\r
903 * Further details at http://wiki.spellchecker.net/doku.php?id=3rd:wysiwyg:fckeditor:wscckf3l .
\r
904 * @name CKEDITOR.config.scayt_srcUrl
\r
908 * config.scayt_srcUrl = "http://my-host/spellcheck/lf/scayt/scayt.js";
\r
912 * Links SCAYT to custom dictionaries. It's a string containing dictionary ids
\r
913 * separared by commas (","). Available only for licensed version.
\r
914 * Further details at http://wiki.spellchecker.net/doku.php?id=custom_dictionary_support .
\r
915 * @name CKEDITOR.config.scayt_customDictionaryIds
\r
919 * config.scayt_customDictionaryIds = '3021,3456,3478"';
\r
923 * Makes it possible to activate a custom dictionary on SCAYT. The user
\r
924 * dictionary name must be used. Available only for licensed version.
\r
925 * @name CKEDITOR.config.scayt_userDictionaryName
\r
929 * config.scayt_userDictionaryName = 'MyDictionary';
\r
933 * Define order of placing of SCAYT context menu items by groups.
\r
934 * It must be a string with one or more of the following
\r
935 * words separated by a pipe ("|"):
\r
937 * <li>'suggest' - main suggestion word list,</li>
\r
938 * <li>'moresuggest' - more suggestions word list,</li>
\r
939 * <li>'control' - SCAYT commands, such as 'Ignore' and 'Add Word'</li>
\r
942 * @name CKEDITOR.config.scayt_contextMenuItemsOrder
\r
944 * @default 'suggest|moresuggest|control'
\r
946 * config.scayt_contextMenuItemsOrder = 'moresuggest|control|suggest';
\r