How to replace CKEditor CDN by yarn installed in Rails app

126 Views Asked by At

I have a Rails 6 app integrated with CKEditor Gem well.

https://github.com/galetahub/ckeditor

But I got a request that I need to replace the CDN to internal host, so I tried install CKEditor by yarn add ckeditor, and it's success.

When I go to the page have editor, the CKEDITOR exist in browser console, but have following error

root/edit_url/lang/ja.js?t=N2MA (404 Not found)
Cannot set properties of undefined (setting 'dir')
root/edit_url/skins/moono-lisa/editor.css?t=N2MA (404 Not found)

I notice that in html head part, these two line appear unexpectedly.

<link rel="stylesheet" type="text/css" href="http://localhost:3000/post/post-id/skins/moono-lisa/editor.css?t=N2MA">
<script type="text/javascript" src="http://localhost:3000/post/post-id/lang/ja.js?t=N2MA"></script>

But I think it should also looking from application.js and application.css files.

Does anyone knows how to fix this issue? Thanks.

I think it's kind of path issue, but I tried many different CKEDITOR_BASEPATH doesn't solve.

0

There are 0 best solutions below