Ticket #3224: 3224.patch

File 3224.patch, 9.6 KB (added by Martin Kou, 15 years ago)
  • _source/lang/en.js

     
    3131         * Screenreader titles. Please note that screenreaders are not always capable
    3232         * of reading non-English words. So be careful while translating it.
    3333         */
    34         editorTitle             : 'Rich text editor, %1',
     34        screenreader    :
     35        {
     36                editorTitle             : 'Rich text editor, %1',
     37                dialogOpened    : '%1 dialog opened. Press Insert+Escape to refresh screen contents.',
     38                dialogClosed    : '%1 dialog closed. Press Insert+Escape to refresh screen contents.'
     39        },
    3540
    3641        // Toolbar buttons without dialogs.
    3742        source                  : 'Source',
  • _source/plugins/wysiwygarea/plugin.js

     
    9696
    9797                init : function( editor )
    9898                {
     99                        var screenreader = editor.lang.screenreader;
     100
    99101                        editor.on( 'editingBlockReady', function()
    100102                                {
    101103                                        var mainElement,
     
    154156                                                        mainElement.setAttributes(
    155157                                                                {
    156158                                                                        role : 'region',
    157                                                                         title : editor.lang.editorTitle.replace( '%1', editor.name ) + '. Type in text.'
     159                                                                        title : screenreader.editorTitle.replace( '%1', editor.name ) + '. Type in text.'
    158160                                                                } );
    159161                                                        iframe.setAttributes(
    160162                                                                {
     
    171173                                                                'top' : '-1000000px',
    172174                                                                left : '-1000000px'
    173175                                                        } );
    174                                                         label.append( CKEDITOR.document.createText( editor.lang.editorTitle.replace( '%1', editor.name ) ) );
     176                                                        label.append( CKEDITOR.document.createText( screenreader.editorTitle.replace( '%1', editor.name ) ) );
    175177                                                        label.insertBefore( iframe );
    176178                                                }
    177179                                        };
  • _source/plugins/dialog/plugin.js

     
    648648                 */
    649649                hide : function()
    650650                {
    651                         this.fire( 'hide', {} );
     651                        var hide = CKEDITOR.tools.bind( function()
     652                        {
     653                                this.fire( 'hide', {} );
    652654
    653                         // Remove the dialog's element from the root document.
    654                         var element = this._.element;
    655                         if ( !element.getParent() )
    656                                 return;
    657                         element.remove();
     655                                // Remove the dialog's element from the root document.
     656                                var element = this._.element;
     657                                if ( !element.getParent() )
     658                                        return;
     659                                element.remove();
    658660
    659                         // Unregister all access keys associated with this dialog.
    660                         unregisterAccessKey( this );
     661                                // Unregister all access keys associated with this dialog.
     662                                unregisterAccessKey( this );
    661663
    662                         // Maintain dialog ordering and remove cover if needed.
    663                         if ( !this._.parentDialog )
    664                                 removeCover();
    665                         else
    666                         {
    667                                 var parentElement = this._.parentDialog.getElement().getFirst();
    668                                 parentElement.setStyle( 'z-index', parseInt( parentElement.$.style.zIndex, 10 ) + Math.floor( this._.editor.config.baseFloatZIndex / 2 ) );
    669                         }
    670                         CKEDITOR.dialog._.currentTop = this._.parentDialog;
     664                                // Maintain dialog ordering and remove cover if needed.
     665                                if ( !this._.parentDialog )
     666                                        removeCover();
     667                                else
     668                                {
     669                                        var parentElement = this._.parentDialog.getElement().getFirst();
     670                                        parentElement.setStyle( 'z-index', parseInt( parentElement.$.style.zIndex, 10 ) +
     671                                                        Math.floor( this._.editor.config.baseFloatZIndex / 2 ) );
     672                                }
     673                                CKEDITOR.dialog._.currentTop = this._.parentDialog;
    671674
    672                         // Deduct or clear the z-index.
    673                         if ( !this._.parentDialog )
    674                         {
    675                                 CKEDITOR.dialog._.currentZIndex = null;
     675                                // Deduct or clear the z-index.
     676                                if ( !this._.parentDialog )
     677                                {
     678                                        CKEDITOR.dialog._.currentZIndex = null;
    676679
    677                                 // Remove access key handlers.
    678                                 CKEDITOR.document.removeListener( 'keydown', accessKeyDownHandler );
    679                                 CKEDITOR.document.removeListener( 'keyup', accessKeyUpHandler );
     680                                        // Remove access key handlers.
     681                                        CKEDITOR.document.removeListener( 'keydown', accessKeyDownHandler );
     682                                        CKEDITOR.document.removeListener( 'keyup', accessKeyUpHandler );
    680683
    681                                 // Restore focus and (if not already restored) selection in the editing area.
    682                                 this.restoreSelection();
    683                                 this._.editor.focus();
    684                         }
    685                         else
    686                                 CKEDITOR.dialog._.currentZIndex -= 10;
     684                                        // Restore focus and (if not already restored) selection in the editing area.
     685                                        this.restoreSelection();
     686                                        this._.editor.focus();
     687                                }
     688                                else
     689                                        CKEDITOR.dialog._.currentZIndex -= 10;
    687690
    688691
    689                         // Reset the initial values of the dialog.
    690                         this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } );
     692                                // Reset the initial values of the dialog.
     693                                this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } );
     694                        }, this );
     695
     696                        // If the screenreader plugin is loaded, then read a label before closing.
     697                        // Otherwise - just open the dialog right away.
     698                        if ( this._.editor.announce )
     699                                this._.editor.announce( 'dialogClosed', hide, this.definition.title );
     700                        else
     701                                hide();
    691702                },
    692703
    693704                /**
     
    26062617                                var dialog = storedDialogs[ dialogName ] ||
    26072618                                        ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );
    26082619
    2609                                 dialog.show();
     2620                                // If the screenreader plugin is loaded, then read a label before opening.
     2621                                // Otherwise - just open the dialog right away.
     2622                                if ( this.announce )
     2623                                {
     2624                                        this.announce( 'dialogOpened', function()
     2625                                                {
     2626                                                        dialog.show();
     2627                                                }, dialog.definition.title );
     2628                                }
     2629                                else
     2630                                        dialog.show();
    26102631
    26112632                                return dialog;
    26122633                        }
  • _source/plugins/screenreader/plugin.js

     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6(function()
     7{
     8        var screenreaderLabels = [ 'dialogOpened', 'dialogClosed' ];
     9        CKEDITOR.plugins.add( 'screenreader',
     10        {
     11                init : function( editor )
     12                {
     13                        var lang = editor.lang.screenreader;
     14                        editor._.screenreaderLabels = {};
     15
     16                        // Insert hidden links in the editor container for screenreader.
     17                        var cssPosition = CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed';
     18                        for ( var i = 0 ; i < screenreaderLabels.length ; i++ )
     19                        {
     20                                var link = editor._.screenreaderLabels[ screenreaderLabels[ i ] ] =
     21                                        CKEDITOR.dom.element.createFromHtml(
     22                                                [
     23                                                        '<a style="position:', cssPosition,
     24                                                        ';width:1px;height:1px;left:-1000000px;right:-1000000px',
     25                                                        ';outline:none;background:transparent;overflow:hidden"',
     26                                                        ' hideFocus="true"',
     27                                                        ' href="javascript:void(0)">',
     28                                                        CKEDITOR.tools.htmlEncode( lang[ screenreaderLabels[ i ] ] ),
     29                                                        '</a>'
     30                                                ].join( '' ), CKEDITOR.document );
     31                                link.appendTo( CKEDITOR.document.getBody() );
     32                        }
     33                }
     34        } );
     35
     36        CKEDITOR.editor.prototype.announce = function( entryId, callback )
     37        {
     38                var link = this._.screenreaderLabels[ entryId ];
     39
     40                if ( !link )
     41                        return;
     42
     43                // Prevent scrolling by moving the 1-pixel link to the top left of view pane.
     44                if ( link.$.style.position == 'fixed' )
     45                        link.setStyles( { left : '0px', top : '0px' } );
     46                else
     47                {
     48                        var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition();
     49                        link.setStyles( { left : scrollPosition.x + 'px', top : scrollPosition.y + 'px' } );
     50                }
     51
     52                // If there're more than 2 arguments, the 3rd, 4th, ... are used to substitue
     53                // %1, %2, etc.
     54                if ( arguments.length > 2 )
     55                {
     56                        var argList = [];
     57                        for ( var i = 2 ; i < arguments.length ; i++ )
     58                                argList.push( arguments[ i ] );
     59
     60                        var str = this.lang.screenreader[ entryId ];
     61                        str = str.replace( /%\d+/g, function( str )
     62                                {
     63                                        var index = parseInt( str.substr( 1 ), 10 ) - 1;
     64                                        return argList[ index ];
     65                                } );
     66
     67                        link.setHtml( CKEDITOR.tools.htmlEncode( str ) );
     68                }
     69
     70                // Put focus at the link so that JAWS will read it.
     71                link.focus();
     72
     73                // Execute the callback function after we're sure the text has been sent to
     74                // JAWS.
     75                setTimeout( function()
     76                        {
     77                                link.setStyles( { left : '-1000000px', top : '-1000000px' } );
     78                                callback();
     79                        }, 300 );
     80        };
     81})();
  • _source/core/config.js

     
    150150         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    151151         */
    152152
    153         plugins : 'basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,save,smiley,showblocks,sourcearea,stylescombo,table,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
     153        plugins : 'basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,save,smiley,showblocks,sourcearea,stylescombo,table,screenreader,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    154154
    155155        /**
    156156         * The editor tabindex value.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy