I am trying to get Export to PDF working with Jodit, but for some reason I am running into this error above. The Documentation for the exporter features no code or examples nor can I find any at all.
const [localConfig, setConfig] = useState({
readonly: false,
toolbar: true,
fullSize,
globalFullSize: false,
extraPlugins: ["export-docs"],
export: {
fileProxy: "/export-to-pdf", // Ensure this endpoint is correctly set up on your server
download: true, // Enable download directly from the editor
},
...config,
});
<JoditEditor
ref={editor}
config={localConfig}
onChange={handleWYSIWYGChange}
value={value}
{...props}
/>
Had the same issue and after some digging I managed to download the PDF by specifying the following configuration:
exportDocs: { ajax: { url: "https://xdsoft.net/jodit/finder/" } }
I'm using react@18.2.0
and jodit-pro-react@4.1.11
.
Below, an example of working code:
import JoditEditor from "jodit-pro-react";
import { FC, useState } from "react";
export const DocumentEditor: FC = () => {
const [editorText] = useState<string>("");
const [localConfig] = useState({
exportDocs: {
ajax: {
url: "https://xdsoft.net/jodit/finder/"
}
},
license: "*****-*****-*****-*****",
buttons: ["exportDocs"]
});
return <JoditEditor value={editorText} config={localConfig} />;
};