jodit / jodit-react

React wrapper for Jodit
MIT License
354 stars 118 forks source link

Export to PDF - Need URL for AJAX request #257

Open hutber opened 5 months ago

hutber commented 5 months ago

image

I am getting ready the code while I wait for my company to finally give me the OME licence key.

So in the mean time I have no license key plugged into the config, and when I click "export to PDF" I get the above error.

I am unsure what the connector url is meant to be and what its function is, is that meant to give me the PDF file? Does jodit just send the html to that url? It is not in any documentation on the site.

    const [localConfig, setConfig] = useState({
      readonly: false,
      toolbar: true,
      fullsize: fullSize,
      globalFullSize: false,
      uploader: {
        url: 'https://sitename.ru/connector/index.php?action=upload'
      },
      ...config,
    });

    <JoditEditor
      config={localConfig}
      onChange={handleWYSIWYGChange}
      value={value}
      removeButtons={['fullsize']}
      {...props}
    />
archidigital commented 3 months ago

Hi @hutber , Specify the following configuration: exportDocs: { ajax: { url: "https://xdsoft.net/jodit/finder/" } } and it should work. 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} />;
};

I'm using react@18.2.0 and jodit-pro-react@4.1.11