2 Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license
\r
7 * @fileOverview The "wysiwygarea" plugin. It registers the "wysiwyg" editing
\r
8 * mode, which handles the main editing area space.
\r
13 // List of elements in which has no way to move editing focus outside.
\r
14 var nonExitableElementNames = { table:1,pre:1 };
\r
16 // Matching an empty paragraph at the end of document.
\r
17 var emptyParagraphRegexp = /\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>| |\u00A0| )?\s*(:?<\/\1>)?\s*(?=$|<\/body>)/gi;
\r
19 function onInsertHtml( evt )
\r
21 if ( this.mode == 'wysiwyg' )
\r
24 this.fire( 'saveSnapshot' );
\r
26 var selection = this.getSelection(),
\r
29 if ( this.dataProcessor )
\r
30 data = this.dataProcessor.toHtml( data );
\r
32 if ( CKEDITOR.env.ie )
\r
34 var selIsLocked = selection.isLocked;
\r
39 var $sel = selection.getNative();
\r
40 if ( $sel.type == 'Control' )
\r
42 $sel.createRange().pasteHTML( data );
\r
45 this.getSelection().lock();
\r
48 this.document.$.execCommand( 'inserthtml', false, data );
\r
50 CKEDITOR.tools.setTimeout( function()
\r
52 this.fire( 'saveSnapshot' );
\r
57 function onInsertElement( evt )
\r
59 if ( this.mode == 'wysiwyg' )
\r
62 this.fire( 'saveSnapshot' );
\r
64 var element = evt.data,
\r
65 elementName = element.getName(),
\r
66 isBlock = CKEDITOR.dtd.$block[ elementName ];
\r
68 var selection = this.getSelection(),
\r
69 ranges = selection.getRanges();
\r
71 var selIsLocked = selection.isLocked;
\r
76 var range, clone, lastElement, bookmark;
\r
78 for ( var i = ranges.length - 1 ; i >= 0 ; i-- )
\r
80 range = ranges[ i ];
\r
82 // Remove the original contents.
\r
83 range.deleteContents();
\r
85 clone = !i && element || element.clone( true );
\r
87 // If we're inserting a block at dtd-violated position, split
\r
88 // the parent blocks until we reach blockLimit.
\r
92 while ( ( current = range.getCommonAncestor( false, true ) )
\r
93 && ( dtd = CKEDITOR.dtd[ current.getName() ] )
\r
94 && !( dtd && dtd [ elementName ] ) )
\r
96 // Split up inline elements.
\r
97 if ( current.getName() in CKEDITOR.dtd.span )
\r
98 range.splitElement( current );
\r
99 // If we're in an empty block which indicate a new paragraph,
\r
100 // simply replace it with the inserting block.(#3664)
\r
101 else if ( range.checkStartOfBlock()
\r
102 && range.checkEndOfBlock() )
\r
104 range.setStartBefore( current );
\r
105 range.collapse( true );
\r
109 range.splitBlock();
\r
113 // Insert the new node.
\r
114 range.insertNode( clone );
\r
116 // Save the last element reference so we can make the
\r
117 // selection later.
\r
118 if ( !lastElement )
\r
119 lastElement = clone;
\r
122 range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END );
\r
124 var next = lastElement.getNextSourceNode( true );
\r
125 if ( next && next.type == CKEDITOR.NODE_ELEMENT )
\r
126 range.moveToElementEditStart( next );
\r
128 selection.selectRanges( [ range ] );
\r
131 this.getSelection().lock();
\r
133 // Save snaps after the whole execution completed.
\r
134 // This's a workaround for make DOM modification's happened after
\r
135 // 'insertElement' to be included either, e.g. Form-based dialogs' 'commitContents'
\r
137 CKEDITOR.tools.setTimeout( function(){
\r
138 this.fire( 'saveSnapshot' );
\r
143 // DOM modification here should not bother dirty flag.(#4385)
\r
144 function restoreDirty( editor )
\r
146 if ( !editor.checkDirty() )
\r
147 setTimeout( function(){ editor.resetDirty(); } );
\r
150 var isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true ),
\r
151 isNotBookmark = CKEDITOR.dom.walker.bookmark( false, true );
\r
153 function isNotEmpty( node )
\r
155 return isNotWhitespace( node ) && isNotBookmark( node );
\r
158 function isNbsp( node )
\r
160 return node.type == CKEDITOR.NODE_TEXT
\r
161 && CKEDITOR.tools.trim( node.getText() ).match( /^(?: |\xa0)$/ );
\r
164 function restoreSelection( selection )
\r
166 if ( selection.isLocked )
\r
168 selection.unlock();
\r
169 setTimeout( function() { selection.lock(); }, 0 );
\r
173 function isBlankParagraph( block )
\r
175 return block.getOuterHtml().match( emptyParagraphRegexp );
\r
178 isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true );
\r
181 * Auto-fixing block-less content by wrapping paragraph (#3190), prevent
\r
182 * non-exitable-block by padding extra br.(#3189)
\r
184 function onSelectionChangeFixBody( evt )
\r
186 var editor = evt.editor,
\r
187 path = evt.data.path,
\r
188 blockLimit = path.blockLimit,
\r
189 selection = evt.data.selection,
\r
190 range = selection.getRanges()[0],
\r
191 body = editor.document.getBody(),
\r
192 enterMode = editor.config.enterMode;
\r
194 // When enterMode set to block, we'll establing new paragraph only if we're
\r
195 // selecting inline contents right under body. (#3657)
\r
196 if ( enterMode != CKEDITOR.ENTER_BR
\r
198 && blockLimit.getName() == 'body'
\r
201 editor.fire( 'updateSnapshot' );
\r
202 restoreDirty( editor );
\r
203 CKEDITOR.env.ie && restoreSelection( selection );
\r
205 var fixedBlock = range.fixBlock( true,
\r
206 editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' );
\r
208 // For IE, we should remove any filler node which was introduced before.
\r
209 if ( CKEDITOR.env.ie )
\r
211 var first = fixedBlock.getFirst( isNotEmpty );
\r
212 first && isNbsp( first ) && first.remove();
\r
215 // If the fixed block is actually blank and is already followed by an exitable blank
\r
216 // block, we should revert the fix and move into the existed one. (#3684)
\r
217 if ( isBlankParagraph( fixedBlock ) )
\r
219 var previousElement = fixedBlock.getPrevious( isNotWhitespace ),
\r
220 nextElement = fixedBlock.getNext( isNotWhitespace );
\r
222 if ( previousElement && previousElement.getName
\r
223 && !( previousElement.getName() in nonExitableElementNames )
\r
224 && isBlankParagraph( previousElement )
\r
225 && range.moveToElementEditStart( previousElement )
\r
226 || nextElement && nextElement.getName
\r
227 && !( nextElement.getName() in nonExitableElementNames )
\r
228 && isBlankParagraph( nextElement )
\r
229 && range.moveToElementEditStart( nextElement ) )
\r
231 fixedBlock.remove();
\r
236 // Notify non-IE that selection has changed.
\r
237 if ( !CKEDITOR.env.ie )
\r
238 editor.selectionChange();
\r
241 // All browsers are incapable to moving cursor out of certain non-exitable
\r
242 // blocks (e.g. table, list, pre) at the end of document, make this happen by
\r
243 // place a bogus node there, which would be later removed by dataprocessor.
\r
244 var walkerRange = new CKEDITOR.dom.range( editor.document ),
\r
245 walker = new CKEDITOR.dom.walker( walkerRange );
\r
246 walkerRange.selectNodeContents( body );
\r
247 walker.evaluator = function( node )
\r
249 return node.type == CKEDITOR.NODE_ELEMENT && ( node.getName() in nonExitableElementNames );
\r
251 walker.guard = function( node, isMoveout )
\r
253 return !( ( node.type == CKEDITOR.NODE_TEXT && isNotWhitespace( node ) ) || isMoveout );
\r
256 if ( walker.previous() )
\r
258 editor.fire( 'updateSnapshot' );
\r
259 restoreDirty( editor );
\r
260 CKEDITOR.env.ie && restoreSelection( selection );
\r
263 if ( enterMode != CKEDITOR.ENTER_BR )
\r
264 paddingBlock = body.append( new CKEDITOR.dom.element( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) );
\r
266 paddingBlock = body;
\r
268 if ( !CKEDITOR.env.ie )
\r
269 paddingBlock.appendBogus();
\r
273 CKEDITOR.plugins.add( 'wysiwygarea',
\r
275 requires : [ 'editingblock' ],
\r
277 init : function( editor )
\r
279 var fixForBody = ( editor.config.enterMode != CKEDITOR.ENTER_BR )
\r
280 ? editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' : false;
\r
282 var frameLabel = editor.lang.editorTitle.replace( '%1', editor.name );
\r
284 var contentDomReadyHandler;
\r
285 editor.on( 'editingBlockReady', function()
\r
295 // Support for custom document.domain in IE.
\r
296 var isCustomDomain = CKEDITOR.env.isCustomDomain();
\r
298 // Creates the iframe that holds the editable document.
\r
299 var createIFrame = function( data )
\r
306 'document.open();' +
\r
308 // The document domain must be set any time we
\r
309 // call document.open().
\r
310 ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +
\r
312 'document.close();';
\r
314 iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +
\r
315 ' style="width:100%;height:100%"' +
\r
316 ' frameBorder="0"' +
\r
317 ' title="' + frameLabel + '"' +
\r
318 // With IE, the custom domain has to be taken care at first,
\r
319 // for other browers, the 'src' attribute should be left empty to
\r
320 // trigger iframe's 'load' event.
\r
321 ' src="' + ( CKEDITOR.env.ie ? 'javascript:void(function(){' + encodeURIComponent( srcScript ) + '}())' : '' ) + '"' +
\r
322 ' tabIndex="' + editor.tabIndex + '"' +
\r
323 ' allowTransparency="true"' +
\r
326 // With FF, it's better to load the data on iframe.load. (#3894,#4058)
\r
327 iframe.on( 'load', function( ev )
\r
330 ev.removeListener();
\r
332 var doc = iframe.getFrameDocument().$;
\r
334 // Don't leave any history log in IE. (#5657)
\r
335 doc.open( "text/html","replace" );
\r
340 mainElement.append( iframe );
\r
343 // The script that launches the bootstrap logic on 'domReady', so the document
\r
344 // is fully editable even before the editing iframe is fully loaded (#4455).
\r
345 contentDomReadyHandler = CKEDITOR.tools.addFunction( contentDomReady );
\r
346 var activationScript =
\r
347 '<script id="cke_actscrpt" type="text/javascript" cke_temp="1">' +
\r
348 ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) +
\r
349 'window.parent.CKEDITOR.tools.callFunction( ' + contentDomReadyHandler + ', window );' +
\r
352 // Editing area bootstrap code.
\r
353 function contentDomReady( domWindow )
\r
355 if ( !frameLoaded )
\r
359 editor.fire( 'ariaWidget', iframe );
\r
361 var domDocument = domWindow.document,
\r
362 body = domDocument.body;
\r
364 // Remove this script from the DOM.
\r
365 var script = domDocument.getElementById( "cke_actscrpt" );
\r
366 script.parentNode.removeChild( script );
\r
368 body.spellcheck = !editor.config.disableNativeSpellChecker;
\r
370 if ( CKEDITOR.env.ie )
\r
372 // Don't display the focus border.
\r
373 body.hideFocus = true;
\r
375 // Disable and re-enable the body to avoid IE from
\r
376 // taking the editing focus at startup. (#141 / #523)
\r
377 body.disabled = true;
\r
378 body.contentEditable = true;
\r
379 body.removeAttribute( 'disabled' );
\r
383 // Gecko need a key event to 'wake up' the editing
\r
384 // ability when document is empty.(#3864)
\r
385 if ( CKEDITOR.env.gecko && !body.childNodes.length )
\r
387 setTimeout( function()
\r
389 restoreDirty( editor );
\r
391 // Simulating keyboard character input by dispatching a keydown of white-space text.
\r
392 var keyEventSimulate = domDocument.$.createEvent( "KeyEvents" );
\r
393 keyEventSimulate.initKeyEvent( 'keypress', true, true, domWindow.$, false,
\r
394 false, false, false, 0, 32 );
\r
395 domDocument.$.dispatchEvent( keyEventSimulate );
\r
397 // Restore the original document status by placing the cursor before a bogus br created (#5021).
\r
398 domDocument.createElement( 'br', { attributes: { '_moz_editor_bogus_node' : 'TRUE', '_moz_dirty' : "" } } )
\r
399 .replace( domDocument.getBody().getFirst() );
\r
400 var nativeRange = new CKEDITOR.dom.range( domDocument );
\r
401 nativeRange.setStartAt( new CKEDITOR.dom.element( body ) , CKEDITOR.POSITION_AFTER_START );
\r
402 nativeRange.select();
\r
406 domDocument.designMode = 'on';
\r
409 // IE, Opera and Safari may not support it and throw
\r
411 try { domDocument.execCommand( 'enableObjectResizing', false, !editor.config.disableObjectResizing ) ; } catch(e) {}
\r
412 try { domDocument.execCommand( 'enableInlineTableEditing', false, !editor.config.disableNativeTableHandles ) ; } catch(e) {}
\r
414 domWindow = editor.window = new CKEDITOR.dom.window( domWindow );
\r
415 domDocument = editor.document = new CKEDITOR.dom.document( domDocument );
\r
417 // Gecko/Webkit need some help when selecting control type elements. (#3448)
\r
418 if ( !( CKEDITOR.env.ie || CKEDITOR.env.opera) )
\r
420 domDocument.on( 'mousedown', function( ev )
\r
422 var control = ev.data.getTarget();
\r
423 if ( control.is( 'img', 'hr', 'input', 'textarea', 'select' ) )
\r
424 editor.getSelection().selectElement( control );
\r
428 // Webkit: avoid from editing form control elements content.
\r
429 if ( CKEDITOR.env.webkit )
\r
431 // Prevent from tick checkbox/radiobox/select
\r
432 domDocument.on( 'click', function( ev )
\r
434 if ( ev.data.getTarget().is( 'input', 'select' ) )
\r
435 ev.data.preventDefault();
\r
438 // Prevent from editig textfield/textarea value.
\r
439 domDocument.on( 'mouseup', function( ev )
\r
441 if ( ev.data.getTarget().is( 'input', 'textarea' ) )
\r
442 ev.data.preventDefault();
\r
446 // IE standard compliant in editing frame doesn't focus the editor when
\r
447 // clicking outside actual content, manually apply the focus. (#1659)
\r
448 if ( CKEDITOR.env.ie
\r
449 && domDocument.$.compatMode == 'CSS1Compat' )
\r
451 var htmlElement = domDocument.getDocumentElement();
\r
452 htmlElement.on( 'mousedown', function( evt )
\r
454 // Setting focus directly on editor doesn't work, we
\r
455 // have to use here a temporary element to 'redirect'
\r
457 if ( evt.data.getTarget().equals( htmlElement ) )
\r
458 ieFocusGrabber.focus();
\r
462 var focusTarget = ( CKEDITOR.env.ie || CKEDITOR.env.webkit ) ?
\r
463 domWindow : domDocument;
\r
465 focusTarget.on( 'blur', function()
\r
467 editor.focusManager.blur();
\r
470 focusTarget.on( 'focus', function()
\r
472 editor.focusManager.focus();
\r
475 var keystrokeHandler = editor.keystrokeHandler;
\r
476 if ( keystrokeHandler )
\r
477 keystrokeHandler.attach( domDocument );
\r
479 if ( CKEDITOR.env.ie )
\r
481 // Override keystrokes which should have deletion behavior
\r
482 // on control types in IE . (#4047)
\r
483 domDocument.on( 'keydown', function( evt )
\r
485 var keyCode = evt.data.getKeystroke();
\r
487 // Backspace OR Delete.
\r
488 if ( keyCode in { 8 : 1, 46 : 1 } )
\r
490 var sel = editor.getSelection(),
\r
491 control = sel.getSelectedElement();
\r
495 // Make undo snapshot.
\r
496 editor.fire( 'saveSnapshot' );
\r
498 // Delete any element that 'hasLayout' (e.g. hr,table) in IE8 will
\r
499 // break up the selection, safely manage it here. (#4795)
\r
500 var bookmark = sel.getRanges()[ 0 ].createBookmark();
\r
501 // Remove the control manually.
\r
503 sel.selectBookmarks( [ bookmark ] );
\r
505 editor.fire( 'saveSnapshot' );
\r
507 evt.data.preventDefault();
\r
512 // PageUp/PageDown scrolling is broken in document
\r
513 // with standard doctype, manually fix it. (#4736)
\r
514 if ( domDocument.$.compatMode == 'CSS1Compat' )
\r
516 var pageUpDownKeys = { 33 : 1, 34 : 1 };
\r
517 domDocument.on( 'keydown', function( evt )
\r
519 if ( evt.data.getKeystroke() in pageUpDownKeys )
\r
521 setTimeout( function ()
\r
523 editor.getSelection().scrollIntoView();
\r
530 // Adds the document body as a context menu target.
\r
531 if ( editor.contextMenu )
\r
532 editor.contextMenu.addTarget( domDocument, editor.config.browserContextMenuOnCtrl !== false );
\r
534 setTimeout( function()
\r
536 editor.fire( 'contentDom' );
\r
540 editor.mode = 'wysiwyg';
\r
541 editor.fire( 'mode' );
\r
545 isLoadingData = false;
\r
547 if ( isPendingFocus )
\r
550 isPendingFocus = false;
\r
552 setTimeout( function()
\r
554 editor.fire( 'dataReady' );
\r
558 * IE BUG: IE might have rendered the iframe with invisible contents.
\r
559 * (#3623). Push some inconsequential CSS style changes to force IE to
\r
562 * Also, for some unknown reasons, short timeouts (e.g. 100ms) do not
\r
563 * fix the problem. :(
\r
565 if ( CKEDITOR.env.ie )
\r
567 setTimeout( function()
\r
569 if ( editor.document )
\r
571 var $body = editor.document.$.body;
\r
572 $body.runtimeStyle.marginBottom = '0px';
\r
573 $body.runtimeStyle.marginBottom = '';
\r
581 editor.addMode( 'wysiwyg',
\r
583 load : function( holderElement, data, isSnapshot )
\r
585 mainElement = holderElement;
\r
587 if ( CKEDITOR.env.ie && CKEDITOR.env.quirks )
\r
588 holderElement.setStyle( 'position', 'relative' );
\r
590 // The editor data "may be dirty" after this
\r
592 editor.mayBeDirty = true;
\r
597 this.loadSnapshotData( data );
\r
599 this.loadData( data );
\r
602 loadData : function( data )
\r
604 isLoadingData = true;
\r
606 var config = editor.config,
\r
607 fullPage = config.fullPage,
\r
608 docType = config.docType;
\r
610 // Build the additional stuff to be included into <head>.
\r
612 '<style type="text/css" cke_temp="1">' +
\r
613 editor._.styles.join( '\n' ) +
\r
616 !fullPage && ( headExtra =
\r
617 CKEDITOR.tools.buildStyleHtml( editor.config.contentsCss ) +
\r
620 var baseTag = config.baseHref ? '<base href="' + config.baseHref + '" cke_temp="1" />' : '';
\r
624 // Search and sweep out the doctype declaration.
\r
625 data = data.replace( /<!DOCTYPE[^>]*>/i, function( match )
\r
627 editor.docType = docType = match;
\r
632 // Get the HTML version of the data.
\r
633 if ( editor.dataProcessor )
\r
634 data = editor.dataProcessor.toHtml( data, fixForBody );
\r
638 // Check if the <body> tag is available.
\r
639 if ( !(/<body[\s|>]/).test( data ) )
\r
640 data = '<body>' + data;
\r
642 // Check if the <html> tag is available.
\r
643 if ( !(/<html[\s|>]/).test( data ) )
\r
644 data = '<html>' + data + '</html>';
\r
646 // Check if the <head> tag is available.
\r
647 if ( !(/<head[\s|>]/).test( data ) )
\r
648 data = data.replace( /<html[^>]*>/, '$&<head><title></title></head>' ) ;
\r
649 else if ( !(/<title[\s|>]/).test( data ) )
\r
650 data = data.replace( /<head[^>]*>/, '$&<title></title>' ) ;
\r
652 // The base must be the first tag in the HEAD, e.g. to get relative
\r
653 // links on styles.
\r
654 baseTag && ( data = data.replace( /<head>/, '$&' + baseTag ) );
\r
656 // Inject the extra stuff into <head>.
\r
657 // Attention: do not change it before testing it well. (V2)
\r
658 // This is tricky... if the head ends with <meta ... content type>,
\r
659 // Firefox will break. But, it works if we place our extra stuff as
\r
660 // the last elements in the HEAD.
\r
661 data = data.replace( /<\/head\s*>/, headExtra + '$&' );
\r
663 // Add the DOCTYPE back to it.
\r
664 data = docType + data;
\r
670 '<html dir="' + config.contentsLangDirection + '"' +
\r
671 ' lang="' + ( config.contentsLanguage || editor.langCode ) + '">' +
\r
672 '<title>' + frameLabel + '</title>' +
\r
677 '<body' + ( config.bodyId ? ' id="' + config.bodyId + '"' : '' ) +
\r
678 ( config.bodyClass ? ' class="' + config.bodyClass + '"' : '' ) +
\r
684 data += activationScript;
\r
687 // The iframe is recreated on each call of setData, so we need to clear DOM objects
\r
689 createIFrame( data );
\r
692 getData : function()
\r
694 var config = editor.config,
\r
695 fullPage = config.fullPage,
\r
696 docType = fullPage && editor.docType,
\r
697 doc = iframe.getFrameDocument();
\r
699 var data = fullPage
\r
700 ? doc.getDocumentElement().getOuterHtml()
\r
701 : doc.getBody().getHtml();
\r
703 if ( editor.dataProcessor )
\r
704 data = editor.dataProcessor.toDataFormat( data, fixForBody );
\r
706 // Strip the last blank paragraph within document.
\r
707 if ( config.ignoreEmptyParagraph )
\r
708 data = data.replace( emptyParagraphRegexp, '' );
\r
711 data = docType + '\n' + data;
\r
716 getSnapshotData : function()
\r
718 return iframe.getFrameDocument().getBody().getHtml();
\r
721 loadSnapshotData : function( data )
\r
723 iframe.getFrameDocument().getBody().setHtml( data );
\r
726 onDispose : function()
\r
728 if ( !editor.document )
\r
731 editor.document.getDocumentElement().clearCustomData();
\r
732 editor.document.getBody().clearCustomData();
\r
734 editor.window.clearCustomData();
\r
735 editor.document.clearCustomData();
\r
737 iframe.clearCustomData();
\r
740 unload : function( holderElement )
\r
744 editor.window = editor.document = iframe = mainElement = isPendingFocus = null;
\r
746 editor.fire( 'contentDomUnload' );
\r
751 if ( isLoadingData )
\r
752 isPendingFocus = true;
\r
753 else if ( editor.window )
\r
755 editor.window.focus();
\r
756 editor.selectionChange();
\r
761 editor.on( 'insertHtml', onInsertHtml, null, null, 20 );
\r
762 editor.on( 'insertElement', onInsertElement, null, null, 20 );
\r
763 // Auto fixing on some document structure weakness to enhance usabilities. (#3190 and #3189)
\r
764 editor.on( 'selectionChange', onSelectionChangeFixBody, null, null, 1 );
\r
768 // Setting voice label as window title, backup the original one
\r
769 // and restore it before running into use.
\r
770 editor.on( 'contentDom', function ()
\r
772 var title = editor.document.getElementsByTag( 'title' ).getItem( 0 );
\r
773 title.setAttribute( '_cke_title', editor.document.$.title );
\r
774 editor.document.$.title = frameLabel;
\r
778 // Create an invisible element to grab focus.
\r
779 if ( CKEDITOR.env.ie )
\r
781 var ieFocusGrabber;
\r
782 editor.on( 'uiReady', function()
\r
784 ieFocusGrabber = editor.container.append( CKEDITOR.dom.element.createFromHtml(
\r
785 // Use 'span' instead of anything else to fly under the screen-reader radar. (#5049)
\r
786 '<span tabindex="-1" style="position:absolute; left:-10000" role="presentation"></span>' ) );
\r
788 ieFocusGrabber.on( 'focus', function()
\r
793 editor.on( 'destroy', function()
\r
795 CKEDITOR.tools.removeFunction( contentDomReadyHandler );
\r
796 ieFocusGrabber.clearCustomData();
\r
802 // Fixing Firefox 'Back-Forward Cache' break design mode. (#4514)
\r
803 if ( CKEDITOR.env.gecko )
\r
807 var body = document.body;
\r
810 window.addEventListener( 'load', arguments.callee, false );
\r
813 var currentHandler = body.getAttribute( 'onpageshow' );
\r
814 body.setAttribute( 'onpageshow', ( currentHandler ? currentHandler + ';' : '') +
\r
815 'event.persisted && (function(){' +
\r
816 'var allInstances = CKEDITOR.instances, editor, doc;' +
\r
817 'for ( var i in allInstances )' +
\r
819 ' editor = allInstances[ i ];' +
\r
820 ' doc = editor.document;' +
\r
823 ' doc.$.designMode = "off";' +
\r
824 ' doc.$.designMode = "on";' +
\r
835 * Disables the ability of resize objects (image and tables) in the editing
\r
840 * config.disableObjectResizing = true;
\r
842 CKEDITOR.config.disableObjectResizing = false;
\r
845 * Disables the "table tools" offered natively by the browser (currently
\r
846 * Firefox only) to make quick table editing operations, like adding or
\r
847 * deleting rows and columns.
\r
851 * config.disableNativeTableHandles = false;
\r
853 CKEDITOR.config.disableNativeTableHandles = true;
\r
856 * Disables the built-in spell checker while typing natively available in the
\r
857 * browser (currently Firefox and Safari only).<br /><br />
\r
859 * Even if word suggestions will not appear in the CKEditor context menu, this
\r
860 * feature is useful to help quickly identifying misspelled words.<br /><br />
\r
862 * This setting is currently compatible with Firefox only due to limitations in
\r
867 * config.disableNativeSpellChecker = false;
\r
869 CKEDITOR.config.disableNativeSpellChecker = true;
\r
872 * Whether the editor must output an empty value ("") if it's contents is made
\r
873 * by an empty paragraph only.
\r
877 * config.ignoreEmptyParagraph = false;
\r
879 CKEDITOR.config.ignoreEmptyParagraph = true;
\r
882 * Fired when data is loaded and ready for retrieval in an editor instance.
\r
883 * @name CKEDITOR.editor#dataReady
\r