-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
ace editor setting theme has a delay #3286
Comments
include the file for the theme right after the ace.js file, instead of letting ace to load it. |
I tried like above,but it didn't set theme to tomorrow_night. If I also keep the follow statement,then the editor also has a blank view at first then turn to tomorrow_night. |
you need to keep the setTheme line. |
Ahan so that is the problem! I am trying to get the computed background color from my editor but it returns white everytime. Is there an event that is triggered once the theme is loaded |
setTheme('ace/theme/monokai', ()=>{}) has a callback, notice the function that gets triggered after the theme has been loaded. |
Why this change? On a slow network, using the `AceEditor` component will result in a blob of text being shown first before being swapped out with the `ace.js` editor after it has completed loading. There is also a problem when setting the theme for the editor which would result in a "flash" as reported in ajaxorg/ace#3286. To avoid this, we need to load the theme js file before displaying the editor. What does this change do? 1. Adds a loading spinner and set the `div.ace` with a `.hidden` class. 2. Once all the relevant scripts and initialization is done, we will then remove the loading spinner and remove `div.ace`.
Why this change? On a slow network, using the `AceEditor` component will result in a blob of text being shown first before being swapped out with the `ace.js` editor after it has completed loading. There is also a problem when setting the theme for the editor which would result in a "flash" as reported in ajaxorg/ace#3286. To avoid this, we need to load the theme js file before displaying the editor. What does this change do? 1. Adds a loading spinner and set the `div.ace` with a `.hidden` class. 2. Once all the relevant scripts and initialization is done, we will then remove the loading spinner and remove `div.ace`.
Why this change? On a slow network, using the `AceEditor` component will result in a blob of text being shown first before being swapped out with the `ace.js` editor after it has completed loading. There is also a problem when setting the theme for the editor which would result in a "flash" as reported in ajaxorg/ace#3286. To avoid this, we need to load the theme js file before displaying the editor. What does this change do? 1. Adds a loading spinner and set the `div.ace` with a `.hidden` class. 2. Once all the relevant scripts and initialization is done, we will then remove the loading spinner and remove `div.ace`.
…26099) Why this change? On a slow network, using the `AceEditor` component will result in a blob of text being shown first before being swapped out with the `ace.js` editor after it has completed loading. There is also a problem when setting the theme for the editor which would result in a "flash" as reported in ajaxorg/ace#3286. To avoid this, we need to load the theme js file before displaying the editor. What does this change do? 1. Adds a loading spinner and set the `div.ace` with a `.hidden` class. 2. Once all the relevant scripts and initialization is done, we will then remove the loading spinner and remove `div.ace`.
when I use ace editor in my project,I set the theme to tommorow_night,but every time the web page firstly set the editor to the default theme,and then about a second later changed to tommorow_night,this caused the editor to have a one-second empty time,just like the picture below:
then it turned to this:
and then quickly changed to tomoorow_night:
Is there a way to disable the default theme and just load the tomorrow_night theme directly?
The text was updated successfully, but these errors were encountered: