﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
10377	nested custom config not loading properly in IE	Jeff Fournier		"When you have multiple CKEditor instances in one page, nested custom config are not loading properly in IE10.

To reproduce :
In the first config file, add a custom toolbar and a customConfig.
In the second custom config add something else.
Create a page with 2 ckeditor replace by code and pass the path of the first config and the name of the toolbar.
When you load the page in IE10 you will see your toolbar in the first editor but the second will have the default one.

I will upload the replacebycode.html sample modified so you can test it. Because you need custom config, I will also upload a zip that you must unzip in the ckeditor folder. For the sample to work properly you must have something like that after you unzipped :
/ckeditor/test/config.js
/ckeditor/test/test/config.js


The problem is in the loadConfig(editor) function in editor.js :


{{{
			CKEDITOR.scriptLoader.load( customConfig, function() {
				// If the CKEDITOR.editorConfig function has been properly
				// defined in the custom configuration file, cache it.
				if (CKEDITOR.editorConfig )
					loadedConfig.fn = CKEDITOR.editorConfig;
				else
					loadedConfig.fn = function() {};

				// Call the load config again. This time the custom
				// config is already cached and so it will get loaded.
				loadConfig( editor );
			});
}}}

For a reason unknown to me, in IE10, it seems like the callback is called with the wrong ""context"". After some call, the callback will be called with the config of the second customConfig but the loadedConfig will be the one of the first config. So it will overwrite the first config with the second one.

Not sure if this is clear. But you can put a breakpoint on ""if (CKEDITOR.editorConfig )"" and you will see.


Right now I have fixed the problem in our production environment like that :

{{{
			CKEDITOR.scriptLoader.load( customConfig, function() {
				// If the CKEDITOR.editorConfig function has been properly
				// defined in the custom configuration file, cache it.
                                if (!loadedConfig.fn && CKEDITOR.editorConfig )
					loadedConfig.fn = CKEDITOR.editorConfig;
				else if(!loadedConfig.fn)
					loadedConfig.fn = function() {};

				// Call the load config again. This time the custom
				// config is already cached and so it will get loaded.
				loadConfig( editor );
			});
}}}

But i'm not sure this is the best way to fix it because it may causes more recurssion."	Bug	closed	Normal		General		duplicate	IE	
