block-variations.js 628 B

123456789101112131415161718192021222324
  1. /**
  2. * File block-variations.js
  3. *
  4. * Adds block variation options for blocks in the new editor.
  5. *
  6. */
  7. // Image Block - Since this block doesn't have core block variations, add a 'default' so the "fancy" option can be turned off.
  8. wp.blocks.registerBlockStyle( 'core/image', {
  9. isDefault: true,
  10. name: 'default', // Class will be turned into '.is-style-default', though no styles needed.
  11. label: 'Default'
  12. } );
  13. // Image Block - Add a 'fancy' class, to match theme's existing "framed" style.
  14. wp.blocks.registerBlockStyle( 'core/image', {
  15. name: 'fancy', // Class will be turned into '.is-style-fancy'
  16. label: 'Fancy'
  17. } );