I am trying to setup the ckeditor5 in my local but I am facing this error
Uncaught SyntaxError: Invalid or unexpected token sample.html:14 Uncaught ReferenceError: ClassicEditor is not defined
Below is the local code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CKEditor 5 – Classic editor</title>
<script src="ckeditor1.js"></script>
</head>
<body>
<h1>Classic editor</h1>
<textarea name="content" id="editor">
<p>This is some sample content.</p>
</textarea>
<script>
ClassicEditor
.create( document.querySelector( '#editor' ) )
.catch( error => {
console.error( error );
} );
</script>
</body>
</html>
But the same is working when I am pointing to cdn ckeditor url:
.3.0/classic/ckeditor.js
working cdn jsfiddle
I am trying to setup the ckeditor5 in my local but I am facing this error
Uncaught SyntaxError: Invalid or unexpected token sample.html:14 Uncaught ReferenceError: ClassicEditor is not defined
Below is the local code.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CKEditor 5 – Classic editor</title>
<script src="ckeditor1.js"></script>
</head>
<body>
<h1>Classic editor</h1>
<textarea name="content" id="editor">
<p>This is some sample content.</p>
</textarea>
<script>
ClassicEditor
.create( document.querySelector( '#editor' ) )
.catch( error => {
console.error( error );
} );
</script>
</body>
</html>
But the same is working when I am pointing to cdn ckeditor url:
https://cdn.ckeditor.com/ckeditor5/12.3.0/classic/ckeditor.js
working cdn jsfiddle
Share Improve this question edited Jul 17, 2019 at 9:14 Lelio Faieta 6,6899 gold badges47 silver badges84 bronze badges asked Jul 17, 2019 at 8:27 RaphaelRaphael 1,8122 gold badges28 silver badges49 bronze badges4 Answers
Reset to default 8It's not working because you don't have editor script loaded, so there's no ClassicEditor
.
You need to load the editor from cdn first: <script src="https://cdn.ckeditor.com/ckeditor5/12.3.1/classic/ckeditor.js"></script>
This is worked for me
window.addEventListener("load", (e)=>{
ClassicEditor.create( document.querySelector( '#editor' ) )
.then( editor => {
console.log( editor );
} )
.catch( error => {
console.error( error );
} );
});
I had the same problem but when I looked in the files I found a folder called