Skip to content

Commit 4115271

Browse files
authored
fix: add blockquote component support (#263)
1 parent 93336b4 commit 4115271

File tree

6 files changed

+14
-1
lines changed

6 files changed

+14
-1
lines changed

apps/example-bot/src/app/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export default async function Page({
1919
<br />
2020
Click the menu button to see the available options.
2121
</p>
22+
<blockquote>Hello world</blockquote>
2223
</div>
2324
);
2425
}

packages/common/src/hostconfig.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export enum InstanceType {
3333
Pre = "Pre",
3434
BoldText = "BoldText",
3535
ItalicText = "ItalicText",
36+
BlockQuote = "BlockQuote",
3637
}
3738

3839
/**

packages/common/src/react.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export enum ReactInstanceType {
4747
NewLine = "br",
4848
ThematicBreak = "hr",
4949
Suspendable = "suspendable",
50+
BlockQuote = "blockquote",
5051
Command = "command",
5152
Pre = "pre",
5253
Code = "code",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { InstanceType } from "@rx-lab/common";
2+
import { BaseComponent } from "./Component";
3+
4+
export class Blockquote extends BaseComponent<any> {
5+
type = InstanceType.BlockQuote;
6+
}

packages/core/src/components/builder/componentBuilder.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
UnsupportedComponentError,
1414
UnsupportedReactComponentError,
1515
} from "@rx-lab/errors";
16+
import { Blockquote } from "../Blockquote";
1617
import { BoldText } from "../BoldText";
1718
import { Code, Pre } from "../Code";
1819
import { ItalicText } from "../ItalicText";
@@ -71,6 +72,7 @@ export class ComponentBuilder implements Builder {
7172
[InstanceType.BoldText]: BoldText as unknown as Constructor<
7273
BaseComponent<any>
7374
>,
75+
[InstanceType.BlockQuote]: Blockquote,
7476
[InstanceType.ItalicText]: ItalicText as unknown as Constructor<
7577
BaseComponent<any>
7678
>,
@@ -88,6 +90,7 @@ export class ComponentBuilder implements Builder {
8890
[ReactInstanceType.Div]: InstanceType.Container,
8991
[ReactInstanceType.Text]: InstanceType.Text,
9092
[ReactInstanceType.Paragraph]: InstanceType.Paragraph,
93+
[ReactInstanceType.BlockQuote]: InstanceType.BlockQuote,
9194
[ReactInstanceType.Span]: InstanceType.InlineParagraph,
9295
[ReactInstanceType.Menu]: InstanceType.Menu,
9396
[ReactInstanceType.H1]: InstanceType.Header,

packages/telegram-adapter/src/renderer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export const renderElementHelper = (
3838
text: children.join(""),
3939
callback_data: parser.encode(element),
4040
};
41-
41+
case InstanceType.BlockQuote:
42+
return [`<blockquote>${children.join("")}</blockquote>`];
4243
case InstanceType.Link:
4344
return [`<a href="${element.props.href}">${children.join("")}</a>`];
4445
case InstanceType.BoldText:

0 commit comments

Comments
 (0)