New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ckeditor-init.js by giving it access to a valid jQuery instance, along with other minor changes to ckeditor-init.js #137
Conversation
…eplace .click(...) with delegated .on(...) in case elements do not exist when code is run
django.jQuery is a nice one. As for "on" I assume it helps on nodes that are dynamically inserted? |
That's right. I am using one of the implementations of django-nested-inlines on a project and I was running into issues with that. I figured it didn't cost too much to toss in support for nested inlines and other dynamically added nodes. |
Fix ckeditor-init.js by giving it access to a valid jQuery instance, along with other minor changes to ckeditor-init.js
Since this commit I run into issues when loading ckeditor (it does not concerns the admin interface). I get a "ReferenceError: django is not defined" in the firefox console. I think it is due to this line : |
@simonpanay , what context are you running ckeditor in? If you are running it within django's admin, The issue itself is this: this commit fixes an issue where we try to use the Just as a sanity check, do you know if you have jQuery running? |
Indeed, this doesn't concern the admin interface where everything works as expected. |
@simonpanay Hmm. You don't have a live example of the issue that I could look at, do you? Are you using require.js or browsify? |
we had some weir cases where jQuery was there but still undefined for the script. So it looks like it's not done yet. |
@natejlong , no I'm not using require.js nor browsify... And no live example, sorry... |
But I'm using Raven.js and bootstrap. |
@simonpanay , nah those wouldn't be causing the problem. |
Nothing special. To address that there was few commits making the jQuery usage more typical and it always worked for me. I can't reproduce that problem in any way. |
@natejlong I made my email address public. Contact me and I will be able to give you access to a live example |
@natejlong Just by removing this line in ckeditor-init.js : |
Haha alright, thanks for figuring that out. I thought that that |
@natejlong Replacing the line No idea what the difference is thought |
The difference is the scoping of |
... and it's the moment where my js knowledge stops :-) |
fixes #13 . Previously ckeditor-init.js failed to properly run as '$' was undefined. The fix is to use django's jQuery instance if '$' is undefined.
Also, I replaced the .click() with a .on() because I was running into issues with the event being attached before all elements had been placed. This is particularly an issue for users of django-nested-inlines.
Changes: