Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jodit call a lot of times of blob endpoint to get worker-html.js #1154

Open
biokaito opened this issue Jul 2, 2024 · 8 comments
Open

Jodit call a lot of times of blob endpoint to get worker-html.js #1154

biokaito opened this issue Jul 2, 2024 · 8 comments

Comments

@biokaito
Copy link

biokaito commented Jul 2, 2024

Jodit Version: 4.0.30

Browser: Chrome
OS: Windows/Mac
Is React App: True
Reproduced on xdsoft.net: True
React Version 17.0.1

Code

<JoditEditor
    // className="mail-content-container"
    ref={editor}
    value={dataContent || mailObject?.content}
    config={configJodit}
    onBlur={handleCKEditorChange}
    tabIndex={1}
    onChange={(newContent) => {}}
  />

Here is log for network on our staging env.
image

And this is log on localhost:
image

image

image

Jodit call a lot of times to get the same response, it is importScripts('https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.2/worker-html.js');

Expected behavior: Call less and don't make Jodit component re-render

Actual behavior: Make Jodit component re-render a lot of times, can not use it.

@biokaito
Copy link
Author

biokaito commented Jul 2, 2024

I tried to upgrade to Jodit-react 4.1.2 but not work for me

@dotam308
Copy link

dotam308 commented Jul 3, 2024

I met this situation too
Trying to find a solution on google, but seems like no results =((
This is so urgent to my project

Please help....Anyone?

@xdan
Copy link
Owner

xdan commented Jul 3, 2024

Hi, @biokaito could you show full code? First of all - onChange={useCallback((newContent) => {}, [])}

@biokaito
Copy link
Author

biokaito commented Jul 3, 2024

Hi @xdan , Here is all my code about Jodit Editor.
import JoditEditor from 'jodit-react';

const configJodit = { readonly: false, observer: false, toolbar: true, spellcheck: true, language: 'en', toolbarButtonSize: 'medium', toolbarAdaptive: false, showCharsCounter: true, showWordsCounter: true, showXPathInStatusbar: false, askBeforePasteHTML: true, askBeforePasteFromWord: true, defaultActionOnPaste: 'insert_clear_html', buttons, uploader: { insertImageAsBase64URI: true, }, width: 800, height: 550, autofocus: true, noDefaultProperties: true, toolbarInline: true, toolbarInlineForSelection: true, toolbarInlineDisableFor: [], toolbarInlineDisabledButtons: ['source'] }

const [dataContent, setDataContent] = useState('');

const editor = useRef(null);

`const handleCKEditorChange = async (data) => {
    setDataContent(data);
  };`

`<JoditEditor
    ref={editor}
    value={dataContent}
    config={configJodit}
    onBlur={handleCKEditorChange}
    tabIndex={1}
  />`

@quanntdev
Copy link

Coincidentally
I am also encountering a similar error.
Somehow, I can't reproduce this error locally, but it appears when I deploy.
I have tried searching for a solution but haven't found any results. Hopefully, someone can help me.

@dotam308
Copy link

dotam308 commented Jul 4, 2024

Hi @xdan , Here is all my code about Jodit Editor. import JoditEditor from 'jodit-react';

const configJodit = { readonly: false, observer: false, toolbar: true, spellcheck: true, language: 'en', toolbarButtonSize: 'medium', toolbarAdaptive: false, showCharsCounter: true, showWordsCounter: true, showXPathInStatusbar: false, askBeforePasteHTML: true, askBeforePasteFromWord: true, defaultActionOnPaste: 'insert_clear_html', buttons, uploader: { insertImageAsBase64URI: true, }, width: 800, height: 550, autofocus: true, noDefaultProperties: true, toolbarInline: true, toolbarInlineForSelection: true, toolbarInlineDisableFor: [], toolbarInlineDisabledButtons: ['source'] }

const [dataContent, setDataContent] = useState('');

const editor = useRef(null);

`const handleCKEditorChange = async (data) => {
    setDataContent(data);
  };`

`<JoditEditor
    ref={editor}
    value={dataContent}
    config={configJodit}
    onBlur={handleCKEditorChange}
    tabIndex={1}
  />`

Hi @xdan , Here is all my code about Jodit Editor. import JoditEditor from 'jodit-react';

const configJodit = { readonly: false, observer: false, toolbar: true, spellcheck: true, language: 'en', toolbarButtonSize: 'medium', toolbarAdaptive: false, showCharsCounter: true, showWordsCounter: true, showXPathInStatusbar: false, askBeforePasteHTML: true, askBeforePasteFromWord: true, defaultActionOnPaste: 'insert_clear_html', buttons, uploader: { insertImageAsBase64URI: true, }, width: 800, height: 550, autofocus: true, noDefaultProperties: true, toolbarInline: true, toolbarInlineForSelection: true, toolbarInlineDisableFor: [], toolbarInlineDisabledButtons: ['source'] }

const [dataContent, setDataContent] = useState('');

const editor = useRef(null);

`const handleCKEditorChange = async (data) => {
    setDataContent(data);
  };`

`<JoditEditor
    ref={editor}
    value={dataContent}
    config={configJodit}
    onBlur={handleCKEditorChange}
    tabIndex={1}
  />`

hi @xdan , have you had a chance to look at this?

@batdaucode
Copy link

I also got this error. Please fix it

@xdan
Copy link
Owner

xdan commented Jul 4, 2024

Hi, @biokaito

const configJodit = useMemo(() => ({
const handleCKEditorChange = useCallback(async (data) => {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants