Closed (outdated)
Project:
Ace Code Editor
Version:
7.x-1.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 May 2014 at 10:01 UTC
Updated:
8 Sep 2024 at 08:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Growiel commentedHi,
Do you have any more information on the error displayed ?
Comment #2
pacoup commentedHello,
I get the same problem when using Ace Editor with the jQuery Update module.
Firefox: TypeError: $(...).live is not a function --- ace_editor.admin.js:192
Chrome: Uncaught TypeError: undefined is not a function --- ace_editor.admin.js?n85i8r:192
This is because of the use of the deprecated .live() function in ace_editor/js/ace_editor.admin.js
http://api.jquery.com/live/
.on() should be used instead.
I tried using .on() and I was able to use Ace Editor with the jQuery Update module.
Comment #3
Growiel commented.live() was removed in jQuery 1.9.
Good catch ! For some weird legacy reasons, I'm still using an older version.
Since you managed to make it work, could you maybe provide a patch that I can test and commit (credits will of course be given where due).
Thanks !
Comment #4
Dave Sandilands commentedThanks Growiel,
I couldn't understand why nothing was happening until I checked the jQuery version I was using via the jQuery Update module. When I went back to 1.7 all was well.
Comment #5
alex.bukach commentedHere's a patch.
Comment #6
interdruper commentedThe patch #5 makes it works under JQuery 1.10, but unfortunately it breaks the editor under JQuery 1.5 and under the defaullt JQuery version provided by Drupal 7.34.
Comment #7
pacoup commentedIt's ugly, but it works. Unless you're using something like sweet.js macros, there's no cleaner way to do it that I know of.
Comment #8
interdruper commented#7 works from 1.4 to 1.10, but... not with 1.9. You can test it with the latest 3.x-dev version of JQuery Update, that let you choose 1.9 for the admin theme.
Anyway, as Pacoup pointed out, the approach in #7 is quite ugly... any javascript guru out there that could help on this?
Comment #9
pacoup commentedIn theory, the check does work for 1.9. Something else in the Ace editor integration must be causing issues. There are already quite a few JS errors with any version of jQuery in this module anyway. Seems to be due for some major refactoring, some of which could solve the ugliness of this fix as well.
Personally though, I think the effort might be better spent on integrating CodeMirror.
Comment #10
interdruper commentedOk, finally it seems that changing only a few lines, with a patch based on #5, this issue can be fixed, making Ace runs on all the JQuery versions, from 1.4 (Drupal native) to even the latest (2.1 by now).
I will commit it to dev in a moment.
Comment #11
interdruper commentedComment #12
interdruper commentedComment #14
interdruper commentedComment #16
interdruper commentedUnfortunately the tried patch (a common patch for every JQuery version) breaks in some cases the Ace functionalities on modes that are not HTML (like PHP).
Not an easy one this issue... more work (and proposals...) needed. I will close this if a smart common patch appears, valid for every JQuery version from 1.4 to 1.1x.
Comment #17
interdruper commentedOk, here is a new patch that aims to ensure compatibility from JQuery 1.4 to JQuery 1.9 and above.
Comment #18
interdruper commentedComment #21
interdruper commentedComment #23
ericras commentedThis didn't work for me with jQuery 1.4.4. I had to modify the following section
to work like the section that was modified in #17:
Comment #24
ericras commentedFixes ongoing jQuery 1.4.4 issue.
Comment #25
interdruper commentedComment #26
rajab natshah