Skip to content

only one line after expand button #15

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

Merged
merged 12 commits into from
Jul 29, 2019
Merged

Conversation

cherifGsoul
Copy link
Contributor

@cherifGsoul cherifGsoul commented Jul 22, 2019

Trim code to prevent creating new line which causes to display one line after the expand button.

The logic:

  • Remove subtracting 1 from the code length
  • Trim the the code to prevent additional characters from creating additional new lines, because before applying PrismJS additional line is created because of " character at the end of the code, that's why total was set to codeLines.length - 1 which makes one line (the last line of the code mostly) visible after the expand button.

With this fix the same number of line of code is present before and after applying PrismJS.

Fixes #14

@cherifGsoul cherifGsoul requested a review from chasenlehara July 23, 2019 14:51
//Without trimming, additional characters can create new lines
//this happens when PrismJS is not applied (in testing)
//setting total to length - 1 makes the last not collapsed
codeBlock.textContent = codeBlock.textContent.trim();

Choose a reason for hiding this comment

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

Is this the best place to do the trimming, or should it be done wherever codeBlock.textContent is initially created/set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it could be trimmed initially in bit-docs-prettify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chasenlehara bit-docs-prettify is not invoked in testing, so I changed the fix to be the same as the needed part to remove the newline at the end.

@@ -0,0 +1,111 @@
You can also set the `value` of the properties of `pageComponentViewModel` and verify that the `routeData` is updated correctly:

Choose a reason for hiding this comment

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

Is this needed for the test? Can this be pared down at all?

@cherifGsoul cherifGsoul requested a review from chasenlehara July 23, 2019 22:57
Copy link

@chasenlehara chasenlehara left a comment

Choose a reason for hiding this comment

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

Feel free to squash and merge.

@cherifGsoul cherifGsoul merged commit 7a8e624 into master Jul 29, 2019
@cherifGsoul cherifGsoul deleted the remove-one-line-after-collapse branch July 29, 2019 15:58
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.

Prevent bottom expand button from showing only one line after it
2 participants