PANmedia / raptor-editor-rails

Get Raptor Editor into your Rails apps
MIT License
17 stars 6 forks source link

TypeError: $(...).editor is not a function #6

Closed woniesong92 closed 10 years ago

woniesong92 commented 11 years ago

I get the following error on Firebug after installing raptor-editor-rails successfully.

TypeError: $(...).editor is not a function
[Break On This Error]   

$("textarea#new-editor").editor();

The textarea remains unchanged.

My settings:

_form.html.erb

<script>
    $("textarea#new-editor").editor();
</script>

application.js

//= require jquery
//= require jquery-ui
//= require raptor
woniesong92 commented 11 years ago

Is it not the right way to include javascript?

<script>
$("textarea#new-editor").editor();
</script>
tristanm commented 11 years ago

Similar to https://github.com/PANmedia/raptor-editor-rails/issues/5

tristanm commented 11 years ago

@Petah @faceleg I've isolated this in a stripped down app. Might need your input.

tristanm commented 11 years ago

@maxsong1002 @lionelrudaz @ymatagne please try the following:

  1. If you're using //= require jquery-ui then change to //= require jquery.ui.all.
  2. Change $(".editable").editor() to $(".editable").raptor() (change the selector and options to suit).

It seems that the jquery-rails gem doesn't provide jQuery UI 1.10 yet so we always need to use the jquery-ui-rails gem instead. I'll update the README with this information.

I need to talk to the Raptor Editor core guys about the consequences of step 2 above.

These changes work in my local tests. Please let me know your experiences.

lionelrudaz commented 11 years ago

Hi Tristan,

Thanks for the update.

If I set the selector to an ID, Raptor doesn't appear. If I set it as a class, like in your example, the program keeps loading and crashes.

I've updated my repo, maybe it helps.

ncuesta commented 11 years ago

I've seen that when the page crashes it sits and waits for a long time on some assets from raptor-editor.com. It seems to me it's actually an issue with the raptor core, not this gem.

lionelrudaz commented 11 years ago

Damn!

What can I do then? Do I have to submit an issue to Raptor Editor?

woniesong92 commented 11 years ago

I thought raptor-editor could be the perfect replacement for Mercury that even works on Internet Explorer. It's unfortunate such a critical error cannot be fixed. :(

faceleg commented 11 years ago

@maxsong1002 although it is true that we are very close to our 1.0 release, as a beta it is normal for breaking changes to be made. We don't actually like making such changes, as we absolutely do know what it is like to be on the receiving end of them.

In saying this, our goal is to reach as stable and complete a product before v1.0 as possible, and at times this does mean that things need to change.

For example, $(selector).editor() was changed to $(selector).raptor() to ensure there would be no conflict with any current or future product that assumed editor() would be available.

As for helping with issues, we try our best. What we cannot do however, is see what you see. The most helpful thing for us are either pastes of actual console / terminal output produced at the time of the issue, or a JSFiddle demonstrating the issue. Without either of these, determining the exact cause is at best difficult, at worst a wild goose chase.

tristanm commented 11 years ago

As @faceleg from the Raptor core team has said, they're on the brink of a new release. This new release will change the way Raptor is compiled and downloaded so we are going to sit tight and release a new version of raptor-editor-rails around the same time. Until then, if you're still having difficulty, you may want to download and install Raptor manually from raptor-editor.com.

I'll make a note in the README too.

ncuesta commented 11 years ago

:+1: for closing this issue now, as it's not an issue for this gem. At least not for now.

pramachan commented 10 years ago

Hi,

I'm getting this error "TypeError: $(...).raptor is not a function $("textarea#text").raptor();"

Petah commented 10 years ago

@pramachan What options did you use in your config.yml? I think by default it downloads raptor in no conflict mode, in which case, you should use raptor(function($) { $("textarea#text").raptor(); });

pramachan commented 10 years ago

Petah,

Thank you very much! Its working well.