添加一个可下载文件的链接。

  • 名称: core/file
  • 类别: 媒体
  • API 版本: 3
  • 块类型: 混合(静态保存 + 服务器增强)
  • 关键词: document, pdf, download

属性

通过 block.json 中的 attributes 属性定义。

属性类型默认值描述
idnumber——
blobstring—角色:local
hrefstring—角色:content
fileIdstring—来源:attribute。 选择器:a:not([download])。 HTML 属性:id
fileNamerich-text—来源:rich-text。 选择器:a:not([download])。 角色:content
textLinkHrefstring—来源:attribute。 选择器:a:not([download])。 HTML 属性:href。 角色:content
textLinkTargetstring—来源:attribute。 选择器:a:not([download])。 HTML 属性:target
showDownloadButtonbooleantrue—
downloadButtonTextrich-text—来源:rich-text。 选择器:a[download]。 角色:content
displayPreviewboolean——
previewHeightnumber600—

支持

通过 block.json 中的 supports 属性定义。

块标记

这是一个 混合块。它保存静态标记,服务器在渲染期间可能会对其进行增强。

<!-- wp:file {"showDownloadButton":true,"previewHeight":600} -->
<!-- Content... -->
<!-- /wp:file -->

来源