X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Frichcombo%2Fplugin.js;h=d7895c8b947fc763b1506427d9b765297e022c4c;hb=9afde8772159bd3436f1f5b7862960307710ae5a;hp=522e864bb957b1a4262f2dd2404b4b87912a9276;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d;p=ckeditor.git diff --git a/_source/plugins/richcombo/plugin.js b/_source/plugins/richcombo/plugin.js index 522e864..d7895c8 100644 --- a/_source/plugins/richcombo/plugin.js +++ b/_source/plugins/richcombo/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -44,6 +44,11 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( || CKEDITOR.document; panelDefinition.className = ( panelDefinition.className || '' ) + ' cke_rcombopanel'; + panelDefinition.block = + { + multiSelect : panelDefinition.multiSelect, + attributes : panelDefinition.attributes + }; this._ = { @@ -83,6 +88,8 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( */ render : function( editor, output ) { + var env = CKEDITOR.env; + var id = 'cke_' + this.id; var clickFn = CKEDITOR.tools.addFunction( function( $element ) { @@ -99,12 +106,7 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( return; } - if ( !_.committed ) - { - _.list.commit(); - _.committed = 1; - } - + this.commit(); var value = this.getValue(); if ( value ) _.list.mark( value ); @@ -123,7 +125,7 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( var element = CKEDITOR.document.getById( id ).getChild( 1 ); element.focus(); }, - execute : clickFn + clickFn : clickFn }; editor.on( 'mode', function() @@ -154,6 +156,9 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( ev.preventDefault(); }); + // For clean up + instance.keyDownFn = keyDownFn; + output.push( '', '' + - '', this.label, '' + - '', + '', this.label, '', + '= 10900 && !env.hc ? '' : ' href="javascript:void(\'' + this.label + '\')"', + ' role="button" aria-labelledby="', id , '_label" aria-describedby="', id, '_text" aria-haspopup="true"' ); // Some browsers don't cancel key events in the keydown but in the // keypress. @@ -187,10 +194,9 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( ' onkeydown="CKEDITOR.tools.callFunction( ', keyDownFn, ', event, this );"' + ' onclick="CKEDITOR.tools.callFunction(', clickFn, ', this); return false;">' + '' + - '' + ( this.voiceLabel ? this.voiceLabel + ' ' : '' ) + '' + '' + this.label + '' + '' + - '' + + '' + ( CKEDITOR.env.hc ? '' : CKEDITOR.env.air ? ' ' : '' ) + '' + // BLACK DOWN-POINTING TRIANGLE '' + '' + '' ); @@ -207,9 +213,10 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( return; var panelDefinition = this._.panelDefinition, + panelBlockDefinition = this._.panelDefinition.block, panelParentElement = panelDefinition.parent || CKEDITOR.document.getBody(), panel = new CKEDITOR.ui.floatPanel( editor, panelParentElement, panelDefinition ), - list = panel.addListBlock( this.id, this.multiSelect ), + list = panel.addListBlock( this.id, panelBlockDefinition ), me = this; panel.onShow = function() @@ -227,16 +234,16 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( me.onOpen(); }; - panel.onHide = function() + panel.onHide = function( preventOnClose ) { if ( me.className ) this.element.getFirst().removeClass( me.className + '_panel' ); - me.setState( CKEDITOR.TRISTATE_OFF ); + me.setState( me.modes && me.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); me._.on = 0; - if ( me.onClose ) + if ( !preventOnClose && me.onClose ) me.onClose(); }; @@ -290,6 +297,7 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( } else textElement.removeClass( 'cke_inline_label' ); + textElement.setHtml( typeof text != 'undefined' ? text : value ); }, @@ -336,7 +344,13 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( commit : function() { - this._.list.commit(); + if ( !this._.committed ) + { + this._.list.commit(); + this._.committed = 1; + CKEDITOR.ui.fire( 'ready', this ); + } + this._.committed = 1; }, setState : function( state )