X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fwysiwygarea%2Fplugin.js;h=c2566468138f0b3a44ca297bff12b4c7f1b0cfc4;hp=11fd76eb32f24108b9fcfd03ab6f95e94fb58a04;hb=059b4c2fef02528bf1af189f7996e80652faddfb;hpb=c6e377a02b54abc07129d72b632763c727476a15 diff --git a/_source/plugins/wysiwygarea/plugin.js b/_source/plugins/wysiwygarea/plugin.js index 11fd76e..c256646 100644 --- a/_source/plugins/wysiwygarea/plugin.js +++ b/_source/plugins/wysiwygarea/plugin.js @@ -241,16 +241,18 @@ For licensing, see LICENSE.html or http://ckeditor.com/license var fixForBody = ( editor.config.enterMode != CKEDITOR.ENTER_BR ) ? editor.config.enterMode == CKEDITOR.ENTER_DIV ? 'div' : 'p' : false; + var frameLabel = editor.lang.editorTitle.replace( '%1', editor.name ); + editor.on( 'editingBlockReady', function() { var mainElement, - fieldset, iframe, isLoadingData, isPendingFocus, frameLoaded, fireMode; + // Support for custom document.domain in IE. var isCustomDomain = CKEDITOR.env.isCustomDomain(); @@ -259,90 +261,59 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { if ( iframe ) iframe.remove(); - if ( fieldset ) - fieldset.remove(); frameLoaded = 0; + var setDataFn = !CKEDITOR.env.gecko && CKEDITOR.tools.addFunction( function( doc ) + { + CKEDITOR.tools.removeFunction( setDataFn ); + doc.write( data ); + }); + + var srcScript = + 'document.open();' + + + // The document domain must be set any time we + // call document.open(). + ( isCustomDomain ? ( 'document.domain="' + document.domain + '";' ) : '' ) + + + // With FF, it's better to load the data on + // iframe.load. (#3894,#4058) + // But in FF, we still need the open()-close() call + // to avoid HTTPS warnings. + ( CKEDITOR.env.gecko ? '' : ( 'parent.CKEDITOR.tools.callFunction(' + setDataFn + ',document);' ) ) + + + 'document.close();'; + iframe = CKEDITOR.dom.element.createFromHtml( '' ); - // Register onLoad event for iframe element, which - // will fill it with content and set custom domain. - iframe.on( 'load', function( e ) - { - e.removeListener(); - var doc = iframe.getFrameDocument().$; - - // Custom domain handling is needed after each document.open(). - doc.open(); - if ( isCustomDomain ) - doc.domain = document.domain; - doc.write( data ); - doc.close(); - - } ); + // With FF, it's better to load the data on iframe.load. (#3894,#4058) + CKEDITOR.env.gecko && iframe.on( 'load', function( ev ) + { + ev.removeListener(); - var accTitle = editor.lang.editorTitle.replace( '%1', editor.name ); + var doc = iframe.getFrameDocument().$; - if ( CKEDITOR.env.gecko ) - { - // Accessibility attributes for Firefox. - mainElement.setAttributes( - { - role : 'region', - title : accTitle - } ); - iframe.setAttributes( - { - role : 'region', - title : ' ' - } ); - } - else if ( CKEDITOR.env.webkit ) - { - iframe.setAttribute( 'title', accTitle ); // Safari 4 - iframe.setAttribute( 'name', accTitle ); // Safari 3 - } - else if ( CKEDITOR.env.ie ) - { - // Accessibility label for IE. - fieldset = CKEDITOR.dom.element.createFromHtml( - '
' + - '' + - CKEDITOR.tools.htmlEncode( accTitle ) + - '' + - '
' - , CKEDITOR.document ); - iframe.appendTo( fieldset ); - fieldset.appendTo( mainElement ); - } + doc.open(); + doc.write( data ); + doc.close(); + }); - if ( !CKEDITOR.env.ie ) - mainElement.append( iframe ); + mainElement.append( iframe ); }; // The script that launches the bootstrap logic on 'domReady', so the document // is fully editable even before the editing iframe is fully loaded (#4455). var activationScript = ''; // Editing area bootstrap code. @@ -350,9 +321,10 @@ For licensing, see LICENSE.html or http://ckeditor.com/license { if ( frameLoaded ) return; - frameLoaded = 1; + editor.fire( 'ariaWidget', iframe ); + var domDocument = domWindow.document, body = domDocument.body; @@ -664,6 +636,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license data = config.docType + '' + + '' + frameLabel + '' + '' + baseTag + headExtra + @@ -759,6 +732,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.on( 'selectionChange', onSelectionChangeFixBody, null, null, 1 ); }); + var titleBackup; + // Setting voice label as window title, backup the original one + // and restore it before running into use. + editor.on( 'contentDom', function () + { + var title = editor.document.getElementsByTag( 'title' ).getItem( 0 ); + title.setAttribute( '_cke_title', editor.document.$.title ); + editor.document.$.title = frameLabel; + }); + + // Create an invisible element to grab focus. if ( CKEDITOR.env.ie ) { @@ -766,7 +750,8 @@ For licensing, see LICENSE.html or http://ckeditor.com/license editor.on( 'uiReady', function() { ieFocusGrabber = editor.container.append( CKEDITOR.dom.element.createFromHtml( - '' ) ); + // Use 'span' instead of anything else to fly under the screen-reader radar. (#5049) + '' ) ); ieFocusGrabber.on( 'focus', function() {