-
Notifications
You must be signed in to change notification settings - Fork 282
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 #898 | Added center align css interaction between IE11 and other … #899
Conversation
… other browsers
Just started reviewing :) |
Thanks for looking into this. I have several questions:
|
I can help add more information. On IE only center alignment (via text align) is set in the P element. Left and right is set on the IMG and uses float. The center text alignment can cause users left aligned text to go center when removing the image though that's not always a reliable reproduction. However there is a worse issue evident in the pasted code here. The CSS is missing a semi colon, causing styling issues too. |
Hi @duracell80, Thanks for adding that.
Which pasted code are we talking about? |
style="text-align:center" Img Float: left Also missing semi colons. |
Hi again @duracell80, I'm not seeing that in the alloy-editor demo, but rather something like this In Chrome <img data-cke-saved-src="http://21stcenturywaves.com/wp-content/uploads/2009/07/fullmoon.thumbnail.jpg" src="http://21stcenturywaves.com/wp-content/uploads/2009/07/fullmoon.thumbnail.jpg" class="" style="float: left;"> And in IE 11 <p><span tabindex="-1" class="cke_widget_wrapper cke_widget_inline cke_widget_image cke_image_nocaption cke_widget_selected cke_widget_focused" role="region" style="float: left;" contenteditable="false" aria-label=" undefined widget" data-cke-display-name="img" data-cke-filter="off" data-cke-widget-wrapper="1" data-cke-widget-id="0"><img class="cke_widget_element" alt="" src="http://21stcenturywaves.com/wp-content/uploads/2009/07/fullmoon.thumbnail.jpg" data-cke-saved-src="http://21stcenturywaves.com/wp-content/uploads/2009/07/fullmoon.thumbnail.jpg" data-widget="image" data-cke-widget-keep-attr="0" data-cke-widget-upcasted="1" data-cke-widget-data="%7B%22hasCaption%22%3Afalse%2C%22src%22%3A%22http%3A%2F%2F21stcenturywaves.com%2Fwp-content%2Fuploads%2F2009%2F07%2Ffullmoon.thumbnail.jpg%22%2C%22alt%22%3A%22%22%2C%22width%22%3A%22%22%2C%22height%22%3A%22%22%2C%22lock%22%3Atrue%2C%22align%22%3A%22left%22%2C%22classes%22%3Anull%7D"><span class="cke_reset cke_widget_drag_handler_container" style='background: url("http://192.168.1.74:8000/dist/alloy-editor/plugins/widget/images/handle.png") rgba(220, 220, 220, 0.5); left: 0px; top: -15px; display: block;'><img width="15" height="15" title="Click and drag to move" class="cke_reset cke_widget_drag_handler" role="presentation" draggable="true" src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" data-cke-widget-drag-handler="1"></span><span class="cke_image_resizer"></span></span></p> So while the Thanks |
Hello @julien, Thank you for looking into this. This is an odd issue and I will try to explain the situation better so we can all be on the same page.
I do not believe my changes caused this error. I believe this was the only error but I could be mistaken.
Let me know if this makes sense and if any more information is needed. |
I'm looking from a slightly different perspective in published content on DXP 7.0. if you run the same tests in DXP you'll see IE is publishing code without semi colon's which will cause issues in general. |
Can this fix be reviewed please because center alignment should not be being set on the paragraph element, the alignment should apply to the image element. |
Just started reviewing :) |
Hey @fortunatomaldonado, I tested this fix in portal regarding #898 and it solves the issue. Concerning the tests, I'm not sure about what's going on, I've tested I'll try running the on the CI again and see if it's still happening. Thanks! |
Hello @julien, I reran the tests locally on master and I am no longer getting the errors. I am not sure what may have caused it or what made it go away. Let me know if the errors still appears after running CI again. Thank you. |
I spent some time changing the saucelabs configuration and fixing the failing test, as soon as this is solved I'll have another look and rerun the tests on travis+saucelabs and keep you updated. Sorry for the delay |
Hello @julien, No worries. It looks like your changes fixed the issue. Thank you for your efforts. |
…browsers
Issue
#898
The issue is the difference in center alignment for IE11 and other browsers will clash and produce unexpected behaviors such as unable to unalign. The left and right align work correctly since this is only adding
float: left
andfloat: right
to the content.Center align is problematic since in IE11, it adds
text-align: center
style to the parentNode of the image, image container. While in other browsers the stylesmargin-right: auto
,margin-left: auto
anddisplay:block
is added to the image.Solution
A solution is to adjust these styles so that they will be correct no matter which browser is being used.
When aligning in other browsers, the first check
getImageAlignment
will look for a text-align Style in the image container. If it is found, then that means it has been previously edited and expect to be center aligned. Then it will add the center alignment in the image. TheremoveImageAlignment
will check and remove the text-align style from the image container.setImageAlignment
will add the style to the image container so that if the content is being worked on in IE11, it will be properly aligned.In IE11, the style is removed from the image since they are not needed on the image but on the image container.
I tested on Firefox, Chrome, and IE11.
Let me know if there are any questions or comments about this.
Thank you.