updateSelectionMenus = (applicationMenu, state) => {
  const {
    // Key/boolean object like "ul: true" of block elements that are selected.
    // This may be an empty object when multiple block elements are selected.
    affiliation,
    isDisabled,
    isMultiline,
    isCodeFences,
    isCodeContent
  } = state

  // Reset format menu.
  const formatMenuItem = applicationMenu.getMenuItemById('formatMenuItem')
  formatMenuItem.submenu.items.forEach(item => (item.enabled = true))

  // Handle menu checked.
  setCheckedMenuItem(applicationMenu, state)

  // Reset paragraph menu.
  setParagraphMenuItemStatus(applicationMenu, !isDisabled)
  if (isDisabled) {
    return
  }

  if (isCodeFences) {
    setParagraphMenuItemStatus(applicationMenu, false)

    // A code line is selected.
    if (isCodeContent) {
      formatMenuItem.submenu.items.forEach(item => (item.enabled = false))

      // TODO: Allow to transform to paragraph for other code blocks too but
      //   currently not supported by Muya.
      // // Allow to transform to paragraph.
      // if (affiliation.frontmatter) {
      //   setMultipleStatus(applicationMenu, ['frontMatterMenuItem'], true)
      // } else if (affiliation.html) {
      //   setMultipleStatus(applicationMenu, ['htmlBlockMenuItem'], true)
      // } else if (affiliation.multiplemath) {
      //   setMultipleStatus(applicationMenu, ['mathBlockMenuItem'], true)
      // } else {
      //  setMultipleStatus(applicationMenu, ['codeFencesMenuItem'], true)
      // }

      if (Object.keys(affiliation).some(b => /code$/.test(b))) {
        setMultipleStatus(applicationMenu, ['codeFencesMenuItem'], true)
      }
    }
  } else if (isMultiline) {
    formatMenuItem.submenu.items
      .filter(item => item.id && DISABLE_LABELS.includes(item.id))
      .forEach(item => (item.enabled = false))
    setMultipleStatus(applicationMenu, DISABLE_LABELS, false)
  }

  // Disable loose list item.
  if (!affiliation.ul && !affiliation.ol) {
    setMultipleStatus(applicationMenu, ['looseListItemMenuItem'], false)
  }
}
Update paragraph menu entires from given state.

@param {Electron.MenuItem} applicationMenu The application menu instance.
@param {*} state The selection information.