-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Render bold/italics/underline on SimpleTextDisplayer #2779
Render bold/italics/underline on SimpleTextDisplayer #2779
Conversation
[shakaCue]); | ||
}); | ||
|
||
it('adds linebreaks when a linebreak cue is seen', () => { |
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.
Although it doesn't directly relate to the goal of this pull, I thought I might as well add a unit test for this as well.
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.
Thank you!
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.
Looks great! If you would add bold, it would be perfect.
lib/text/simple_text_displayer.js
Outdated
@@ -82,8 +82,25 @@ shaka.text.SimpleTextDisplayer = class { | |||
// Flatten nested cue payloads recursively. If a cue has nested cues, | |||
// their contents should be combined and replace the payload of the parent. | |||
const flattenPayload = (cue) => { | |||
// TODO: If we want to support bold, italic, underline here, we would | |||
// insert markup into the payload. | |||
// Handle styles (currently underlines/italics). TODO support for color. |
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.
Could you add support for bold? Something like cue.fontWeight >= shaka.text.Cue.fontWeight.BOLD
?
[shakaCue]); | ||
}); | ||
|
||
it('adds linebreaks when a linebreak cue is seen', () => { |
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.
Thank you!
small comment fix
2b01c09
to
7e72472
Compare
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.
Thank you!
All tests passed! |
Also pertains to #2648.