X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Flistblock%2Fplugin.js;fp=_source%2Fplugins%2Flistblock%2Fplugin.js;h=946a54f19c9ef5c2c6d9909930f92f216f7d2172;hb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;hp=0000000000000000000000000000000000000000;hpb=b93873b6532ee7515fb0d6f8b73176c44fad28f7;p=ckeditor.git diff --git a/_source/plugins/listblock/plugin.js b/_source/plugins/listblock/plugin.js new file mode 100644 index 0000000..946a54f --- /dev/null +++ b/_source/plugins/listblock/plugin.js @@ -0,0 +1,231 @@ +/* +Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +CKEDITOR.plugins.add( 'listblock', +{ + requires : [ 'panel' ], + + onLoad : function() + { + CKEDITOR.ui.panel.prototype.addListBlock = function( name, multiSelect ) + { + return this.addBlock( name, new CKEDITOR.ui.listBlock( this.getHolderElement(), multiSelect ) ); + }; + + CKEDITOR.ui.listBlock = CKEDITOR.tools.createClass( + { + base : CKEDITOR.ui.panel.block, + + $ : function( blockHolder, multiSelect ) + { + // Call the base contructor. + this.base( blockHolder ); + + this.multiSelect = !!multiSelect; + + 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 + + this._.pendingHtml = []; + this._.items = {}; + this._.groups = {}; + }, + + _ : + { + close : function() + { + if ( this._.started ) + { + this._.pendingHtml.push( '' ); + delete this._.started; + } + }, + + getClick : function() + { + if ( !this._.click ) + { + this._.click = CKEDITOR.tools.addFunction( function( value ) + { + var marked = true; + + if ( this.multiSelect ) + marked = this.toggle( value ); + else + this.mark( value ); + + if ( this.onClick ) + this.onClick( value, marked ); + }, + this ); + } + return this._.click; + } + }, + + proto : + { + add : function( value, html, title ) + { + var pendingHtml = this._.pendingHtml, + id = 'cke_' + CKEDITOR.tools.getNextNumber(); + + if ( !this._.started ) + { + pendingHtml.push( '