X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Frichcombo%2Fplugin.js;h=f79c1b31cc24f4534109e85a6391498808988f7d;hb=4e70ea24db840898be8cc21c950363a52a2a6aba;hp=76523bc1ca692037567fa06fd52535ff8d89f5b5;hpb=614511639979907ceb0da3614122a4d8eb963ad4;p=ckeditor.git diff --git a/_source/plugins/richcombo/plugin.js b/_source/plugins/richcombo/plugin.js index 76523bc..f79c1b3 100644 --- a/_source/plugins/richcombo/plugin.js +++ b/_source/plugins/richcombo/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 */ @@ -18,7 +18,7 @@ CKEDITOR.plugins.add( 'richcombo', * @constant * @example */ -CKEDITOR.UI_RICHCOMBO = 3; +CKEDITOR.UI_RICHCOMBO = 'richcombo'; CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( { @@ -106,8 +106,7 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( return; } - !_.committed && this.commit(); - + this.commit(); var value = this.getValue(); if ( value ) _.list.mark( value ); @@ -129,11 +128,16 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( clickFn : clickFn }; - editor.on( 'mode', function() - { - this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); - }, - this ); + function updateState() + { + var state = this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED; + this.setState( editor.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : state ); + this.setValue( '' ); + } + + editor.on( 'mode', updateState, this ); + // If this combo is sensitive to readOnly state, update it accordingly. + !this.readOnly && editor.on( 'readOnly', updateState, this); var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element ) { @@ -161,14 +165,14 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( instance.keyDownFn = keyDownFn; output.push( - '', + '', '', + ' role="presentation">', '', this.label, '', '= 10900 && !env.hc ? '' : ' href="javascript:void(\'' + this.label + '\')"', @@ -197,7 +201,7 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( '' + '' + this.label + '' + '' + - '' + ( CKEDITOR.env.hc ? '' : '' ) + '' + // BLACK DOWN-POINTING TRIANGLE + '' + ( CKEDITOR.env.hc ? '▼' : CKEDITOR.env.air ? ' ' : '' ) + '' + // BLACK DOWN-POINTING TRIANGLE '' + '' + '' ); @@ -290,16 +294,18 @@ CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass( this._.value = value; var textElement = this.document.getById( 'cke_' + this.id + '_text' ); - - if ( !( value || text ) ) + if ( textElement ) { - text = this.label; - textElement.addClass( 'cke_inline_label' ); - } - else - textElement.removeClass( 'cke_inline_label' ); + if ( !( value || text ) ) + { + text = this.label; + textElement.addClass( 'cke_inline_label' ); + } + else + textElement.removeClass( 'cke_inline_label' ); - textElement.setHtml( typeof text != 'undefined' ? text : value ); + textElement.setHtml( typeof text != 'undefined' ? text : value ); + } }, getValue : function() @@ -345,7 +351,12 @@ 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; },