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

Performance issue #80

Closed alepore closed 9 years ago

alepore commented 10 years ago

Hi! I get slow rendering of the editor_engines/_ck_editor.html.erb partial, like 1s on a pretty slow server and 500ms on the development machine. that's like 75% of the page rendering time.

Anyone has the same problem? I'm on 2-2-stable

alepore commented 10 years ago

update: not sure i understand what the tweaked template does, but i stripped down my _ck_editor.html.erb as follow and i solved performance problems. ckeditor works for me when deployed in production with capistrano. note: i'm using ckeditor gem 4.1.0

<script>
  window['CKEDITOR_BASEPATH'] = "/assets/ckeditor/";
</script>

<%= javascript_include_tag 'ckeditor/init' %>

<script>
  $(function() {
    var ids = [<%= raw ids.map{|id| "'#{id}'"}.join(', ') %>];
    for (var key in ids) {
      if ($('#' + ids[key]).length > 0) {
        CKEDITOR.replace(ids[key]);
      }
    }
  });
</script>
JDutil commented 10 years ago

would you mind submitting a PR?

alepore commented 10 years ago

@sbasir please review this change as the original PR was yours