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

Fix #5949: Make RTE spacing uniform #5953

Merged
merged 5 commits into from
Dec 14, 2018
Merged

Conversation

ankita240796
Copy link
Contributor

@ankita240796 ankita240796 commented Dec 6, 2018

Explanation

Fixes #5949: Adding bottom margin for paragraphs in editor mode fixes the issue of inconsistent spacing.

Checklist

  • The PR title starts with "Fix #bugnum: ", followed by a short, clear summary of the changes. (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • The PR explanation includes the words "Fixes #bugnum: ..." (or "Fixes part of #bugnum" if the PR only partially fixes an issue).
  • The linter/Karma presubmit checks have passed.
    • These should run automatically, but if not, you can manually trigger them locally using python scripts/pre_commit_linter.py and bash scripts/run_frontend_tests.sh.
  • The PR is made from a branch that's not called "develop".
  • The PR follows the style guide.
  • The PR is assigned to an appropriate reviewer.
    • If you're a new contributor, please ask on Gitter for someone to assign a reviewer.
    • If you're not sure who the appropriate reviewer is, please assign to the issue's "owner" -- see the "talk-to" label on the issue.

@ankita240796
Copy link
Contributor Author

Hi @seanlip, @bansalnitish PTAL!

@codecov-io
Copy link

codecov-io commented Dec 6, 2018

Codecov Report

❗ No coverage uploaded for pull request base (develop@e93451b). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #5953   +/-   ##
==========================================
  Coverage           ?   45.47%           
==========================================
  Files              ?      517           
  Lines              ?    30378           
  Branches           ?     4571           
==========================================
  Hits               ?    13814           
  Misses             ?    16564           
  Partials           ?        0

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 e93451b...8762210. Read the comment docs.

Copy link
Contributor

@bansalnitish bansalnitish left a comment

Choose a reason for hiding this comment

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

Hi @ankita240796,
You cleared of the paragraph spaces that were indeed needed in the preview mode. The expected thing to do here was to add the spaces at the start of next paragraph in the editor mode (though in the preview mode it works fine).

You cleared off the spaces that should be there at the start of paragraph in the preview mode. Let me know if you need some more clarification on this one.

@ankita240796 ankita240796 changed the title Fix #5949: Remove extra space in rte Fix #5949: Make RTE spacing uniform Dec 6, 2018
@ankita240796
Copy link
Contributor Author

Hi @bansalnitish, I have made the changes as suggested by you. PTAL!

Copy link
Contributor

@bansalnitish bansalnitish left a comment

Choose a reason for hiding this comment

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

Looks good!
A minor nit and also one thing to note here is that we don't need bottom margin for the last paragraph. You could try something like:

.oppia-rte > p:not(:last-child) {
  line-height: 1.5;
  margin-bottom: 18px;
}

*/
.rte-viewer > p {
line-height: 28px;
margin-bottom: 18px;
margin-top: 18px
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing Semicolon!

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, PTAL!

@ankita240796
Copy link
Contributor Author

Hi @bansalnitish, I have made the changes, PTAL!

@bansalnitish
Copy link
Contributor

bansalnitish commented Dec 7, 2018

Hi @ankita240796,

This works fine in the editor mode but just try creating an item selection exploration and click the preview button. All those paragraph spaces are gone! This needs to be fixed.

Screenshot:
This is what I saved.

image

This is what I got.

image

@ankita240796
Copy link
Contributor Author

Hi @bansalnitish,

I have made the paragraph margin consistent for all p tags. I also tested it for various interactions and hints as well. It works fine now, PTAL!

Thanks!

Copy link
Contributor

@bansalnitish bansalnitish left a comment

Choose a reason for hiding this comment

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

This looks like a good fix @ankita240796. LGTM!

Copy link
Contributor

@nithusha21 nithusha21 left a comment

Choose a reason for hiding this comment

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

In the editor view, when not in editing mode:
image

In the editor view, while editing:
image

In the preview tab:
image

  • I think the spacing is different while editing, while the spacing matches on the editor and preview tabs.
  • The spacing below the image also differs.
  • In the original issue report, the comparison was between the "while editing" stage and the "not editing" state of the editor view.

To me it still looks like the spacing is different. Is this similar to what you see @bansalnitish? If so I think the issue is still not fixed...

text-align: left;
word-spacing: 0;
word-break: break-word;
}

p:last-child {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @bansalnitish, @ankita240796 I think this will affect all paragraph tags on Oppia right? Is this intended? Just clarifying...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes @nithusha21 , it affects the behaviour of all paragraph tags on Oppia but it provides a consistent behaviour as well. I checked for various pages and interactions and the change does not create any issues.

Copy link
Contributor

@bansalnitish bansalnitish left a comment

Choose a reason for hiding this comment

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

Just to avoid merge!

@ankita240796
Copy link
Contributor Author

ankita240796 commented Dec 8, 2018

Hi @bansalnitish @nithusha21,

I tried some other stuff as follows:

We can fix p tags in rte editor using the following css:

.oppia-rte > p {
  line-height: 1.5;
  margin-bottom: 18px;
  margin-top: 18px;
}

.oppia-rte > p:last-child {
  margin-bottom: 0px;
}

.oppia-rte > p:first-child {
  margin-top: 0px;
}

This introduces issues with multiple choice and item selection interaction where margin is seen in editor but not in preview. To fix that we can use following css:

.protractor-test-multiple-choice-option > p {
  line-height: 1.5;
  margin-bottom: 18px;
  margin-top: 18px;
}

.protractor-test-multiple-choice-option > p:last-child {
  margin-bottom: 0px;
}

.protractor-test-multiple-choice-option > p:first-child {
  margin-top: 0px;
}

Further this leaves p tags without margin in add response modal which are not nested in some specific class. Here is a screenshot for the same:

image

We can either introduce a class or use the angular-html-bind tag to enforce the rule but the second option is less preferred since it can have a vast scope for other p tags (If we do not want to modify p tags everywhere).

Can you please provide your inputs here about how can I further approach this issue.

Thanks!

@nithusha21
Copy link
Contributor

Hmmm, I am not sure. Deferring to @bansalnitish

@bansalnitish
Copy link
Contributor

@nithusha21 to me the spacing looks good, I have some screenshots for the same. I also checked the spacing between paragraphs via the inspect element and it's 18 px everywhere.

In the editor mode while editing:
test1

In the editor mode:
test2

In the preview mode:
test3

In the editor mode while editing:
test4

In the editor mode:
test5

In the preview tab:
test6

@nithusha21
Copy link
Contributor

Ah I see..... The paragraph spacing looks good to me. I think I was confused 😅. I was looking at the line spacing (Within a paragraph). And that still looks off to me. Can we file an issue for that? (If you can confirm the behavior, and also check if there already exists an issue for the same).

@nithusha21
Copy link
Contributor

Also, thanks for filing the issue for image spacing I pointed out! 😄

@bansalnitish
Copy link
Contributor

Yes, you're right @nithusha21 the line spacing in the editor mode while editing and after saving look different to me as well. I'll check once again and file an issue (if it exists).

Copy link
Contributor

@bansalnitish bansalnitish left a comment

Choose a reason for hiding this comment

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

Thanks @ankita240796 for the PR, LGTM!

@bansalnitish bansalnitish merged commit b4fd79b into oppia:develop Dec 14, 2018
@ankita240796 ankita240796 deleted the fix-rte branch December 14, 2018 08:59
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.

Inconsistent paragraph spacing in RTE in the exploration editor
4 participants