嵌入一个简单的播放列表。

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

块关系

允许的内部块:
– core/playlist-track

属性

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

属性类型默认值描述
typestring"audio"—
orderstring"asc"—
showTracklistbooleantrue—
showImagesbooleantrue—
showPlayButtonArtworkbooleanfalse—
showArtistsbooleantrue—
showNumbersbooleantrue—
showTrackLengthbooleantrue—
waveformStylestring"bars"枚举: bars, mirror, line, blocks, dots, seekbar
waveformColorstring——
waveformGradientstring——
waveformBackgroundColorstring——
waveformBackgroundGradientstring——
captionstring——

支持

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

上下文

通过 block.json 中的 usesContext 和 providesContext 属性定义。

提供上下文:

  • showArtists → 属性 showArtists
  • showImages → 属性 showImages

块标记

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

<!-- wp:core/playlist {"caption":"Sample playlist"} -->
<figure class="wp-block-playlist">
    <ol class="wp-block-playlist__tracklist wp-block-playlist__tracklist-show-numbers">
        <!-- wp:core/playlist-track {"id":123,"src":"https://example.com/audio.mp3","album":"Example album","artist":"Example creator","image":"https://example.com/track-image.jpg","imageAlt":"Track image","length":"3:21","title":"Sample track"} /-->
    </ol>
    <figcaption class="wp-element-caption">Sample playlist</figcaption>
</figure>
<!-- /wp:core/playlist -->

来源