Skip to content

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

Closed
jorgefilipecosta wants to merge 1 commit into
masterfrom
fix/styles-that-are-wrapped-with-editor-styles-wrapper-are-not-cached
Closed

Fix: Styles that are wrapped with editor styles wrapper are not cached#18763
jorgefilipecosta wants to merge 1 commit into
masterfrom
fix/styles-that-are-wrapped-with-editor-styles-wrapper-are-not-cached

Conversation

@jorgefilipecosta

Copy link
Copy Markdown
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
Copy Markdown
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