Reputation: 33
When integrating CKeditor in Laravel. It returns error:
GET http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js net::ERR_ABORTED 404 (Not Found)
Uncaught ReferenceError: CKEditor is not defined at add:88
This is my code:
<script src="vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
<textarea id="editor1" ></textarea>
<script>
CKEDITOR.replace( 'editor1' );
</script>
There are questions with the same problem, but none helped me
Upvotes: 0
Views: 10299
Reputation: 1
use this script <script src="https://cdn.ckeditor.com/4.5.6/standard/ckeditor.js"></script>
and after your text area write
<script>CKEDITOR.replace( 'article-ckeditor' ); </script>
it will works with you
Upvotes: -1
Reputation: 1494
You must first publish vendor with:
php artisan vendor:publish --tag=ckeditor
And then use the asset helper function to address the script file:
<script src="{{asset('vendor/unisharp/laravel-ckeditor/ckeditor.js')}}"></script>
or
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
This happened because You forgot to add a forward slash before referencing the js file. this way browser addresses it from where your page currently at. so use slash before the address or use the asset helper function
This should print out this:
http://127.0.0.1:8000/vendor/unisharp/laravel-ckeditor/ckeditor.js (correct)
Instead of this:
http://127.0.0.1:8000/control/post/vendor/unisharp/laravel-ckeditor/ckeditor.js (wrong)
Upvotes: 2