-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Fixes #6206: Fix enlargement of text in RTE #6447
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.
LGTM from code owner's perspective, Thanks @bansalnitish!
Codecov Report
@@ Coverage Diff @@
## develop #6447 +/- ##
===========================================
- Coverage 75.76% 75.73% -0.04%
===========================================
Files 992 969 -23
Lines 78607 78350 -257
Branches 4649 4625 -24
===========================================
- Hits 59560 59335 -225
+ Misses 19047 19015 -32
Continue to review full report at Codecov.
|
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 @bansalnitish, I have one concern. PTAL. Thanks!
nested inside the p and span tag. !important is added to override | ||
the inline css.*/ | ||
.oppia-rte p span { | ||
font-size: 1em !important; |
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.
Is this the only way to get this done? I am saying this because we already have an issue #5097 regarding removal of !important
from the codebase.
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 agree with @YashJipkate. Please find a way to avoid !important, or explain the line of reasoning (with evidence) that causes you to conclude that doing so is not possible. Typically you can avoid the use of !important by adding more specificity in the CSS rule.
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.
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 don't think we can remove !important
from here. As discussed on the issue thread, a span tag gets introduced before the text (which the issue of CKEditor) with a inline style. !important
is a only way to remove that inline style.
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.
Wait -- I don't understand something. If the inline style is coming from a CSS class in oppia.css, why is that style being added inline to the span tag? Is there some JS code that is doing that? Normally styles in oppia.css classes will show up as being part of the class in the CSS inspector, it wouldn't be "unpacked" and added to the DOM element directly.
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 span tag is introduced by CKEditor. It comes as style=font-size:1.6 em
. It's taking the same font size whatever is mentioned in the body tag in oppia.css.
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.
Ah ok. Can you add all this information to the comment as justification of why this cannot be resolved without using !important? Once you've done that, I think this can go in.
Thanks!
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.
Sure, thanks!
This size is taken similar to font-size in the body element. There is as | ||
such no way to remove !important as of now, its a CKEditor bug | ||
(refer issue #6206). */ | ||
.oppia-rte p span { |
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.
Why do we do this for both oppia-rte and oppia-rte-editor?
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 did this because this bug appeared to happen during the editing mode as well after saving. So I need to fix it at both of these places. Thanks!
@@ -358,6 +358,21 @@ p:last-child { | |||
margin: 1.4em 0; | |||
} | |||
|
|||
/* This will prevent the enlargment of the text in the RTE. A span tag gets |
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.
spelling: enlargement
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.
Done!
@@ -358,6 +358,21 @@ p:last-child { | |||
margin: 1.4em 0; | |||
} | |||
|
|||
/* This will prevent the enlargment of the text in the RTE. A span tag gets | |||
introduced when a user selects the text from the end of first line, goes to the | |||
second one and then write some text to replace that. The span tag carries |
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.
write --> writes
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.
Done!
along with it a style=font-size:1.6em;, due to which the text is enlarged. | ||
This size is taken similar to font-size in the body element. There is as | ||
such no way to remove !important as of now, its a CKEditor bug | ||
(refer issue #6206). */ |
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.
issue #6206 on Oppia
(otherwise sounds like it's #6206 on CKEditor repo)
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.
Done!
introduced when a user selects the text from the end of first line, goes to the | ||
second one and then write some text to replace that. The span tag carries | ||
along with it a style=font-size:1.6em;, due to which the text is enlarged. | ||
This size is taken similar to font-size in the body element. There is as |
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.
This size seems to be taken from the font-size from the body element's CSS class, but we do not know what JS code is causing it to be inlined in the span tag.
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.
Done!
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.
Thanks @bansalnitish!
along with it a style=font-size:1.6em;, due to which the text is enlarged. | ||
This size seems to be taken from the font-size from the body element's | ||
CSS class, but we do not know what JS code is causing it to be inlined in the | ||
span tag. There is as such no way to remove !important as of now, its a CKEditor |
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.
nit: it's not its.
("It's" is short for "it is" and is appropriate here.)
@YashJipkate, I think this needs your review. Thanks! |
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! Thanks @bansalnitish!
Hm. Any idea why it says "The Travis CI build is still in progress"? The Details page suggests that they've completed. /cc @oppia/dev-workflow-team |
@bansalnitish, I think your branch is not up-to-date to develop. Can you please update your branch? Lint checks now run on CircleCi. Thanks! |
Fixes #6206.