The error message suggests that the get method is not available on the object returned by dialogDefinition.getContents('uploadTab'). This could be because the getContents method returns an array of content elements, and the get method is not available on arrays.
To access the uploadField element, you can use array indexing instead of the get method. Here's an updated version of the code:
CKEDITOR.on( 'dialogDefinition', function( ev )
{
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if ( dialogName == 'image' )
{
dialogDefinition.addContents({
id : 'uploadTab',
label : 'Upload',
elements : [
{
type: 'text',
id: 'uploadField',
label: 'Search images',
}
]
})
var inputField = dialogDefinition.getContents('uploadTab')[0].getChild(['uploadField']);
inputField.onChange = function(){
console.log(inputField.getValue());
};
}
});
In this version, we use [0] to access the first (and only) element in the array returned by getContents('uploadTab'). Then, we use getChild(['uploadField']) to access the uploadField element.