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

Fix: Styles that are wrapped with editor styles wrapper are not cached #18763

Conversation

jorgefilipecosta
Copy link
Member

Fix: #18741

Description

Until now we passed the editor styles content via editor settings. The editor module transformed the CSS rules to wrap them and added them to a newly created style element on the page.
The current approach has two problems:

  • The styles are not cached and they are passed as a set every time the editor loads.
  • If the editor styles are pointing to a http(s) URL the server needs to download the styles on every page load to content before sending the styles to the client.

This PR proposes a different approach: Editor styles are enqueued to the client so they can be cached and the server does not need to download anything, as a setting we just pass the editor style URL's. On the client, we dynamically change the stylesheets to be correctly wrapped.

How has this been tested?

I checked the editor still looks as before.
Using the browser dev tools I checked the stylesheets were transformed as expected.

@jorgefilipecosta jorgefilipecosta added [Feature] Custom Editor Styles Functionality for adding custom editor styles [Type] Enhancement A suggestion for improvement. labels Nov 26, 2019
@jorgefilipecosta
Copy link
Member Author

Closing this PR as the approach referred may have some problems in the core because the styles are concatenated there so isolating specific style sheets is not simple.

@oandregal oandregal deleted the fix/styles-that-are-wrapped-with-editor-styles-wrapper-are-not-cached branch April 29, 2020 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Custom Editor Styles Functionality for adding custom editor styles [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Styles that are wrapped with editor styles wrapper are not cached
1 participant