Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Commit

Permalink
remove problematic code, fixes #80 and #101
Browse files Browse the repository at this point in the history
  • Loading branch information
alepore committed May 21, 2015
1 parent 0ac3054 commit f5215b7
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions app/views/shared/editor_engines/_ck_editor.html.erb
@@ -1,26 +1,7 @@
<script>
window['CKEDITOR_BASEPATH'] = "/assets/ckeditor/";

window.CKEDITOR_ASSETS_MAPPING = {
<% Rails.application.assets.each_logical_path(->(path){ path =~ /ckeditor/ && path != 'ckeditor/override.js' }) do |asset| %>
"<%= asset %>": "<%= asset_path(asset) %>",
<% end %>
}

window.CKEDITOR_GETURL = function( resource ) {
// If this is not a full or absolute path.
if ( resource.indexOf( ':/' ) == -1 && resource.indexOf( '/' ) !== 0 )
resource = this.basePath + resource;

// Add the timestamp, except for directories.
if ( resource.charAt( resource.length - 1 ) != '/' ){
var url = resource.match( /^(.*?:\/\/[^\/]*)\/assets\/(.+)/ );
if(url) resource = (CKEDITOR_ASSETS_MAPPING[url[2]] || '/assets/' + url[2]);
}

return resource;
}
</script>

<%= javascript_include_tag 'ckeditor/init' %>

<script>
Expand Down

8 comments on commit f5215b7

@alepore
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still not sure why that code was there.
only problems with that, and ckeditor works well without it.

@Godweed
Copy link

@Godweed Godweed commented on f5215b7 Oct 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello I guess this is related with the asset pipeline issue. The current version do not work in production mode. Could not find the ckeditor/init.js in production mode.

@alepore
Copy link
Member Author

@alepore alepore commented on f5215b7 Oct 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Godweed what version are you using?
I use spree editor on multiple 2.2 -> 3.0 stores without problems

@Godweed
Copy link

@Godweed Godweed commented on f5215b7 Oct 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using 3.0 stable version and getting
Request URL:http://www.domain.com/javascripts/ckeditor/init.js
Request Method:GET
Status Code:404 Not Found

@alepore
Copy link
Member Author

@alepore alepore commented on f5215b7 Oct 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Godweed
Copy link

@Godweed Godweed commented on f5215b7 Oct 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already added Rails.application.config.assets.precompile += %w( ckeditor/* )
and the files are precompiled in public/ckeditor but could not find the /javascripts/ckeditor/init.js file

looks like it is related basebath I guess could not fix it yet

var CKEDITOR_BASEPATH = '/assets/ckeditor/';

@alepore
Copy link
Member Author

@alepore alepore commented on f5215b7 Oct 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the ckeditor gem has a task to copy non digested files, see https://github.com/galetahub/ckeditor/blob/master/lib/tasks/ckeditor.rake

anyway this is a https://github.com/galetahub/ckeditor problem, like most of the issues on this gem

@Godweed
Copy link

@Godweed Godweed commented on f5215b7 Oct 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot alepore, at last it works

Please sign in to comment.