feat(parser): Add LiveChatBannerChatSummary node, update TextRun node (#809)

* feat(parser): add `LiveChatBannerChatSummary` node

* feat(TextRun): add `deemphasize` property

* chore: npm run build:parser-map
This commit is contained in:
jonz94
2024-11-19 02:49:50 +08:00
committed by GitHub
parent 53d1c759b6
commit 7fb00fa378
3 changed files with 27 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ export default class TextRun implements Run {
bold: boolean;
italics: boolean;
strikethrough: boolean;
deemphasize: boolean;
attachment;
constructor(data: RawNode) {
@@ -15,6 +16,7 @@ export default class TextRun implements Run {
this.bold = Boolean(data.bold);
this.italics = Boolean(data.italics);
this.strikethrough = Boolean(data.strikethrough);
this.deemphasize = Boolean(data.deemphasize);
if (Reflect.has(data, 'navigationEndpoint')) {
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
@@ -33,6 +35,7 @@ export default class TextRun implements Run {
if (this.bold) tags.push('b');
if (this.italics) tags.push('i');
if (this.strikethrough) tags.push('s');
if (this.deemphasize) tags.push('small');
const escaped_text = escape(this.text);
const styled_text = tags.map((tag) => `<${tag}>`).join('') + escaped_text + tags.map((tag) => `</${tag}>`).join('');