-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1681 from vektor-inc/add/animation/wrap-unwrap
アニメーション ラップ、アンラップ機能を追加
- Loading branch information
Showing
4 changed files
with
76 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { createBlock } from '@wordpress/blocks'; | ||
|
||
const transforms = { | ||
from: [ | ||
{ | ||
type: 'block', | ||
isMultiBlock: true, | ||
blocks: ['*'], | ||
__experimentalConvert(blocks) { | ||
// Clone the Blocks to be Grouped | ||
// Failing to create new block references causes the original blocks | ||
// to be replaced in the switchToBlockType call thereby meaning they | ||
// are removed both from their original location and within the | ||
// new group block. | ||
const groupInnerBlocks = blocks.map((block) => { | ||
return createBlock( | ||
block.name, | ||
block.attributes, | ||
block.innerBlocks | ||
); | ||
}); | ||
|
||
return createBlock('vk-blocks/animation', {}, groupInnerBlocks); | ||
}, | ||
}, | ||
], | ||
to: [ | ||
{ | ||
type: 'block', | ||
blocks: ['*'], | ||
transform: (attributes, innerBlocks) => innerBlocks, | ||
}, | ||
], | ||
}; | ||
|
||
export default transforms; |