Hi

With the both 5.x.1 and 5.x.2 firebug show me same error on wysiwyg.js (ligne 78 )

Drupal.wysiwyg.instances is undefined
[Break on this error] Drupal.wysiwyg.instances[params.field] = {};


Drupal.wysiwygAttach = function(context, params) {
if (typeof Drupal.wysiwyg.editor.attach[params.editor] == 'function') {
// (Re-)initialize field instance.
Drupal.wysiwyg.instances[params.field] = {};
// Provide all input format parameters to editor instance.
jQuery.extend(Drupal.wysiwyg.instances[params.field], params);
// Provide editor callbacks for plugins, if available.
if (typeof Drupal.wysiwyg.editor.instance[params.editor] == 'object') {
jQuery.extend(Drupal.wysiwyg.instances[params.field], Drupal.wysiwyg.editor.instance[params.editor]);
}
// Store this field id, so (external) plugins can use it.
// @todo Wrong point in time. Probably can only supported by editors which
// support a onFocus() or similar event.
Drupal.wysiwyg.activeId = params.field;
// Attach or update toggle link.
Drupal.wysiwygAttachToggleLink(context, params);
// Attach editor, if enabled by default or last state was enabled.
if (params.status) {
Drupal.wysiwyg.editor.attach[params.editor](context, params, (Drupal.settings.wysiwyg.configs[params.editor] ? Drupal.wysiwyg.clone(Drupal.settings.wysiwyg.configs[params.editor][params.format]) : {}));
}
// Otherwise, attach default behaviors.
else {
Drupal.wysiwyg.editor.attach.none(context, params);
Drupal.wysiwyg.instances[params.field].editor = 'none';
}
}
};

Comments

sun’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry, I cannot replicate this issue.

This can only mean that wysiwyg.init.js is not loaded on the page, or, not loaded first (which might happen if you are customizing your JavaScript through other modules or directly in template.php).

sun’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Sorry, without further information this issue can only be marked as won't fix. Feel free to re-open this issue if you want to provide further information.

jason ruyle’s picture

Version: 5.x-1.x-dev » 6.x-2.0-alpha1
Status: Closed (won't fix) » Active

I'm getting this same problem:
Drupal 6-stable
WYSIWYG: 6.x-2.0-alpha1
IMCE Wysiwyg API bridge: 6.x-1.0
IMCE: 6.x-1.2

To re-create I have my body field set to filter input type, to I go and change it to HTML EDITOR. When I change, I get the above error in firebug.

jason ruyle’s picture

Assigned: Unassigned » jason ruyle
Status: Active » Closed (fixed)

Well found issue and I'm sure someone else has posted this, but make sure you checkoff the IMCE under your Buttons/Plugins.

mstef’s picture

Status: Closed (fixed) » Active

This is happening without the editor even being displayed on the page. Internet Explorer throws a popup JS error on every page load. Firebug reports the same error. Just upgraded to the latest version - problem still exists. (using tinymce alone)

mstef’s picture

Status: Active » Closed (fixed)

cache needed to be cleared after upgrading to the newest release - i believe. no problems..

mstef’s picture

Status: Closed (fixed) » Active

Wrong - both versions are throwing this error. (6.1 & 6.2)

sun’s picture

Status: Active » Postponed (maintainer needs more info)

If Wysiwyg API does not work as expected, please

1) Remove all buttons/plugins from your Wysiwyg profile except bold+italic buttons
2) Test whether the editor appears
3) If not, temporarily disable (all) other contrib modules
4) Test again
5) If the editor appears, re-enable other contrib modules step-by-step to see who's guilty.

mstef’s picture

has nothing to do with the editor appearing or not.

mstef’s picture

I don't know if this is related to other people getting this error but I found out what was causing mine. I was including the JS files in the Popups API. Removing it got rid of the errors. So this is fixed for me.

sun’s picture

Title: Firebug error : Drupal.wysiwyg.instances[params.field] = {}; » JavaScript error with Popups API: Drupal.wysiwyg.instances is undefined

Better title.

sun’s picture

@mikestefff: Can you elaborate a bit more on your last follow-up? I don't understand what you changed to fix this issue.

mstef’s picture

Well I didn't create this issue so what I did to resolve it most likely has nothing to do with the initial post (also why changing the title might not be a good idea). I was using the popups api on every single page. One of my links included the wysiwyg js files because I was trying to load the editor inside a popup for popup node creation (ended up removing it because it wouldn't work). So because of this link, the wysiwyg files were being loaded, and I can only assume the errors were thrown because until you initialize the popup, the editor wasn't being shown.

sun’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Well, the original poster never came back to this issue.

Sorry, without further information this issue can only be marked as won't fix.

Feel free to re-open this issue if you want to provide further information. Thanks.

hintbw’s picture

