Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

アニメーション ラップ、アンラップ機能を追加 #1681

Merged
merged 4 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 33 additions & 31 deletions editor-css/_editor_before.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,39 @@
fill: #c00;
}

.editor-block-list-item-vk-blocks-taxonomy:after,
.editor-block-list-item-vk-blocks-select-post-list:after,
.editor-block-list-item-vk-blocks-accordion:after,
.editor-block-list-item-vk-blocks-animation:after,
.editor-block-list-item-vk-blocks-archive-list:after,
.editor-block-list-item-vk-blocks-breadcrumb:after,
.editor-block-list-item-vk-blocks-button-outer:after,
.editor-block-list-item-vk-blocks-card:after,
.editor-block-list-item-vk-blocks-child-page:after,
.editor-block-list-item-vk-blocks-dynamic-text:after,
.editor-block-list-item-vk-blocks-timeline:after,
.editor-block-list-item-vk-blocks-step:after,
.editor-block-list-item-vk-blocks-outer:after,
.editor-block-list-item-vk-blocks-post-list:after,
.editor-block-list-item-vk-blocks-table-of-contents:after,
.editor-block-list-item-vk-blocks-table-of-contents-new:after,
.editor-block-list-item-vk-blocks-simple-table:after,
.editor-block-list-item-vk-blocks-grid-column:after,
.editor-block-list-item-vk-blocks-gridcolcard:after,
.editor-block-list-item-vk-blocks-icon-card:after {
position: absolute;
top: 0;
right: 0;
content: "Pro";
display: inline-block;
font-size: 10px;
line-height: 1;
color: #fff;
background-color: #cd3034;
border-radius: 2px;
padding: 3px 4px;
.block-editor-inserter__block-list {
.editor-block-list-item-vk-blocks-taxonomy:after,
.editor-block-list-item-vk-blocks-select-post-list:after,
.editor-block-list-item-vk-blocks-accordion:after,
.editor-block-list-item-vk-blocks-animation:after,
.editor-block-list-item-vk-blocks-archive-list:after,
.editor-block-list-item-vk-blocks-breadcrumb:after,
.editor-block-list-item-vk-blocks-button-outer:after,
.editor-block-list-item-vk-blocks-card:after,
.editor-block-list-item-vk-blocks-child-page:after,
.editor-block-list-item-vk-blocks-dynamic-text:after,
.editor-block-list-item-vk-blocks-timeline:after,
.editor-block-list-item-vk-blocks-step:after,
.editor-block-list-item-vk-blocks-outer:after,
.editor-block-list-item-vk-blocks-post-list:after,
.editor-block-list-item-vk-blocks-table-of-contents:after,
.editor-block-list-item-vk-blocks-table-of-contents-new:after,
.editor-block-list-item-vk-blocks-simple-table:after,
.editor-block-list-item-vk-blocks-grid-column:after,
.editor-block-list-item-vk-blocks-gridcolcard:after,
.editor-block-list-item-vk-blocks-icon-card:after {
position: absolute;
top: 0;
right: 0;
content: "Pro";
display: inline-block;
font-size: 10px;
line-height: 1;
color: #fff;
background-color: #cd3034;
border-radius: 2px;
padding: 3px 4px;
}
}

// ラベル名と説明の文字の太さも大きさも同じでわからないので太字に
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ e.g.

== Changelog ==

[ Add Function ][ Animation(Pro) ] Added transforms settings to wrap and unwrap.

= 1.56.0 =
[ Add Block ][ Dynamic Text Block (Pro) ] Add Dynamic text block.
[ Add Function ][ Admin screen ] Added block style manager function.
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/_pro/animation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import edit from './edit';
import save from './save';
import deprecatedHooks from './deprecated/hooks';
import deprecated from './deprecated/save';
import transforms from './transforms';

import { addFilter } from '@wordpress/hooks';

Expand All @@ -17,6 +18,7 @@ export { metadata, name };

export const settings = {
icon: <Icon />,
transforms,
edit,
save,
deprecated,
Expand Down
39 changes: 39 additions & 0 deletions src/blocks/_pro/animation/transforms.js
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;