Opened 7 years ago

Closed 7 years ago

#10377 closed Bug (duplicate)

nested custom config not loading properly in IE

Reported by: Jeff Fournier Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: IE Cc:

Description

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.

Attachments (2)

configTest.zip (1.9 KB) - added by Jeff Fournier 7 years ago.
replacebycode.html (11.7 KB) - added by Jeff Fournier 7 years ago.

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by Jeff Fournier

Attachment: configTest.zip added

Changed 7 years ago by Jeff Fournier

Attachment: replacebycode.html added

comment:1 Changed 7 years ago by Jakub Ś

Keywords: IE added
Resolution: duplicate
Status: newclosed
Summary: nested custom config not loading properly in IE10nested custom config not loading properly in IE
Version: 4.1

DUP of #6504.

@jffou17 thanks for good explanation of the problem.

I was able to reproduce this problem in IE7, IE8 and IE10. This looks exactly like #6504 (Script loader race condition) issue thus I'm closing it as duplicate and will link this ticket to older one.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy