/**\r
- * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.\r
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.\r
* For licensing, see LICENSE.md or http://ckeditor.com/license\r
*/\r
\r
*/\r
\r
( function() {\r
+ var framedWysiwyg;\r
+\r
CKEDITOR.plugins.add( 'wysiwygarea', {\r
init: function( editor ) {\r
if ( editor.config.fullPage ) {\r
// With IE, the custom domain has to be taken care at first,\r
// for other browers, the 'src' attribute should be left empty to\r
// trigger iframe's 'load' event.\r
- // Microsoft Edge throws "Permission Denied" if treated like an IE (#13441).\r
+ // Microsoft Edge throws "Permission Denied" if treated like an IE (http://dev.ckeditor.com/ticket/13441).\r
if ( CKEDITOR.env.air ) {\r
src = 'javascript:void(0)'; // jshint ignore:line\r
} else if ( CKEDITOR.env.ie && !CKEDITOR.env.edge ) {\r
body.hideFocus = true;\r
\r
// Disable and re-enable the body to avoid IE from\r
- // taking the editing focus at startup. (#141 / #523)\r
+ // taking the editing focus at startup. (http://dev.ckeditor.com/ticket/141 / http://dev.ckeditor.com/ticket/523)\r
body.disabled = true;\r
body.removeAttribute( 'disabled' );\r
}\r
\r
var editable = this;\r
\r
- // Without it IE8 has problem with removing selection in nested editable. (#13785)\r
+ // Without it IE8 has problem with removing selection in nested editable. (http://dev.ckeditor.com/ticket/13785)\r
if ( CKEDITOR.env.ie && !CKEDITOR.env.edge ) {\r
doc.getDocumentElement().addClass( doc.$.compatMode );\r
}\r
\r
- // Prevent IE/Edge from leaving a new paragraph/div after deleting all contents in body. (#6966, #13142)\r
+ // Prevent IE/Edge from leaving a new paragraph/div after deleting all contents in body. (http://dev.ckeditor.com/ticket/6966, http://dev.ckeditor.com/ticket/13142)\r
if ( CKEDITOR.env.ie && !CKEDITOR.env.edge && editor.enterMode != CKEDITOR.ENTER_P ) {\r
removeSuperfluousElement( 'p' );\r
} else if ( CKEDITOR.env.edge && editor.enterMode != CKEDITOR.ENTER_DIV ) {\r
removeSuperfluousElement( 'div' );\r
}\r
\r
- // Fix problem with cursor not appearing in Webkit and IE11+ when clicking below the body (#10945, #10906).\r
+ // Fix problem with cursor not appearing in Webkit and IE11+ when clicking below the body (http://dev.ckeditor.com/ticket/10945, http://dev.ckeditor.com/ticket/10906).\r
// Fix for older IEs (8-10 and QM) is placed inside selection.js.\r
if ( CKEDITOR.env.webkit || ( CKEDITOR.env.ie && CKEDITOR.env.version > 10 ) ) {\r
doc.getDocumentElement().on( 'mousedown', function( evt ) {\r
// PageUp OR PageDown\r
if ( keyCode == 33 || keyCode == 34 ) {\r
// PageUp/PageDown scrolling is broken in document\r
- // with standard doctype, manually fix it. (#4736)\r
+ // with standard doctype, manually fix it. (http://dev.ckeditor.com/ticket/4736)\r
if ( CKEDITOR.env.ie ) {\r
setTimeout( function() {\r
editor.getSelection().scrollIntoView();\r
// Page up/down cause editor selection to leak\r
// outside of editable thus we try to intercept\r
// the behavior, while it affects only happen\r
- // when editor contents are not overflowed. (#7955)\r
+ // when editor contents are not overflowed. (http://dev.ckeditor.com/ticket/7955)\r
else if ( editor.window.$.innerHeight > this.$.offsetHeight ) {\r
var range = editor.createRange();\r
range[ keyCode == 33 ? 'moveToElementEditStart' : 'moveToElementEditEnd' ]( this );\r
// focus is moved onto a non-editing host, e.g. link or button, but\r
// it becomes a problem for the object type selection, since the resizer\r
// handler attached on it will mark other part of the UI, especially\r
- // for the dialog. (#8157)\r
+ // for the dialog. (http://dev.ckeditor.com/ticket/8157)\r
// [IE<8 & Opera] Even worse For old IEs, the cursor will not vanish even if\r
- // the selection has been moved to another text input in some cases. (#4716)\r
+ // the selection has been moved to another text input in some cases. (http://dev.ckeditor.com/ticket/4716)\r
//\r
// Now the range restore is disabled, so we simply force IE to clean\r
// up the selection before blur.\r
this.attachListener( doc, 'blur', function() {\r
- // Error proof when the editor is not visible. (#6375)\r
+ // Error proof when the editor is not visible. (http://dev.ckeditor.com/ticket/6375)\r
try {\r
doc.$.selection.empty();\r
} catch ( er ) {}\r
\r
if ( CKEDITOR.env.iOS ) {\r
// [iOS] If touch is bound to any parent of the iframe blur happens on any touch\r
- // event and body becomes the focused element (#10714).\r
+ // event and body becomes the focused element (http://dev.ckeditor.com/ticket/10714).\r
this.attachListener( doc, 'touchend', function() {\r
win.focus();\r
} );\r
}\r
\r
var title = editor.document.getElementsByTag( 'title' ).getItem( 0 );\r
- // document.title is malfunctioning on Chrome, so get value from the element (#12402).\r
+ // document.title is malfunctioning on Chrome, so get value from the element (http://dev.ckeditor.com/ticket/12402).\r
title.data( 'cke-title', title.getText() );\r
\r
// [IE] JAWS will not recognize the aria label we used on the iframe\r
\r
// 2. On keyup remove all elements that were not marked\r
// as non-superfluous (which means they must have had appeared in the meantime).\r
+ // Also we should preserve all temporary elements inserted by editor – otherwise we'd likely\r
+ // leak fake selection's content into editable due to removing hidden selection container (http://dev.ckeditor.com/ticket/14831).\r
editable.attachListener( editable, 'keyup', function() {\r
var elements = doc.getElementsByTag( tagName );\r
if ( lockRetain ) {\r
- if ( elements.count() == 1 && !elements.getItem( 0 ).getCustomData( 'retain' ) ) {\r
+ if ( elements.count() == 1 && !elements.getItem( 0 ).getCustomData( 'retain' ) &&\r
+ !elements.getItem( 0 ).hasAttribute( 'data-cke-temp' ) ) {\r
elements.getItem( 0 ).remove( 1 );\r
}\r
lockRetain = false;\r
}\r
}\r
\r
- var framedWysiwyg = CKEDITOR.tools.createClass( {\r
+ framedWysiwyg = CKEDITOR.tools.createClass( {\r
$: function() {\r
this.base.apply( this, arguments );\r
\r
this._.frameLoadedHandler = CKEDITOR.tools.addFunction( function( win ) {\r
// Avoid opening design mode in a frame window thread,\r
- // which will cause host page scrolling.(#4397)\r
+ // which will cause host page scrolling.(http://dev.ckeditor.com/ticket/4397)\r
CKEDITOR.tools.setTimeout( onDomReady, 0, this, win );\r
}, this );\r
\r
this.fixInitialSelection();\r
\r
// Fire dataReady for the consistency with inline editors\r
- // and because it makes sense. (#10370)\r
+ // and because it makes sense. (http://dev.ckeditor.com/ticket/10370)\r
editor.fire( 'dataReady' );\r
}\r
else {\r
}\r
\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
+ // is fully editable even before the editing iframe is fully loaded (http://dev.ckeditor.com/ticket/4455).\r
var bootstrapCode =\r
'<script id="cke_actscrpt" type="text/javascript"' + ( CKEDITOR.env.ie ? ' defer="defer" ' : '' ) + '>' +\r
'var wasLoaded=0;' + // It must be always set to 0 as it remains as a window property.\r
}\r
\r
// IE<10 needs this hack to properly enable <base href="...">.\r
- // See: http://stackoverflow.com/a/13373180/1485219 (#11910).\r
+ // See: http://stackoverflow.com/a/13373180/1485219 (http://dev.ckeditor.com/ticket/11910).\r
if ( baseTag && CKEDITOR.env.ie && CKEDITOR.env.version < 10 ) {\r
bootstrapCode +=\r
'<script id="cke_basetagscrpt">' +\r
\r
var doc = this.getDocument();\r
\r
- // Work around Firefox bug - error prune when called from XUL (#320),\r
+ // Work around Firefox bug - error prune when called from XUL (http://dev.ckeditor.com/ticket/320),\r
// defer it thanks to the async nature of this method.\r
try {\r
doc.write( data );\r
\r
var data = fullPage ? doc.getDocumentElement().getOuterHtml() : doc.getBody().getHtml();\r
\r
- // BR at the end of document is bogus node for Mozilla. (#5293).\r
+ // BR at the end of document is bogus node for Mozilla. (http://dev.ckeditor.com/ticket/5293).\r
// Prevent BRs from disappearing from the end of the content\r
- // while enterMode is ENTER_BR (#10146).\r
+ // while enterMode is ENTER_BR (http://dev.ckeditor.com/ticket/10146).\r
if ( CKEDITOR.env.gecko && config.enterMode != CKEDITOR.ENTER_BR )\r
data = data.replace( /<br>(?=\s*(:?$|<\/body>))/, '' );\r
\r
onResize;\r
\r
// Trying to access window's frameElement property on Edge throws an exception\r
- // when frame was already removed from DOM. (#13850, #13790)\r
+ // when frame was already removed from DOM. (http://dev.ckeditor.com/ticket/13850, http://dev.ckeditor.com/ticket/13790)\r
try {\r
iframe = editor.window.getFrame();\r
} catch ( e ) {}\r
CKEDITOR.tools.removeFunction( this._.frameLoadedHandler );\r
\r
// On IE, iframe is returned even after remove() method is called on it.\r
- // Checking if parent is present fixes this issue. (#13850)\r
+ // Checking if parent is present fixes this issue. (http://dev.ckeditor.com/ticket/13850)\r
if ( iframe && iframe.getParent() ) {\r
iframe.clearCustomData();\r
onResize = iframe.removeCustomData( 'onResize' );\r
\r
// IE BUG: When destroying editor DOM with the selection remains inside\r
// editing area would break IE7/8's selection system, we have to put the editing\r
- // iframe offline first. (#3812 and #5441)\r
+ // iframe offline first. (http://dev.ckeditor.com/ticket/3812 and http://dev.ckeditor.com/ticket/5441)\r
iframe.remove();\r
} else {\r
CKEDITOR.warn( 'editor-destroy-iframe' );\r
var css = [];\r
\r
// IE>=8 stricts mode doesn't have 'contentEditable' in effect\r
- // on element unless it has layout. (#5562)\r
+ // on element unless it has layout. (http://dev.ckeditor.com/ticket/5562)\r
if ( CKEDITOR.document.$.documentMode >= 8 ) {\r
css.push( 'html.CSS1Compat [contenteditable=false]{min-height:0 !important}' );\r
\r
\r
css.push( selectors.join( ',' ) + '{display:inline-block}' );\r
}\r
- // Set the HTML style to 100% to have the text cursor in affect (#6341)\r
+ // Set the HTML style to 100% to have the text cursor in affect (http://dev.ckeditor.com/ticket/6341)\r
else if ( CKEDITOR.env.gecko ) {\r
css.push( 'html{height:100% !important}' );\r
css.push( 'img:-moz-broken{-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}' );\r
}\r
\r
- // #6341: The text cursor must be set on the editor area.\r
- // #6632: Avoid having "text" shape of cursor in IE7 scrollbars.\r
+ // http://dev.ckeditor.com/ticket/6341: The text cursor must be set on the editor area.\r
+ // http://dev.ckeditor.com/ticket/6632: Avoid having "text" shape of cursor in IE7 scrollbars.\r
css.push( 'html{cursor:text;*cursor:auto}' );\r
\r
// Use correct cursor for these elements\r