From 013a13408424c9968f820907ce5eb88a0516436a Mon Sep 17 00:00:00 2001 From: pbkompasz <47194071+pbkompasz@users.noreply.github.com> Date: Sat, 8 Oct 2022 16:48:24 +0300 Subject: [PATCH] Refactor Bilibili class component to functional (#4227) --- shared/editor/embeds/Bilibili.tsx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/shared/editor/embeds/Bilibili.tsx b/shared/editor/embeds/Bilibili.tsx index 06d8ecd9f..ba7867636 100644 --- a/shared/editor/embeds/Bilibili.tsx +++ b/shared/editor/embeds/Bilibili.tsx @@ -4,18 +4,16 @@ import { EmbedProps as Props } from "."; const URL_REGEX = /(?:https?:\/\/)?(www\.bilibili\.com)\/video\/([\w\d]+)?(\?\S+)?/i; -export default class Vimeo extends React.Component { - static ENABLED = [URL_REGEX]; - - render() { - const { matches } = this.props.attrs; - const videoId = matches[2]; - return ( - - ); - } +export default function Bilibili(props: Props) { + const { matches } = props.attrs; + const videoId = matches[2]; + return ( + + ); } + +Bilibili.ENABLED = [URL_REGEX];