question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ability to show a spinner while the editor is loading

See original GitHub issue

Is your feature request related to a problem? Please describe.

Feature request, unless a solution already exists.

I am currently “self hosting” the tinymce script with unpkg by supplying the prop tinymceScriptSrc="https://unpkg.com/tinymce@5.6.1/tinymce.min.js" to the Editor component.

I noticed that it might take some time until the editor is fully loaded and gets rendered. It’s an up and down. Sometimes faster, sometimes slower. This means that users stare at a nearly blank page until the editor is rendered.

Describe the solution you’d like

I would like to improve the user experience by showing a spinner. They should know that something is happening. However I could not find a event callback that is actually called when the editor finished loading and renders.

 <Editor
      tinymceScriptSrc="https://unpkg.com/tinymce@5.6.1/tinymce.min.js"
      onShow={() => console.log("onShow")}
      onBeforeRenderUI={() => console.log("onBeforeRenderUI")}
      onActivate={() => console.log("onActivate")}
      onPreProcess={(e) => console.log("onPreProcess")}
      onPostProcess={(e) => console.log("onPostProcess")}
      onLoadContent={() => console.log("onLoadContent")}
      value={props.value}
      onEditorChange={props.onChange}
      init={...}
    />

None of the callbacks above logs to the console so I assume that none is called.

Am I missing something or would it be possible to have a callback that is called when the editor is actually rendered. Without a callback like this, I see no possibility to know when the spinner should be hidden.

Describe alternatives you’ve considered

I also considered to load the tinymce script in a <script /> tag myself. However all the themes, plugins etc. are still first loaded when the Editor component is rendered. So this does not really improve the load time.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
tiny-jamescommented, May 9, 2021

Since someone asked, here’s an example with a spinner: https://codesandbox.io/s/tinymcereact-with-loading-spinner-n4e7b

1reaction
tiny-jamescommented, Feb 15, 2021

Thanks for the bug report.

The reason none of those events are firing is that the editor does not add the listeners until the init event fires.

You could still implement a spinner using the setup function (in the init prop) and the onInit prop: https://codesandbox.io/s/tinymcereact-forked-n4e7b?file=/src/index.js

Also with the current release you could get those other events by registering them in the setup function however I admit it’s a bug for us to have those event handlers but only register them after the init event fires effectively making them useless. I will put together a PR to register event handlers on setup.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Loading Spinner while CKEditor loads - Stack Overflow
I would like to have a loading spinner animation display while the editor was loading with no textarea displayed, as opposed to the...
Read more >
Loading Spinner - Kaizen Design System
A loading spinner is generally a branded element with a looping animation that indicates loading is in process and where it will appear....
Read more >
How to manually show and hide loading or spinning image?
Instead of default datasource config/method to load remote data, I am using a custom function to load data and I like to manually...
Read more >
Show Loading spinner when a Gallery is loading in Power ...
Show Loading spinner when a Gallery is loading in Power apps canvas apps · None – This value signifies that the spinner won't...
Read more >
Loading Spinner on Whole Page on Every Livewire Request
You can support for the growth of this channel by purchasing one of my product called(Laravel Livewire Starter Kit) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found