﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
11166	Mirror editor if using divarea with a JavaScript loader	Alexander Ebert		"I have discovered a pretty weird issue causing the creation of a double editor, let's call it ""Mirror Editor"".

The setup:
 * CKEditor 4 (confirmed for 4.0 - 4.3, including custom built from Git)
 * JavaScript loader (self-made/head.js/LABjs)
 * jQuery Adapter
 * divarea Plugin

I need to make use of a JavaScript loader because CKEditor is sometimes dynamically loaded from a remote host, forcing me to use a dependent loader with callback. It is worth noting, that this issue is raised even if the files are loaded from the same host.

The issue is caused by a race condition, we're creating an CKEditor instance by using a custom config passed to `$(...).ckeditor($config)`. Meanwhile the other scripts on the page finished executing and CKEditor's callbacks for `domReady` are executed. One of these callbacks invokes `inlineAll()` which normally isn't much of a big deal, but since we're using the `divarea` plugin, it happens to sometimes trigger it on the editor in creation.

As a result we end up with two editors (the 2nd one has a generic ID and `element.$ = div.cke_wysiwyg_div`) which are unaware of each other and ultimately breaking everything, even the toolbars overlap.

It is worth noting, that the issue is not always reproducible, usually 1 of 3 page loads result in the broken editor(s).

To solve this issue I'm setting `CKEDITOR.disableAutoInline = true;` immediately after CKEditor has loaded to prevent this double creation.

You can see this issue on the attached screenshot, the editor with the grayed-out buttons is the mirror editor (2nd created) and you can clearly see the ""real"" editor hidden below it. Once it loses focus, the 2nd editor becomes invisible."	Bug	pending	Normal		General	4.0			
