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
add fullscreen to code blocks #10784
add fullscreen to code blocks #10784
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.
Tried it out locally, works well! Thanks for the contribution 😃
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.
|
@ludwiczakpawel thank you for your feedback, updated PR, reduced markup and kept possibility to add any new buttons in action-panel |
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.
One issue in the comments, though not a blocker.
But also, I've just realized that old posts do not have an icon in the code blocks:
I guess it's because markup is not generated on the fly but stored somehow? I don't know tbh...
I don't think it matters that much for "older posts" so if there's not an easy way to fix it, I'd at least try to hide it for older posts and make this functionality "available" for new posts only.
| .highlight { | ||
| overflow: auto; | ||
| } |
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's one last thing we could try to fix... So this style changes a little bit the behavior of how overflow looks like.. On prod, when you have long lines in highlight the code is actually from edge to edge when scrolling.
Because of that additional styling here ^ there's an offset on the left and right side, defined by the padding, so the code is no longer from edge to edge.
I do understand why you have this styling here (so the buttons are sticked to the corner of the code block), although maybe we could try to bring the previous styling back (so code will be edge to edge when scrolling). I think the trick here is to move the padding from the outer .highlight to the inner one. But this may need a bit more testing though.
If you need help with it, I'm happy to jump in.
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.
@ludwiczakpawel, sure, I will check it!
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 move padding to inner element - .highlight, where overflow is and it worked. Now we also have proper calculation of paddings (screenshot will be attached) for wide scrollable area (before text had no right padding at the end of the line).
Yes, on save an article turns the markdown into HTML, that's stored in the DB and in the cache at the first request. Everytime an article is updated the cache is wiped and the HTML version in the DB is overwritten. If we need to update all old articles we need an update script to resave all existing articles to update their markup. It's a possibility. |
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 looks great to me.
@ludwiczakpawel @rhymes Because it has the if ... action built in, this is resilient to the old posts not immediately being compatible....
We'll handle this scenario as a one-off, but yeah we should seek to create a more general framework around backfilling breaking changes. There's no easy answer, but we're definitely outgrowing the old fragile way quickly.
@Winner95 only thing left to do is make sure all the tests are updated. It looks like the only failing tests are approval tests. See info here: https://docs.forem.com/tests/approvals-tests/
I approve this pending the tests passing.
…/add-lightbox-v2-code-8990
|
Thanks so much for the PR @Winner95. Any chance you can put some screenshots in the PR description showing the functionality in action. Thanks! |
within padded area
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 for making the change @Winner95! 🚀
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.
🎉🎉🎉
* add fullscreen to code blocks * add review fixes * remove extra import * fix approved tests * code review - paddings * fix padding to make highlight code scrollable within padded area * add fullscreen to existing webpack entrypoint * fixed aria: true generated extra ids * fix tests


What type of PR is this? (check all applicable)
Description
I added fullscreen functionality for code blocks via panel, shown on hover. There are some updates for highlight code block, which allow division of concerns in code:
markdown_parser_spec.rbbelow 250 lines, divide it into two files.This is how highlight block was before:

This is after:
Related Tickets & Documents
Closes #8990
QA Instructions, Screenshots, Recordings
Added tests?
Added to documentation?
PS: I hope this pull-request will be helpful:)