var current, dtd;\r
if ( isBlock )\r
{\r
- while( ( current = range.getCommonAncestor( false, true ) )\r
+ while ( ( current = range.getCommonAncestor( false, true ) )\r
&& ( dtd = CKEDITOR.dtd[ current.getName() ] )\r
&& !( dtd && dtd [ elementName ] ) )\r
{\r
// DOM modification here should not bother dirty flag.(#4385)\r
function restoreDirty( editor )\r
{\r
- if( !editor.checkDirty() )\r
+ if ( !editor.checkDirty() )\r
setTimeout( function(){ editor.resetDirty(); } );\r
}\r
\r
\r
// If the fixed block is blank and already followed by a exitable\r
// block, we should revert the fix. (#3684)\r
- if( fixedBlock.getOuterHtml().match( emptyParagraphRegexp ) )\r
+ if ( fixedBlock.getOuterHtml().match( emptyParagraphRegexp ) )\r
{\r
var previousElement = fixedBlock.getPrevious( isNotWhitespace ),\r
nextElement = fixedBlock.getNext( isNotWhitespace );\r
\r
range.select();\r
// Notify non-IE that selection has changed.\r
- if( !CKEDITOR.env.ie )\r
+ if ( !CKEDITOR.env.ie )\r
editor.selectionChange();\r
}\r
\r
if ( lastNode && lastNode.getName && ( lastNode.getName() in nonExitableElementNames ) )\r
{\r
restoreDirty( editor );\r
- if( !CKEDITOR.env.ie )\r
+ if ( !CKEDITOR.env.ie )\r
body.appendBogus();\r
else\r
body.append( editor.document.createText( '\xa0' ) );\r
iframe = CKEDITOR.dom.element.createFromHtml( '<iframe' +\r
' style="width:100%;height:100%"' +\r
' frameBorder="0"' +\r
- // Support for custom document.domain in IE.\r
- ( isCustomDomain ?\r
+ ( !CKEDITOR.env.webkit ?\r
+ // Support for custom document.domain in IE.\r
' src="javascript:void((function(){' +\r
- 'document.open();' +\r
- 'document.domain=\'' + document.domain + '\';' +\r
- 'document.close();' +\r
+ 'document.open();' + // To avoid HTTPS warnings.\r
+ ( isCustomDomain ?\r
+ 'document.domain=\'' + document.domain + '\';' : '' ) +\r
+ 'document.close();' +\r
'})())"' : '' ) +\r
' tabIndex="-1"' +\r
' allowTransparency="true"' +\r
// The script that launches the bootstrap logic on 'domReady', so the document\r
// is fully editable even before the editing iframe is fully loaded (#4455).\r
var activationScript =\r
- '<script id="cke_actscrpt" type="text/javascript">' +\r
+ '<script id="cke_actscrpt" type="text/javascript" cke_temp="1">' +\r
'window.parent.CKEDITOR._["contentDomReady' + editor.name + '"]( window );' +\r
'</script>';\r
\r
\r
// IE standard compliant in editing frame doesn't focus the editor when\r
// clicking outside actual content, manually apply the focus. (#1659)\r
- if( CKEDITOR.env.ie\r
+ if ( CKEDITOR.env.ie\r
&& domDocument.$.compatMode == 'CSS1Compat' )\r
{\r
var htmlElement = domDocument.getDocumentElement();\r
if ( CKEDITOR.env.gecko )\r
{\r
var first = body;\r
- while( first.firstChild )\r
+ while ( first.firstChild )\r
first = first.firstChild;\r
\r
- if( !first.nextSibling\r
+ if ( !first.nextSibling\r
&& ( 'BR' == first.tagName )\r
&& first.hasAttribute( '_moz_editor_bogus_node' ) )\r
{\r
\r
if ( CKEDITOR.env.ie )\r
{\r
- // Cancel default action for backspace in IE on control types. (#4047)\r
+ // Override keystrokes which should have deletion behavior\r
+ // on control types in IE . (#4047)\r
domDocument.on( 'keydown', function( evt )\r
{\r
- // Backspace.\r
- var control = evt.data.getKeystroke() == 8\r
- && editor.getSelection().getSelectedElement();\r
- if ( control )\r
+ var keyCode = evt.data.getKeystroke();\r
+\r
+ // Backspace OR Delete.\r
+ if ( keyCode in { 8 : 1, 46 : 1 } )\r
{\r
- // Make undo snapshot.\r
- editor.fire( 'saveSnapshot' );\r
- // Remove manually.\r
- control.remove();\r
- editor.fire( 'saveSnapshot' );\r
- evt.cancel();\r
+ var sel = editor.getSelection(),\r
+ control = sel.getSelectedElement();\r
+\r
+ if ( control )\r
+ {\r
+ // Make undo snapshot.\r
+ editor.fire( 'saveSnapshot' );\r
+\r
+ // Delete any element that 'hasLayout' (e.g. hr,table) in IE8 will\r
+ // break up the selection, safely manage it here. (#4795)\r
+ var bookmark = sel.getRanges()[ 0 ].createBookmark();\r
+ // Remove the control manually.\r
+ control.remove();\r
+ sel.selectBookmarks( [ bookmark ] );\r
+\r
+ editor.fire( 'saveSnapshot' );\r
+\r
+ evt.data.preventDefault();\r
+ }\r
}\r
} );\r
\r
// PageUp/PageDown scrolling is broken in document\r
// with standard doctype, manually fix it. (#4736)\r
- if( domDocument.$.compatMode == 'CSS1Compat' )\r
+ if ( domDocument.$.compatMode == 'CSS1Compat' )\r
{\r
var pageUpDownKeys = { 33 : 1, 34 : 1 };\r
domDocument.on( 'keydown', function( evt )\r
{\r
- if( evt.data.getKeystroke() in pageUpDownKeys )\r
+ if ( evt.data.getKeystroke() in pageUpDownKeys )\r
{\r
setTimeout( function ()\r
{\r
});\r
\r
// Create an invisible element to grab focus.\r
- if( CKEDITOR.env.ie )\r
+ if ( CKEDITOR.env.ie )\r
{\r
var ieFocusGrabber;\r
editor.on( 'uiReady', function()\r
});\r
\r
// Fixing Firefox 'Back-Forward Cache' break design mode. (#4514)\r
- if( CKEDITOR.env.gecko )\r
+ if ( CKEDITOR.env.gecko )\r
{\r
- var topWin = window.top;\r
-\r
( function ()\r
{\r
- var topBody = topWin.document.body;\r
+ var body = document.body;\r
\r
- if( !topBody )\r
- topWin.addEventListener( 'load', arguments.callee, false );\r
+ if ( !body )\r
+ window.addEventListener( 'load', arguments.callee, false );\r
else\r
{\r
- topBody.setAttribute( 'onpageshow', topBody.getAttribute( 'onpageshow' )\r
+ body.setAttribute( 'onpageshow', body.getAttribute( 'onpageshow' )\r
+ ';event.persisted && CKEDITOR.tools.callFunction(' +\r
CKEDITOR.tools.addFunction( function()\r
{\r
var allInstances = CKEDITOR.instances,\r
editor,\r
doc;\r
- for( var i in allInstances )\r
+ for ( var i in allInstances )\r
{\r
editor = allInstances[ i ];\r
doc = editor.document;\r
- if( doc )\r
+ if ( doc )\r
{\r
doc.$.designMode = 'off';\r
doc.$.designMode = 'on';\r
* config.ignoreEmptyParagraph = false;\r
*/\r
CKEDITOR.config.ignoreEmptyParagraph = true;\r
+\r
+/**\r
+ * Fired when data is loaded and ready for retrieval in an editor instance.\r
+ * @name CKEDITOR.editor#dataReady\r
+ * @event\r
+ */\r