插入图像以做出视觉声明。
属性
通过 block.json 中的 attributes 属性定义。
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
blob | string | — | 角色: local |
url | string | — | 来源: attribute。 选择器: img。 HTML 属性: src。 角色: content |
alt | string | "" | 来源: attribute。 选择器: img。 HTML 属性: alt。 角色: content |
caption | rich-text | — | 来源: rich-text。 选择器: figcaption。 角色: content |
lightbox | object | — | — |
title | string | — | 来源: attribute。 选择器: img。 HTML 属性: title。 角色: content |
href | string | — | 来源: attribute。 选择器: figure > a。 HTML 属性: href。 角色: content |
rel | string | — | 来源: attribute。 选择器: figure > a。 HTML 属性: rel |
linkClass | string | — | 来源: attribute。 选择器: figure > a。 HTML 属性: class |
id | number | — | 角色: content |
width | string | — | — |
height | string | — | — |
aspectRatio | string | — | — |
scale | string | — | — |
focalPoint | object | — | — |
sizeSlug | string | — | — |
linkDestination | string | — | — |
linkTarget | string | — | 来源: attribute。 选择器: figure > a。 HTML 属性: target |
isDecorative | boolean | false | — |
支持功能
通过 block.json 中的 supports 属性定义。
interactivity:truealign:"left","center","right","wide","full"anchor:truecolor:text:falsebackground:false
filter:duotone:true
spacing:margin:true
shadow:true
上下文
通过 block.json 中的 usesContext 和 providesContext 属性定义。
使用的上下文:
allowResizeimageCropfixedHeightnavigationButtonTypepostIdpostTypequeryIdgalleryId
块样式
通过 block.json 中的 styles 属性定义。
| 样式名称 | 标签 | 默认值 |
|---|---|---|
default | 默认 | 是 |
rounded | 圆角 | 否 |
CSS 选择器
通过 selectors 属性在 block.json 中定义。
- 尺寸:
.wp-block-image img, .wp-block-image .components-placeholder - 边框:
.wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder - 阴影:
.wp-block-image img, .wp-block-image .wp-block-image__crop-area, .wp-block-image .components-placeholder - 滤镜:
- 双色:
.wp-block-image img, .wp-block-image .components-placeholder
- 双色:
区块标记
这是一个 混合区块。它保存服务器在渲染期间可能增强的静态标记。
<!-- wp:core/image -->
<figure class="wp-block-image"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==" alt="" /></figure>
<!-- /wp:core/image -->
来源
- block.json (参考)
- 源代码目录 — 浏览
edit和save源文件,index.php等。