Gutenberg 6.2為封面、媒體和文本區塊添加嵌套功能

Gutenberg 6.2 已經發布,給我們帶來了兩個不錯的改進:一個是為【按鈕】區塊添加了鏈接打開方式設置,也就是你可以設置按鈕鏈接在新標籤/窗口打開;另一個是為【 封面 】、【媒體和文本】區塊添加嵌套功能。

設置按鈕鏈接打開方式

設置按鈕鏈接打開方式

區塊嵌套功能

還有很多人要求在【封面】和【媒體和文本】區塊中使用各種區塊類型,因此該版本已經刪除了它們的嵌套區塊限制。

【 封面 】、【媒體和文本】區塊添加嵌套功能

區塊樣式註冊PHP API

對開發者來說,此版本引入了一個新的PHP API,以簡化區塊樣式變體的註冊。

// Registering a style variation using a registered WP style.
register_block_style(
'core/quote',
array(
'name' => 'fancy-quote',
'label' => 'Fancy Quote',
'style_handle' => 'myguten-style',
)
);

// Registering a style variation using an inline style.
register_block_style(
'core/quote',
array(
'name' => 'not-fancy-quote',
'label' => 'Not Fancy Quote',
'inline_style' => '.wp-block-quote.is-style-not-fancy-quote { color: blue; }',
)
);

要了解更多改進,請看: https://make.wordpress.org/core/2019/07/31/whats-new-in-gutenberg-31-july/

發表評論

郵箱地址不會被公開。 必填項已用*標註