-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
| //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(); |
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 best place to do the trimming, or should it be done wherever codeBlock.textContent is initially created/set?
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.
Yeah, it could be trimmed initially in bit-docs-prettify
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.
@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.
test-collapse-last-line.md
Outdated
| @@ -0,0 +1,111 @@ | |||
| You can also set the `value` of the properties of `pageComponentViewModel` and verify that the `routeData` is updated correctly: | |||
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 needed for the test? Can this be pared down at all?
chasenlehara
left a comment
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.
Feel free to squash and merge.
Trim code to prevent creating new line which causes to display one line after the expand button.
The logic:
1from the code lengthPrismJSadditional line is created because of"character at the end of the code, that's whytotalwas set tocodeLines.length - 1which 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