diff --git a/src/blocks/gallery-carousel/block.json b/src/blocks/gallery-carousel/block.json index 307dffcb390..f13c4ea64e9 100644 --- a/src/blocks/gallery-carousel/block.json +++ b/src/blocks/gallery-carousel/block.json @@ -1,6 +1,6 @@ { "name": "coblocks/gallery-carousel", - "category": "coblocks-galleries", + "category": "media", "attributes": { "gutter": { "type": "number", diff --git a/src/blocks/gallery-carousel/index.js b/src/blocks/gallery-carousel/index.js index d866336e648..1e632ecccfc 100644 --- a/src/blocks/gallery-carousel/index.js +++ b/src/blocks/gallery-carousel/index.js @@ -8,6 +8,7 @@ import metadata from './block.json'; import save from './save'; import transforms from './transforms'; import { GalleryAttributes } from '../../components/block-gallery/shared'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -29,6 +30,7 @@ const settings = { title: __( 'Carousel', 'coblocks' ), /* translators: block description */ description: __( 'Display multiple images in a beautiful carousel gallery.', 'coblocks' ), + category: hasFormattingCategory ? 'coblocks-galleries' : 'media', attributes, icon, keywords: [ diff --git a/src/blocks/gallery-collage/block.json b/src/blocks/gallery-collage/block.json index c0992830f37..3a3763c84f0 100644 --- a/src/blocks/gallery-collage/block.json +++ b/src/blocks/gallery-collage/block.json @@ -1,6 +1,6 @@ { "name": "coblocks/gallery-collage", - "category": "coblocks-galleries", + "category": "media", "attributes": { "images": { "type": "array", diff --git a/src/blocks/gallery-collage/index.js b/src/blocks/gallery-collage/index.js index db008575994..bdec8b0e8d8 100644 --- a/src/blocks/gallery-collage/index.js +++ b/src/blocks/gallery-collage/index.js @@ -8,6 +8,7 @@ import metadata from './block.json'; import save from './save'; import transforms from './transforms'; import { GalleryAttributes } from '../../components/block-gallery/shared'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies. @@ -29,6 +30,7 @@ const settings = { title: __( 'Collage', 'coblocks' ), /* translators: block description */ description: __( 'Assemble images into a beautiful collage gallery.', 'coblocks' ), + category: hasFormattingCategory ? 'coblocks-galleries' : 'media', icon, keywords: [ 'coblocks', diff --git a/src/blocks/gallery-masonry/block.json b/src/blocks/gallery-masonry/block.json index 9b877633763..2be26c0c7a1 100644 --- a/src/blocks/gallery-masonry/block.json +++ b/src/blocks/gallery-masonry/block.json @@ -1,10 +1,10 @@ -{ - "name": "coblocks/gallery-masonry", - "category": "coblocks-galleries", - "attributes": { - "gridSize": { - "type": "string", - "default": "xlrg" - } - } -} +{ + "name": "coblocks/gallery-masonry", + "category": "media", + "attributes": { + "gridSize": { + "type": "string", + "default": "xlrg" + } + } +} diff --git a/src/blocks/gallery-masonry/index.js b/src/blocks/gallery-masonry/index.js index fb1315cd95f..4c910b09b59 100644 --- a/src/blocks/gallery-masonry/index.js +++ b/src/blocks/gallery-masonry/index.js @@ -8,6 +8,7 @@ import metadata from './block.json'; import save from './save'; import transforms from './transforms'; import { GalleryAttributes } from '../../components/block-gallery/shared'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -29,6 +30,7 @@ const settings = { title: __( 'Masonry', 'coblocks' ), /* translators: block description */ description: __( 'Display multiple images in an organized masonry gallery.', 'coblocks' ), + category: hasFormattingCategory ? 'coblocks-galleries' : 'media', icon, keywords: [ 'coblocks', diff --git a/src/blocks/gallery-offset/block.json b/src/blocks/gallery-offset/block.json index 6de4bc53649..0ceafc72778 100644 --- a/src/blocks/gallery-offset/block.json +++ b/src/blocks/gallery-offset/block.json @@ -1,6 +1,6 @@ { "name": "coblocks/gallery-offset", - "category": "coblocks-galleries", + "category": "media", "attributes": { "gridSize": { "type": "string", diff --git a/src/blocks/gallery-offset/index.js b/src/blocks/gallery-offset/index.js index 600444ccaac..d9dfa9b0afd 100644 --- a/src/blocks/gallery-offset/index.js +++ b/src/blocks/gallery-offset/index.js @@ -8,6 +8,7 @@ import icon from './icon'; import transforms from './transforms'; import metadata from './block.json'; import { GalleryAttributes } from '../../components/block-gallery/shared'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -29,6 +30,7 @@ const settings = { title: __( 'Offset', 'coblocks' ), /* translators: block description */ description: __( 'Display images in an offset brick pattern gallery.', 'coblocks' ), + category: hasFormattingCategory ? 'coblocks-galleries' : 'media', icon, keywords: [ 'coblocks', diff --git a/src/blocks/gallery-stacked/block.json b/src/blocks/gallery-stacked/block.json index 48ae0c80153..3e57cf41183 100644 --- a/src/blocks/gallery-stacked/block.json +++ b/src/blocks/gallery-stacked/block.json @@ -1,25 +1,25 @@ -{ - "name": "coblocks/gallery-stacked", - "category": "coblocks-galleries", - "attributes": { - "align": { - "type": "string", - "default": "full" - }, - "captionStyle": { - "type": "string" - }, - "fullwidth": { - "type": "boolean", - "default": true - }, - "gutter": { - "type": "number", - "default": 0 - }, - "gutterMobile": { - "type": "number", - "default": 0 - } - } -} +{ + "name": "coblocks/gallery-stacked", + "category": "media", + "attributes": { + "align": { + "type": "string", + "default": "full" + }, + "captionStyle": { + "type": "string" + }, + "fullwidth": { + "type": "boolean", + "default": true + }, + "gutter": { + "type": "number", + "default": 0 + }, + "gutterMobile": { + "type": "number", + "default": 0 + } + } +} diff --git a/src/blocks/gallery-stacked/index.js b/src/blocks/gallery-stacked/index.js index cb0f789bd4b..afef24e3c0d 100644 --- a/src/blocks/gallery-stacked/index.js +++ b/src/blocks/gallery-stacked/index.js @@ -8,6 +8,7 @@ import metadata from './block.json'; import save from './save'; import transforms from './transforms'; import { GalleryAttributes } from '../../components/block-gallery/shared'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -29,6 +30,7 @@ const settings = { title: __( 'Stacked', 'coblocks' ), /* translators: block description */ description: __( 'Display multiple images in a single column stacked gallery.', 'coblocks' ), + category: hasFormattingCategory ? 'coblocks-galleries' : 'media', icon, keywords: [ 'coblocks', diff --git a/src/blocks/gif/block.json b/src/blocks/gif/block.json index 52922613c84..6163282c085 100644 --- a/src/blocks/gif/block.json +++ b/src/blocks/gif/block.json @@ -1,6 +1,6 @@ { "name": "coblocks/gif", - "category": "common", + "category": "media", "attributes": { "url": { "attribute": "src", diff --git a/src/blocks/gif/index.js b/src/blocks/gif/index.js index ecc29d9e42f..16c656c9ba3 100644 --- a/src/blocks/gif/index.js +++ b/src/blocks/gif/index.js @@ -5,6 +5,7 @@ import edit from './edit'; import icon from './icon'; import metadata from './block.json'; import save from './save'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -21,6 +22,7 @@ const settings = { title: __( 'Gif', 'coblocks' ), /* translators: block description */ description: __( 'Pick a gif, any gif.', 'coblocks' ), + category: hasFormattingCategory ? 'common' : 'media', icon, keywords: [ 'coblocks', diff --git a/src/blocks/gist/block.json b/src/blocks/gist/block.json index 4005613c9fe..f837ee64f13 100644 --- a/src/blocks/gist/block.json +++ b/src/blocks/gist/block.json @@ -1,6 +1,6 @@ { "name": "coblocks/gist", - "category": "formatting", + "category": "embed", "attributes": { "url": { "type": "string" diff --git a/src/blocks/gist/index.js b/src/blocks/gist/index.js index d5acb2332cd..c0ea84e48f4 100644 --- a/src/blocks/gist/index.js +++ b/src/blocks/gist/index.js @@ -7,6 +7,7 @@ import icon from './icon'; import metadata from './block.json'; import save from './save'; import transforms from './transforms'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -23,6 +24,7 @@ const settings = { title: __( 'Gist', 'coblocks' ), /* translators: block description */ description: __( 'Embed GitHub gists by adding a gist link.', 'coblocks' ), + category: hasFormattingCategory ? 'common' : 'embed', icon, keywords: [ 'coblocks', diff --git a/src/blocks/icon/block.json b/src/blocks/icon/block.json index 033e5c146ea..1895501e1e2 100644 --- a/src/blocks/icon/block.json +++ b/src/blocks/icon/block.json @@ -1,6 +1,6 @@ { "name": "coblocks/icon", - "category": "common", + "category": "design", "attributes": { "icon": { "type": "string", diff --git a/src/blocks/icon/index.js b/src/blocks/icon/index.js index facde206f24..e2091b51f57 100644 --- a/src/blocks/icon/index.js +++ b/src/blocks/icon/index.js @@ -1,11 +1,12 @@ /** * Internal dependencies */ -import edit from './edit'; import deprecated from './deprecated'; +import edit from './edit'; import icon from './icon'; import metadata from './block.json'; import save from './save'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -17,6 +18,7 @@ import { __ } from '@wordpress/i18n'; */ export const DEFAULT_ICON_SIZE = 60; + /** * Block constants */ @@ -27,6 +29,7 @@ const settings = { title: __( 'Icon', 'coblocks' ), /* translators: block description */ description: __( 'Add a stylized graphic symbol to communicate something more.', 'coblocks' ), + category: hasFormattingCategory ? 'common' : 'design', icon, keywords: [ 'coblocks', diff --git a/src/blocks/share/block.json b/src/blocks/share/block.json index 3045e9d1e53..bb867da52d8 100644 --- a/src/blocks/share/block.json +++ b/src/blocks/share/block.json @@ -1,6 +1,6 @@ { "name": "coblocks/social", - "category": "common", + "category": "widgets", "attributes": { "align": { "type": "string", diff --git a/src/blocks/share/index.js b/src/blocks/share/index.js index 12ac193e07d..d8ea515b137 100644 --- a/src/blocks/share/index.js +++ b/src/blocks/share/index.js @@ -4,6 +4,7 @@ import edit from './edit'; import icon from './icon'; import metadata from './block.json'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -20,6 +21,7 @@ const settings = { title: __( 'Share', 'coblocks' ), /* translators: block description */ description: __( 'Add social sharing links to help you get likes and shares.', 'coblocks' ), + category: hasFormattingCategory ? 'common' : 'widgets', icon, keywords: [ 'coblocks', diff --git a/src/blocks/social-profiles/block.json b/src/blocks/social-profiles/block.json index d85dbf531fd..7c5a59b2322 100644 --- a/src/blocks/social-profiles/block.json +++ b/src/blocks/social-profiles/block.json @@ -1,6 +1,6 @@ { "name": "coblocks/social-profiles", - "category": "common", + "category": "widgets", "attributes": { "align": { "type": "string", diff --git a/src/blocks/social-profiles/index.js b/src/blocks/social-profiles/index.js index c3df442a667..c3dcf477da9 100644 --- a/src/blocks/social-profiles/index.js +++ b/src/blocks/social-profiles/index.js @@ -5,6 +5,7 @@ import edit from './edit'; import icon from './icon'; import metadata from './block.json'; import { transforms } from './transforms'; +import { hasFormattingCategory } from '../../utils/block-helpers'; /** * WordPress dependencies @@ -21,6 +22,7 @@ const settings = { title: __( 'Social Profiles', 'coblocks' ), /* translators: block description */ description: __( 'Grow your audience with links to social media profiles.', 'coblocks' ), + category: hasFormattingCategory ? 'common' : 'widgets', icon, keywords: [ 'coblocks', diff --git a/src/utils/block-helpers.js b/src/utils/block-helpers.js index e809cf983cd..9bb8e4b6183 100644 --- a/src/utils/block-helpers.js +++ b/src/utils/block-helpers.js @@ -41,3 +41,11 @@ export const supportsCollections = () => { return false; }; +/** + * Check for which category to assign. + * + * @return {boolean} Value to indicate function support. + */ +export const hasFormattingCategory = wp.blocks.getCategories().some( function( category ) { + return category.slug === 'formatting'; +} );