spree-contrib / spree_editor

Rich text editor for Spree with Image and File uploading in-place.
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
112 stars 183 forks source link

ckeditor load before jQuery #40

Closed babrovka closed 11 years ago

babrovka commented 11 years ago

ckeditor load before jQuery, it causes broblem

$(function() { Uncaught ReferenceError: $ is not defined var ids = ['product_description', 'page_body']; for(var key in ids){ if($('#' + ids[key]).length > 0){ CKEDITOR.replace(ids[key]); } } });

and CKeditor doesnt load

JDutil commented 11 years ago

Please check the order your asset pipeline is defined. Make sure the js is requriing spree_editor after jquery. This is working fine on master for me.

robertmassaioli commented 11 years ago

Also, people often get into trouble in development mode when they have accidentally compiled their assets. I would recommend to everybody that they run:

RAILS_ENV=development bundle exec rake assets:clean

Then do a hard refresh in your browser. Other than that @jdutil 's advice seems good.

JDutil commented 11 years ago

Closing out unless theres more details provided on how to reproduce the error since it works fine for me & the specs.

chrise86 commented 11 years ago

Also getting this problem on 1-3-stable branch:

gem 'spree', '1.3.2'
gem 'spree_editor', :github => 'spree/spree_editor', branch: "1-3-stable"
gem 'tinymce-rails', '>= 3.4.7.0.1'
gem 'ckeditor', '~> 4.0.2'

Admin js:

//= require jquery
//= require jquery_ujs

//= require admin/spree_core
//= require admin/spree_promo

//= require_tree .
//= require admin/spree_editor
JDutil commented 11 years ago

You should not need to include a tinymce and ckeditor gems in your gemfile. Perhaps try removing them as you may be referencing bad versions.

I also don't support ckeditor before having added it to the master branch for Spree 2.0. If you continue to have problems I would suggest waiting to use it until Spree 2.0 as that's what the intended version for ckeditor was.

chrise86 commented 11 years ago

Ok I've tried various combinations, but the code thats breaking is:

<script type="text/javascript">
  $(function() {
    var myConfig = { dompath: true };
    tinyMCE.init({"mode":"exact","editor_selector":"tinymce","theme":"advanced","language":"en","skin":"o2k7","plugins":"safari,style,layer,table,advhr,advimage,inlinepopups,insertdatetime,preview,media,searchreplace,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template","theme_advanced_buttons1":"cut,copy,paste,pastetext,pasteword,|,search,replace,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview","theme_advanced_buttons2":"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,sub,sup,|,bullist,numlist,|,outdent,indent,blockquote,|,","theme_advanced_buttons3":"styleselect,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor","theme_advanced_buttons4":"tablecontrols,|,hr,removeformat,visualaid","theme_advanced_buttons5":"fullscreen,|,charmap,media,advhr,|,visualchars,blockquote","theme_advanced_toolbar_location":"top","theme_advanced_toolbar_align":"left","theme_advanced_statusbar_location":"top","theme_advanced_resizing":false,"elements":"product_description,page_body"});
  });
</script>

It appears above everything else in the head.

emilkarl commented 9 years ago

I've got the same problem with 1-3-stable. Anyone solution for this?