mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
refactor(extension-youtube): command types (#3842)
This commit is contained in:
parent
3937c44c43
commit
e22b873e55
@ -26,13 +26,15 @@ export interface YoutubeOptions {
|
||||
width: number;
|
||||
}
|
||||
|
||||
type SetYoutubeVideoOptions = { src: string, width?: number, height?: number, start?: number }
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
youtube: {
|
||||
/**
|
||||
* Insert a youtube video
|
||||
*/
|
||||
setYoutubeVideo: (options: { src: string, width?: number, height?: number, start?: number }) => ReturnType,
|
||||
setYoutubeVideo: (options: SetYoutubeVideoOptions) => ReturnType,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -103,7 +105,7 @@ export const Youtube = Node.create<YoutubeOptions>({
|
||||
|
||||
addCommands() {
|
||||
return {
|
||||
setYoutubeVideo: options => ({ commands }) => {
|
||||
setYoutubeVideo: (options: SetYoutubeVideoOptions) => ({ commands }) => {
|
||||
if (!isValidYoutubeUrl(options.src)) {
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user