I am trying to add a plugin to the classic build of CKEditor5. I have followed the instructions on this page: https://ckeditor.com/docs/ckeditor5/latest/installation/plugins/installing-plugins.html
I can tell that I've done everything properly since everything works as it is supposed to when I open up the sample/index.html
.
Now comes the time to integrate this custom build with my react app.
The instructions on this page, 'describe' what to do:
You will create a new build somewhere next to your project and include it like you included one of the existing builds.
It says to 'include it like you included of one of the existing builds'. Well, this is how I included the classic-build:
import React from "react";
import ReactDOM from "react-dom";
import CKEditor from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
import "./styles.css";
function App() {
return (
<div className="App">
<CKEditor
editor={ClassicEditor}
// Other Props
}}
/>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
So, I would assume that I would do something like this:
import React from "react";
import ReactDOM from "react-dom";
import CKEditor from "@ckeditor/ckeditor5-react";
import ClassicEditor from './ckeditor/ckeditor'
import "./styles.css";
function App() {
return (
<div className="App">
<CKEditor
editor={ClassicEditor}
// Other Props
/>
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
That is, simply change the import
statement from:
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
to
import ClassicEditor from './ckeditor/ckeditor'
With ./ckeditor/ckeditor/
being the ckeditor.js
file found in the build
folder of my modified version of the custom build.
But, this does not work. There is no export in the new ckeditor.js file. Neither a default export nor a named export. So perhaps I should import the file like this:
import './ckeditor/ckeditor'
But then how do I tell the React component which editor to use. There is an editor
prop, which takes the name of the editor to use -- namely:
<CKEditor
editor={ClassicEditor}
// Other Props
/>
So I am stuck. I have no idea how to include the custom build into my react app.
Any ideas?
Thanks.