Skip to content

Commit

Permalink
Revert "feat/bundle.js: Registerの後方互換処理を追加"
Browse files Browse the repository at this point in the history
This reverts commit 479ad57.
  • Loading branch information
miminari committed Aug 3, 2021
1 parent 48776a9 commit f482a04
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/blocks/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,8 @@ const registerBlock = (block) => {

let { metadata, settings, name } = block;

/*
そもそも Require at Least が 5.7 なので 5.5 以下の後方互換は不要ではあるが、現状影響が少ないので残しておく
window.wpVersion は外観 > カスタマイズ > ウィジェットでは undefined を返すので比較不可能
ともかく最初から undefined が条件に当てはまらないように変更
*/

//WP5.5未満の場合
if (
window.wpVersion !== undefined &&
window.wpVersion !== null &&
compareVersions(window.wpVersion, '5.5') < 0
) {
if (compareVersions(window.wpVersion, '5.5') < 0) {
//nameを削除
delete metadata.name;
//カテゴリ等を追加
Expand All @@ -107,10 +97,11 @@ const registerBlock = (block) => {
// 5.8以前の場合はnameのみ渡す
if (typeof getBlockSettingsFromMetadata !== 'function') {
registerBlockType(name, settings);
} else {
} else if (metadata) {
registerBlockType(metadata, settings);
}
};

/**
* Function to register VK Blocks.
*
Expand Down

0 comments on commit f482a04

Please sign in to comment.