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

onload and setContents #446

Closed
mkhstar opened this issue Jul 22, 2020 · 4 comments
Closed

onload and setContents #446

mkhstar opened this issue Jul 22, 2020 · 4 comments
Labels

Comments

@mkhstar
Copy link

mkhstar commented Jul 22, 2020

Hi @JiHong88,
In the latest release of suneditor, the onload function is never been called and the setContents is been set without inserting in the onload function. Please can you check on this

@JiHong88
Copy link
Owner

Hi @mkhstar :)

In previous versions, it was called in the "setTimeout" function and an error occurred when called before "onload".
But it changed.

onload is call in the _editorInit.
_editorInit method is called elsewhere depending on whether or not "iframe" is used.

iframe:

contextEl.wysiwygFrame.addEventListener('load', function () {
  util._setIframeDocument(this, options);
  core._editorInit(false, options.value);
  options.value = null;
});

not using iframe:

core._editorInit(false, options.value);
options.value = null;

So if you don't use "iframe", you can use "setContents" right away, but it won't work when you use the "iframe" option.
Using the "setContents" function before "onload" is not the right way.
Because due to the nature of the web, this code can also reuse "setTimeout".

@mkhstar
Copy link
Author

mkhstar commented Jul 22, 2020

The problem is in the latest version, editor.onload is never called. Please can you check that

@JiHong88 JiHong88 added the bug label Jul 23, 2020
@JiHong88
Copy link
Owner

I will release new version at today

@JiHong88
Copy link
Owner

@mkhstar The 2.32.1 version has been updated.
Thank you!

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

No branches or pull requests

2 participants