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