From 711bf187c3d5bd724bd8ebc9c38fa4c5b663f6dc Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sat, 5 Nov 2022 18:10:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20bbcode=E8=A7=A3=E9=87=8A=E5=99=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0boldtag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/com.msgbyte.bbcode/src/tags/BoldTag.tsx | 10 ++++++++++ .../web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 client/web/plugins/com.msgbyte.bbcode/src/tags/BoldTag.tsx diff --git a/client/web/plugins/com.msgbyte.bbcode/src/tags/BoldTag.tsx b/client/web/plugins/com.msgbyte.bbcode/src/tags/BoldTag.tsx new file mode 100644 index 00000000..e35a8a61 --- /dev/null +++ b/client/web/plugins/com.msgbyte.bbcode/src/tags/BoldTag.tsx @@ -0,0 +1,10 @@ +import React from 'react'; +import type { TagProps } from '../bbcode/type'; + +export const BoldTag: React.FC = React.memo((props) => { + const { node } = props; + const text = node.content.join(''); + + return {text}; +}); +BoldTag.displayName = 'BoldTag'; diff --git a/client/web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts b/client/web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts index 7abc5dfb..148bf252 100644 --- a/client/web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts +++ b/client/web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts @@ -6,10 +6,12 @@ import { PlainText } from './PlainText'; import { UrlTag } from './UrlTag'; import { EmojiTag } from './EmojiTag'; import { MarkdownTag } from './MarkdownTag'; +import { BoldTag } from './BoldTag'; import './styles.less'; registerBBCodeTag('_text', PlainText); +registerBBCodeTag('b', BoldTag); registerBBCodeTag('url', UrlTag); registerBBCodeTag('img', ImgTag); registerBBCodeTag('code', CodeTag);