-
Notifications
You must be signed in to change notification settings - Fork 98
🎉 Support video embed youtube #93
🎉 Support video embed youtube #93
Conversation
Someone is attempting to deploy a commit to a Personal Account owned by @otoyo on Vercel. @otoyo first needs to authorize it. |
何とかYouTubeURLをvideo blockで埋め込めるようになりました。 漏れなどありましたら教えていただければと思います。 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
} | ||
if (item.video.type === 'external') { | ||
video.External = { Url: item.video.external.url } | ||
} else { |
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.
この else
ブロックは何も処理していないので不要です。
@@ -72,6 +73,10 @@ export interface Image { | |||
Width?: number | |||
Height?: number | |||
} | |||
export interface Video{ |
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.
上に1行空行を入れてください。
import YouTube, {YouTubeProps } from 'react-youtube'; | ||
|
||
|
||
const Video=({block})=> { |
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.
const Video=({block})=> { | |
const Video=({ block })=> { |
{}
の内側にはスペースを1個お願いします。
@@ -0,0 +1,32 @@ | |||
import styles from '../../styles/notion-block.module.css' | |||
import React from 'react'; | |||
import YouTube, {YouTubeProps } from 'react-youtube'; |
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.
import YouTube, {YouTubeProps } from 'react-youtube'; | |
import YouTube, { YouTubeProps } from 'react-youtube'; |
{} の内側にはスペースを1個お願いします。
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.
行末のセミコロンは不要です。
autoplay: 1, | ||
}, | ||
}; | ||
console.log(VIDEOS) |
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.
console.log
が残っているので削除お願いします。
const VIDEOS =url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); | ||
const videoID=""+VIDEOS[1]+""; | ||
|
||
//npm |
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.
このコメントも特に意味はないと思うので削除をお願いします。
|
||
const Video=({block})=> { | ||
const url = block.Video.External.Url | ||
const VIDEOS =url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); |
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.
URLが来ることはわかっているため全て正規表現でマッチするより URL インターフェースを使う方が保守性の面で優れています。
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.
=
の両側にスペースをお願いします。
const Video=({block})=> { | ||
const url = block.Video.External.Url | ||
const VIDEOS =url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); | ||
const videoID=""+VIDEOS[1]+""; |
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.
=
と +
の両側にスペースをお願いします。
96f813c のコミットは全て指摘していくとかなり多くなってしまうので私の方で修正しておきます。 |
いろいろツメが甘くてすみませんでした💦💦 |
コードのスタイルに関してはエディタにプラグインを入れるなどすれば自動でフォーマットしてくれるので試してみてください。 |
フォーマッタですね!? |
修正があるため main ではなく下記のブランチに向けてマージしてしまいます。main に向ける際には PR を作ってお知らせしますね。 |
便利な拡張機能発見出来ました\(^o^)/ |
Video block_youtube限定
埋め込めるURL
埋め込むとブログ上で再生できます