-
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
Fix fire print on Firefox #4813
Conversation
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.
I'm thinking about refactoring the whole thing a little bit and moving most of its part into preview
plugin (see my inline comments).
Additionally there are two failing tests inside print
suite (the one you modified and one about immediately invoking print on document.readyState === 'complete'
). However, instead of fixing, we should probably remove them and instead add some tests to preview
plugin to check if passed calback has been executed in the right time.
Thanks, @Comandeer for refactoring and review. Changes:
|
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.
Unfortunately our current approach does not work correctly in IE as it does not change document.readyState
to complete
if there are any images in the content. Additionally simply switching to load
event instead also won't work, because Safari does not fire load
for subsequent opening of preview window. It means that we have to introduce two different flows – one for IE, using (probably) load
event and other one for all other browsers.
Blocked by #4824. |
@Comandeer, I've added two ways to invoke the |
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.
Overally looks good, there's only one issue with the moment of invoking callback in IE (see inline comment).
Please also rebase the PR onto latest master
.
Thanks, @Comandeer for the review. Now it's working properly for me on every browser, and it's 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.
Fix seems to work well, good job!
However there are still some small issues:
- see my inline comments;
- there is a mismatch between manual test
.md
and.html
file, resulting in non-functional test – please fix it; - it'd be good to add two more unit tests – one for IE and checking if callback is really fired on
load
and one for other browsers to check if it's fired onreadystatechange
with appropriatereadyState
; - and traditionally – rebase onto latest
master
.
Thank's @Comandeer for the review. I added all the things you mentioned except the unit tests because we must using |
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.
After adding #3876 to issues closed by this PR, we need some manual test for it. Fortunately there is already one, /test/plugins/print/manual/print
– just add version and issue tags and it's good to go.
There is also a small issue with previewcdn
manual test. At the moment it's failing in Firefox due to the fact that it uses CKEditor 4 from the latest master
branch, so without the fix. I don't know if there's sensible way to fix it 🤔
</div> | ||
|
||
<script> | ||
if ( bender.env.mobile ) { |
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.
if ( bender.env.mobile ) { | |
if ( bender.tools.env.mobile ) { |
Thanks @Comandeer for the review. Changes:
With the earlier PR fixing #4444 problem, we decided to use the |
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 renamed fireCallback
and printCallback
to previewCallback
.
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
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?
The problem was with the page load status in FF mode, because an attempt to print was triggered when the preview page was not ready. So I added a
onreadystatechange
callback to wait for thecomplete
status.Also, due to the rollback of my previous changes related to the CDN opening "preview" problem #4444 I am adding these changes to this PR.
Which issues does your PR resolve?
Closes #4790.
#4444.
#3876