Status: Closed (won't fix) » Active

I'm getting the same error with 6.0-2.x version of Wysiwyg.

I cannot get either FCKeditor or TinyMCE to load for any textarea fields. The error message is the same as the one originally reported for this issue. Here is the output from Firefox's error console (though I've tried this with multiple browsers, different themes - including Garland, and I've also tried disabling most of my modules that might be causing any javascript trouble.)

Error: Drupal.wysiwyg.editor.instance is undefined
Source File: http://www.aztea.org/sites/all/modules/wysiwyg/wysiwyg.js?P
Line: 92

Error: Drupal.wysiwyg.editor.instance is undefined
Source File: http://www.aztea.org/sites/all/modules/wysiwyg/editors/js/none.js?P
Line: 50

Error: Drupal.wysiwyg.editor.instance is undefined
Source File: http://www.aztea.org/sites/all/modules/wysiwyg/editors/js/fckeditor-2.6....
Line: 150

Those are the three errors that appear and the error is basically the same when a TinyMCE profile is enabled for that input field.

sleary’s picture

I'm getting the exact same trio of errors as well with with 6.0-2.x. I'm also using Garland, and have tried disabling other modules. I have FCKeditor set for one input type and TinyMCE for another; I can't get either one to show up.

sleary’s picture

Title: JavaScript error with Popups API: Drupal.wysiwyg.instances is undefined » JavaScript error: Drupal.wysiwyg.instances is undefined

Changing title, because hintbw and I don't have Popups API installed but are still getting the errors. Any suggestions appreciated.

sun’s picture

Version: 6.x-2.0-alpha1 » 6.x-2.0
Assigned: jason ruyle » Unassigned
Status: Active » Postponed (maintainer needs more info)

This most probably means that wysiwyg.init.js is not loaded at all on your sites. That's basically impossible - unless a third-party module hi-jacks the JavaScripts on all pages. If you would compile a list of JavaScript-related modules you have installed on your site, we might find the one that's guilty.

Please make sure you read the FAQ for Wysiwyg module (also linked from the project page).

If Wysiwyg API does not work as expected, please test whether it works

- after clearing/flushing Drupal's cache AND your browser's cache
- by temporarily switching to Drupal core's default Garland theme.
- after removing all wysiwyg profiles, create a new one, and in that profile, remove all plugins/buttons except bold + italic.
- by using the latest development snapshot.
- after disabling (all) other contrib modules (and if it does, re-enable them step-by-step to see who's guilty).
- in a different browser.

In case none of those steps make it work, then we need much more information in this issue. The editor and editor version in question, your browser and browser version, the web server software (Apache/IIS). Hence, setting proper status.

In any case, please report back about the status of this issue. Thanks.

hintbw’s picture

Here is how I fixed the issue I had reported here. I disabled the Wysiwyg 2.0 module in the modules list. I then clicked on uninstall and checked the box to uninstall the wysiwyg module.

After uninstalling the wysiwyg module, via FTP I deleted the module completely from the server. I then downloaded the July 19th development release of Wysiwyg 2.x and uploaded that version of the module to the server and enabled the module. I then went to the Wysiwyg configuration screen and setup a basic profile for TinyMCE (including nothing more than the bold and italic modules). I then went to create content and it worked.

I subsequently went back and added additional buttons and plugins to my editor and it has continued to work. The editor continues to appear and work just fine.

NOTE: I already had the tinymce and fckeditor libraries installed at sites/all/libraries. When I uninstalled the Wysiwyg module I didn't do anything to them. The new Wysiwyg module I uploaded just picked those editor libraries up automatically since they were in the right location. (I am running TinyMCE 3.2.5)

sun’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Fixed

Strange, we've seen a lot of such installation issues recently (which cannot be solved by this module). Could you add this to the FAQ, if possible?

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Status: Closed (fixed) » Needs review

This seems to be a Popups API issue - please replace
success: function(script) {
eval(script);
}
with
success: function(script) {
window.setTimeout(window.eval, 200, script);
}
in popups.js

twod’s picture

Status: Needs review » Closed (fixed)

Please create a new issue about that in Popups API's issue queue (and perhaps reference this one).
This issue is a bit old and any problems here which could have been caused by Wysiwyg seem resolved.

scai’s picture

Version: 6.x-2.0 » 7.x-2.x-dev

it helped for me to rename file /sites/all/modules/wysiwyg/wysiwyg.init.js to /sites/all/modules/wysiwyg/wysiwyg_init.js and change line 368 in file /sites/all/modules/wysiwyg/wysiwyg.module
to
drupal_add_js($path . '/wysiwyg_init.js', array('group' => JS_LIBRARY));

twod’s picture

Version: 7.x-2.x-dev » 6.x-2.0

@scai. Please create a new issue if you're experiencing problems with the filename. Also make sure all caches were cleared.
The only reason I can come up with for a rename to fix things is if a broken version of wysiwyg.init.js was cached or left out of the aggregated file when JavaScript optimization/aggregation was turned on.

scai’s picture

no, JavaScript optimization/aggregation was turned off and caches were cleared few times, also I turned off and on module Wysiwyg and ran cron, but I could not solve this problem for a few days. Firebug show that Drupal.wysiwyg is undefined and file /sites/all/modules/wysiwyg/wysiwyg.init.js could not be load (404 error). I don't know why but after renaming problem dissapeared

Yunus260’s picture

I just want to thank scai for post #24 because it helped me to remove the error message in Firebug that wysiwyg.init is not loaded or something like that.