Looking forward to test Yoast Drupal :)

I'm using the WYSIWYG module and CKEditor, but the CKEditor detection function is causing trouble.

ReferenceError: detectCKEditorInstances is not defined
detectCKEditorInstances();
yoast_s...?nv7221 (regel 89, kol 12)

You should probably define the function outside of the body.once scope and put in in docReady scope or global scope, like the other functions.

Comments

JurriaanRoelofs created an issue. See original summary.

bramtenhove’s picture

Assigned: Unassigned » bramtenhove

I'll take a look into this!

EloRo’s picture

Thanks! Solved this by putting the function outside the scope of document ready like suggested.

Made the variable maxDetectTries global (window.maxDetectTries).

jurriaanroelofs’s picture

Status: Active » Needs review
StatusFileSize
new4.32 KB

Here's a patch that solves this problem and also retains proper variable scope.
I hope you don't mind I also changed the polling interval from 25ms to 250ms because I noticed that without an CKEditor present the polling caused the javascript interpreter to put a noticeable load on my processor during the 2.5 seconds where it's also needed for a lot of other stuff.

bramtenhove’s picture

I agree with changing the polling interval, good idea.

Will try your patch and commit it.

robertragas’s picture

StatusFileSize
new12.12 KB

I have tried the patch and the console error is gone, but when using the snippet editor the text changes to undefined when I release the focus on the snippet editor.
I am using firefox.

marcoka’s picture

i can confirm this error. used latest dev versions of media/ckeditor and file_entity

marcoka’s picture

changed the line with patch
if (typeof CKEDITOR != "undefined" && typeof CKEDITOR.instances != "undefined" && CKEDITOR.instances.length != 0 && maxDetectTries > 0) {

i still have the error in my firefox sonole.

marcoka’s picture

niels de ruijter’s picture

niels de ruijter’s picture

niels de ruijter’s picture

Tested the patch.

Unfortunately the patch breaks the snippet editor in some cases, yet to figure out what breaks it exactly. After the patch everything in the CKEditor works like expected on all browsers including Firefox (42.0).

Funksmaname’s picture

patch worked for me thanks! (FF 42.0)

niels de ruijter’s picture

The whole detectCKEditorInstance function can be replaced with a simple event listener. It takes care of any errors, but the DrupalSource.triggerEvent on seems to result in nothing though. It does get executed, but the summary doesn't update.

robertragas’s picture

This patch of Jurriaan in combination with the patch on https://www.drupal.org/node/2636836 ( for the snippet editor ) will fix the firefox problems. Will commit it.

robertragas’s picture

Status: Needs review » Closed (fixed)