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

Fixes #6206: Fix enlargement of text in RTE #6447

Merged
merged 6 commits into from
Mar 28, 2019

Conversation

bansalnitish
Copy link
Contributor

Fixes #6206.

Copy link
Contributor

@ankita240796 ankita240796 left a 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-io
Copy link

codecov-io commented Mar 13, 2019

Codecov Report

Merging #6447 into develop will decrease coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ
...loration_editor/editor_tab/ExplorationEditorTab.js 33.33% <0%> (-17.42%) ⬇️
schema_utils.py 95.9% <0%> (-4.1%) ⬇️
...s/dev/head/domain/utilities/LanguageUtilService.js 84.21% <0%> (-3.03%) ⬇️
core/templates/dev/head/pages/library/Library.js 23.72% <0%> (-2.51%) ⬇️
.../directives/ItemSelectionInputValidationService.js 67.16% <0%> (-1.67%) ⬇️
core/controllers/profile.py 88.48% <0%> (-1.4%) ⬇️
core/domain/visualization_registry.py 93.33% <0%> (-0.61%) ⬇️
...ev/head/expressions/ExpressionSyntaxTreeService.js 98.28% <0%> (-0.43%) ⬇️
core/controllers/base.py 95.43% <0%> (-0.39%) ⬇️
.../dev/head/domain/question/QuestionObjectFactory.js 93.44% <0%> (-0.21%) ⬇️
... and 164 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 11c73a7...eb69d3d. Read the comment docs.

Copy link
Contributor

@YashJipkate YashJipkate left a 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;
Copy link
Contributor

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.

Copy link
Member

@seanlip seanlip Mar 13, 2019

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.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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!

Copy link
Contributor Author

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 {
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

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

spelling: enlargement

Copy link
Contributor Author

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
Copy link
Member

Choose a reason for hiding this comment

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

write --> writes

Copy link
Contributor Author

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). */
Copy link
Member

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)

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Member

@seanlip seanlip left a 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
Copy link
Member

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.)

@seanlip
Copy link
Member

seanlip commented Mar 20, 2019

@YashJipkate, I think this needs your review. Thanks!

@seanlip seanlip removed their assignment Mar 20, 2019
Copy link
Contributor

@YashJipkate YashJipkate left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @bansalnitish!

@YashJipkate YashJipkate removed their assignment Mar 22, 2019
@seanlip
Copy link
Member

seanlip commented Mar 22, 2019

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

@apb7
Copy link
Contributor

apb7 commented Mar 23, 2019

@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!

@bansalnitish bansalnitish merged commit 6cf5a9d into oppia:develop Mar 28, 2019
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.

6 participants