finish embed components

This commit is contained in:
MapleLeaf
2021-12-26 14:11:17 -06:00
parent fefb57fcc3
commit 97581cfabd
13 changed files with 514 additions and 51 deletions

View File

@@ -0,0 +1,23 @@
import React from "react"
import { ReacordElement } from "../element.js"
import { EmbedChildNode } from "./embed-child.js"
import type { EmbedOptions } from "./embed-options"
export type EmbedImageProps = {
url: string
}
export function EmbedImage(props: EmbedImageProps) {
return (
<ReacordElement
props={props}
createNode={() => new EmbedImageNode(props)}
/>
)
}
class EmbedImageNode extends EmbedChildNode<EmbedImageProps> {
override modifyEmbedOptions(options: EmbedOptions): void {
options.image = { url: this.props.url }
}
}