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
99 scayt_control.setDisabled( plugin.isPaused( editor ) === false );
\r
102 editor.fire( 'showScaytState' );
\r
105 editor.on( 'contentDom', createInstance );
\r
106 editor.on( 'contentDomUnload', function()
\r
109 var scripts = CKEDITOR.document.getElementsByTag( 'script' ),
\r
110 scaytIdRegex = /^dojoIoScript(\d+)$/i,
\r
111 scaytSrcRegex = /^https?:\/\/svc\.spellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;
\r
113 for ( var i=0; i < scripts.count(); i++ )
\r
115 var script = scripts.getItem( i ),
\r
116 id = script.getId(),
\r
117 src = script.getAttribute( 'src' );
\r
119 if ( id && src && id.match( scaytIdRegex ) && src.match( scaytSrcRegex ))
\r
124 editor.on( 'beforeCommandExec', function( ev ) // Disable SCAYT before Source command execution.
\r
126 if ( ( ev.data.name == 'source' || ev.data.name == 'newpage' ) && editor.mode == 'wysiwyg' )
\r
128 var scayt_instance = plugin.getScayt( editor );
\r
129 if ( scayt_instance )
\r
131 plugin.setPaused( editor, !scayt_instance.disabled );
\r
132 // store a control id for restore a specific scayt control settings
\r
133 plugin.setControlId( editor, scayt_instance.id );
\r
134 scayt_instance.destroy( true );
\r
135 delete plugin.instances[ editor.name ];
\r
138 // Catch on source mode switch off (#5720)
\r
139 else if ( ev.data.name == 'source' && editor.mode == 'source' )
\r
140 plugin.markControlRestore( editor );
\r
143 editor.on( 'afterCommandExec', function( ev )
\r
145 if ( !plugin.isScaytEnabled( editor ) )
\r
148 if ( editor.mode == 'wysiwyg' && ( ev.data.name == 'undo' || ev.data.name == 'redo' ) )
\r
149 window.setTimeout( function() { plugin.getScayt( editor ).refresh(); }, 10 );
\r
152 editor.on( 'destroy', function( ev )
\r
154 var editor = ev.editor,
\r
155 scayt_instance = plugin.getScayt( editor );
\r
157 // SCAYT instance might already get destroyed by mode switch (#5744).
\r
158 if ( !scayt_instance )
\r
161 delete plugin.instances[ editor.name ];
\r
162 // store a control id for restore a specific scayt control settings
\r
163 plugin.setControlId( editor, scayt_instance.id );
\r
164 scayt_instance.destroy( true );
\r
167 // Listen to data manipulation to reflect scayt markup.
\r
168 editor.on( 'afterSetData', function()
\r
170 if ( plugin.isScaytEnabled( editor ) ) {
\r
171 window.setTimeout( function()
\r
173 var instance = plugin.getScayt( editor );
\r
174 instance && instance.refresh();
\r
179 // Reload spell-checking for current word after insertion completed.
\r
180 editor.on( 'insertElement', function()
\r
182 var scayt_instance = plugin.getScayt( editor );
\r
183 if ( plugin.isScaytEnabled( editor ) )
\r
185 // Unlock the selection before reload, SCAYT will take
\r
186 // care selection update.
\r
187 if ( CKEDITOR.env.ie )
\r
188 editor.getSelection().unlock( true );
\r
190 // Return focus to the editor and refresh SCAYT markup (#5573).
\r
191 window.setTimeout( function()
\r
193 scayt_instance.focus();
\r
194 scayt_instance.refresh();
\r
197 }, this, null, 50 );
\r
199 editor.on( 'insertHtml', function()
\r
201 var scayt_instance = plugin.getScayt( editor );
\r
202 if ( plugin.isScaytEnabled( editor ) )
\r
204 // Unlock the selection before reload, SCAYT will take
\r
205 // care selection update.
\r
206 if ( CKEDITOR.env.ie )
\r
207 editor.getSelection().unlock( true );
\r
209 // Return focus to the editor (#5573)
\r
210 // Refresh SCAYT markup
\r
211 window.setTimeout( function()
\r
213 scayt_instance.focus();
\r
214 scayt_instance.refresh();
\r
217 }, this, null, 50 );
\r
219 editor.on( 'scaytDialog', function( ev ) // Communication with dialog.
\r
221 ev.data.djConfig = window.djConfig;
\r
222 ev.data.scayt_control = plugin.getScayt( editor );
\r
223 ev.data.tab = openPage;
\r
224 ev.data.scayt = window.scayt;
\r
227 var dataProcessor = editor.dataProcessor,
\r
228 htmlFilter = dataProcessor && dataProcessor.htmlFilter;
\r
232 htmlFilter.addRules(
\r
236 span : function( element )
\r
238 if ( element.attributes[ 'data-scayt_word' ]
\r
239 && element.attributes[ 'data-scaytid' ] )
\r
241 delete element.name; // Write children, but don't write this node.
\r
250 // Override Image.equals method avoid CK snapshot module to add SCAYT markup to snapshots. (#5546)
\r
251 var undoImagePrototype = CKEDITOR.plugins.undo.Image.prototype;
\r
252 undoImagePrototype.equals = CKEDITOR.tools.override( undoImagePrototype.equals, function( org )
\r
254 return function( otherImage )
\r
256 var thisContents = this.contents,
\r
257 otherContents = otherImage.contents;
\r
258 var scayt_instance = plugin.getScayt( this.editor );
\r
259 // Making the comparison based on content without SCAYT word markers.
\r
260 if ( scayt_instance && plugin.isScaytReady( this.editor ) )
\r
262 // scayt::reset might return value undefined. (#5742)
\r
263 this.contents = scayt_instance.reset( thisContents ) || '';
\r
264 otherImage.contents = scayt_instance.reset( otherContents ) || '';
\r
267 var retval = org.apply( this, arguments );
\r
269 this.contents = thisContents;
\r
270 otherImage.contents = otherContents;
\r
275 if ( editor.document )
\r
279 CKEDITOR.plugins.scayt =
\r
281 engineLoaded : false,
\r
283 // Data storage for SCAYT control, based on editor instances
\r
285 setControlInfo : function( editor, o )
\r
287 if ( editor && editor.name && typeof ( this.controlInfo[ editor.name ] ) != 'object' )
\r
288 this.controlInfo[ editor.name ] = {};
\r
290 for ( var infoOpt in o )
\r
291 this.controlInfo[ editor.name ][ infoOpt ] = o[ infoOpt ];
\r
293 isControlRestored : function( editor )
\r
297 this.controlInfo[ editor.name ] )
\r
299 return this.controlInfo[ editor.name ].restored ;
\r
303 markControlRestore : function( editor )
\r
305 this.setControlInfo( editor, { restored:true } );
\r
307 setControlId: function( editor, id )
\r
309 this.setControlInfo( editor, { id:id } );
\r
311 getControlId: function( editor )
\r
315 this.controlInfo[ editor.name ] &&
\r
316 this.controlInfo[ editor.name ].id )
\r
318 return this.controlInfo[ editor.name ].id;
\r
322 setPaused: function( editor , bool )
\r
324 this.setControlInfo( editor, { paused:bool } );
\r
326 isPaused: function( editor )
\r
330 this.controlInfo[editor.name] )
\r
332 return this.controlInfo[editor.name].paused;
\r
336 getScayt : function( editor )
\r
338 return this.instances[ editor.name ];
\r
340 isScaytReady : function( editor )
\r
342 return this.engineLoaded === true &&
\r
343 'undefined' !== typeof window.scayt && this.getScayt( editor );
\r
345 isScaytEnabled : function( editor )
\r
347 var scayt_instance = this.getScayt( editor );
\r
348 return ( scayt_instance ) ? scayt_instance.disabled === false : false;
\r
350 getUiTabs : function( editor )
\r
354 // read UI tabs value from config
\r
355 var configUiTabs = editor.config.scayt_uiTabs || "1,1,1";
\r
357 // convert string to array
\r
358 configUiTabs = configUiTabs.split( ',' );
\r
360 // "About us" should be always shown for standard config
\r
361 configUiTabs[3] = "1";
\r
363 for ( var i = 0; i < 4; i++ ) {
\r
364 uiTabs[i] = (typeof window.scayt != "undefined" && typeof window.scayt.uiTags != "undefined")
\r
365 ? (parseInt(configUiTabs[i],10) && window.scayt.uiTags[i])
\r
366 : parseInt(configUiTabs[i],10);
\r
370 loadEngine : function( editor )
\r
372 // SCAYT doesn't work with Firefox2, Opera and AIR.
\r
373 if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 || CKEDITOR.env.opera || CKEDITOR.env.air )
\r
374 return editor.fire( 'showScaytState' );
\r
376 if ( this.engineLoaded === true )
\r
377 return onEngineLoad.apply( editor ); // Add new instance.
\r
378 else if ( this.engineLoaded == -1 ) // We are waiting.
\r
379 return CKEDITOR.on( 'scaytReady', function(){ onEngineLoad.apply( editor ); } ); // Use function(){} to avoid rejection as duplicate.
\r
381 CKEDITOR.on( 'scaytReady', onEngineLoad, editor );
\r
382 CKEDITOR.on( 'scaytReady', function()
\r
384 this.engineLoaded = true;
\r
389 ); // First to run.
\r
391 this.engineLoaded = -1; // Loading in progress.
\r
393 // compose scayt url
\r
394 var protocol = document.location.protocol;
\r
395 // Default to 'http' for unknown.
\r
396 protocol = protocol.search( /https?:/) != -1? protocol : 'http:';
\r
397 var baseUrl = 'svc.spellchecker.net/scayt26/loader__base.js';
\r
399 var scaytUrl = editor.config.scayt_srcUrl || ( protocol + '//' + baseUrl );
\r
400 var scaytConfigBaseUrl = plugin.parseUrl( scaytUrl ).path + '/';
\r
402 if( window.scayt == undefined )
\r
404 CKEDITOR._djScaytConfig =
\r
406 baseUrl: scaytConfigBaseUrl,
\r
411 CKEDITOR.fireOnce( 'scaytReady' );
\r
416 // Append javascript code.
\r
417 CKEDITOR.document.getHead().append(
\r
418 CKEDITOR.document.createElement( 'script',
\r
422 type : 'text/javascript',
\r
430 CKEDITOR.fireOnce( 'scaytReady' );
\r
434 parseUrl : function ( data )
\r
437 if ( data.match && ( match = data.match(/(.*)[\/\\](.*?\.\w+)$/) ) )
\r
438 return { path: match[1], file: match[2] };
\r
444 var plugin = CKEDITOR.plugins.scayt;
\r
446 // Context menu constructing.
\r
447 var addButtonCommand = function( editor, buttonName, buttonLabel, commandName, command, menugroup, menuOrder )
\r
449 editor.addCommand( commandName, command );
\r
451 // If the "menu" plugin is loaded, register the menu item.
\r
452 editor.addMenuItem( commandName,
\r
454 label : buttonLabel,
\r
455 command : commandName,
\r
461 var commandDefinition =
\r
463 preserveState : true,
\r
464 editorFocus : false,
\r
467 exec: function( editor )
\r
469 if ( plugin.isScaytReady( editor ) )
\r
471 var isEnabled = plugin.isScaytEnabled( editor );
\r
473 this.setState( isEnabled ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_ON );
\r
475 var scayt_control = plugin.getScayt( editor );
\r
476 // the place where the status of editor focus should be restored
\r
477 // after there will be ability to store its state before SCAYT button click
\r
478 // if (storedFocusState is focused )
\r
479 // scayt_control.focus();
\r
481 // now focus is set certainly
\r
482 scayt_control.focus();
\r
483 scayt_control.setDisabled( isEnabled );
\r
485 else if ( !editor.config.scayt_autoStartup && plugin.engineLoaded >= 0 ) // Load first time
\r
487 this.setState( CKEDITOR.TRISTATE_DISABLED );
\r
488 plugin.loadEngine( editor );
\r
493 // Add scayt plugin.
\r
494 CKEDITOR.plugins.add( 'scayt',
\r
496 requires : [ 'menubutton' ],
\r
498 beforeInit : function( editor )
\r
500 var items_order = editor.config.scayt_contextMenuItemsOrder
\r
501 || 'suggest|moresuggest|control',
\r
502 items_order_str = "";
\r
504 items_order = items_order.split( '|' );
\r
506 if ( items_order && items_order.length )
\r
508 for ( var pos = 0 ; pos < items_order.length ; pos++ )
\r
509 items_order_str += 'scayt_' + items_order[ pos ] + ( items_order.length != parseInt( pos, 10 ) + 1 ? ',' : '' );
\r
512 // Put it on top of all context menu items (#5717)
\r
513 editor.config.menu_groups = items_order_str + ',' + editor.config.menu_groups;
\r
516 init : function( editor )
\r
518 // Delete span[data-scaytid] when text pasting in editor (#6921)
\r
519 var dataFilter = editor.dataProcessor && editor.dataProcessor.dataFilter;
\r
520 var dataFilterRules =
\r
524 span : function( element )
\r
526 var attrs = element.attributes;
\r
527 if ( attrs && attrs[ 'data-scaytid' ] )
\r
528 delete element.name;
\r
532 dataFilter && dataFilter.addRules( dataFilterRules );
\r
534 var moreSuggestions = {},
\r
535 mainSuggestions = {};
\r
538 var command = editor.addCommand( commandName, commandDefinition );
\r
540 // Add Options dialog.
\r
541 CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) );
\r
543 var uiTabs = plugin.getUiTabs( editor );
\r
545 var menuGroup = 'scaytButton';
\r
546 editor.addMenuGroup( menuGroup );
\r
547 // combine menu items to render
\r
548 var uiMenuItems = {};
\r
550 var lang = editor.lang.scayt;
\r
553 uiMenuItems.scaytToggle =
\r
555 label : lang.enable,
\r
556 command : commandName,
\r
560 if ( uiTabs[0] == 1 )
\r
561 uiMenuItems.scaytOptions =
\r
563 label : lang.options,
\r
565 onClick : function()
\r
567 openPage = 'options';
\r
568 editor.openDialog( commandName );
\r
572 if ( uiTabs[1] == 1 )
\r
573 uiMenuItems.scaytLangs =
\r
575 label : lang.langs,
\r
577 onClick : function()
\r
579 openPage = 'langs';
\r
580 editor.openDialog( commandName );
\r
583 if ( uiTabs[2] == 1 )
\r
584 uiMenuItems.scaytDict =
\r
586 label : lang.dictionariesTab,
\r
588 onClick : function()
\r
590 openPage = 'dictionaries';
\r
591 editor.openDialog( commandName );
\r
595 uiMenuItems.scaytAbout =
\r
597 label : editor.lang.scayt.about,
\r
599 onClick : function()
\r
601 openPage = 'about';
\r
602 editor.openDialog( commandName );
\r
606 editor.addMenuItems( uiMenuItems );
\r
608 editor.ui.add( 'Scayt', CKEDITOR.UI_MENUBUTTON,
\r
610 label : lang.title,
\r
611 title : CKEDITOR.env.opera ? lang.opera_title : lang.title,
\r
612 className : 'cke_button_scayt',
\r
613 modes : { wysiwyg : 1 },
\r
614 onRender: function()
\r
616 command.on( 'state', function()
\r
618 this.setState( command.state );
\r
622 onMenu : function()
\r
624 var isEnabled = plugin.isScaytEnabled( editor );
\r
626 editor.getMenuItem( 'scaytToggle' ).label = lang[ isEnabled ? 'disable' : 'enable' ];
\r
628 var uiTabs = plugin.getUiTabs( editor );
\r
631 scaytToggle : CKEDITOR.TRISTATE_OFF,
\r
632 scaytOptions : isEnabled && uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
633 scaytLangs : isEnabled && uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
634 scaytDict : isEnabled && uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
\r
635 scaytAbout : isEnabled && uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
\r
640 // If the "contextmenu" plugin is loaded, register the listeners.
\r
641 if ( editor.contextMenu && editor.addMenuItems )
\r
643 editor.contextMenu.addListener( function( element, selection )
\r
645 if ( !plugin.isScaytEnabled( editor )
\r
646 || selection.getRanges()[ 0 ].checkReadOnly() )
\r
649 var scayt_control = plugin.getScayt( editor ),
\r
650 node = scayt_control.getScaytNode();
\r
655 var word = scayt_control.getWord( node );
\r
660 var sLang = scayt_control.getLang(),
\r
662 items_suggestion = window.scayt.getSuggestion( word, sLang );
\r
663 if ( !items_suggestion || !items_suggestion.length )
\r
665 // Remove unused commands and menuitems
\r
666 for ( i in moreSuggestions )
\r
668 delete editor._.menuItems[ i ];
\r
669 delete editor._.commands[ i ];
\r
671 for ( i in mainSuggestions )
\r
673 delete editor._.menuItems[ i ];
\r
674 delete editor._.commands[ i ];
\r
676 moreSuggestions = {}; // Reset items.
\r
677 mainSuggestions = {};
\r
679 var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || 'on';
\r
680 var moreSuggestionsUnableAdded = false;
\r
682 var maxSuggestions = editor.config.scayt_maxSuggestions;
\r
683 ( typeof maxSuggestions != 'number' ) && ( maxSuggestions = 5 );
\r
684 !maxSuggestions && ( maxSuggestions = items_suggestion.length );
\r
686 var contextCommands = editor.config.scayt_contextCommands || 'all';
\r
687 contextCommands = contextCommands.split( '|' );
\r
689 for ( var i = 0, l = items_suggestion.length; i < l; i += 1 )
\r
691 var commandName = 'scayt_suggestion_' + items_suggestion[i].replace( ' ', '_' );
\r
692 var exec = ( function( el, s )
\r
697 scayt_control.replace( el, s );
\r
700 })( node, items_suggestion[i] );
\r
702 if ( i < maxSuggestions )
\r
704 addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
\r
705 commandName, exec, 'scayt_suggest', i + 1 );
\r
706 _r[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
707 mainSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
709 else if ( moreSuggestionsUnable == 'on' )
\r
711 addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
\r
712 commandName, exec, 'scayt_moresuggest', i + 1 );
\r
713 moreSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
\r
714 moreSuggestionsUnableAdded = true;
\r
718 if ( moreSuggestionsUnableAdded )
\r
720 // Register the More suggestions group;
\r
721 editor.addMenuItem( 'scayt_moresuggest',
\r
723 label : lang.moreSuggestions,
\r
724 group : 'scayt_moresuggest',
\r
726 getItems : function()
\r
728 return moreSuggestions;
\r
731 mainSuggestions[ 'scayt_moresuggest' ] = CKEDITOR.TRISTATE_OFF;
\r
734 if ( in_array( 'all', contextCommands ) || in_array( 'ignore', contextCommands) )
\r
736 var ignore_command = {
\r
738 scayt_control.ignore( node );
\r
741 addButtonCommand( editor, 'ignore', lang.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1 );
\r
742 mainSuggestions[ 'scayt_ignore' ] = CKEDITOR.TRISTATE_OFF;
\r
745 if ( in_array( 'all', contextCommands ) || in_array( 'ignoreall', contextCommands ) )
\r
747 var ignore_all_command = {
\r
749 scayt_control.ignoreAll( node );
\r
752 addButtonCommand(editor, 'ignore_all', lang.ignoreAll, 'scayt_ignore_all', ignore_all_command, 'scayt_control', 2);
\r
753 mainSuggestions['scayt_ignore_all'] = CKEDITOR.TRISTATE_OFF;
\r
756 if ( in_array( 'all', contextCommands ) || in_array( 'add', contextCommands ) )
\r
758 var addword_command = {
\r
760 window.scayt.addWordToUserDictionary( node );
\r
763 addButtonCommand(editor, 'add_word', lang.addWord, 'scayt_add_word', addword_command, 'scayt_control', 3);
\r
764 mainSuggestions['scayt_add_word'] = CKEDITOR.TRISTATE_OFF;
\r
767 if ( scayt_control.fireOnContextMenu )
\r
768 scayt_control.fireOnContextMenu( editor );
\r
770 return mainSuggestions;
\r
774 var showInitialState = function()
\r
776 editor.removeListener( 'showScaytState', showInitialState );
\r
778 if ( !CKEDITOR.env.opera && !CKEDITOR.env.air )
\r
779 command.setState( plugin.isScaytEnabled( editor ) ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
\r
781 command.setState( CKEDITOR.TRISTATE_DISABLED );
\r
784 editor.on( 'showScaytState', showInitialState );
\r
786 if ( CKEDITOR.env.opera || CKEDITOR.env.air )
\r
788 editor.on( 'instanceReady', function()
\r
790 showInitialState();
\r
795 if ( editor.config.scayt_autoStartup )
\r
797 editor.on( 'instanceReady', function()
\r
799 plugin.loadEngine( editor );
\r
804 afterInit : function( editor )
\r
806 // Prevent word marker line from displaying in elements path and been removed when cleaning format. (#3570) (#4125)
\r
807 var elementsPathFilters,
\r
808 scaytFilter = function( element )
\r
810 if ( element.hasAttribute( 'data-scaytid' ) )
\r
814 if ( editor._.elementsPath && ( elementsPathFilters = editor._.elementsPath.filters ) )
\r
815 elementsPathFilters.push( scaytFilter );
\r
817 editor.addRemoveFormatFilter && editor.addRemoveFormatFilter( scaytFilter );
\r
824 * If enabled (true), turns on SCAYT automatically after loading the editor.
\r
825 * @name CKEDITOR.config.scayt_autoStartup
\r
829 * config.scayt_autoStartup = true;
\r
833 * Defines the number of SCAYT suggestions to show in the main context menu.
\r
834 * The possible values are:
\r
836 * <li>0 (zero): All suggestions are displayed in the main context menu.</li>
\r
837 * <li>Positive number: The maximum number of suggestions to shown in context
\r
838 * menu. Other entries will be shown in "More Suggestions" sub-menu.</li>
\r
839 * <li>Negative number: No suggestions are shown in the main context menu. All
\r
840 * entries will be listed in the "Suggestions" sub-menu.</li>
\r
842 * @name CKEDITOR.config.scayt_maxSuggestions
\r
846 * // Display only three suggestions in the main context menu.
\r
847 * config.scayt_maxSuggestions = 3;
\r
849 * // Do not show the suggestions directly.
\r
850 * config.scayt_maxSuggestions = -1;
\r
854 * Sets the customer ID for SCAYT. Required for migration from free version
\r
855 * with banner to paid version.
\r
856 * @name CKEDITOR.config.scayt_customerid
\r
860 * // Load SCAYT using my customer ID.
\r
861 * config.scayt_customerid = 'your-encrypted-customer-id';
\r
865 * Enables/disables the "More Suggestions" sub-menu in the context menu.
\r
866 * The possible values are "on" or "off".
\r
867 * @name CKEDITOR.config.scayt_moreSuggestions
\r
871 * // Disables the "More Suggestions" sub-menu.
\r
872 * config.scayt_moreSuggestions = 'off';
\r
876 * Customizes the display of SCAYT context menu commands ("Add Word", "Ignore"
\r
877 * and "Ignore All"). It must be a string with one or more of the following
\r
878 * words separated by a pipe ("|"):
\r
880 * <li>"off": disables all options.</li>
\r
881 * <li>"all": enables all options.</li>
\r
882 * <li>"ignore": enables the "Ignore" option.</li>
\r
883 * <li>"ignoreall": enables the "Ignore All" option.</li>
\r
884 * <li>"add": enables the "Add Word" option.</li>
\r
886 * @name CKEDITOR.config.scayt_contextCommands
\r
890 * // Show only "Add Word" and "Ignore All" in the context menu.
\r
891 * config.scayt_contextCommands = 'add|ignoreall';
\r
895 * Sets the default spellchecking language for SCAYT.
\r
896 * @name CKEDITOR.config.scayt_sLang
\r
900 * // Sets SCAYT to German.
\r
901 * config.scayt_sLang = 'de_DE';
\r
905 * Sets the visibility of the SCAYT tabs in the settings dialog and toolbar
\r
906 * button. The value must contain a "1" (enabled) or "0" (disabled) number for
\r
907 * each of the following entries, in this precise order, separated by a
\r
908 * comma (","): "Options", "Languages" and "Dictionary".
\r
909 * @name CKEDITOR.config.scayt_uiTabs
\r
913 * // Hide the "Languages" tab.
\r
914 * config.scayt_uiTabs = '1,0,1';
\r
919 * Set the URL to SCAYT core. Required to switch to licensed version of SCAYT application.
\r
920 * Further details at http://wiki.spellchecker.net/doku.php?id=3rd:wysiwyg:fckeditor:wscckf3l .
\r
921 * @name CKEDITOR.config.scayt_srcUrl
\r
925 * config.scayt_srcUrl = "http://my-host/spellcheck/lf/scayt/scayt.js";
\r
929 * Links SCAYT to custom dictionaries. It's a string containing dictionary ids
\r
930 * separared by commas (","). Available only for licensed version.
\r
931 * Further details at http://wiki.spellchecker.net/doku.php?id=custom_dictionary_support .
\r
932 * @name CKEDITOR.config.scayt_customDictionaryIds
\r
936 * config.scayt_customDictionaryIds = '3021,3456,3478"';
\r
940 * Makes it possible to activate a custom dictionary on SCAYT. The user
\r
941 * dictionary name must be used. Available only for licensed version.
\r
942 * @name CKEDITOR.config.scayt_userDictionaryName
\r
946 * config.scayt_userDictionaryName = 'MyDictionary';
\r
950 * Define order of placing of SCAYT context menu items by groups.
\r
951 * It must be a string with one or more of the following
\r
952 * words separated by a pipe ("|"):
\r
954 * <li>'suggest' - main suggestion word list,</li>
\r
955 * <li>'moresuggest' - more suggestions word list,</li>
\r
956 * <li>'control' - SCAYT commands, such as 'Ignore' and 'Add Word'</li>
\r
959 * @name CKEDITOR.config.scayt_contextMenuItemsOrder
\r
961 * @default 'suggest|moresuggest|control'
\r
963 * config.scayt_contextMenuItemsOrder = 'moresuggest|control|suggest';
\r