-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add cache key to assets #5003
Add cache key to assets #5003
Conversation
It's been a while since we last heard from you. We are marking this pull request as stale due to inactivity. Please provide the requested feedback or the pull request will be closed after next 7 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @sculpt0r
Everything looks solid and works properly. 👍
There are some small typos to check and also I am thinking about creating an additional test. Please check my comments below.
|
||
<script> | ||
( function() { | ||
if ( bender.tools.env.mobile || !CKEDITOR.timestamp ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, this test will be only run on builded version of the editor.
Maybe should we create another test with sets CKEDITOR.timestamp
, which will allow checking properly adding cache key without building the editor, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be difficult to do so as timestamp should be set before resources are being loaded – so basically before loading CKEditor. As Bender manages loading the editor, it's a really non-trivial task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally speaking sounds like a good idea, but due to ⬆️ #5003 (comment) I'll leave it as it is.
tests/core/tools.js
Outdated
}, | ||
|
||
// (#4761) | ||
'test buidStyleHtml returns relative URL for passed relative URL string': function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'test buidStyleHtml returns relative URL for passed relative URL string': function() { | |
'test buildStyleHtml returns |
The same typo is in the next 2 tests.
tests/core/tools.js
Outdated
expected = '<style>' + styleText + '</style>', | ||
styledStringElem = CKEDITOR.tools.buildStyleHtml( styleText ); | ||
|
||
assert.areSame( expected, styledStringElem, 'Styled text was not exact same wrapped in style elem' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.areSame( expected, styledStringElem, 'Styled text was not exact same wrapped in style elem' ); | |
assert.areSame( expected, styledStringElem, 'Styled text was not exact same wrapped in style element' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution looks good, however some stylesheets are still missing a cache key after building docs, e.g.
- http://localhost:9001/ckeditor4/4.17.1/examples/image2.html –
tableselection,css
, - http://localhost:9001/ckeditor4/4.17.1/examples/spreadsheets.html –
balloontoolbar.css
,default.css
,dialog.css
.
Could you look into it?
|
||
<script> | ||
( function() { | ||
if ( bender.tools.env.mobile || !CKEDITOR.timestamp ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be difficult to do so as timestamp should be set before resources are being loaded – so basically before loading CKEditor. As Bender manages loading the editor, it's a really non-trivial task
Rebased on the newest master. |
In my case:
@Comandeer are you sure you have a freshly built doc version? |
Yes. These were the only resources without the cache key, everything else had it 🤔 I'll check it once more. |
Ok, it works. It seems that something's wrong with our docs build system (see #5019) and I had to force proper CKE4 version by manually checking out the branch inside |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution looks good, I'm only missing direct tests for CKEDITOR.appendTimestamp()
.
Rebased on the newest master |
@Comandeer - ready for another review.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I've just slightly improved API docs.
What is the purpose of this pull request?
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
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.
What is the proposed changelog entry for this pull request?
What changes did you make?
Give an overview…
The previous solution #4852 changed the default behavior for CSS URLs. Each time, the URL was provided - it was turned into the absolute path via the
getUrl
function which adds URL calculated based onCKEDITOR_BASEPATH
.ckeditor4/core/ckeditor_base.js
Lines 172 to 175 in 10b8a21
However, it was not always valid for products that may serve CKE4 from a specific location. The user may still want to serve its own CSS files based on the path related to the loaded page, not the editor.
Please notice, that changes in
ckeditor_base.js
require additional action and lead to changes inckeditor.js
:ckeditor4/core/ckeditor_base.js
Line 13 in 10b8a21
I changed almost the same places, but only appends the cache key.
Also, added tests for
getUrl
from the previous solution. Since @Comandeer already spends time to cover this part of the editor with the test - we may use them.Which issues does your PR resolve?
Closes #4761 .