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 for lack of cache key for some resources #4852

Merged
merged 9 commits into from
Aug 27, 2021
Merged

Fix for lack of cache key for some resources #4852

merged 9 commits into from
Aug 27, 2021

Conversation

Comandeer
Copy link
Member

What is the purpose of this pull request?

Bug fix

Does your PR contain necessary tests?

All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.

This PR contains

  • Unit tests
  • Manual tests

Did you follow the CKEditor 4 code style guide?

Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.

  • PR is consistent with the code style guide

What is the proposed changelog entry for this pull request?

Fixed Issues:

* [#4761](https://github.com/ckeditor/ckeditor4/issues/4761): Fixed: not all resources loaded by the editor respect the cache key.

API Changes:

* [#4761](https://github.com/ckeditor/ckeditor4/issues/4761): [`CKEDITOR.dom.document#appendStyleSheet()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dom_document.html#method-appendStyleSheet) and [`CKEDITOR.tools.buildStyleHtml()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_tools.html#method-buildStyleHtml) now use [`CKEDITOR.getUrl()`](https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html#method-getUrl) to correctly handle caching of CSS files.

What changes did you make?

I've used CKEDITOR.getUrl() inside CKEDITOR.tools.buildStyleHtml() (used to load config.contentsCss files) and CKEDITOR.dom.document#appendStyleSheet() (used to add stylesheets in plugin) to add the cache key to every CSS file.

I've also changed the default value of config.contentsCss as wrapping it in CKEDITOR.getUrl() is no longer needed (not sure if we should add info about it to changelog or some notification in API docs?). I've added some basic tests for CKEDITOR.getUrl() as well – apparently it wasn't tested until now.

As it's a potentially breaking change I'll target it to major instead of master.

Which issues does your PR resolve?

Closes #4761.

@sculpt0r sculpt0r self-assigned this Aug 25, 2021
Copy link
Contributor

@sculpt0r sculpt0r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also changed the default value of config.contentsCss as wrapping it in CKEDITOR.getUrl() is no longer needed (not sure if we should add info about it to changelog or some notification in API docs?).

I think we don't have to mention that anywhere - since the final result will be the same.

It is nice that you covered old functionality with tests :)

I left just two small comments. Tests on building editor seems to be working fine 👍

tests/core/ckeditor/manual/geturl.html Outdated Show resolved Hide resolved
tests/core/ckeditor/geturl.js Outdated Show resolved Hide resolved
@sculpt0r sculpt0r assigned sculpt0r and unassigned sculpt0r Aug 26, 2021
@Comandeer Comandeer self-assigned this Aug 26, 2021
Comandeer and others added 2 commits August 26, 2021 16:36
Co-authored-by: Bartłomiej Kalemba <[email protected]>
Co-authored-by: Bartłomiej Kalemba <[email protected]>
@Comandeer
Copy link
Member Author

I've applied all your suggestions. Thanks for doing the work for me ;)

Copy link
Contributor

@sculpt0r sculpt0r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍 🎉

Nice job - we have another bug down :D

@sculpt0r sculpt0r merged commit 70649e5 into major Aug 27, 2021
@sculpt0r sculpt0r deleted the t/4761 branch August 27, 2021 05:49
Comandeer added a commit that referenced this pull request Nov 17, 2021
This reverts commit 70649e5, reversing
changes made to 92173c6.
jacekbogdanski added a commit that referenced this pull request Nov 17, 2021
Revert "Merge pull request #4852 from ckeditor/t/4761"
@sculpt0r sculpt0r mentioned this pull request Dec 22, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache key not applied everywhere
2 participants