X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Flistblock%2Fplugin.js;h=e4898a5b33730208c1889af8ba1e0ce961aaa46c;hb=refs%2Ftags%2Fv3.6.1;hp=9a7c6e2db7763f3be510b6d8d686df455b446dbb;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/plugins/listblock/plugin.js b/_source/plugins/listblock/plugin.js index 9a7c6e2..e4898a5 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-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -9,28 +9,35 @@ CKEDITOR.plugins.add( 'listblock', onLoad : function() { - CKEDITOR.ui.panel.prototype.addListBlock = function( name, multiSelect ) + CKEDITOR.ui.panel.prototype.addListBlock = function( name, definition ) { - return this.addBlock( name, new CKEDITOR.ui.listBlock( this.getHolderElement(), multiSelect ) ); + return this.addBlock( name, new CKEDITOR.ui.listBlock( this.getHolderElement(), definition ) ); }; CKEDITOR.ui.listBlock = CKEDITOR.tools.createClass( { base : CKEDITOR.ui.panel.block, - $ : function( blockHolder, multiSelect ) + $ : function( blockHolder, blockDefinition ) { - // Call the base contructor. - this.base( blockHolder ); + blockDefinition = blockDefinition || {}; + + var attribs = blockDefinition.attributes || ( blockDefinition.attributes = {} ); + ( this.multiSelect = !!blockDefinition.multiSelect ) && + ( attribs[ 'aria-multiselectable' ] = true ); + // Provide default role of 'listbox'. + !attribs.role && ( attribs.role = 'listbox' ); - this.multiSelect = !!multiSelect; + // Call the base contructor. + this.base.apply( this, arguments ); var keys = this.keys; keys[ 40 ] = 'next'; // ARROW-DOWN 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 = {}; @@ -75,22 +82,26 @@ 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 ) { - pendingHtml.push( '