JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.4.3
[ckeditor.git] / _source / plugins / wysiwygarea / plugin.js
1 /*\r
2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 /**\r
7  * @fileOverview The "wysiwygarea" plugin. It registers the "wysiwyg" editing\r
8  *              mode, which handles the main editing area space.\r
9  */\r
10 \r
11 (function()\r
12 {\r
13         // List of elements in which has no way to move editing focus outside.\r
14         var nonExitableElementNames = { table:1,pre:1 };\r
15 \r
16         // Matching an empty paragraph at the end of document.\r
17         var emptyParagraphRegexp = /(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;\r
18 \r
19         var notWhitespaceEval = CKEDITOR.dom.walker.whitespaces( true );\r
20 \r
21         // Elements that could have empty new line around, including table, pre-formatted block, hr, page-break. (#6554)\r
22         function nonExitable( element )\r
23         {\r
24                 return ( element.getName() in nonExitableElementNames )\r
25                                 || element.isBlockBoundary() && CKEDITOR.dtd.$empty[ element.getName() ];\r
26         }\r
27 \r
28         function checkReadOnly( selection )\r
29         {\r
30                 if ( selection.getType() == CKEDITOR.SELECTION_ELEMENT )\r
31                         return selection.getSelectedElement().isReadOnly();\r
32                 else\r
33                         return selection.getCommonAncestor().isReadOnly();\r
34         }\r
35 \r
36         function onInsertHtml( evt )\r
37         {\r
38                 if ( this.mode == 'wysiwyg' )\r
39                 {\r
40                         this.focus();\r
41 \r
42                         var selection = this.getSelection();\r
43                         if ( checkReadOnly( selection ) )\r
44                                 return;\r
45 \r
46                         var data = evt.data;\r
47                         this.fire( 'saveSnapshot' );\r
48 \r
49                         if ( this.dataProcessor )\r
50                                 data = this.dataProcessor.toHtml( data );\r
51 \r
52                         if ( CKEDITOR.env.ie )\r
53                         {\r
54                                 var selIsLocked = selection.isLocked;\r
55 \r
56                                 if ( selIsLocked )\r
57                                         selection.unlock();\r
58 \r
59                                 var $sel = selection.getNative();\r
60 \r
61                                 // Delete control selections to avoid IE bugs on pasteHTML.\r
62                                 if ( $sel.type == 'Control' )\r
63                                         $sel.clear();\r
64                                 else if  ( selection.getType() == CKEDITOR.SELECTION_TEXT )\r
65                                 {\r
66                                         // Due to IE bugs on handling contenteditable=false blocks\r
67                                         // (#6005), we need to make some checks and eventually\r
68                                         // delete the selection first.\r
69 \r
70                                         var range = selection.getRanges()[0],\r
71                                                 endContainer = range && range.endContainer;\r
72 \r
73                                         if ( endContainer &&\r
74                                                  endContainer.type == CKEDITOR.NODE_ELEMENT &&\r
75                                                  endContainer.getAttribute( 'contenteditable' ) == 'false' &&\r
76                                                  range.checkBoundaryOfElement( endContainer, CKEDITOR.END ) )\r
77                                         {\r
78                                                 range.setEndAfter( range.endContainer );\r
79                                                 range.deleteContents();\r
80                                         }\r
81                                 }\r
82 \r
83                                 try\r
84                                 {\r
85                                         $sel.createRange().pasteHTML( data );\r
86                                 }\r
87                                 catch (e) {}\r
88 \r
89                                 if ( selIsLocked )\r
90                                         this.getSelection().lock();\r
91                         }\r
92                         else\r
93                                 this.document.$.execCommand( 'inserthtml', false, data );\r
94 \r
95                         // Webkit does not scroll to the cursor position after pasting (#5558)\r
96                         if ( CKEDITOR.env.webkit )\r
97                         {\r
98                                 this.document.$.execCommand( 'inserthtml', false, '<span id="cke_paste_marker" cke_temp="1"></span>' );\r
99                                 var marker = this.document.getById( 'cke_paste_marker' );\r
100                                 marker.scrollIntoView();\r
101                                 marker.remove();\r
102                                 marker = null;\r
103                         }\r
104 \r
105                         CKEDITOR.tools.setTimeout( function()\r
106                                 {\r
107                                         this.fire( 'saveSnapshot' );\r
108                                 }, 0, this );\r
109                 }\r
110         }\r
111 \r
112         function onInsertElement( evt )\r
113         {\r
114                 if ( this.mode == 'wysiwyg' )\r
115                 {\r
116                         this.focus();\r
117 \r
118                         var selection = this.getSelection();\r
119                         if ( checkReadOnly( selection ) )\r
120                                 return;\r
121 \r
122                         this.fire( 'saveSnapshot' );\r
123 \r
124                         var ranges = selection.getRanges(),\r
125                                 element = evt.data,\r
126                                 elementName = element.getName(),\r
127                                 isBlock = CKEDITOR.dtd.$block[ elementName ];\r
128 \r
129                         var selIsLocked = selection.isLocked;\r
130 \r
131                         if ( selIsLocked )\r
132                                 selection.unlock();\r
133 \r
134                         var range, clone, lastElement, bookmark;\r
135 \r
136                         for ( var i = ranges.length - 1 ; i >= 0 ; i-- )\r
137                         {\r
138                                 range = ranges[ i ];\r
139 \r
140                                 // Remove the original contents.\r
141                                 range.deleteContents();\r
142 \r
143                                 clone = !i && element || element.clone( 1 );\r
144 \r
145                                 // If we're inserting a block at dtd-violated position, split\r
146                                 // the parent blocks until we reach blockLimit.\r
147                                 var current, dtd;\r
148                                 if ( isBlock )\r
149                                 {\r
150                                         while ( ( current = range.getCommonAncestor( 0, 1 ) )\r
151                                                         && ( dtd = CKEDITOR.dtd[ current.getName() ] )\r
152                                                         && !( dtd && dtd [ elementName ] ) )\r
153                                         {\r
154                                                 // Split up inline elements.\r
155                                                 if ( current.getName() in CKEDITOR.dtd.span )\r
156                                                         range.splitElement( current );\r
157                                                 // If we're in an empty block which indicate a new paragraph,\r
158                                                 // simply replace it with the inserting block.(#3664)\r
159                                                 else if ( range.checkStartOfBlock()\r
160                                                          && range.checkEndOfBlock() )\r
161                                                 {\r
162                                                         range.setStartBefore( current );\r
163                                                         range.collapse( true );\r
164                                                         current.remove();\r
165                                                 }\r
166                                                 else\r
167                                                         range.splitBlock();\r
168                                         }\r
169                                 }\r
170 \r
171                                 // Insert the new node.\r
172                                 range.insertNode( clone );\r
173 \r
174                                 // Save the last element reference so we can make the\r
175                                 // selection later.\r
176                                 if ( !lastElement )\r
177                                         lastElement = clone;\r
178                         }\r
179 \r
180                         range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END );\r
181 \r
182                         // If we're inserting a block element immediatelly followed by\r
183                         // another block element, the selection must move there. (#3100,#5436)\r
184                         if ( isBlock )\r
185                         {\r
186                                 var next = lastElement.getNext( notWhitespaceEval ),\r
187                                         nextName = next && next.type == CKEDITOR.NODE_ELEMENT && next.getName();\r
188 \r
189                                 // Check if it's a block element that accepts text.\r
190                                 if ( nextName && CKEDITOR.dtd.$block[ nextName ] && CKEDITOR.dtd[ nextName ]['#'] )\r
191                                         range.moveToElementEditStart( next );\r
192                         }\r
193 \r
194                         selection.selectRanges( [ range ] );\r
195 \r
196                         if ( selIsLocked )\r
197                                 this.getSelection().lock();\r
198 \r
199                         // Save snaps after the whole execution completed.\r
200                         // This's a workaround for make DOM modification's happened after\r
201                         // 'insertElement' to be included either, e.g. Form-based dialogs' 'commitContents'\r
202                         // call.\r
203                         CKEDITOR.tools.setTimeout( function(){\r
204                                 this.fire( 'saveSnapshot' );\r
205                         }, 0, this );\r
206                 }\r
207         }\r
208 \r
209         // DOM modification here should not bother dirty flag.(#4385)\r
210         function restoreDirty( editor )\r
211         {\r
212                 if ( !editor.checkDirty() )\r
213                         setTimeout( function(){ editor.resetDirty(); }, 0 );\r
214         }\r
215 \r
216         var isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ),\r
217                 isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true );\r
218 \r
219         function isNotEmpty( node )\r
220         {\r
221                 return isNotWhitespace( node ) && isNotBookmark( node );\r
222         }\r
223 \r
224         function isNbsp( node )\r
225         {\r
226                 return node.type == CKEDITOR.NODE_TEXT\r
227                            && CKEDITOR.tools.trim( node.getText() ).match( /^(?:&nbsp;|\xa0)$/ );\r
228         }\r
229 \r
230         function restoreSelection( selection )\r
231         {\r
232                 if ( selection.isLocked )\r
233                 {\r
234                         selection.unlock();\r
235                         setTimeout( function() { selection.lock(); }, 0 );\r
236                 }\r
237         }\r
238 \r
239         function isBlankParagraph( block )\r
240         {\r
241                 return block.getOuterHtml().match( emptyParagraphRegexp );\r
242         }\r
243 \r
244         isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true );\r
245 \r
246         // Gecko need a key event to 'wake up' the editing\r
247         // ability when document is empty.(#3864, #5781)\r
248         function activateEditing( editor )\r
249         {\r
250                 var win = editor.window,\r
251                         doc = editor.document,\r
252                         body = editor.document.getBody(),\r
253                         bodyChildsNum = body.getChildren().count();\r
254 \r
255                 if ( !bodyChildsNum || ( bodyChildsNum == 1&& body.getFirst().hasAttribute( '_moz_editor_bogus_node' ) ) )\r
256                 {\r
257                         restoreDirty( editor );\r
258 \r
259                         // Memorize scroll position to restore it later (#4472).\r
260                         var hostDocument = editor.element.getDocument();\r
261                         var hostDocumentElement = hostDocument.getDocumentElement();\r
262                         var scrollTop = hostDocumentElement.$.scrollTop;\r
263                         var scrollLeft = hostDocumentElement.$.scrollLeft;\r
264 \r
265                         // Simulating keyboard character input by dispatching a keydown of white-space text.\r
266                         var keyEventSimulate = doc.$.createEvent( "KeyEvents" );\r
267                         keyEventSimulate.initKeyEvent( 'keypress', true, true, win.$, false,\r
268                                 false, false, false, 0, 32 );\r
269                         doc.$.dispatchEvent( keyEventSimulate );\r
270 \r
271                         if ( scrollTop != hostDocumentElement.$.scrollTop || scrollLeft != hostDocumentElement.$.scrollLeft )\r
272                                 hostDocument.getWindow().$.scrollTo( scrollLeft, scrollTop );\r
273 \r
274                         // Restore the original document status by placing the cursor before a bogus br created (#5021).\r
275                         bodyChildsNum && body.getFirst().remove();\r
276                         doc.getBody().appendBogus();\r
277                         var nativeRange = new CKEDITOR.dom.range( doc );\r
278                         nativeRange.setStartAt( body , CKEDITOR.POSITION_AFTER_START );\r
279                         nativeRange.select();\r
280                 }\r
281         }\r
282 \r
283         /**\r
284          *  Auto-fixing block-less content by wrapping paragraph (#3190), prevent\r
285          *  non-exitable-block by padding extra br.(#3189)\r
286          */\r
287         function onSelectionChangeFixBody( evt )\r
288         {\r
289                 var editor = evt.editor,\r
290                         path = evt.data.path,\r
291                         blockLimit = path.blockLimit,\r
292                         selection = evt.data.selection,\r
293                         range = selection.getRanges()[0],\r
294                         body = editor.document.getBody(),\r
295                         enterMode = editor.config.enterMode;\r
296 \r
297                 CKEDITOR.env.gecko && activateEditing( editor );\r
298 \r
299                 // When enterMode set to block, we'll establing new paragraph only if we're\r
300                 // selecting inline contents right under body. (#3657)\r
301                 if ( enterMode != CKEDITOR.ENTER_BR\r
302                      && range.collapsed\r
303                          && blockLimit.getName() == 'body'\r
304                          && !path.block )\r
305                 {\r
306                         editor.fire( 'updateSnapshot' );\r
307                         restoreDirty( editor );\r
308                         CKEDITOR.env.ie && restoreSelection( selection );\r
309 \r
310                         var fixedBlock = range.fixBlock( true,\r
311                                         editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p'  );\r
312 \r
313                         // For IE, we should remove any filler node which was introduced before.\r
314                         if ( CKEDITOR.env.ie )\r
315                         {\r
316                                 var first = fixedBlock.getFirst( isNotEmpty );\r
317                                 first && isNbsp( first ) && first.remove();\r
318                         }\r
319 \r
320                         // If the fixed block is actually blank and is already followed by an exitable blank\r
321                         // block, we should revert the fix and move into the existed one. (#3684)\r
322                         if ( isBlankParagraph( fixedBlock ) )\r
323                         {\r
324                                 var element = fixedBlock.getNext( isNotWhitespace );\r
325                                 if ( element &&\r
326                                          element.type == CKEDITOR.NODE_ELEMENT &&\r
327                                          !nonExitable( element ) )\r
328                                 {\r
329                                         range.moveToElementEditStart( element );\r
330                                         fixedBlock.remove();\r
331                                 }\r
332                                 else\r
333                                 {\r
334                                         element = fixedBlock.getPrevious( isNotWhitespace );\r
335                                         if ( element &&\r
336                                                  element.type == CKEDITOR.NODE_ELEMENT &&\r
337                                                  !nonExitable( element ) )\r
338                                         {\r
339                                                 range.moveToElementEditEnd( element );\r
340                                                 fixedBlock.remove();\r
341                                         }\r
342                                 }\r
343                         }\r
344 \r
345                         range.select();\r
346                         // Notify non-IE that selection has changed.\r
347                         if ( !CKEDITOR.env.ie )\r
348                                 editor.selectionChange();\r
349                 }\r
350 \r
351                 // All browsers are incapable to moving cursor out of certain non-exitable\r
352                 // blocks (e.g. table, list, pre) at the end of document, make this happen by\r
353                 // place a bogus node there, which would be later removed by dataprocessor.\r
354                 var walkerRange = new CKEDITOR.dom.range( editor.document ),\r
355                         walker = new CKEDITOR.dom.walker( walkerRange );\r
356                 walkerRange.selectNodeContents( body );\r
357                 walker.evaluator = function( node )\r
358                 {\r
359                         return node.type == CKEDITOR.NODE_ELEMENT && ( node.getName() in nonExitableElementNames );\r
360                 };\r
361                 walker.guard = function( node, isMoveout )\r
362                 {\r
363                         return !( ( node.type == CKEDITOR.NODE_TEXT && isNotWhitespace( node ) ) || isMoveout );\r
364                 };\r
365 \r
366                 if ( walker.previous() )\r
367                 {\r
368                         editor.fire( 'updateSnapshot' );\r
369                         restoreDirty( editor );\r
370                         CKEDITOR.env.ie && restoreSelection( selection );\r
371 \r
372                         var paddingBlock;\r
373                         if ( enterMode != CKEDITOR.ENTER_BR )\r
374                                 paddingBlock = body.append( new CKEDITOR.dom.element( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) );\r
375                         else\r
376                                 paddingBlock = body;\r
377 \r
378                         if ( !CKEDITOR.env.ie )\r
379                                 paddingBlock.appendBogus();\r
380                 }\r
381         }\r
382 \r
383         CKEDITOR.plugins.add( 'wysiwygarea',\r
384         {\r
385                 requires : [ 'editingblock' ],\r
386 \r
387                 init : function( editor )\r
388                 {\r
389                         var fixForBody = ( editor.config.enterMode != CKEDITOR.ENTER_BR )\r
390                                 ? editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' : false;\r
391 \r
392                         var frameLabel = editor.lang.editorTitle.replace( '%1', editor.name );\r
393 \r
394                         var contentDomReadyHandler;\r
395                         editor.on( 'editingBlockReady', function()\r
396                                 {\r
397                                         var mainElement,\r
398                                                 iframe,\r
399                                                 isLoadingData,\r
400                                                 isPendingFocus,\r
401                                                 frameLoaded,\r
402                                                 fireMode;\r
403 \r
404 \r
405                                         // Support for custom document.domain in IE.\r
406                                         var isCustomDomain = CKEDITOR.env.isCustomDomain();\r
407 \r
408                                         // Creates the iframe that holds the editable document.\r
409                                         var createIFrame = function( data )\r
410                                         {\r
411                                                 if ( iframe )\r
412                                                         iframe.remove();\r
413 \r
414 \r
415                                                 var srcScript =\r
416                                                         'document.open();' +\r
417 \r
418                                                         // The document domain must be set any time we\r
419                                                         // call document.open().\r
420                                                         ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +\r
421 \r
422                                                         'document.close();';\r
423 \r
424                                                 iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +\r
425                                                         ' style="width:100%;height:100%"' +\r
426                                                         ' frameBorder="0"' +\r
427                                                         ' title="' + frameLabel + '"' +\r
428                                                         // With IE, the custom domain has to be taken care at first,\r
429                                                         // for other browers, the 'src' attribute should be left empty to\r
430                                                         // trigger iframe's 'load' event.\r
431                                                         ' src="' + ( CKEDITOR.env.ie ? 'javascript:void(function(){' + encodeURIComponent( srcScript ) + '}())' : '' ) + '"' +\r
432                                                         ' tabIndex="' + ( CKEDITOR.env.webkit? -1 : editor.tabIndex ) + '"' +\r
433                                                         ' allowTransparency="true"' +\r
434                                                         '></iframe>' );\r
435 \r
436                                                 // Running inside of Firefox chrome the load event doesn't bubble like in a normal page (#5689)\r
437                                                 if ( document.location.protocol == 'chrome:' )\r
438                                                         CKEDITOR.event.useCapture = true;\r
439 \r
440                                                 // With FF, it's better to load the data on iframe.load. (#3894,#4058)\r
441                                                 iframe.on( 'load', function( ev )\r
442                                                         {\r
443                                                                 frameLoaded = 1;\r
444                                                                 ev.removeListener();\r
445 \r
446                                                                 var doc = iframe.getFrameDocument().$;\r
447 \r
448                                                                 // Don't leave any history log in IE. (#5657)\r
449                                                                 doc.open( "text/html","replace" );\r
450                                                                 doc.write( data );\r
451                                                                 doc.close();\r
452                                                         });\r
453 \r
454                                                 // Reset adjustment back to default (#5689)\r
455                                                 if ( document.location.protocol == 'chrome:' )\r
456                                                         CKEDITOR.event.useCapture = false;\r
457 \r
458                                                 // The container must be visible when creating the iframe in FF (#5956)\r
459                                                 var element = editor.element,\r
460                                                         isHidden = CKEDITOR.env.gecko && !element.isVisible(),\r
461                                                         previousStyles = {};\r
462                                                 if ( isHidden )\r
463                                                 {\r
464                                                         element.show();\r
465                                                         previousStyles = {\r
466                                                                 position : element.getStyle( 'position' ),\r
467                                                                 top : element.getStyle( 'top' )\r
468                                                         };\r
469                                                         element.setStyles( { position : 'absolute', top : '-3000px' } );\r
470                                                 }\r
471 \r
472                                                 mainElement.append( iframe );\r
473 \r
474                                                 if ( isHidden )\r
475                                                 {\r
476                                                         setTimeout( function()\r
477                                                         {\r
478                                                                 element.hide();\r
479                                                                 element.setStyles( previousStyles );\r
480                                                         }, 1000 );\r
481                                                 }\r
482                                         };\r
483 \r
484                                         // The script that launches the bootstrap logic on 'domReady', so the document\r
485                                         // is fully editable even before the editing iframe is fully loaded (#4455).\r
486                                         contentDomReadyHandler = CKEDITOR.tools.addFunction( contentDomReady );\r
487                                         var activationScript =\r
488                                                 '<script id="cke_actscrpt" type="text/javascript" cke_temp="1">' +\r
489                                                         ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +\r
490                                                         'window.parent.CKEDITOR.tools.callFunction( ' + contentDomReadyHandler + ', window );' +\r
491                                                 '</script>';\r
492 \r
493                                         // Editing area bootstrap code.\r
494                                         function contentDomReady( domWindow )\r
495                                         {\r
496                                                 if ( !frameLoaded )\r
497                                                         return;\r
498                                                 frameLoaded = 0;\r
499 \r
500                                                 editor.fire( 'ariaWidget', iframe );\r
501 \r
502                                                 var domDocument = domWindow.document,\r
503                                                         body = domDocument.body;\r
504 \r
505                                                 // Remove this script from the DOM.\r
506                                                 var script = domDocument.getElementById( "cke_actscrpt" );\r
507                                                 script.parentNode.removeChild( script );\r
508 \r
509                                                 body.spellcheck = !editor.config.disableNativeSpellChecker;\r
510 \r
511                                                 if ( CKEDITOR.env.ie )\r
512                                                 {\r
513                                                         // Don't display the focus border.\r
514                                                         body.hideFocus = true;\r
515 \r
516                                                         // Disable and re-enable the body to avoid IE from\r
517                                                         // taking the editing focus at startup. (#141 / #523)\r
518                                                         body.disabled = true;\r
519                                                         body.contentEditable = true;\r
520                                                         body.removeAttribute( 'disabled' );\r
521                                                 }\r
522                                                 else\r
523                                                 {\r
524                                                         // Avoid opening design mode in a frame window thread,\r
525                                                         // which will cause host page scrolling.(#4397)\r
526                                                         setTimeout( function()\r
527                                                         {\r
528                                                                 // Prefer 'contentEditable' instead of 'designMode'. (#3593)\r
529                                                                 if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900\r
530                                                                                 || CKEDITOR.env.opera )\r
531                                                                         domDocument.$.body.contentEditable = true;\r
532                                                                 else if ( CKEDITOR.env.webkit )\r
533                                                                         domDocument.$.body.parentNode.contentEditable = true;\r
534                                                                 else\r
535                                                                         domDocument.$.designMode = 'on';\r
536                                                         }, 0 );\r
537                                                 }\r
538 \r
539                                                 CKEDITOR.env.gecko && CKEDITOR.tools.setTimeout( activateEditing, 0, null, editor );\r
540 \r
541                                                 domWindow       = editor.window = new CKEDITOR.dom.window( domWindow );\r
542                                                 domDocument     = editor.document       = new CKEDITOR.dom.document( domDocument );\r
543 \r
544                                                 domDocument.on( 'dblclick', function( evt )\r
545                                                 {\r
546                                                         var element = evt.data.getTarget(),\r
547                                                                 data = { element : element, dialog : '' };\r
548                                                         editor.fire( 'doubleclick', data );\r
549                                                         data.dialog && editor.openDialog( data.dialog );\r
550                                                 });\r
551 \r
552                                                 // Gecko/Webkit need some help when selecting control type elements. (#3448)\r
553                                                 if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera ) )\r
554                                                 {\r
555                                                         domDocument.on( 'mousedown', function( ev )\r
556                                                         {\r
557                                                                 var control = ev.data.getTarget();\r
558                                                                 if ( control.is( 'img', 'hr', 'input', 'textarea', 'select' ) )\r
559                                                                         editor.getSelection().selectElement( control );\r
560                                                         } );\r
561                                                 }\r
562 \r
563                                                 if ( CKEDITOR.env.gecko )\r
564                                                 {\r
565                                                         domDocument.on( 'mouseup', function( ev )\r
566                                                         {\r
567                                                                 if ( ev.data.$.button == 2 )\r
568                                                                 {\r
569                                                                         var target = ev.data.getTarget();\r
570 \r
571                                                                         // Prevent right click from selecting an empty block even\r
572                                                                         // when selection is anchored inside it. (#5845)\r
573                                                                         if ( !target.getOuterHtml().replace( emptyParagraphRegexp, '' ) )\r
574                                                                         {\r
575                                                                                 var range = new CKEDITOR.dom.range( domDocument );\r
576                                                                                 range.moveToElementEditStart( target );\r
577                                                                                 range.select( true );\r
578                                                                         }\r
579                                                                 }\r
580                                                         } );\r
581                                                 }\r
582 \r
583                                                 // Prevent the browser opening links in read-only blocks. (#6032)\r
584                                                 domDocument.on( 'click', function( ev )\r
585                                                         {\r
586                                                                 ev = ev.data;\r
587                                                                 if ( ev.getTarget().is( 'a' ) && ev.$.button != 2 )\r
588                                                                         ev.preventDefault();\r
589                                                         });\r
590 \r
591                                                 // Webkit: avoid from editing form control elements content.\r
592                                                 if ( CKEDITOR.env.webkit )\r
593                                                 {\r
594                                                         // Prevent from tick checkbox/radiobox/select\r
595                                                         domDocument.on( 'click', function( ev )\r
596                                                         {\r
597                                                                 if ( ev.data.getTarget().is( 'input', 'select' ) )\r
598                                                                         ev.data.preventDefault();\r
599                                                         } );\r
600 \r
601                                                         // Prevent from editig textfield/textarea value.\r
602                                                         domDocument.on( 'mouseup', function( ev )\r
603                                                         {\r
604                                                                 if ( ev.data.getTarget().is( 'input', 'textarea' ) )\r
605                                                                         ev.data.preventDefault();\r
606                                                         } );\r
607                                                 }\r
608 \r
609                                                 // IE standard compliant in editing frame doesn't focus the editor when\r
610                                                 // clicking outside actual content, manually apply the focus. (#1659)\r
611                                                 if ( CKEDITOR.env.ie\r
612                                                         && domDocument.$.compatMode == 'CSS1Compat'\r
613                                                                 || CKEDITOR.env.gecko\r
614                                                                 || CKEDITOR.env.opera )\r
615                                                 {\r
616                                                         var htmlElement = domDocument.getDocumentElement();\r
617                                                         htmlElement.on( 'mousedown', function( evt )\r
618                                                         {\r
619                                                                 // Setting focus directly on editor doesn't work, we\r
620                                                                 // have to use here a temporary element to 'redirect'\r
621                                                                 // the focus.\r
622                                                                 if ( evt.data.getTarget().equals( htmlElement ) )\r
623                                                                 {\r
624                                                                         if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 )\r
625                                                                                 blinkCursor();\r
626                                                                         focusGrabber.focus();\r
627                                                                 }\r
628                                                         } );\r
629                                                 }\r
630 \r
631                                                 domWindow.on( 'blur', function()\r
632                                                         {\r
633                                                                 editor.focusManager.blur();\r
634                                                         });\r
635 \r
636                                                 var wasFocused;\r
637 \r
638                                                 domWindow.on( 'focus', function()\r
639                                                         {\r
640                                                                 var doc = editor.document;\r
641 \r
642                                                                 if ( CKEDITOR.env.gecko && CKEDITOR.env.version >= 10900 )\r
643                                                                         blinkCursor();\r
644                                                                 else if ( CKEDITOR.env.opera )\r
645                                                                         doc.getBody().focus();\r
646                                                                 // Webkit needs focus for the first time on the HTML element. (#6153)\r
647                                                                 else if ( CKEDITOR.env.webkit )\r
648                                                                 {\r
649                                                                         if ( !wasFocused )\r
650                                                                         {\r
651                                                                                 editor.document.getDocumentElement().focus();\r
652                                                                                 wasFocused = 1;\r
653                                                                         }\r
654                                                                 }\r
655 \r
656                                                                 editor.focusManager.focus();\r
657                                                         });\r
658 \r
659                                                 var keystrokeHandler = editor.keystrokeHandler;\r
660                                                 if ( keystrokeHandler )\r
661                                                         keystrokeHandler.attach( domDocument );\r
662 \r
663                                                 if ( CKEDITOR.env.ie )\r
664                                                 {\r
665                                                         domDocument.getDocumentElement().addClass( domDocument.$.compatMode );\r
666                                                         // Override keystrokes which should have deletion behavior\r
667                                                         //  on control types in IE . (#4047)\r
668                                                         domDocument.on( 'keydown', function( evt )\r
669                                                         {\r
670                                                                 var keyCode = evt.data.getKeystroke();\r
671 \r
672                                                                 // Backspace OR Delete.\r
673                                                                 if ( keyCode in { 8 : 1, 46 : 1 } )\r
674                                                                 {\r
675                                                                         var sel = editor.getSelection(),\r
676                                                                                 control = sel.getSelectedElement();\r
677 \r
678                                                                         if ( control )\r
679                                                                         {\r
680                                                                                 // Make undo snapshot.\r
681                                                                                 editor.fire( 'saveSnapshot' );\r
682 \r
683                                                                                 // Delete any element that 'hasLayout' (e.g. hr,table) in IE8 will\r
684                                                                                 // break up the selection, safely manage it here. (#4795)\r
685                                                                                 var bookmark = sel.getRanges()[ 0 ].createBookmark();\r
686                                                                                 // Remove the control manually.\r
687                                                                                 control.remove();\r
688                                                                                 sel.selectBookmarks( [ bookmark ] );\r
689 \r
690                                                                                 editor.fire( 'saveSnapshot' );\r
691 \r
692                                                                                 evt.data.preventDefault();\r
693                                                                         }\r
694                                                                 }\r
695                                                         } );\r
696 \r
697                                                         // PageUp/PageDown scrolling is broken in document\r
698                                                         // with standard doctype, manually fix it. (#4736)\r
699                                                         if ( domDocument.$.compatMode == 'CSS1Compat' )\r
700                                                         {\r
701                                                                 var pageUpDownKeys = { 33 : 1, 34 : 1 };\r
702                                                                 domDocument.on( 'keydown', function( evt )\r
703                                                                 {\r
704                                                                         if ( evt.data.getKeystroke() in pageUpDownKeys )\r
705                                                                         {\r
706                                                                                 setTimeout( function ()\r
707                                                                                 {\r
708                                                                                         editor.getSelection().scrollIntoView();\r
709                                                                                 }, 0 );\r
710                                                                         }\r
711                                                                 } );\r
712                                                         }\r
713                                                 }\r
714 \r
715                                                 // Adds the document body as a context menu target.\r
716                                                 if ( editor.contextMenu )\r
717                                                         editor.contextMenu.addTarget( domDocument, editor.config.browserContextMenuOnCtrl !== false );\r
718 \r
719                                                 setTimeout( function()\r
720                                                         {\r
721                                                                 editor.fire( 'contentDom' );\r
722 \r
723                                                                 if ( fireMode )\r
724                                                                 {\r
725                                                                         editor.mode = 'wysiwyg';\r
726                                                                         editor.fire( 'mode' );\r
727                                                                         fireMode = false;\r
728                                                                 }\r
729 \r
730                                                                 isLoadingData = false;\r
731 \r
732                                                                 if ( isPendingFocus )\r
733                                                                 {\r
734                                                                         editor.focus();\r
735                                                                         isPendingFocus = false;\r
736                                                                 }\r
737                                                                 setTimeout( function()\r
738                                                                 {\r
739                                                                         editor.fire( 'dataReady' );\r
740                                                                 }, 0 );\r
741 \r
742                                                                 // IE, Opera and Safari may not support it and throw errors.\r
743                                                                 try { editor.document.$.execCommand( 'enableObjectResizing', false, !editor.config.disableObjectResizing ) ; } catch(e) {}\r
744                                                                 try { editor.document.$.execCommand( 'enableInlineTableEditing', false, !editor.config.disableNativeTableHandles ) ; } catch(e) {}\r
745 \r
746                                                                 /*\r
747                                                                  * IE BUG: IE might have rendered the iframe with invisible contents.\r
748                                                                  * (#3623). Push some inconsequential CSS style changes to force IE to\r
749                                                                  * refresh it.\r
750                                                                  *\r
751                                                                  * Also, for some unknown reasons, short timeouts (e.g. 100ms) do not\r
752                                                                  * fix the problem. :(\r
753                                                                  */\r
754                                                                 if ( CKEDITOR.env.ie )\r
755                                                                 {\r
756                                                                         setTimeout( function()\r
757                                                                                 {\r
758                                                                                         if ( editor.document )\r
759                                                                                         {\r
760                                                                                                 var $body = editor.document.$.body;\r
761                                                                                                 $body.runtimeStyle.marginBottom = '0px';\r
762                                                                                                 $body.runtimeStyle.marginBottom = '';\r
763                                                                                         }\r
764                                                                                 }, 1000 );\r
765                                                                 }\r
766                                                         },\r
767                                                         0 );\r
768                                         }\r
769 \r
770                                         editor.addMode( 'wysiwyg',\r
771                                                 {\r
772                                                         load : function( holderElement, data, isSnapshot )\r
773                                                         {\r
774                                                                 mainElement = holderElement;\r
775 \r
776                                                                 if ( CKEDITOR.env.ie && CKEDITOR.env.quirks )\r
777                                                                         holderElement.setStyle( 'position', 'relative' );\r
778 \r
779                                                                 // The editor data "may be dirty" after this\r
780                                                                 // point.\r
781                                                                 editor.mayBeDirty = true;\r
782 \r
783                                                                 fireMode = true;\r
784 \r
785                                                                 if ( isSnapshot )\r
786                                                                         this.loadSnapshotData( data );\r
787                                                                 else\r
788                                                                         this.loadData( data );\r
789                                                         },\r
790 \r
791                                                         loadData : function( data )\r
792                                                         {\r
793                                                                 isLoadingData = true;\r
794 \r
795                                                                 var config = editor.config,\r
796                                                                         fullPage = config.fullPage,\r
797                                                                         docType = config.docType;\r
798 \r
799                                                                 // Build the additional stuff to be included into <head>.\r
800                                                                 var headExtra =\r
801                                                                         '<style type="text/css" cke_temp="1">' +\r
802                                                                                 editor._.styles.join( '\n' ) +\r
803                                                                         '</style>';\r
804 \r
805                                                                 !fullPage && ( headExtra =\r
806                                                                         CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +\r
807                                                                         headExtra );\r
808 \r
809                                                                 var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" cke_temp="1" />' : '';\r
810 \r
811                                                                 if ( fullPage )\r
812                                                                 {\r
813                                                                         // Search and sweep out the doctype declaration.\r
814                                                                         data = data.replace( /<!DOCTYPE[^>]*>/i, function( match )\r
815                                                                                 {\r
816                                                                                         editor.docType = docType = match;\r
817                                                                                         return '';\r
818                                                                                 });\r
819                                                                 }\r
820 \r
821                                                                 // Get the HTML version of the data.\r
822                                                                 if ( editor.dataProcessor )\r
823                                                                         data = editor.dataProcessor.toHtml( data, fixForBody );\r
824 \r
825                                                                 if ( fullPage )\r
826                                                                 {\r
827                                                                         // Check if the <body> tag is available.\r
828                                                                         if ( !(/<body[\s|>]/).test( data ) )\r
829                                                                                 data = '<body>' + data;\r
830 \r
831                                                                         // Check if the <html> tag is available.\r
832                                                                         if ( !(/<html[\s|>]/).test( data ) )\r
833                                                                                 data = '<html>' + data + '</html>';\r
834 \r
835                                                                         // Check if the <head> tag is available.\r
836                                                                         if ( !(/<head[\s|>]/).test( data ) )\r
837                                                                                 data = data.replace( /<html[^>]*>/, '$&<head><title></title></head>' ) ;\r
838                                                                         else if ( !(/<title[\s|>]/).test( data ) )\r
839                                                                                 data = data.replace( /<head[^>]*>/, '$&<title></title>' ) ;\r
840 \r
841                                                                         // The base must be the first tag in the HEAD, e.g. to get relative\r
842                                                                         // links on styles.\r
843                                                                         baseTag && ( data = data.replace( /<head>/, '$&' + baseTag ) );\r
844 \r
845                                                                         // Inject the extra stuff into <head>.\r
846                                                                         // Attention: do not change it before testing it well. (V2)\r
847                                                                         // This is tricky... if the head ends with <meta ... content type>,\r
848                                                                         // Firefox will break. But, it works if we place our extra stuff as\r
849                                                                         // the last elements in the HEAD.\r
850                                                                         data = data.replace( /<\/head\s*>/, headExtra + '$&' );\r
851 \r
852                                                                         // Add the DOCTYPE back to it.\r
853                                                                         data = docType + data;\r
854                                                                 }\r
855                                                                 else\r
856                                                                 {\r
857                                                                         data =\r
858                                                                                 config.docType +\r
859                                                                                 '<html dir="' + config.contentsLangDirection + '"' +\r
860                                                                                         ' lang="' + ( config.contentsLanguage || editor.langCode ) + '">' +\r
861                                                                                 '<head>' +\r
862                                                                                         '<title>' + frameLabel + '</title>' +\r
863                                                                                         baseTag +\r
864                                                                                         headExtra +\r
865                                                                                 '</head>' +\r
866                                                                                 '<body' + ( config.bodyId ? ' id="' + config.bodyId + '"' : '' ) +\r
867                                                                                                   ( config.bodyClass ? ' class="' + config.bodyClass + '"' : '' ) +\r
868                                                                                                   '>' +\r
869                                                                                         data +\r
870                                                                                 '</html>';\r
871                                                                 }\r
872 \r
873                                                                 data += activationScript;\r
874 \r
875 \r
876                                                                 // The iframe is recreated on each call of setData, so we need to clear DOM objects\r
877                                                                 this.onDispose();\r
878                                                                 createIFrame( data );\r
879                                                         },\r
880 \r
881                                                         getData : function()\r
882                                                         {\r
883                                                                 var config = editor.config,\r
884                                                                         fullPage = config.fullPage,\r
885                                                                         docType = fullPage && editor.docType,\r
886                                                                         doc = iframe.getFrameDocument();\r
887 \r
888                                                                 var data = fullPage\r
889                                                                         ? doc.getDocumentElement().getOuterHtml()\r
890                                                                         : doc.getBody().getHtml();\r
891 \r
892                                                                 if ( editor.dataProcessor )\r
893                                                                         data = editor.dataProcessor.toDataFormat( data, fixForBody );\r
894 \r
895                                                                 // Reset empty if the document contains only one empty paragraph.\r
896                                                                 if ( config.ignoreEmptyParagraph )\r
897                                                                         data = data.replace( emptyParagraphRegexp, function( match, lookback ) { return lookback; } );\r
898 \r
899                                                                 if ( docType )\r
900                                                                         data = docType + '\n' + data;\r
901 \r
902                                                                 return data;\r
903                                                         },\r
904 \r
905                                                         getSnapshotData : function()\r
906                                                         {\r
907                                                                 return iframe.getFrameDocument().getBody().getHtml();\r
908                                                         },\r
909 \r
910                                                         loadSnapshotData : function( data )\r
911                                                         {\r
912                                                                 iframe.getFrameDocument().getBody().setHtml( data );\r
913                                                         },\r
914 \r
915                                                         onDispose : function()\r
916                                                         {\r
917                                                                 if ( !editor.document )\r
918                                                                         return;\r
919 \r
920                                                                 editor.document.getDocumentElement().clearCustomData();\r
921                                                                 editor.document.getBody().clearCustomData();\r
922 \r
923                                                                 editor.window.clearCustomData();\r
924                                                                 editor.document.clearCustomData();\r
925 \r
926                                                                 iframe.clearCustomData();\r
927 \r
928                                                                 /*\r
929                                                                 * IE BUG: When destroying editor DOM with the selection remains inside\r
930                                                                 * editing area would break IE7/8's selection system, we have to put the editing\r
931                                                                 * iframe offline first. (#3812 and #5441)\r
932                                                                 */\r
933                                                                 iframe.remove();\r
934                                                         },\r
935 \r
936                                                         unload : function( holderElement )\r
937                                                         {\r
938                                                                 this.onDispose();\r
939 \r
940                                                                 editor.window = editor.document = iframe = mainElement = isPendingFocus = null;\r
941 \r
942                                                                 editor.fire( 'contentDomUnload' );\r
943                                                         },\r
944 \r
945                                                         focus : function()\r
946                                                         {\r
947                                                                 if ( isLoadingData )\r
948                                                                         isPendingFocus = true;\r
949                                                                 // Temporary solution caused by #6025, supposed be unified by #6154.\r
950                                                                 else if ( CKEDITOR.env.opera && editor.document )\r
951                                                                 {\r
952                                                                         // Required for Opera when switching focus\r
953                                                                         // from another iframe, e.g. panels. (#6444)\r
954                                                                         var iframe = editor.window.$.frameElement;\r
955                                                                         iframe.blur(), iframe.focus();\r
956                                                                         editor.document.getBody().focus();\r
957 \r
958                                                                         editor.selectionChange();\r
959                                                                 }\r
960                                                                 else if ( !CKEDITOR.env.opera && editor.window )\r
961                                                                 {\r
962                                                                         editor.window.focus();\r
963 \r
964                                                                         editor.selectionChange();\r
965                                                                 }\r
966                                                         }\r
967                                                 });\r
968 \r
969                                         editor.on( 'insertHtml', onInsertHtml, null, null, 20 );\r
970                                         editor.on( 'insertElement', onInsertElement, null, null, 20 );\r
971                                         // Auto fixing on some document structure weakness to enhance usabilities. (#3190 and #3189)\r
972                                         editor.on( 'selectionChange', onSelectionChangeFixBody, null, null, 1 );\r
973                                 });\r
974 \r
975                         var titleBackup;\r
976                         // Setting voice label as window title, backup the original one\r
977                         // and restore it before running into use.\r
978                         editor.on( 'contentDom', function()\r
979                                 {\r
980                                         var title = editor.document.getElementsByTag( 'title' ).getItem( 0 );\r
981                                         title.setAttribute( '_cke_title', editor.document.$.title );\r
982                                         editor.document.$.title = frameLabel;\r
983                                 });\r
984 \r
985                         // IE8 stricts mode doesn't have 'contentEditable' in effect\r
986                         // on element unless it has layout. (#5562)\r
987                         if ( CKEDITOR.env.ie8Compat )\r
988                         {\r
989                                 editor.addCss( 'html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}' );\r
990 \r
991                                 var selectors = [];\r
992                                 for ( var tag in CKEDITOR.dtd.$removeEmpty )\r
993                                         selectors.push( 'html.CSS1Compat ' + tag + '[contenteditable=false]' );\r
994                                 editor.addCss( selectors.join( ',' ) + '{ display:inline-block;}' );\r
995                         }\r
996                         // Set the HTML style to 100% to have the text cursor in affect (#6341)\r
997                         else if ( CKEDITOR.env.gecko )\r
998                                 editor.addCss( 'html { height: 100% !important; }' );\r
999 \r
1000                         // Switch on design mode for a short while and close it after then.\r
1001                         function blinkCursor( retry )\r
1002                         {\r
1003                                 CKEDITOR.tools.tryThese(\r
1004                                         function()\r
1005                                         {\r
1006                                                 editor.document.$.designMode = 'on';\r
1007                                                 setTimeout( function()\r
1008                                                 {\r
1009                                                         editor.document.$.designMode = 'off';\r
1010                                                         if ( CKEDITOR.currentInstance == editor )\r
1011                                                                 editor.document.getBody().focus();\r
1012                                                 }, 50 );\r
1013                                         },\r
1014                                         function()\r
1015                                         {\r
1016                                                 // The above call is known to fail when parent DOM\r
1017                                                 // tree layout changes may break design mode. (#5782)\r
1018                                                 // Refresh the 'contentEditable' is a cue to this.\r
1019                                                 editor.document.$.designMode = 'off';\r
1020                                                 var body = editor.document.getBody();\r
1021                                                 body.setAttribute( 'contentEditable', false );\r
1022                                                 body.setAttribute( 'contentEditable', true );\r
1023                                                 // Try it again once..\r
1024                                                 !retry && blinkCursor( 1 );\r
1025                                         });\r
1026                         }\r
1027 \r
1028                         // Create an invisible element to grab focus.\r
1029                         if ( CKEDITOR.env.gecko || CKEDITOR.env.ie || CKEDITOR.env.opera )\r
1030                         {\r
1031                                 var focusGrabber;\r
1032                                 editor.on( 'uiReady', function()\r
1033                                 {\r
1034                                         focusGrabber = editor.container.append( CKEDITOR.dom.element.createFromHtml(\r
1035                                                 // Use 'span' instead of anything else to fly under the screen-reader radar. (#5049)\r
1036                                                 '<span tabindex="-1" style="position:absolute;" role="presentation"></span>' ) );\r
1037 \r
1038                                         focusGrabber.on( 'focus', function()\r
1039                                                 {\r
1040                                                         editor.focus();\r
1041                                                 } );\r
1042                                 } );\r
1043                                 editor.on( 'destroy', function()\r
1044                                 {\r
1045                                         CKEDITOR.tools.removeFunction( contentDomReadyHandler );\r
1046                                         focusGrabber.clearCustomData();\r
1047                                 } );\r
1048                         }\r
1049 \r
1050                         // Disable form elements editing mode provided by some browers. (#5746)\r
1051                         editor.on( 'insertElement', function ( evt )\r
1052                         {\r
1053                                 var element = evt.data;\r
1054                                 if ( element.type == CKEDITOR.NODE_ELEMENT\r
1055                                                 && ( element.is( 'input' ) || element.is( 'textarea' ) ) )\r
1056                                 {\r
1057                                         if ( !element.isReadOnly() )\r
1058                                         {\r
1059                                                 element.setAttribute( 'contentEditable', false );\r
1060                                                 // We should flag that the element was locked by our code so\r
1061                                                 // it'll be editable by the editor functions (#6046).\r
1062                                                 element.setCustomData( '_cke_notReadOnly', 1 );\r
1063                                         }\r
1064                                 }\r
1065                         });\r
1066 \r
1067                 }\r
1068         });\r
1069 \r
1070         // Fixing Firefox 'Back-Forward Cache' break design mode. (#4514)\r
1071         if ( CKEDITOR.env.gecko )\r
1072         {\r
1073                 (function()\r
1074                 {\r
1075                         var body = document.body;\r
1076 \r
1077                         if ( !body )\r
1078                                 window.addEventListener( 'load', arguments.callee, false );\r
1079                         else\r
1080                         {\r
1081                                 var currentHandler = body.getAttribute( 'onpageshow' );\r
1082                                 body.setAttribute( 'onpageshow', ( currentHandler ? currentHandler + ';' : '') +\r
1083                                                         'event.persisted && (function(){' +\r
1084                                                                 'var allInstances = CKEDITOR.instances, editor, doc;' +\r
1085                                                                 'for ( var i in allInstances )' +\r
1086                                                                 '{' +\r
1087                                                                 '       editor = allInstances[ i ];' +\r
1088                                                                 '       doc = editor.document;' +\r
1089                                                                 '       if ( doc )' +\r
1090                                                                 '       {' +\r
1091                                                                 '               doc.$.designMode = "off";' +\r
1092                                                                 '               doc.$.designMode = "on";' +\r
1093                                                                 '       }' +\r
1094                                                                 '}' +\r
1095                                                 '})();' );\r
1096                         }\r
1097                 } )();\r
1098 \r
1099         }\r
1100 })();\r
1101 \r
1102 /**\r
1103  * Disables the ability of resize objects (image and tables) in the editing\r
1104  * area.\r
1105  * @type Boolean\r
1106  * @default false\r
1107  * @example\r
1108  * config.disableObjectResizing = true;\r
1109  */\r
1110 CKEDITOR.config.disableObjectResizing = false;\r
1111 \r
1112 /**\r
1113  * Disables the "table tools" offered natively by the browser (currently\r
1114  * Firefox only) to make quick table editing operations, like adding or\r
1115  * deleting rows and columns.\r
1116  * @type Boolean\r
1117  * @default true\r
1118  * @example\r
1119  * config.disableNativeTableHandles = false;\r
1120  */\r
1121 CKEDITOR.config.disableNativeTableHandles = true;\r
1122 \r
1123 /**\r
1124  * Disables the built-in spell checker while typing natively available in the\r
1125  * browser (currently Firefox and Safari only).<br /><br />\r
1126  *\r
1127  * Even if word suggestions will not appear in the CKEditor context menu, this\r
1128  * feature is useful to help quickly identifying misspelled words.<br /><br />\r
1129  *\r
1130  * This setting is currently compatible with Firefox only due to limitations in\r
1131  * other browsers.\r
1132  * @type Boolean\r
1133  * @default true\r
1134  * @example\r
1135  * config.disableNativeSpellChecker = false;\r
1136  */\r
1137 CKEDITOR.config.disableNativeSpellChecker = true;\r
1138 \r
1139 /**\r
1140  * Whether the editor must output an empty value ("") if it's contents is made\r
1141  * by an empty paragraph only.\r
1142  * @type Boolean\r
1143  * @default true\r
1144  * @example\r
1145  * config.ignoreEmptyParagraph = false;\r
1146  */\r
1147 CKEDITOR.config.ignoreEmptyParagraph = true;\r
1148 \r
1149 /**\r
1150  * Fired when data is loaded and ready for retrieval in an editor instance.\r
1151  * @name CKEDITOR.editor#dataReady\r
1152  * @event\r
1153  */\r