X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Flistblock%2Fplugin.js;h=0828ffc142e2e97a9a9dc458e001af6db0160c57;hb=refs%2Ftags%2Fv3.6.6;hp=848cc2aa99a1ec537ecd88dd89a07ee378eeacdc;hpb=059b4c2fef02528bf1af189f7996e80652faddfb;p=ckeditor.git diff --git a/_source/plugins/listblock/plugin.js b/_source/plugins/listblock/plugin.js index 848cc2a..0828ffc 100644 --- a/_source/plugins/listblock/plugin.js +++ b/_source/plugins/listblock/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -9,9 +9,9 @@ CKEDITOR.plugins.add( 'listblock', onLoad : function() { - CKEDITOR.ui.panel.prototype.addListBlock = function( name, definiton ) + CKEDITOR.ui.panel.prototype.addListBlock = function( name, definition ) { - return this.addBlock( name, new CKEDITOR.ui.listBlock( this.getHolderElement(), definiton ) ); + return this.addBlock( name, new CKEDITOR.ui.listBlock( this.getHolderElement(), definition ) ); }; CKEDITOR.ui.listBlock = CKEDITOR.tools.createClass( @@ -36,7 +36,8 @@ CKEDITOR.plugins.add( 'listblock', keys[ 9 ] = 'next'; // TAB keys[ 38 ] = 'prev'; // ARROW-UP keys[ CKEDITOR.SHIFT + 9 ] = 'prev'; // SHIFT + TAB - keys[ 32 ] = 'click'; // SPACE + keys[ 32 ] = CKEDITOR.env.ie ? 'mouseup' : 'click'; // SPACE + CKEDITOR.env.ie && ( keys[ 13 ] = 'mouseup' ); // Manage ENTER, since onclick is blocked in IE (#8041). this._.pendingHtml = []; this._.items = {}; @@ -81,7 +82,7 @@ CKEDITOR.plugins.add( 'listblock', add : function( value, html, title ) { var pendingHtml = this._.pendingHtml, - id = 'cke_' + CKEDITOR.tools.getNextNumber(); + id = CKEDITOR.tools.getNextId(); if ( !this._.started ) { @@ -93,13 +94,13 @@ CKEDITOR.plugins.add( 'listblock', this._.items[ value ] = id; pendingHtml.push( - '
  • ' + + '
  • ' ); @@ -109,7 +110,7 @@ CKEDITOR.plugins.add( 'listblock', { this._.close(); - var id = 'cke_' + CKEDITOR.tools.getNextNumber(); + var id = CKEDITOR.tools.getNextId(); this._.groups[ title ] = id; @@ -120,11 +121,6 @@ CKEDITOR.plugins.add( 'listblock', { this._.close(); this.element.appendHtml( this._.pendingHtml.join( '' ) ); - - var items = this._.items, - doc = this.element.getDocument(); - for ( var value in items ) - doc.getById( items[ value ] + '_option' ).setAttribute( 'aria-setsize', this._.size ); delete this._.size; this._.pendingHtml = []; @@ -194,12 +190,19 @@ CKEDITOR.plugins.add( 'listblock', item.addClass( 'cke_selected' ); this.element.getDocument().getById( itemId + '_option' ).setAttribute( 'aria-selected', true ); - this.element.setAttribute( 'aria-activedescendant', itemId + '_option' ); + this.onMark && this.onMark( item ); }, unmark : function( value ) { - this.element.getDocument().getById( this._.items[ value ] ).removeClass( 'cke_selected' ); + var doc = this.element.getDocument(), + itemId = this._.items[ value ], + item = doc.getById( itemId ); + + item.removeClass( 'cke_selected' ); + doc.getById( itemId + '_option' ).removeAttribute( 'aria-selected' ); + + this.onUnmark && this.onUnmark( item ); }, unmarkAll : function() @@ -209,8 +212,13 @@ CKEDITOR.plugins.add( 'listblock', for ( var value in items ) { - doc.getById( items[ value ] ).removeClass( 'cke_selected' ); + var itemId = items[ value ]; + + doc.getById( itemId ).removeClass( 'cke_selected' ); + doc.getById( itemId + '_option' ).removeAttribute( 'aria-selected' ); } + + this.onUnmark && this.onUnmark(); }, isMarked : function( value )