嵌入块
嵌入是一种在文档中展示外部内容的方式。BlockNote 支持多种嵌入,帮助你有效地组织和格式化内容。
文件
类型及属性
type FileBlock = {
id: string;
type: "file";
props: {
backgroundColor: string;
name: string;
url: string;
caption: string;
};
content: undefined;
children: Block[];
};backgroundColor: 块的背景颜色。默认值为 "default"。
name: 文件名称。默认值为 ""。
url: 文件 URL。默认值为 ""。
caption: 文件说明。默认值为 ""。
图片
配置选项
type ImageBlockOptions = {
icon?: string;
};icon: 图标 SVG 的 HTML 字符串。如果没有提供 URL,图片块将显示一个按钮,允许通过链接或文件添加图片,其中提供的 SVG 会替代该按钮中的通用文件图标。
类型及属性
type ImageBlock = {
id: string;
type: "image";
props: {
backgroundColor: string;
textAlignment: "left" | "center" | "right" | "justify";
name: string;
url: string;
caption: string;
showPreview: boolean;
previewWidth: number | undefined;
};
content: undefined;
children: Block[];
};backgroundColor: 块的背景颜色。默认值为 "default"。
textAlignment: 图片的对齐方式。默认值为 "left"。
name: 图片文件名称。默认值为 ""。
url: 图片 URL。默认值为 ""。
caption: 图片说明。默认值为 ""。
showPreview: 是否显示图片预览还是链接。默认值为 true。
previewWidth: 图片预览宽度,单位为像素。默认值为 undefined(无固定宽度)。
视频
配置选项
type VideoBlockOptions = {
icon?: string;
};icon: 图标 SVG 的 HTML 字符串。如果没有提供 URL,视频块将显示一个按钮,允许通过链接或文件添加视频,其中提供的 SVG 会替代该按钮中的通用文件图标。
类型及属性
type VideoBlock = {
id: string;
type: "video";
props: {
backgroundColor: string;
textAlignment: "left" | "center" | "right" | "justify";
name: string;
url: string;
caption: string;
showPreview: boolean;
previewWidth: number | undefined;
};
content: undefined;
children: Block[];
};backgroundColor: 块的背景颜色。默认值为 "default"。
textAlignment: 视频的对齐方式。默认值为 "left"。
name: 视频文件名称。默认值为 ""。
url: 视频 URL。默认值为 ""。
caption: 视频说明。默认值为 ""。
showPreview: 是否显示视频播放器还是链接。默认值为 true。
previewWidth: 视频预览宽度,单位为像素。默认值为 undefined(无固定宽度)。
音频
配置选项
type AudioBlockOptions = {
icon?: string;
};icon: 图标 SVG 的 HTML 字符串。如果没有提供 URL,音频块将显示一个按钮,允许通过链接或文件添加音频,其中提供的 SVG 会替代该按钮中的通用文件图标。
类型及属性
type AudioBlock = {
id: string;
type: "audio";
props: {
backgroundColor: string;
name: string;
url: string;
caption: string;
showPreview: boolean;
};
content: undefined;
children: Block[];
};backgroundColor: 块的背景颜色。默认值为 "default"。
name: 音频文件名称。默认值为 ""。
url: 音频 URL。默认值为 ""。
caption: 音频说明。默认值为 ""。
showPreview: 是否显示音频播放器还是链接。默认值为 true。