function hydrateButtons(groups, groupName, type, block) {
  if (isEditable(type, block.tags)) {
    const restoreButton = createButton(ICONS.RESTORE)
    restoreButton.addEventListener('click', () => block.restore())
    block.iconBar.appendChild(restoreButton)
  }

  if (isInteractive(block.tags) && block.tags.includes(STATIC_TAG_TYPES.OPENABLE)) {
    // The three versions of the "Open in Playground" button.
    const readyButton = createButton(ICONS.PLAYGROUND.READY)
    const workingButton = createButton(ICONS.PLAYGROUND.WORKING)
    const errorButton = createButton(ICONS.PLAYGROUND.ERROR)

    // Handler to open in the playground.
    const open = createOpenInPlaygroundHandler(groups, groupName, block, readyButton, workingButton, errorButton)

    // Only ready and error trigger an open, if "working", forces user to wait until it completes.
    readyButton.addEventListener('click', open)
    errorButton.addEventListener('click', open)

    // Hydrate
    putOpenInPlaygroundButton(block, readyButton)
  }
}
// Hydrate the restore and share buttons as applicable
Hydrate the restore and share buttons as applicable
Hydrate the restore and share buttons as applicable
function hydrateButtons(groups, groupName, type, block) {
  if (isEditable(type, block.tags)) {
    const restoreButton = createButton(ICONS.RESTORE)
    restoreButton.addEventListener('click', () => block.restore())
    block.iconBar.appendChild(restoreButton)
  }
  if (isInteractive(block.tags) && block.tags.includes(STATIC_TAG_TYPES.OPENABLE)) {
    const readyButton = createButton(ICONS.PLAYGROUND.READY)
    const workingButton = createButton(ICONS.PLAYGROUND.WORKING)
    const errorButton = createButton(ICONS.PLAYGROUND.ERROR)
    const open = createOpenInPlaygroundHandler(groups, groupName, block, readyButton, workingButton, errorButton)
    readyButton.addEventListener('click', open)
    errorButton.addEventListener('click', open)
    putOpenInPlaygroundButton(block, readyButton)
  }
}
function hydrateButtons ( groups , groupName , type , block ) { if ( isEditable ( type , block . tags ) ) { const restoreButton = createButton ( ICONS . RESTORE ) restoreButton . addEventListener ( 'click' , ( ) => block . restore ( ) ) block . iconBar . appendChild ( restoreButton ) } if ( isInteractive ( block . tags ) && block . tags . includes ( STATIC_TAG_TYPES . OPENABLE ) ) { const readyButton = createButton ( ICONS . PLAYGROUND . READY ) const workingButton = createButton ( ICONS . PLAYGROUND . WORKING ) const errorButton = createButton ( ICONS . PLAYGROUND . ERROR ) const open = createOpenInPlaygroundHandler ( groups , groupName , block , readyButton , workingButton , errorButton ) readyButton . addEventListener ( 'click' , open ) errorButton . addEventListener ( 'click' , open ) putOpenInPlaygroundButton ( block , readyButton ) } }
Hydrate the restore and share buttons as applicable
Hydrate the restore and share buttons as applicable
// The three versions of the "Open in Playground" button. // Handler to open in the playground. // Only ready and error trigger an open, if "working", forces user to wait until it completes. // Hydrate