2 Copyright (c) 2003-2010, 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
19 var found = false, key;
\r
20 for (key in haystack)
\r
22 if ((haystack[key] === needle) || ( haystack[key] == needle))
\r
31 var onEngineLoad = function()
\r
35 var createInstance = function() // Create new instance every time Document is created.
\r
37 // Initialise Scayt instance.
\r
40 oParams.srcNodeRef = editor.document.getWindow().$.frameElement;
\r
41 // syntax : AppName.AppVersion@AppRevision
\r
42 oParams.assocApp = 'CKEDITOR.' + CKEDITOR.version + '@' + CKEDITOR.revision;
\r
43 oParams.customerid = editor.config.scayt_customerid || '1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';
\r
44 oParams.customDictionaryIds = editor.config.scayt_customDictionaryIds || '';
\r
45 oParams.userDictionaryName = editor.config.scayt_userDictionaryName || '';
\r
46 oParams.sLang = editor.config.scayt_sLang || 'en_US';
\r
48 // Introduce SCAYT onLoad callback. (#5632)
\r
49 oParams.onLoad = function()
\r
51 // Draw down word marker to avoid being covered by background-color style.(#5466)
\r
52 if ( !( CKEDITOR.env.ie && CKEDITOR.env.version < 8 ) )
\r
53 this.addStyle( this.selectorCss(), 'padding-bottom: 2px !important;' );
\r
55 // Call scayt_control.focus when SCAYT loaded
\r
56 // and only if editor has focus and scayt control creates at first time (#5720)
\r
57 if ( editor.focusManager.hasFocus && !plugin.isControlRestored( editor ) )
\r
62 oParams.onBeforeChange = function()
\r
64 if ( plugin.getScayt( editor ) && !editor.checkDirty() )
\r
65 setTimeout( function(){ editor.resetDirty(); } );
\r
68 var scayt_custom_params = window.scayt_custom_params;
\r
69 if ( typeof scayt_custom_params == 'object')
\r
71 for ( var k in scayt_custom_params )
\r
73 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.scayt_word && element.attributes.scaytid )
\r
249 delete element.name; // Write children, but don't write this node.
\r
258 // Override Image.equals method avoid CK snapshot module to add SCAYT markup to snapshots. (#5546)
\r
259 var undoImagePrototype = CKEDITOR.plugins.undo.Image.prototype;
\r
260 undoImagePrototype.equals = CKEDITOR.tools.override( undoImagePrototype.equals, function( org )
\r
262 return function( otherImage )
\r
264 var thisContents = this.contents,
\r
265 otherContents = otherImage.contents;
\r
266 var scayt_instance = plugin.getScayt( this.editor );
\r
267 // Making the comparison based on content without SCAYT word markers.
\r
268 if ( scayt_instance && plugin.isScaytReady( this.editor ) )
\r
270 // scayt::reset might return value undefined. (#5742)
\r
271 this.contents = scayt_instance.reset( thisContents ) || '';
\r
272 otherImage.contents = scayt_instance.reset( otherContents ) || '';
\r
275 var retval = org.apply( this, arguments );
\r
277 this.contents = thisContents;
\r
278 otherImage.contents = otherContents;
\r
283 if ( editor.document )
\r
287 CKEDITOR.plugins.scayt =
\r
289 engineLoaded : false,
\r
291 // Data storage for SCAYT control, based on editor instances
\r
293 setControlInfo : function( editor, o )
\r
295 if ( editor && editor.name && typeof ( this.controlInfo[ editor.name ] ) != 'object' )
\r
296 this.controlInfo[ editor.name ] = {};
\r
298 for ( var infoOpt in o )
\r
299 this.controlInfo[ editor.name ][ infoOpt ] = o[ infoOpt ];
\r
301 isControlRestored : function ( editor )
\r
305 this.controlInfo[ editor.name ] )
\r
307 return this.controlInfo[ editor.name ].restored ;
\r
311 markControlRestore : function ( editor )
\r
313 this.setControlInfo( editor,{ restored:true } );
\r
315 setControlId: function (editor, id)
\r
317 this.setControlInfo( editor,{ id:id } );
\r
319 getControlId: function (editor)
\r
323 this.controlInfo[ editor.name ] &&
\r
324 this.controlInfo[ editor.name ].id )
\r
326 return this.controlInfo[ editor.name ].id;
\r
330 setPaused: function ( editor , bool )
\r
332 this.setControlInfo( editor,{ paused:bool } );
\r
334 isPaused: function (editor)
\r
338 this.controlInfo[editor.name] )
\r
340 return this.controlInfo[editor.name].paused ;
\r
344 getScayt : function( editor )
\r
346 return this.instances[ editor.name ];
\r
348 isScaytReady : function( editor )
\r
350 return this.engineLoaded === true &&
\r
351 'undefined' !== typeof window.scayt && this.getScayt( editor );
\r
353 isScaytEnabled : function( editor )
\r
355 var scayt_instance = this.getScayt( editor );
\r
356 return ( scayt_instance ) ? scayt_instance.disabled === false : false;
\r
358 loadEngine : function( editor )
\r
360 // SCAYT doesn't work with Firefox2, Opera.
\r
361 if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 || CKEDITOR.env.opera )
\r
362 return editor.fire( 'showScaytState' );
\r
364 if ( this.engineLoaded === true )
\r
365 return onEngineLoad.apply( editor ); // Add new instance.
\r
366 else if ( this.engineLoaded == -1 ) // We are waiting.
\r
367 return CKEDITOR.on( 'scaytReady', function(){ onEngineLoad.apply( editor ); } ); // Use function(){} to avoid rejection as duplicate.
\r
369 CKEDITOR.on( 'scaytReady', onEngineLoad, editor );
\r
370 CKEDITOR.on( 'scaytReady', function()
\r
372 this.engineLoaded = true;
\r
377 ); // First to run.
\r
379 this.engineLoaded = -1; // Loading in progress.
\r
381 // compose scayt url
\r
382 var protocol = document.location.protocol;
\r
383 // Default to 'http' for unknown.
\r
384 protocol = protocol.search( /https?:/) != -1? protocol : 'http:';
\r
385 var baseUrl = 'svc.spellchecker.net/spellcheck31/lf/scayt24/loader__base.js';
\r
387 var scaytUrl = editor.config.scayt_srcUrl || ( protocol + '//' + baseUrl );
\r
388 var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + '/';
\r
390 if( window.scayt == undefined )
\r
392 CKEDITOR._djScaytConfig =
\r
394 baseUrl: scaytConfigBaseUrl,
\r
399 CKEDITOR.fireOnce( 'scaytReady' );
\r
404 // Append javascript code.
\r
405 CKEDITOR.document.getHead().append(
\r
406 CKEDITOR.document.createElement( 'script',
\r
410 type : 'text/javascript',
\r
418 CKEDITOR.fireOnce( 'scaytReady' );
\r
422 parseUrl : function ( data )
\r
425 if ( data.match && ( match = data.match(/(.*)[\/\\](.*?\.\w+)$/) ) )
\r
426 return { path: match[1], file: match[2] };
\r
432 var plugin = CKEDITOR.plugins.scayt;
\r
434 // Context menu constructing.
\r
435 var addButtonCommand = function( editor, buttonName, buttonLabel, commandName, command, menugroup, menuOrder )
\r
437 editor.addCommand( commandName, command );
\r
439 // If the "menu" plugin is loaded, register the menu item.
\r
440 editor.addMenuItem( commandName,
\r
442 label : buttonLabel,
\r
443 command : commandName,
\r
449 var commandDefinition =
\r
451 preserveState : true,
\r
452 editorFocus : false,
\r
454 exec: function( editor )
\r
456 var autoStartup = editor.config.scayt_autoStartup;
\r
457 autoStartup = ( autoStartup == undefined ) || autoStartup;
\r
459 if ( plugin.isScaytReady( editor ) )
\r
461 var isEnabled = plugin.isScaytEnabled( editor );
\r
463 this.setState( isEnabled ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_ON );
\r
465 var scayt_control = plugin.getScayt( editor );
\r
466 // the place where the status of editor focus should be restored
\r
467 // after there will be ability to store its state before SCAYT button click
\r
468 // if (storedFocusState is focused )
\r
469 // scayt_control.focus();
\r
471 // now focus is set certainly
\r
472 scayt_control.focus( );
\r
473 scayt_control.setDisabled( isEnabled );
\r
475 else if ( !autoStartup && plugin.engineLoaded >= 0 ) // Load first time
\r
477 this.setState( CKEDITOR.TRISTATE_DISABLED );
\r
478 plugin.loadEngine( editor );
\r
483 // Add scayt plugin.
\r
484 CKEDITOR.plugins.add( 'scayt',
\r
486 requires : [ 'menubutton' ],
\r
488 beforeInit : function( editor )
\r
490 var items_order = editor.config.scayt_contextMenuItemsOrder
\r
491 || 'suggest|moresuggest|control',
\r
492 items_order_str = "";
\r
494 items_order = items_order.split( '|' );
\r
496 if ( items_order && items_order.length )
\r
498 for ( var pos in items_order )
\r
499 items_order_str += 'scayt_' + items_order[ pos ] + ( items_order.length != parseInt( pos, 10 ) + 1 ? ',' : '' );
\r
502 // Register scayt rbc menu group.
\r
503 if ( editor.config.scayt_contextMenuOntop )
\r
504 // Put it on top of all context menu items
\r
505 editor.config.menu_groups = items_order_str + ',' + editor.config.menu_groups;
\r
508 editor.config.menu_groups = editor.config.menu_groups + ',' +items_order_str;
\r
511 init : function( editor )
\r
513 var moreSuggestions = {};
\r
514 var mainSuggestions = {};
\r
517 var command = editor.addCommand( commandName, commandDefinition );
\r
519 // Add Options dialog.
\r
520 CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) );
\r
522 var confuiTabs = editor.config.scayt_uiTabs || '1,1,1';
\r
524 // string to array convert
\r
525 confuiTabs = confuiTabs.split( ',' );
\r
526 // check array length ! always must be 3 filled with 1 or 0
\r
527 for (var i=0,l=3; i<l; i++)
\r
529 var flag = parseInt(confuiTabs[i] || '1' ,10);
\r
530 uiTabs.push( flag );
\r
533 var menuGroup = 'scaytButton';
\r
534 editor.addMenuGroup( menuGroup );
\r
535 // combine menu items to render
\r
536 var uiMuneItems = {};
\r
539 uiMuneItems.scaytToggle =
\r
541 label : editor.lang.scayt.enable,
\r
542 command : commandName,
\r
546 if (uiTabs[0] == 1)
\r
547 uiMuneItems.scaytOptions =
\r
549 label : editor.lang.scayt.options,
\r
551 onClick : function()
\r
553 openPage = 'options';
\r
554 editor.openDialog( commandName );
\r
558 if (uiTabs[1] == 1)
\r
559 uiMuneItems.scaytLangs =
\r
561 label : editor.lang.scayt.langs,
\r
563 onClick : function()
\r
565 openPage = 'langs';
\r
566 editor.openDialog( commandName );
\r
569 if (uiTabs[2] == 1)
\r
570 uiMuneItems.scaytDict =
\r
572 label : editor.lang.scayt.dictionariesTab,
\r
574 onClick : function()
\r
576 openPage = 'dictionaries';
\r
577 editor.openDialog( commandName );
\r
581 uiMuneItems.scaytAbout =
\r
583 label : editor.lang.scayt.about,
\r
585 onClick : function()
\r
587 openPage = 'about';
\r
588 editor.openDialog( commandName );
\r
593 uiTabs[3] = 1; // about us tab is always on
\r
594 plugin.uiTabs = uiTabs;
\r
596 editor.addMenuItems( uiMuneItems );
\r
598 editor.ui.add( 'Scayt', CKEDITOR.UI_MENUBUTTON,
\r
600 label : editor.lang.scayt.title,
\r
601 title : CKEDITOR.env.opera ? editor.lang.scayt.opera_title : editor.lang.scayt.title,
\r
602 className : 'cke_button_scayt',
\r
603 onRender: function()
\r
605 command.on( 'state', function()
\r
607 this.setState( command.state );
\r
611 onMenu : function()
\r
613 var isEnabled = plugin.isScaytEnabled( editor );
\r
615 editor.getMenuItem( 'scaytToggle' ).label = editor.lang.scayt[ isEnabled ? 'disable' : 'enable' ];
\r
618 scaytToggle : CKEDITOR.TRISTATE_OFF,
\r
619 scaytOptions : isEnabled && plugin.uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
620 scaytLangs : isEnabled && plugin.uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
621 scaytDict : isEnabled && plugin.uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
622 scaytAbout : isEnabled && plugin.uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
\r
627 // If the "contextmenu" plugin is loaded, register the listeners.
\r
628 if ( editor.contextMenu && editor.addMenuItems )
\r
630 editor.contextMenu.addListener( function( )
\r
632 if ( !plugin.isScaytEnabled( editor ) )
\r
635 var scayt_control = plugin.getScayt( editor ),
\r
636 node = scayt_control.getScaytNode();
\r
641 var word = scayt_control.getWord( node );
\r
646 var sLang = scayt_control.getLang(),
\r
648 items_suggestion = window.scayt.getSuggestion( word, sLang );
\r
649 if ( !items_suggestion || !items_suggestion.length )
\r
651 // Remove unused commands and menuitems
\r
652 for ( i in moreSuggestions )
\r
654 delete editor._.menuItems[ i ];
\r
655 delete editor._.commands[ i ];
\r
657 for ( i in mainSuggestions )
\r
659 delete editor._.menuItems[ i ];
\r
660 delete editor._.commands[ i ];
\r
662 moreSuggestions = {}; // Reset items.
\r
663 mainSuggestions = {};
\r
665 var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || 'on';
\r
666 var moreSuggestionsUnableAdded = false;
\r
668 var maxSuggestions = editor.config.scayt_maxSuggestions;
\r
669 ( typeof maxSuggestions != 'number' ) && ( maxSuggestions = 5 );
\r
670 !maxSuggestions && ( maxSuggestions = items_suggestion.length );
\r
672 var contextCommands = editor.config.scayt_contextCommands || 'all';
\r
673 contextCommands = contextCommands.split( '|' );
\r
675 for ( var i = 0, l = items_suggestion.length; i < l; i += 1 )
\r
677 var commandName = 'scayt_suggestion_' + items_suggestion[i].replace( ' ', '_' );
\r
678 var exec = ( function( el, s )
\r
683 scayt_control.replace(el, s);
\r
686 })( node, items_suggestion[i] );
\r
688 if ( i < maxSuggestions )
\r
690 addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
\r
691 commandName, exec, 'scayt_suggest', i + 1 );
\r
692 _r[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
693 mainSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
695 else if ( moreSuggestionsUnable == 'on' )
\r
697 addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
\r
698 commandName, exec, 'scayt_moresuggest', i + 1 );
\r
699 moreSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
700 moreSuggestionsUnableAdded = true;
\r
704 if ( moreSuggestionsUnableAdded )
\r
706 // Register the More suggestions group;
\r
707 editor.addMenuItem( 'scayt_moresuggest',
\r
709 label : editor.lang.scayt.moreSuggestions,
\r
710 group : 'scayt_moresuggest',
\r
712 getItems : function()
\r
714 return moreSuggestions;
\r
717 mainSuggestions[ 'scayt_moresuggest' ] = CKEDITOR.TRISTATE_OFF;
\r
720 if ( in_array( 'all', contextCommands ) || in_array( 'ignore', contextCommands) )
\r
722 var ignore_command = {
\r
724 scayt_control.ignore( node );
\r
727 addButtonCommand( editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1 );
\r
728 mainSuggestions[ 'scayt_ignore' ] = CKEDITOR.TRISTATE_OFF;
\r
731 if ( in_array( 'all', contextCommands ) || in_array( 'ignoreall', contextCommands ) )
\r
733 var ignore_all_command = {
\r
735 scayt_control.ignoreAll( node );
\r
738 addButtonCommand(editor, 'ignore_all', editor.lang.scayt.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2);
\r
739 mainSuggestions['scayt_ignore_all'] = CKEDITOR.TRISTATE_OFF;
\r
742 if ( in_array( 'all', contextCommands ) || in_array( 'add', contextCommands ) )
\r
744 var addword_command = {
\r
746 window.scayt.addWordToUserDictionary( node );
\r
749 addButtonCommand(editor, 'add_word', editor.lang.scayt.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3);
\r
750 mainSuggestions['scayt_add_word'] = CKEDITOR.TRISTATE_OFF;
\r
753 if ( scayt_control.fireOnContextMenu )
\r
754 scayt_control.fireOnContextMenu( editor );
\r
756 return mainSuggestions;
\r
760 var showInitialState = function()
\r
762 editor.removeListener( 'showScaytState', showInitialState );
\r
764 if ( !CKEDITOR.env.opera )
\r
765 command.setState( plugin.isScaytEnabled( editor ) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
\r
767 command.setState( CKEDITOR.TRISTATE_DISABLED );
\r
770 editor.on( 'showScaytState', showInitialState );
\r
772 if ( CKEDITOR.env.opera )
\r
774 editor.on( 'instanceReady', function()
\r
776 showInitialState();
\r
781 var autoStartup = editor.config.scayt_autoStartup;
\r
782 if ( ( autoStartup == undefined ) || autoStartup )
\r
784 editor.on( 'instanceReady', function()
\r
786 plugin.loadEngine( editor );
\r
791 afterInit : function( editor )
\r
793 // Prevent word marker line from displaying in elements path and been removed when cleaning format. (#3570) (#4125)
\r
794 var elementsPathFilters,
\r
795 scaytFilter = function( element )
\r
797 if ( element.hasAttribute( 'scaytid' ) )
\r
801 if ( editor._.elementsPath && ( elementsPathFilters = editor._.elementsPath.filters ) )
\r
802 elementsPathFilters.push( scaytFilter );
\r
804 editor.addRemoveFormatFilter && editor.addRemoveFormatFilter( scaytFilter );
\r
811 * If enabled (true), turns on SCAYT automatically after loading the editor.
\r
812 * @name CKEDITOR.config.scayt_autoStartup
\r
816 * config.scayt_autoStartup = false;
\r
820 * Defines the number of SCAYT suggestions to show in the main context menu.
\r
821 * The possible values are:
\r
823 * <li>0 (zero): All suggestions are displayed in the main context menu.</li>
\r
824 * <li>Positive number: The maximum number of suggestions to shown in context
\r
825 * menu. Other entries will be shown in "More Suggestions" sub-menu.</li>
\r
826 * <li>Negative number: No suggestions are shown in the main context menu. All
\r
827 * entries will be listed in the "Suggestions" sub-menu.</li>
\r
829 * @name CKEDITOR.config.scayt_maxSuggestions
\r
833 * // Display only three suggestions in the main context menu.
\r
834 * config.scayt_maxSuggestions = 3;
\r
836 * // Do not show the suggestions directly.
\r
837 * config.scayt_maxSuggestions = -1;
\r
841 * Sets the customer ID for SCAYT. Required for migration from free version
\r
842 * with banner to paid version.
\r
843 * @name CKEDITOR.config.scayt_customerid
\r
847 * // Load SCAYT using my customer ID.
\r
848 * config.scayt_customerid = 'your-encrypted-customer-id';
\r
852 * Enables/disables the "More Suggestions" sub-menu in the context menu.
\r
853 * The possible values are "on" or "off".
\r
854 * @name CKEDITOR.config.scayt_moreSuggestions
\r
858 * // Disables the "More Suggestions" sub-menu.
\r
859 * config.scayt_moreSuggestions = 'off';
\r
863 * Customizes the display of SCAYT context menu commands ("Add Word", "Ignore"
\r
864 * and "Ignore All"). It must be a string with one or more of the following
\r
865 * words separated by a pipe ("|"):
\r
867 * <li>"off": disables all options.</li>
\r
868 * <li>"all": enables all options.</li>
\r
869 * <li>"ignore": enables the "Ignore" option.</li>
\r
870 * <li>"ignoreall": enables the "Ignore All" option.</li>
\r
871 * <li>"add": enables the "Add Word" option.</li>
\r
873 * @name CKEDITOR.config.scayt_contextCommands
\r
877 * // Show only "Add Word" and "Ignore All" in the context menu.
\r
878 * config.scayt_contextCommands = 'add|ignoreall';
\r
882 * Sets the default spellchecking language for SCAYT.
\r
883 * @name CKEDITOR.config.scayt_sLang
\r
887 * // Sets SCAYT to German.
\r
888 * config.scayt_sLang = 'de_DE';
\r
892 * Sets the visibility of the SCAYT tabs in the settings dialog and toolbar
\r
893 * button. The value must contain a "1" (enabled) or "0" (disabled) number for
\r
894 * each of the following entries, in this precise order, separated by a
\r
895 * comma (","): "Options", "Languages" and "Dictionary".
\r
896 * @name CKEDITOR.config.scayt_uiTabs
\r
900 * // Hide the "Languages" tab.
\r
901 * config.scayt_uiTabs = '1,0,1';
\r
906 * Set the URL to SCAYT core. Required to switch to licensed version of SCAYT application.
\r
907 * Further details at http://wiki.spellchecker.net/doku.php?id=3rd:wysiwyg:fckeditor:wscckf3l .
\r
908 * @name CKEDITOR.config.scayt_srcUrl
\r
912 * config.scayt_srcUrl = "http://my-host/spellcheck/lf/scayt/scayt.js";
\r
916 * Links SCAYT to custom dictionaries. It's a string containing dictionary ids
\r
917 * separared by commas (","). Available only for licensed version.
\r
918 * Further details at http://wiki.spellchecker.net/doku.php?id=custom_dictionary_support .
\r
919 * @name CKEDITOR.config.scayt_customDictionaryIds
\r
923 * config.scayt_customDictionaryIds = '3021,3456,3478"';
\r
927 * Makes it possible to activate a custom dictionary on SCAYT. The user
\r
928 * dictionary name must be used. Available only for licensed version.
\r
929 * @name CKEDITOR.config.scayt_userDictionaryName
\r
933 * config.scayt_userDictionaryName = 'MyDictionary';
\r
937 * Makes it possible to place the SCAYT context menu items above others.
\r
938 * @name CKEDITOR.config.scayt_contextMenuOntop
\r
942 * config.scayt_contextMenuOntop = true;
\r
946 * Define order of placing of SCAYT context menu items by groups.
\r
947 * It must be a string with one or more of the following
\r
948 * words separated by a pipe ("|"):
\r
950 * <li>'suggest' - main suggestion word list,</li>
\r
951 * <li>'moresuggest' - more suggestions word list,</li>
\r
952 * <li>'control' - SCAYT commands, such as 'Ignore' and 'Add Word'</li>
\r
955 * @name CKEDITOR.config.scayt_contextMenuItemsOrder
\r
957 * @default 'suggest|moresuggest|control'
\r
959 * config.scayt_contextMenuItemsOrder = 'moresuggest|control|suggest';
\r