/*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
For licensing, see LICENSE.html or http://ckeditor.com/license\r
*/\r
\r
* @constant\r
* @example\r
*/\r
-CKEDITOR.UI_RICHCOMBO = 3;\r
+CKEDITOR.UI_RICHCOMBO = 'richcombo';\r
\r
CKEDITOR.ui.richCombo = CKEDITOR.tools.createClass(\r
{\r
return;\r
}\r
\r
- if ( !_.committed )\r
- {\r
- _.list.commit();\r
- _.committed = 1;\r
- }\r
-\r
+ this.commit();\r
var value = this.getValue();\r
if ( value )\r
_.list.mark( value );\r
var element = CKEDITOR.document.getById( id ).getChild( 1 );\r
element.focus();\r
},\r
- execute : clickFn\r
+ clickFn : clickFn\r
};\r
\r
- editor.on( 'mode', function()\r
- {\r
- this.setState( this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );\r
- },\r
- this );\r
+ function updateState()\r
+ {\r
+ var state = this.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;\r
+ this.setState( editor.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : state );\r
+ this.setValue( '' );\r
+ }\r
+\r
+ editor.on( 'mode', updateState, this );\r
+ // If this combo is sensitive to readOnly state, update it accordingly.\r
+ !this.readOnly && editor.on( 'readOnly', updateState, this);\r
\r
var keyDownFn = CKEDITOR.tools.addFunction( function( ev, element )\r
{\r
ev.preventDefault();\r
});\r
\r
+ // For clean up\r
+ instance.keyDownFn = keyDownFn;\r
+\r
output.push(\r
- '<span class="cke_rcombo">',\r
+ '<span class="cke_rcombo" role="presentation">',\r
'<span id=', id );\r
\r
if ( this.className )\r
output.push( ' class="', this.className, ' cke_off"');\r
\r
output.push(\r
- '>',\r
+ ' role="presentation">',\r
'<span id="' + id+ '_label" class=cke_label>', this.label, '</span>',\r
'<a hidefocus=true title="', this.title, '" tabindex="-1"',\r
env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(\'' + this.label + '\')"',\r
'<span>' +\r
'<span id="' + id + '_text" class="cke_text cke_inline_label">' + this.label + '</span>' +\r
'</span>' +\r
- '<span class=cke_openbutton>' + ( CKEDITOR.env.hc ? '<span>▼</span>' : '' ) + '</span>' + // BLACK DOWN-POINTING TRIANGLE\r
+ '<span class=cke_openbutton><span class=cke_icon>' + ( CKEDITOR.env.hc ? '▼' : CKEDITOR.env.air ? ' ' : '' ) + '</span></span>' + // BLACK DOWN-POINTING TRIANGLE\r
'</a>' +\r
'</span>' +\r
'</span>' );\r
me.onOpen();\r
};\r
\r
- panel.onHide = function()\r
+ panel.onHide = function( preventOnClose )\r
{\r
if ( me.className )\r
this.element.getFirst().removeClass( me.className + '_panel' );\r
\r
- me.setState( CKEDITOR.TRISTATE_OFF );\r
+ me.setState( me.modes && me.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED );\r
\r
me._.on = 0;\r
\r
- if ( me.onClose )\r
+ if ( !preventOnClose && me.onClose )\r
me.onClose();\r
};\r
\r
this._.value = value;\r
\r
var textElement = this.document.getById( 'cke_' + this.id + '_text' );\r
-\r
- if ( !( value || text ) )\r
+ if ( textElement )\r
{\r
- text = this.label;\r
- textElement.addClass( 'cke_inline_label' );\r
- }\r
- else\r
- textElement.removeClass( 'cke_inline_label' );\r
+ if ( !( value || text ) )\r
+ {\r
+ text = this.label;\r
+ textElement.addClass( 'cke_inline_label' );\r
+ }\r
+ else\r
+ textElement.removeClass( 'cke_inline_label' );\r
\r
- textElement.setHtml( typeof text != 'undefined' ? text : value );\r
+ textElement.setHtml( typeof text != 'undefined' ? text : value );\r
+ }\r
},\r
\r
getValue : function()\r
\r
commit : function()\r
{\r
- this._.list.commit();\r
+ if ( !this._.committed )\r
+ {\r
+ this._.list.commit();\r
+ this._.committed = 1;\r
+ CKEDITOR.ui.fire( 'ready', this );\r
+ }\r
+ this._.committed = 1;\r
},\r
\r
setState : function( state )\r