Hi, I made a page callback to embed a node form into a ctools modal box. The problem is, the Wysiwyg is not showing on the body field.

Here's the code :

* A modal node/add callback.
function my_module_ajax_node() {
$node = (object) array(
'uid' => $user->uid,
'name' => (isset($user->name) ? $user->name : ''),
'type' => 'my_node_type',
'language' => LANGUAGE_NONE
$form_state = array(
'title' => 'Create a node',
'ajax' => TRUE,
'build_info' => array(
'args' => array($node),
form_load_include($form_state, 'inc', 'node', 'node.pages');
$output = ctools_modal_form_wrapper('my_node_type_node_form', $form_state);

Have you some suggestions about this bug?

Thank you a lot.

#7 ckeditor_ctools.patch402 bytesomerida


Version:7.x-1.0-rc1» 7.x-1.x-dev

I am running into this issue as well running the latest dev. here is my code for the ctools modal, nothing particularly daunting.

function guided_tour_create_object_reference($parent_node, $field_name, $node = null) {
module_load_include('inc', 'node', 'node.pages');
    if (!
$node) {
$node = new stdClass;
$node->type = 'guided_tour_overlay';
$node->name = $user->name;
$node->language = LANGUAGE_NONE;
$form_state = array(
'ajax'  => TRUE,
'title' => t('Guided Tour'),
'build_info' => array(
'args'  => array($node),
$output = ctools_modal_form_wrapper('guided_tour_overlay_node_form', $form_state);

The error that gets reported in the javascript console is as follows:

Uncaught SyntaxError: Unexpected token < en.js:1
Uncaught TypeError: Cannot read property 'options' of undefined overlay:50
Resource interpreted as Stylesheet but transferred with MIME type text/html: "/node/310/edit/skins/kama/editor.css?t=C3HA5RM". overlay:16

it is trying to include lang/en.js from the url of the page, same with the editor css as you can see above in the error. So the basePath is getting overridden somewhere. Checking CKEDITOR.basePath in the console yeilds the following


Project:Chaos tool suite (ctools)» Wysiwyg
Version:7.x-1.x-dev» 7.x-2.x-dev

Moved to wysiwyg module as the error most likely exists there

It looks like whatever is adding that CSS file is doing so with a relative URL, but because it's happening during AJAX, the relative URL is not what is expected, perhaps?

I suspect it is something of that nature. still digging thru wysiwyg code to figure out how it is all added. Installed the ckeditor module and it works just fine, thus my suspicion is that the issue lies in wysiwyg somewhere.

new696 bytes

still looking at this with no such luck yet. attached is a test module to reproduce the issue.

Status:Active» Closed (duplicate)

Looks like this is related to how the editor is loaded by wysiwyg. I had remembered that at one point there was another site I had worked on where ckeditor worked in a modal and it dawned on me that I had to patch wysiwyg for it to work. The patch from #356480: Lazy-load editors resolves this issue.

new402 bytes

I ran into this issue where the CKEditor did not initialize within a ctools modal. I fixed by checking if the instance exists first. Attached is a patch.

Chrome console showed an error stating "Error: uncaught exception: [CKEDITOR.editor] The instance "EDITOR_ID" already exists."

Thank you omerida, I was close !

You're welcome!

Issue summary:View changes
Status:Closed (duplicate)» Needs review

This bug does not seem to be fixed for me, using latest ctools and wysiwyg dev versions.
Patch in #7 solved it.

Status:Needs review» Postponed (maintainer needs more info)

The patch in #7 destroys any existing instances attached to a field the editor should be [re-]attached to.

This is simply the wrong approach to fixing the problem since the instance shouldn't exist at all. Either something else created it (could happen if also using the standalone ckeditor.module), or it was not previously destroyed when the field it belongs to was updated or removed (someone forgot to detach Drupal behaviors, or we missed such an event).

I'm afraid destroying an existing editor instance before attaching a new one could result in old content (stored in the editor instance) could replace the contents of the field before the new instance is attached, potentially removing any changes made since the elements belonging to the previous editor instance were removed.

Can you give specific instructions on how to reproduce this issue?
Is the Panels-In-Place-Editor involved?
Is it only happening for some modals?
Can you reproduce it using the test module in #5?
Was there another node form outside/behind the modal?
Which field(s) was the editor active on?
Was an editor instance actually visible when the error happened, or had there previously been a visible editor instance on the a field, but it disappeared when performing a certain action?