Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Setup & Introduction to Gutenberg: Tooling And Terminology

Setup & Introduction to Gutenberg: Tooling And Terminology

This is my portion from an all day Gutenberg Workshop at WordCamp Miami 2018.

Zac Gordon

March 16, 2018
Tweet

More Decks by Zac Gordon

Other Decks in Technology

Transcript

  1. Introduction Overview 1. JavaScript libraries included with Gutenberg 2. How

    to access Gutenberg JavaScript libraries 3. registerBlockType() for building blocks 4. Types of blocks 5. Extra block features
  2. Introduction Overview 1. JavaScript libraries included with Gutenberg 2. How

    to access Gutenberg JavaScript libraries 3. registerBlockType() for building blocks 4. Types of blocks 5. Extra block features
  3. Introduction Overview 1. JavaScript libraries included with Gutenberg 2. How

    to access Gutenberg JavaScript libraries 3. registerBlockType() for building blocks 4. Types of blocks 5. Extra block features
  4. Introduction Overview 1. JavaScript libraries included with Gutenberg 2. How

    to access Gutenberg JavaScript libraries 3. registerBlockType() for building blocks 4. Types of blocks 5. Extra block features
  5. Introduction Overview 1. JavaScript libraries included with Gutenberg 2. How

    to access Gutenberg JavaScript libraries 3. registerBlockType() for building blocks 4. Types of blocks 5. Extra block features
  6. Introduction Overview 1. JavaScript libraries included with Gutenberg 2. How

    to access Gutenberg JavaScript libraries 3. registerBlockType() for building blocks 4. Types of blocks 5. Extra block features
  7. JS Libraries in Gutenberg • wp.element - React & ReactDOM

    • wp.blocks • wp.components • wp.i18n • wp.data • packages*
  8. JS Libraries in Gutenberg • wp.element - React & ReactDOM

    • wp.blocks - Components for building blocks • wp.components • wp.i18n • wp.data • packages*
  9. JS Libraries in Gutenberg • wp.element - React & ReactDOM

    • wp.blocks - Components for building blocks • wp.components - Generic components • wp.i18n • wp.data • packages*
  10. JS Libraries in Gutenberg • wp.element - React & ReactDOM

    • wp.blocks - Components for building blocks • wp.components - More generic components • wp.i18n - Internationalization and localization • wp.data • packages*
  11. JS Libraries in Gutenberg • wp.element - React & ReactDOM

    • wp.blocks - Components for building blocks • wp.components - More generic components • wp.i18n - Internationalization and localization • wp.data - Redux state management • packages*
  12. JS Libraries in Gutenberg • wp.element - React & ReactDOM

    • wp.blocks - Components for building blocks • wp.components - More generic components • wp.i18n - Internationalization and localization • wp.data - Redux state management • packages* - Modules and tools available via NPM
  13. JS Libraries in Gutenberg • wp.element - React & ReactDOM

    • wp.blocks - Components for building blocks • wp.components - More generic components • wp.i18n - Internationalization and localization • wp.data - Redux state management • packages* - Modules and tools available via NPM
  14. — window.wp “ The Gutenberg JavaScript libraries are stored in

    a “window.wp” JavaScript object in global scope.
  15. Accessing Gutenberg JS Libraries 1. Open the Gutenberg Editor 2.

    Open the Console in web inspector 3. Type wp.element, hit return 4. Try wp.blocks, wp.components, wp.i18n, and wp.data 5. Try with just wp
  16. Accessing GB JS Libraries the right way • Create a

    plugin • Enqueue a JavaScript file using enqueue_block_editor_assets • Reference wp.element in your code • Reference wp.element.createElement in your code • Try for other libraries
  17. — Hi Roy “ You may often want to rename

    libraries in global window object to have shorter names
  18. registerBlockType() edit/save settings • Code to manage editing the block

    • Code to determine what gets saved to content
  19. registerBlockType() settings • Name • Description • Icon • Category

    • Keywords • Supports • Attributes • Transforms • Edit • Save • Custom
  20. Types of Blocks • Static - Cannot edit content •

    Editable - Can edit content • Dynamic
  21. Types of Blocks • Static - Cannot edit content •

    Editable - Can edit content • Dynamic - Save settings, not content (content is dynamic)
  22. Introduction Review 1. JavaScript libraries included with Gutenberg 2. How

    to access Gutenberg JavaScript libraries 3. registerBlockType() for building blocks 4. Types of blocks 5. Extra block features