I am facing this issue after upgrading from CKEditor 3.6 to CKEditor 4.4.3 . Selecting a value in richCombo would reflect in the combo and not change on opening other combos or typing in the editor in 3.6 . Same code doesn't work in the latest version (4.3.3). I am facing 2 issues -
1. Selecting a value in the combo doesn't reflect in the title --- Fixed this by adding the line this.setValue(value) inside onClick function .
2. Opening any other combo or clicking inside the editor results in title being reset to the label in definition. How can I prevent this from happening ? Combo should display the selected value until it is explicitly destroyed or cleared .
Pasted the sample code below ,is this combo missing any additional parameters ? Checked the styles combo, can't find anything being done there to retain the selected style (opening another combo and selecting a value will not change style value until user presses enter key or moves to a line with different style)
Sample code in plugin.js : Created plugin with states combo . Select a value in states combo (say CA) , "CA" is now displayed as the label of this combo . Type something in the editor or open another combo , title of states combo is reset to "State".
( function() { CKEDITOR.plugins.add( 'statecityplugin', { requires: 'richcombo', init: function( editor ) { var config = editor.config, stateList = [], cityList = []; stateList.push(['Cali','CA','CA']); stateList.push(['Tex','TX','TX']); cityList.push(['SanFran','SF','SF']); cityList.push(['LosAng','LA','LA']); editor.ui.addRichCombo( 'states', { label: 'State', title: 'State', panel: { css: [editor.config.contentsCss, CKEDITOR.skin.getPath('editor')], multiSelect: false, attributes: { 'aria-label': 'State' } }, init: function() { var state, stateName, stateCode, i, count; for ( i = 0, count = stateList.length; i < count; i++ ) { state = stateList[ i ]; stateName = state[0]; stateCode = state[1]; this.add( stateName,stateCode, stateCode ); } this.commit(); }, onClick: function( value ) { editor.insertHtml('You are in '+value); editor.fire( 'saveSnapshot' ); } }); } } ); } )();
I'm being affected by this
I'm being affected by this same bug. any help is greatly appreciated.
Check the styles combo again
I don't think this is a bug.
Check the styles combo again ... more precisely the "onRender" function.
It says (from the source):
This basically changes the title whenever the selection changes. In this case (stylecombo) it checks whether one of the styles in the combo is apliccable. If so it sets this style as title else it empties the value and "Style" will be displayed.
So you probably have to write your own "onRender" function to retain your selection as title.