@wordpress/edit-site 5.28.1 → 5.28.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/build/components/add-new-pattern/index.js +18 -8
  2. package/build/components/add-new-pattern/index.js.map +1 -1
  3. package/build/components/editor/index.js +1 -1
  4. package/build/components/editor/index.js.map +1 -1
  5. package/build/components/global-styles/block-preview-panel.js +2 -2
  6. package/build/components/global-styles/block-preview-panel.js.map +1 -1
  7. package/build/components/global-styles/font-library-modal/collection-font-details.js +1 -1
  8. package/build/components/global-styles/font-library-modal/collection-font-details.js.map +1 -1
  9. package/build/components/global-styles/font-library-modal/context.js +1 -1
  10. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  11. package/build/components/global-styles/font-library-modal/font-collection.js +84 -7
  12. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  13. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
  14. package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  15. package/build/components/global-styles/font-library-modal/installed-fonts.js +10 -7
  16. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  17. package/build/components/global-styles/font-library-modal/utils/index.js +1 -1
  18. package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  19. package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js +14 -1
  20. package/build/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
  21. package/build/components/global-styles/font-library-modal/utils/preview-styles.js +64 -8
  22. package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  23. package/build/components/global-styles/screen-revisions/revisions-buttons.js +6 -4
  24. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  25. package/build/components/layout/index.js +8 -3
  26. package/build/components/layout/index.js.map +1 -1
  27. package/build/components/layout/router.js +26 -5
  28. package/build/components/layout/router.js.map +1 -1
  29. package/build/components/media/index.js +3 -3
  30. package/build/components/media/index.js.map +1 -1
  31. package/build/components/page-patterns/use-patterns.js +10 -5
  32. package/build/components/page-patterns/use-patterns.js.map +1 -1
  33. package/build/components/page-templates-template-parts/index.js +1 -0
  34. package/build/components/page-templates-template-parts/index.js.map +1 -1
  35. package/build/components/sidebar/index.js +10 -3
  36. package/build/components/sidebar/index.js.map +1 -1
  37. package/build/components/sidebar-dataviews/default-views.js +1 -1
  38. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  39. package/build/components/sidebar-navigation-screen-pages/index.js +3 -1
  40. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  41. package/build/hooks/commands/use-edit-mode-commands.js +8 -8
  42. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  43. package/build/store/private-actions.js +3 -1
  44. package/build/store/private-actions.js.map +1 -1
  45. package/build-module/components/add-new-pattern/index.js +18 -8
  46. package/build-module/components/add-new-pattern/index.js.map +1 -1
  47. package/build-module/components/editor/index.js +1 -1
  48. package/build-module/components/editor/index.js.map +1 -1
  49. package/build-module/components/global-styles/block-preview-panel.js +2 -2
  50. package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
  51. package/build-module/components/global-styles/font-library-modal/collection-font-details.js +1 -1
  52. package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +1 -1
  53. package/build-module/components/global-styles/font-library-modal/context.js +1 -1
  54. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  55. package/build-module/components/global-styles/font-library-modal/font-collection.js +87 -10
  56. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  57. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
  58. package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
  59. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +11 -8
  60. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  61. package/build-module/components/global-styles/font-library-modal/utils/index.js +2 -2
  62. package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
  63. package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js +13 -1
  64. package/build-module/components/global-styles/font-library-modal/utils/make-families-from-faces.js.map +1 -1
  65. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +63 -8
  66. package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
  67. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +6 -4
  68. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  69. package/build-module/components/layout/index.js +8 -3
  70. package/build-module/components/layout/index.js.map +1 -1
  71. package/build-module/components/layout/router.js +26 -5
  72. package/build-module/components/layout/router.js.map +1 -1
  73. package/build-module/components/media/index.js +3 -3
  74. package/build-module/components/media/index.js.map +1 -1
  75. package/build-module/components/page-patterns/use-patterns.js +10 -5
  76. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  77. package/build-module/components/page-templates-template-parts/index.js +1 -0
  78. package/build-module/components/page-templates-template-parts/index.js.map +1 -1
  79. package/build-module/components/sidebar/index.js +10 -3
  80. package/build-module/components/sidebar/index.js.map +1 -1
  81. package/build-module/components/sidebar-dataviews/default-views.js +2 -2
  82. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  83. package/build-module/components/sidebar-navigation-screen-pages/index.js +3 -1
  84. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  85. package/build-module/hooks/commands/use-edit-mode-commands.js +8 -8
  86. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  87. package/build-module/store/private-actions.js +3 -1
  88. package/build-module/store/private-actions.js.map +1 -1
  89. package/build-style/style-rtl.css +33 -11
  90. package/build-style/style.css +33 -11
  91. package/package.json +42 -42
  92. package/src/components/add-new-pattern/index.js +27 -11
  93. package/src/components/editor/index.js +1 -0
  94. package/src/components/global-styles/block-preview-panel.js +2 -2
  95. package/src/components/global-styles/font-library-modal/collection-font-details.js +1 -1
  96. package/src/components/global-styles/font-library-modal/context.js +1 -1
  97. package/src/components/global-styles/font-library-modal/font-collection.js +118 -13
  98. package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
  99. package/src/components/global-styles/font-library-modal/installed-fonts.js +25 -23
  100. package/src/components/global-styles/font-library-modal/style.scss +2 -5
  101. package/src/components/global-styles/font-library-modal/utils/index.js +2 -2
  102. package/src/components/global-styles/font-library-modal/utils/make-families-from-faces.js +13 -1
  103. package/src/components/global-styles/font-library-modal/utils/preview-styles.js +72 -15
  104. package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +60 -5
  105. package/src/components/global-styles/screen-revisions/revisions-buttons.js +7 -5
  106. package/src/components/global-styles/screen-revisions/style.scss +11 -6
  107. package/src/components/layout/index.js +47 -30
  108. package/src/components/layout/router.js +31 -2
  109. package/src/components/layout/style.scss +7 -0
  110. package/src/components/media/index.js +7 -9
  111. package/src/components/page-patterns/style.scss +10 -0
  112. package/src/components/page-patterns/use-patterns.js +13 -5
  113. package/src/components/page-templates-template-parts/index.js +1 -0
  114. package/src/components/page-templates-template-parts/style.scss +6 -0
  115. package/src/components/sidebar/index.js +14 -5
  116. package/src/components/sidebar-dataviews/default-views.js +2 -2
  117. package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -1
  118. package/src/components/sidebar-navigation-screen-pages/index.js +10 -6
  119. package/src/hooks/commands/use-edit-mode-commands.js +14 -14
  120. package/src/store/private-actions.js +4 -0
  121. package/build/components/global-styles/font-library-modal/fonts-grid.js +0 -57
  122. package/build/components/global-styles/font-library-modal/fonts-grid.js.map +0 -1
  123. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -92
  124. package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +0 -1
  125. package/build-module/components/global-styles/font-library-modal/fonts-grid.js +0 -50
  126. package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +0 -1
  127. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -84
  128. package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +0 -1
  129. package/src/components/global-styles/font-library-modal/fonts-grid.js +0 -59
  130. package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +0 -103
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_i18n","_icons","_commands","_htmlEntities","_router","_preferences","_interface","_notices","_editor","_store","_useEditedEntityRecord","_interopRequireDefault","_isTemplateRemovable","_isTemplateRevertable","_keyboardShortcutHelpModal","_preferencesModal","_patternModal","_lockUnlock","_constants","_link","useHistory","unlock","routerPrivateApis","usePageContentFocusCommands","record","template","useEditedEntityRecord","isPage","canvasMode","templateId","currentPostType","useSelect","select","_isPage","getCanvasMode","editSiteStore","getCurrentPostType","getCurrentTemplateId","editorStore","onClick","editTemplate","useLink","postType","postId","setRenderingMode","useDispatch","isLoading","commands","push","name","label","sprintf","decodeEntities","title","icon","layout","callback","close","__","page","useEditorModeCommands","switchEditorMode","editorMode","getEditorMode","code","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isEditingPage","isTemplateRevertable","type","TEMPLATE_POST_TYPE","isRTL","rotateRight","rotateLeft","isTemplateRemovable","path","trash","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","toggleDistractionFree","setIsListViewOpened","activeSidebar","showBlockBreadcrumbs","isListViewOpen","isDistractionFree","isTopToolbar","isFocusMode","get","preferencesStore","isListViewOpened","interfaceStore","getActiveComplementaryArea","openModal","toggle","createInfoNotice","noticesStore","drawerLeft","drawerRight","blockDefault","id","actions","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","listView","usePatternCommands","pattern","edit","PATTERN_MODALS","rename","symbol","duplicate","useEditModeCommands","useCommandLoader","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tedit,\n\ttrash,\n\trotateLeft,\n\trotateRight,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcode,\n\tkeyboard,\n\tlistView,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { PATTERN_MODALS } from '../../components/pattern-modal';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { useLink } from '../../components/routes/link';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { isPage, canvasMode, templateId, currentPostType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isPage: _isPage, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getCurrentPostType, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tisPage: _isPage(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\t\tcurrentPostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { onClick: editTemplate } = useLink( {\n\t\tpostType: 'wp_template',\n\t\tpostId: templateId,\n\t} );\n\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( currentPostType !== 'wp_template' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\t/* translators: %1$s: template title */\n\t\t\tlabel: sprintf(\n\t\t\t\t'Edit template: %s',\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\teditTemplate();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-locked' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useEditorModeCommands() {\n\tconst { switchEditorMode } = useDispatch( editSiteStore );\n\tconst { canvasMode, editorMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tif ( canvasMode !== 'edit' || editorMode !== 'text' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( editorMode === 'text' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/exit-code-editor',\n\t\t\tlabel: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst isEditingPage = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\tselect( editorStore ).getCurrentPostType() !== 'wp_template',\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tconst path =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleDistractionFree,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t} = useDispatch( editSiteStore );\n\tconst {\n\t\tcanvasMode,\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tshowBlockBreadcrumbs,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editSiteStore );\n\t\tconst { isListViewOpened } = select( editorStore );\n\t\treturn {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-spotlight-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction Free' )\n\t\t\t: __( 'Enter Distraction Free ' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-top-toolbar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( editorMode === 'visual' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel: __( 'Open code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'text' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nfunction usePatternCommands() {\n\tconst { isLoaded, record: pattern } = useEditedEntityRecord();\n\tconst { openModal } = useDispatch( interfaceStore );\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( pattern?.type === 'wp_block' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.rename );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.duplicate );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/exit-code-editor',\n\t\thook: useEditorModeCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/patterns',\n\t\thook: usePatternCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAeA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,sBAAA,GAAAC,sBAAA,CAAAZ,OAAA;AACA,IAAAa,oBAAA,GAAAD,sBAAA,CAAAZ,OAAA;AACA,IAAAc,qBAAA,GAAAF,sBAAA,CAAAZ,OAAA;AACA,IAAAe,0BAAA,GAAAf,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EH,IAAAF,0BAAgB,EAAE;IACjBpE,IAAI,EAAE,wBAAwB;IAC9BqE,IAAI,EAAEtC;EACP,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["_data","require","_i18n","_icons","_commands","_htmlEntities","_router","_preferences","_interface","_notices","_editor","_store","_useEditedEntityRecord","_interopRequireDefault","_isTemplateRemovable","_isTemplateRevertable","_keyboardShortcutHelpModal","_preferencesModal","_patternModal","_lockUnlock","_constants","_link","useHistory","unlock","routerPrivateApis","usePageContentFocusCommands","record","template","useEditedEntityRecord","isPage","canvasMode","templateId","currentPostType","useSelect","select","_isPage","getCanvasMode","editSiteStore","getCurrentPostType","getCurrentTemplateId","editorStore","onClick","editTemplate","useLink","postType","postId","setRenderingMode","useDispatch","isLoading","commands","push","name","label","sprintf","__","decodeEntities","title","icon","layout","callback","close","page","useEditorModeCommands","switchEditorMode","editorMode","getEditorMode","code","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isEditingPage","isTemplateRevertable","type","TEMPLATE_POST_TYPE","isRTL","rotateRight","rotateLeft","isTemplateRemovable","path","trash","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","toggleDistractionFree","setIsListViewOpened","activeSidebar","showBlockBreadcrumbs","isListViewOpen","isDistractionFree","isTopToolbar","isFocusMode","get","preferencesStore","isListViewOpened","interfaceStore","getActiveComplementaryArea","openModal","toggle","createInfoNotice","noticesStore","drawerLeft","drawerRight","blockDefault","id","actions","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","listView","usePatternCommands","pattern","edit","PATTERN_MODALS","rename","symbol","duplicate","useEditModeCommands","useCommandLoader","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tedit,\n\ttrash,\n\trotateLeft,\n\trotateRight,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcode,\n\tkeyboard,\n\tlistView,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { PATTERN_MODALS } from '../../components/pattern-modal';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { useLink } from '../../components/routes/link';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { isPage, canvasMode, templateId, currentPostType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isPage: _isPage, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getCurrentPostType, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tisPage: _isPage(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\t\tcurrentPostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { onClick: editTemplate } = useLink( {\n\t\tpostType: 'wp_template',\n\t\tpostId: templateId,\n\t} );\n\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( currentPostType !== 'wp_template' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: sprintf(\n\t\t\t\t/* translators: %s: template title */\n\t\t\t\t__( 'Edit template: %s' ),\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\teditTemplate();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-locked' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useEditorModeCommands() {\n\tconst { switchEditorMode } = useDispatch( editSiteStore );\n\tconst { canvasMode, editorMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tif ( canvasMode !== 'edit' || editorMode !== 'text' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( editorMode === 'text' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/exit-code-editor',\n\t\t\tlabel: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst isEditingPage = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\tselect( editorStore ).getCurrentPostType() !== 'wp_template',\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t__( 'Reset template: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Reset template part: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t__( 'Delete template: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Delete template part: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tconst path =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleDistractionFree,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t} = useDispatch( editSiteStore );\n\tconst {\n\t\tcanvasMode,\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tshowBlockBreadcrumbs,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t\tisTopToolbar,\n\t\tisFocusMode,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditorMode } = select( editSiteStore );\n\t\tconst { isListViewOpened } = select( editorStore );\n\t\treturn {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tisFocusMode: get( 'core', 'focusMode' ),\n\t\t\tisTopToolbar: get( 'core', 'fixedToolbar' ),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisFocusMode ? __( 'Spotlight off.' ) : __( 'Spotlight on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-spotlight-mode/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'focusMode' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: isDistractionFree\n\t\t\t? __( 'Exit Distraction Free' )\n\t\t\t: __( 'Enter Distraction Free ' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisTopToolbar\n\t\t\t\t\t? __( 'Top toolbar off.' )\n\t\t\t\t\t: __( 'Top toolbar on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-top-toolbar/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\ttoggle( 'core', 'fixedToolbar' );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tif ( editorMode === 'visual' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel: __( 'Open code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'text' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: isListViewOpen\n\t\t\t? __( 'Close List View' )\n\t\t\t: __( 'Open List View' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tisListViewOpen ? __( 'List View off.' ) : __( 'List View on.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-list-view/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nfunction usePatternCommands() {\n\tconst { isLoaded, record: pattern } = useEditedEntityRecord();\n\tconst { openModal } = useDispatch( interfaceStore );\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( pattern?.type === 'wp_block' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.rename );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.duplicate );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/exit-code-editor',\n\t\thook: useEditorModeCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/patterns',\n\t\thook: usePatternCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAeA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,sBAAA,GAAAC,sBAAA,CAAAZ,OAAA;AACA,IAAAa,oBAAA,GAAAD,sBAAA,CAAAZ,OAAA;AACA,IAAAc,qBAAA,GAAAF,sBAAA,CAAAZ,OAAA;AACA,IAAAe,0BAAA,GAA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E;IACjBpE,IAAI,EAAE,yBAAyB;IAC/BqE,IAAI,EAAET,kBAAkB;IACxBU,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,IAAAF,0BAAgB,EAAE;IACjBpE,IAAI,EAAE,wBAAwB;IAC9BqE,IAAI,EAAEtC;EACP,CAAE,CAAC;AACJ"}
@@ -29,6 +29,7 @@ const setCanvasMode = mode => ({
29
29
  registry,
30
30
  dispatch
31
31
  }) => {
32
+ const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
32
33
  registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
33
34
  dispatch({
34
35
  type: 'SET_CANVAS_MODE',
@@ -36,7 +37,8 @@ const setCanvasMode = mode => ({
36
37
  });
37
38
  // Check if the block list view should be open by default.
38
39
  // If `distractionFree` mode is enabled, the block list view should not be open.
39
- if (mode === 'edit' && registry.select(_preferences.store).get('core', 'showListViewByDefault') && !registry.select(_preferences.store).get('core', 'distractionFree')) {
40
+ // This behavior is disabled for small viewports.
41
+ if (isMediumOrBigger && mode === 'edit' && registry.select(_preferences.store).get('core', 'showListViewByDefault') && !registry.select(_preferences.store).get('core', 'distractionFree')) {
40
42
  registry.dispatch(_editor.store).setIsListViewOpened(true);
41
43
  } else {
42
44
  registry.dispatch(_editor.store).setIsListViewOpened(false);
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_preferences","_editor","_coreData","_notices","_i18n","_htmlEntities","_constants","setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","editorStore","setIsListViewOpened","setIsInserterOpened","exports","setEditorCanvasContainerView","view","removeTemplates","items","isTemplate","TEMPLATE_POST_TYPE","promiseResult","Promise","allSettled","map","item","coreStore","deleteEntityRecord","id","force","throwOnError","every","status","successMessage","length","title","rendered","sprintf","__","decodeEntities","noticesStore","createSuccessNotice","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","createErrorNotice"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../utils/constants';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( true );\n\t\t} else {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t}\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n\n/**\n * Action that removes an array of templates.\n *\n * @param {Array} items An array of template or template part objects to remove.\n */\nexport const removeTemplates =\n\t( items ) =>\n\tasync ( { registry } ) => {\n\t\tconst isTemplate = items[ 0 ].type === TEMPLATE_POST_TYPE;\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\titems.map( ( item ) => {\n\t\t\t\treturn registry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\titem.type,\n\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t} )\n\t\t);\n\n\t\t// If all the promises were fulfilled with sucess.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\n\t\t\tif ( items.length === 1 ) {\n\t\t\t\t// Depending on how the entity was retrieved its title might be\n\t\t\t\t// an object or simple string.\n\t\t\t\tconst title =\n\t\t\t\t\ttypeof items[ 0 ].title === 'string'\n\t\t\t\t\t\t? items[ 0 ].title\n\t\t\t\t\t\t: items[ 0 ].title?.rendered;\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = isTemplate\n\t\t\t\t\t? __( 'Templates deleted.' )\n\t\t\t\t\t: __( 'Template parts deleted.' );\n\t\t\t}\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( successMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'site-editor-template-deleted-success',\n\t\t\t\t} );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to delete a single template.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? __( 'An error occurred while deleting the template.' )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the template part.'\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t\t// If we were trying to delete a multiple templates\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the templates.'\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the template parts.'\n\t\t\t\t\t\t );\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the templates: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the template parts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the templates: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the template parts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t}\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,MAAMQ,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7BD,QAAQ,CAACC,QAAQ,CAAEC,kBAAiB,CAAC,CAACC,uBAAuB,CAAE,MAAO,CAAC;EACvEF,QAAQ,CAAE;IACTG,IAAI,EAAE,iBAAiB;IACvBL;EACD,CAAE,CAAC;EACH;EACA;EACA,IACCA,IAAI,KAAK,MAAM,IACfC,QAAQ,CACNK,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,GAAG,CAAE,MAAM,EAAE,uBAAwB,CAAC,IACxC,C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MACD,KAAM,MAAMiB,aAAa,IAAIF,cAAc,EAAG;QAC7C,IAAKE,aAAa,CAACN,MAAM,EAAEC,OAAO,EAAG;UACpCC,aAAa,CAACK,GAAG,CAAED,aAAa,CAACN,MAAM,CAACC,OAAQ,CAAC;QAClD;MACD;MACA,IAAKC,aAAa,CAACM,IAAI,KAAK,CAAC,EAAG;QAC/BT,YAAY,GAAGvB,UAAU,GACtB,IAAAmB,QAAE,EACF,iDACA,CAAC,GACD,IAAAA,QAAE,EACF,sDACA,CAAC;MACL,CAAC,MAAM,IAAKO,aAAa,CAACM,IAAI,KAAK,CAAC,EAAG;QACtCT,YAAY,GAAGvB,UAAU,GACtB,IAAAkB,aAAO,GACP;QACA,IAAAC,QAAE,EACD,oDACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAAE,CAAC,CACvB,CAAC,GACD,IAAAR,aAAO,GACP;QACA,IAAAC,QAAE,EACD,yDACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAAE,CAAC,CACvB,CAAC;MACL,CAAC,MAAM;QACNH,YAAY,GAAGvB,UAAU,GACtB,IAAAkB,aAAO,GACP;QACA,IAAAC,QAAE,EACD,uDACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAACO,IAAI,CAAE,GAAI,CAC/B,CAAC,GACD,IAAAf,aAAO,GACP;QACA,IAAAC,QAAE,EACD,4DACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAACO,IAAI,CAAE,GAAI,CAC/B,CAAC;MACL;IACD;IACAjD,QAAQ,CACNC,QAAQ,CAAEoC,cAAa,CAAC,CACxBa,iBAAiB,CAAEX,YAAY,EAAE;MAAEnC,IAAI,EAAE;IAAW,CAAE,CAAC;EAC1D;AACD,CAAC;AAACO,OAAA,CAAAG,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_blockEditor","require","_preferences","_editor","_coreData","_notices","_i18n","_htmlEntities","_constants","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","editorStore","setIsListViewOpened","setIsInserterOpened","exports","setEditorCanvasContainerView","view","removeTemplates","items","isTemplate","TEMPLATE_POST_TYPE","promiseResult","Promise","allSettled","map","item","coreStore","deleteEntityRecord","id","force","throwOnError","every","status","successMessage","length","title","rendered","sprintf","__","decodeEntities","noticesStore","createSuccessNotice","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","createErrorNotice"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../utils/constants';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst isMediumOrBigger =\n\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t// This behavior is disabled for small viewports.\n\t\tif (\n\t\t\tisMediumOrBigger &&\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( true );\n\t\t} else {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t}\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n\n/**\n * Action that removes an array of templates.\n *\n * @param {Array} items An array of template or template part objects to remove.\n */\nexport const removeTemplates =\n\t( items ) =>\n\tasync ( { registry } ) => {\n\t\tconst isTemplate = items[ 0 ].type === TEMPLATE_POST_TYPE;\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\titems.map( ( item ) => {\n\t\t\t\treturn registry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\titem.type,\n\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t} )\n\t\t);\n\n\t\t// If all the promises were fulfilled with sucess.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\n\t\t\tif ( items.length === 1 ) {\n\t\t\t\t// Depending on how the entity was retrieved its title might be\n\t\t\t\t// an object or simple string.\n\t\t\t\tconst title =\n\t\t\t\t\ttypeof items[ 0 ].title === 'string'\n\t\t\t\t\t\t? items[ 0 ].title\n\t\t\t\t\t\t: items[ 0 ].title?.rendered;\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( title )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = isTemplate\n\t\t\t\t\t? __( 'Templates deleted.' )\n\t\t\t\t\t: __( 'Template parts deleted.' );\n\t\t\t}\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( successMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'site-editor-template-deleted-success',\n\t\t\t\t} );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to delete a single template.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? __( 'An error occurred while deleting the template.' )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the template part.'\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t\t// If we were trying to delete a multiple templates\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the templates.'\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the template parts.'\n\t\t\t\t\t\t );\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the templates: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the template parts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the templates: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the template parts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t}\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,O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AAAkB,aAAO,GACP;QACA,IAAAC,QAAE,EACD,uDACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAACO,IAAI,CAAE,GAAI,CAC/B,CAAC,GACD,IAAAf,aAAO,GACP;QACA,IAAAC,QAAE,EACD,4DACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAACO,IAAI,CAAE,GAAI,CAC/B,CAAC;MACL;IACD;IACArD,QAAQ,CACNC,QAAQ,CAAEwC,cAAa,CAAC,CACxBa,iBAAiB,CAAEX,YAAY,EAAE;MAAEnC,IAAI,EAAE;IAAW,CAAE,CAAC;EAC1D;AACD,CAAC;AAACO,OAAA,CAAAG,eAAA,GAAAA,eAAA"}
@@ -19,13 +19,13 @@ import CreateTemplatePartModal from '../create-template-part-modal';
19
19
  import SidebarButton from '../sidebar-button';
20
20
  import { unlock } from '../../lock-unlock';
21
21
  import { PATTERN_TYPES, PATTERN_DEFAULT_CATEGORY, TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
22
- import usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';
23
22
  const {
24
23
  useHistory,
25
24
  useLocation
26
25
  } = unlock(routerPrivateApis);
27
26
  const {
28
- CreatePatternModal
27
+ CreatePatternModal,
28
+ useAddPatternCategory
29
29
  } = unlock(editPatternsPrivateApis);
30
30
  export default function AddNewPattern() {
31
31
  const history = useHistory();
@@ -45,9 +45,6 @@ export default function AddNewPattern() {
45
45
  createErrorNotice
46
46
  } = useDispatch(noticesStore);
47
47
  const patternUploadInputRef = useRef();
48
- const {
49
- patternCategories
50
- } = usePatternCategories();
51
48
  function handleCreatePattern({
52
49
  pattern,
53
50
  categoryId
@@ -94,6 +91,10 @@ export default function AddNewPattern() {
94
91
  },
95
92
  title: __('Import pattern from JSON')
96
93
  });
94
+ const {
95
+ categoryMap,
96
+ findOrCreateTerm
97
+ } = useAddPatternCategory();
97
98
  return createElement(Fragment, null, createElement(DropdownMenu, {
98
99
  controls: controls,
99
100
  toggleProps: {
@@ -119,12 +120,21 @@ export default function AddNewPattern() {
119
120
  const file = event.target.files?.[0];
120
121
  if (!file) return;
121
122
  try {
122
- const currentCategoryId = params.categoryType !== TEMPLATE_PART_POST_TYPE && patternCategories.find(category => category.name === params.categoryId)?.id;
123
+ let currentCategoryId;
124
+ // When we're not handling template parts, we should
125
+ // add or create the proper pattern category.
126
+ if (params.categoryType !== TEMPLATE_PART_POST_TYPE) {
127
+ const currentCategory = categoryMap.values().find(term => term.name === params.categoryId);
128
+ if (!!currentCategory) {
129
+ currentCategoryId = currentCategory.id || (await findOrCreateTerm(currentCategory.label));
130
+ }
131
+ }
123
132
  const pattern = await createPatternFromFile(file, currentCategoryId ? [currentCategoryId] : undefined);
124
133
 
125
134
  // Navigate to the All patterns category for the newly created pattern
126
- // if we're not on that page already.
127
- if (!currentCategoryId) {
135
+ // if we're not on that page already and if we're not in the `my-patterns`
136
+ // category.
137
+ if (!currentCategoryId && params.categoryId !== 'my-patterns') {
128
138
  history.push({
129
139
  path: `/patterns`,
130
140
  categoryType: PATTERN_TYPES.theme,
@@ -1 +1 @@
1
- {"version":3,"names":["DropdownMenu","useState","useRef","__","sprintf","plus","symbol","symbolFilled","upload","useSelect","useDispatch","privateApis","routerPrivateApis","editPatternsPrivateApis","store","patternsStore","coreStore","noticesStore","CreateTemplatePartModal","SidebarButton","unlock","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","usePatternCategories","useHistory","useLocation","CreatePatternModal","AddNewPattern","history","params","showPatternModal","setShowPatternModal","showTemplatePartModal","setShowTemplatePartModal","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","createPatternFromFile","createSuccessNotice","createErrorNotice","patternUploadInputRef","patternCategories","handleCreatePattern","pattern","categoryId","push","postId","id","postType","user","categoryType","theme","canvas","handleCreateTemplatePart","templatePart","handleError","controls","icon","onClick","title","current","click","createElement","Fragment","toggleProps","as","label","onClose","onSuccess","onError","closeModal","blocks","onCreate","type","accept","hidden","ref","onChange","event","file","target","files","currentCategoryId","find","category","name","undefined","path","raw","err","message","value"],"sources":["@wordpress/edit-site/src/components/add-new-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus, symbol, symbolFilled, upload } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tprivateApis as editPatternsPrivateApis,\n\tstore as patternsStore,\n} from '@wordpress/patterns';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport SidebarButton from '../sidebar-button';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { CreatePatternModal } = unlock( editPatternsPrivateApis );\n\nexport default function AddNewPattern() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst [ showPatternModal, setShowPatternModal ] = useState( false );\n\tconst [ showTemplatePartModal, setShowTemplatePartModal ] =\n\t\tuseState( false );\n\tconst isBlockBasedTheme = useSelect( ( select ) => {\n\t\treturn select( coreStore ).getCurrentTheme()?.is_block_theme;\n\t}, [] );\n\tconst { createPatternFromFile } = unlock( useDispatch( patternsStore ) );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst patternUploadInputRef = useRef();\n\tconst { patternCategories } = usePatternCategories();\n\n\tfunction handleCreatePattern( { pattern, categoryId } ) {\n\t\tsetShowPatternModal( false );\n\n\t\thistory.push( {\n\t\t\tpostId: pattern.id,\n\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\tcategoryType: PATTERN_TYPES.theme,\n\t\t\tcategoryId,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleCreateTemplatePart( templatePart ) {\n\t\tsetShowTemplatePartModal( false );\n\n\t\t// Navigate to the created template part editor.\n\t\thistory.push( {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleError() {\n\t\tsetShowPatternModal( false );\n\t\tsetShowTemplatePartModal( false );\n\t}\n\n\tconst controls = [\n\t\t{\n\t\t\ticon: symbol,\n\t\t\tonClick: () => setShowPatternModal( true ),\n\t\t\ttitle: __( 'Create pattern' ),\n\t\t},\n\t];\n\n\tif ( isBlockBasedTheme ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbolFilled,\n\t\t\tonClick: () => setShowTemplatePartModal( true ),\n\t\t\ttitle: __( 'Create template part' ),\n\t\t} );\n\t}\n\n\tcontrols.push( {\n\t\ticon: upload,\n\t\tonClick: () => {\n\t\t\tpatternUploadInputRef.current.click();\n\t\t},\n\t\ttitle: __( 'Import pattern from JSON' ),\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tcontrols={ controls }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tas: SidebarButton,\n\t\t\t\t} }\n\t\t\t\ticon={ plus }\n\t\t\t\tlabel={ __( 'Create pattern' ) }\n\t\t\t/>\n\t\t\t{ showPatternModal && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tonClose={ () => setShowPatternModal( false ) }\n\t\t\t\t\tonSuccess={ handleCreatePattern }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showTemplatePartModal && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setShowTemplatePartModal( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ handleCreateTemplatePart }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept=\".json\"\n\t\t\t\thidden\n\t\t\t\tref={ patternUploadInputRef }\n\t\t\t\tonChange={ async ( event ) => {\n\t\t\t\t\tconst file = event.target.files?.[ 0 ];\n\t\t\t\t\tif ( ! file ) return;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst currentCategoryId =\n\t\t\t\t\t\t\tparams.categoryType !== TEMPLATE_PART_POST_TYPE &&\n\t\t\t\t\t\t\tpatternCategories.find(\n\t\t\t\t\t\t\t\t( category ) =>\n\t\t\t\t\t\t\t\t\tcategory.name === params.categoryId\n\t\t\t\t\t\t\t)?.id;\n\t\t\t\t\t\tconst pattern = await createPatternFromFile(\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\tcurrentCategoryId\n\t\t\t\t\t\t\t\t? [ currentCategoryId ]\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Navigate to the All patterns category for the newly created pattern\n\t\t\t\t\t\t// if we're not on that page already.\n\t\t\t\t\t\tif ( ! currentCategoryId ) {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpath: `/patterns`,\n\t\t\t\t\t\t\t\tcategoryType: PATTERN_TYPES.theme,\n\t\t\t\t\t\t\t\tcategoryId: PATTERN_DEFAULT_CATEGORY,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The imported pattern's title.\n\t\t\t\t\t\t\t\t__( 'Imported \"%s\" from JSON.' ),\n\t\t\t\t\t\t\t\tpattern.title.raw\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'import-pattern-success',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\tcreateErrorNotice( err.message, {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'import-pattern-error',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tevent.target.value = '';\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,IAAI,EAAEC,MAAM,EAAEC,YAAY,EAAEC,MAAM,QAAQ,kBAAkB;AACrE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SACCD,WAAW,IAAIE,uBAAuB,EACtCC,KAAK,IAAIC,aAAa,QAChB,qBAAqB;AAC5B,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASF,KAAK,IAAIG,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,+BAA+B;AACnE,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SACCC,aAAa,EACbC,wBAAwB,EACxBC,uBAAuB,QACjB,uBAAuB;AAC9B,OAAOC,oBAAoB,MAAM,8DAA8D;AAE/F,MAAM;EAAEC,UAAU;EAAEC;AAAY,CAAC,GAAGN,MAAM,CAAER,iBAAkB,CAAC;AAC/D,MAAM;EAAEe;AAAmB,CAAC,GAAGP,MAAM,CAAEP,uBAAwB,CAAC;AAEhE,eAAe,SAASe,aAAaA,CAA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,CAAC,SAAS;QACT+B,KAAK,CAACE,MAAM,CAACW,KAAK,GAAG,EAAE;MACxB;IACD;EAAG,CACH,CACA,CAAC;AAEL"}
1
+ {"version":3,"names":["DropdownMenu","useState","useRef","__","sprintf","plus","symbol","symbolFilled","upload","useSelect","useDispatch","privateApis","routerPrivateApis","editPatternsPrivateApis","store","patternsStore","coreStore","noticesStore","CreateTemplatePartModal","SidebarButton","unlock","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","useHistory","useLocation","CreatePatternModal","useAddPatternCategory","AddNewPattern","history","params","showPatternModal","setShowPatternModal","showTemplatePartModal","setShowTemplatePartModal","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","createPatternFromFile","createSuccessNotice","createErrorNotice","patternUploadInputRef","handleCreatePattern","pattern","categoryId","push","postId","id","postType","user","categoryType","theme","canvas","handleCreateTemplatePart","templatePart","handleError","controls","icon","onClick","title","current","click","categoryMap","findOrCreateTerm","createElement","Fragment","toggleProps","as","label","onClose","onSuccess","onError","closeModal","blocks","onCreate","type","accept","hidden","ref","onChange","event","file","target","files","currentCategoryId","currentCategory","values","find","term","name","undefined","path","raw","err","message","value"],"sources":["@wordpress/edit-site/src/components/add-new-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { plus, symbol, symbolFilled, upload } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tprivateApis as editPatternsPrivateApis,\n\tstore as patternsStore,\n} from '@wordpress/patterns';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\nimport SidebarButton from '../sidebar-button';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { CreatePatternModal, useAddPatternCategory } = unlock(\n\teditPatternsPrivateApis\n);\n\nexport default function AddNewPattern() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst [ showPatternModal, setShowPatternModal ] = useState( false );\n\tconst [ showTemplatePartModal, setShowTemplatePartModal ] =\n\t\tuseState( false );\n\tconst isBlockBasedTheme = useSelect( ( select ) => {\n\t\treturn select( coreStore ).getCurrentTheme()?.is_block_theme;\n\t}, [] );\n\tconst { createPatternFromFile } = unlock( useDispatch( patternsStore ) );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst patternUploadInputRef = useRef();\n\n\tfunction handleCreatePattern( { pattern, categoryId } ) {\n\t\tsetShowPatternModal( false );\n\n\t\thistory.push( {\n\t\t\tpostId: pattern.id,\n\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\tcategoryType: PATTERN_TYPES.theme,\n\t\t\tcategoryId,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleCreateTemplatePart( templatePart ) {\n\t\tsetShowTemplatePartModal( false );\n\n\t\t// Navigate to the created template part editor.\n\t\thistory.push( {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleError() {\n\t\tsetShowPatternModal( false );\n\t\tsetShowTemplatePartModal( false );\n\t}\n\n\tconst controls = [\n\t\t{\n\t\t\ticon: symbol,\n\t\t\tonClick: () => setShowPatternModal( true ),\n\t\t\ttitle: __( 'Create pattern' ),\n\t\t},\n\t];\n\n\tif ( isBlockBasedTheme ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbolFilled,\n\t\t\tonClick: () => setShowTemplatePartModal( true ),\n\t\t\ttitle: __( 'Create template part' ),\n\t\t} );\n\t}\n\n\tcontrols.push( {\n\t\ticon: upload,\n\t\tonClick: () => {\n\t\t\tpatternUploadInputRef.current.click();\n\t\t},\n\t\ttitle: __( 'Import pattern from JSON' ),\n\t} );\n\n\tconst { categoryMap, findOrCreateTerm } = useAddPatternCategory();\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tcontrols={ controls }\n\t\t\t\ttoggleProps={ {\n\t\t\t\t\tas: SidebarButton,\n\t\t\t\t} }\n\t\t\t\ticon={ plus }\n\t\t\t\tlabel={ __( 'Create pattern' ) }\n\t\t\t/>\n\t\t\t{ showPatternModal && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tonClose={ () => setShowPatternModal( false ) }\n\t\t\t\t\tonSuccess={ handleCreatePattern }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showTemplatePartModal && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setShowTemplatePartModal( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ handleCreateTemplatePart }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept=\".json\"\n\t\t\t\thidden\n\t\t\t\tref={ patternUploadInputRef }\n\t\t\t\tonChange={ async ( event ) => {\n\t\t\t\t\tconst file = event.target.files?.[ 0 ];\n\t\t\t\t\tif ( ! file ) return;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet currentCategoryId;\n\t\t\t\t\t\t// When we're not handling template parts, we should\n\t\t\t\t\t\t// add or create the proper pattern category.\n\t\t\t\t\t\tif ( params.categoryType !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\t\t\t\t\tconst currentCategory = categoryMap\n\t\t\t\t\t\t\t\t.values()\n\t\t\t\t\t\t\t\t.find(\n\t\t\t\t\t\t\t\t\t( term ) => term.name === params.categoryId\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( !! currentCategory ) {\n\t\t\t\t\t\t\t\tcurrentCategoryId =\n\t\t\t\t\t\t\t\t\tcurrentCategory.id ||\n\t\t\t\t\t\t\t\t\t( await findOrCreateTerm(\n\t\t\t\t\t\t\t\t\t\tcurrentCategory.label\n\t\t\t\t\t\t\t\t\t) );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst pattern = await createPatternFromFile(\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\tcurrentCategoryId\n\t\t\t\t\t\t\t\t? [ currentCategoryId ]\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Navigate to the All patterns category for the newly created pattern\n\t\t\t\t\t\t// if we're not on that page already and if we're not in the `my-patterns`\n\t\t\t\t\t\t// category.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! currentCategoryId &&\n\t\t\t\t\t\t\tparams.categoryId !== 'my-patterns'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpath: `/patterns`,\n\t\t\t\t\t\t\t\tcategoryType: PATTERN_TYPES.theme,\n\t\t\t\t\t\t\t\tcategoryId: PATTERN_DEFAULT_CATEGORY,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The imported pattern's title.\n\t\t\t\t\t\t\t\t__( 'Imported \"%s\" from JSON.' ),\n\t\t\t\t\t\t\t\tpattern.title.raw\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'import-pattern-success',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch ( err ) {\n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rD,iBAAiB,CAAEqD,GAAG,CAACC,OAAO,EAAE;UAC/BnB,IAAI,EAAE,UAAU;UAChB5B,EAAE,EAAE;QACL,CAAE,CAAC;MACJ,CAAC,SAAS;QACTiC,KAAK,CAACE,MAAM,CAACa,KAAK,GAAG,EAAE;MACxB;IACD;EAAG,CACH,CACA,CAAC;AAEL"}
@@ -175,7 +175,7 @@ export default function Editor({
175
175
  rules: blockRemovalRules
176
176
  }), createElement(PatternModal, null)), editorMode === 'text' && isEditMode && createElement(CodeEditor, null), isEditMode && createElement(Fragment, null, createElement(KeyboardShortcutsEditMode, null), createElement(EditorKeyboardShortcutsRegister, null), createElement(EditorKeyboardShortcuts, null))),
177
177
  secondarySidebar: isEditMode && (shouldShowInserter && createElement(InserterSidebar, null) || shouldShowListView && createElement(ListViewSidebar, null)),
178
- sidebar: isEditMode && isRightSidebarOpen && createElement(Fragment, null, createElement(ComplementaryArea.Slot, {
178
+ sidebar: !isDistractionFree && isEditMode && isRightSidebarOpen && createElement(Fragment, null, createElement(ComplementaryArea.Slot, {
179
179
  scope: "core/edit-site"
180
180
  })),
181
181
  footer: shouldShowBlockBreadcrumbs && createElement(BlockBreadcrumb, {
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useSelect","Notice","useInstanceId","useViewportMatch","store","preferencesStore","BlockBreadcrumb","BlockToolbar","blockEditorStore","privateApis","blockEditorPrivateApis","BlockInspector","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorKeyboardShortcutsRegister","EditorKeyboardShortcuts","EditorNotices","EditorSnackbars","editorPrivateApis","editorStore","__","sprintf","coreDataStore","SidebarComplementaryAreaFills","SidebarInspectorFill","CodeEditor","KeyboardShortcutsEditMode","WelcomeGuide","StartTemplateOptions","editSiteStore","GlobalStylesRenderer","useTitle","CanvasLoader","unlock","useEditedEntityRecord","PatternModal","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","SiteEditorCanvas","TemplatePartConverter","useSpecificEditorSettings","BlockRemovalWarningModal","ExperimentalEditorProvider","EditorProvider","InserterSidebar","ListViewSidebar","interfaceLabels","body","sidebar","actions","footer","blockRemovalRules","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","type","editedPostType","isLargeViewport","context","contextPost","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","isDistractionFree","showIconLabels","showBlockBreadcrumbs","postTypeLabel","select","get","getEditedPostContext","getEditorMode","getCanvasMode","__unstableGetEditorMode","getActiveComplementaryArea","getEntityRecord","isInserterOpened","isListViewOpened","getPostTypeLabel","_context","postId","postType","undefined","name","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","postWithTemplate","title","_POST_TYPE_LABELS$edi","loadingProgressId","settings","isReady","createElement","Fragment","id","status","isDismissible","post","__unstableTemplate","useSubRegistry","enableRegionNavigation","className","notices","content","hideDragHandle","rules","secondarySidebar","Slot","scope","rootLabelText","labels"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { useInstanceId, useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockBreadcrumb,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockInspector,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tEditorKeyboardShortcuts,\n\tEditorNotices,\n\tEditorSnackbars,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarComplementaryAreaFills,\n\tSidebarInspectorFill,\n} from '../sidebar-edit-mode';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport PatternModal from '../pattern-modal';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SiteEditorCanvas from '../block-editor/site-editor-canvas';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\nconst {\n\tExperimentalEditorProvider: EditorProvider,\n\tInserterSidebar,\n\tListViewSidebar,\n} = unlock( editorPrivateApis );\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'core/query': __( 'Query Loop displays a list of posts or pages.' ),\n\t'core/post-content': __(\n\t\t'Post Content displays the content of a post or page.'\n\t),\n\t'core/post-template': __(\n\t\t'Post Template displays each post or page in a Query Loop.'\n\t),\n\t'bindings/core/pattern-overrides': __(\n\t\t'Blocks from synced patterns that can have overriden content.'\n\t),\n};\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { type: editedPostType } = editedPost;\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tcontext,\n\t\tcontextPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t\tpostTypeLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditedPostContext, getEditorMode, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tconst { isInserterOpened, isListViewOpened, getPostTypeLabel } =\n\t\t\tselect( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: _context,\n\t\t\tcontextPost: _context?.postId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t_context.postType,\n\t\t\t\t\t\t_context.postId\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t};\n\t}, [] );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\n\t\t! isDistractionFree &&\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst postWithTemplate = !! context?.postId;\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPostType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst isReady =\n\t\t! isLoading &&\n\t\t( ( postWithTemplate && !! contextPost && !! editedPost ) ||\n\t\t\t( ! postWithTemplate && !! editedPost ) );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ postWithTemplate ? contextPost : editedPost }\n\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\tpostWithTemplate ? editedPost : undefined\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t{ showVisualEditor && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<TemplatePartConverter />\n\t\t\t\t\t\t\t\t\t\t<SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t\t\t\t\t\t</SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SiteEditorCanvas />\n\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<PatternModal />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ editorMode === 'text' && isEditMode && (\n\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t( ( shouldShowInserter && <InserterSidebar /> ) ||\n\t\t\t\t\t\t\t\t( shouldShowListView && <ListViewSidebar /> ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\trootLabelText={ postTypeLabel }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\tsecondarySidebar: secondarySidebar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,MAAE,CACI,CAAC,EACrB,CAAEmD,eAAe,IAClB0C,aAAA,CAACjG,YAAY;MAAC6G,cAAc;IAAA,CAAE,CAC9B,EACDZ,aAAA,CAACjE,gBAAgB,MAAE,CAAC,EACpBiE,aAAA,CAAC9D,wBAAwB;MACxB2E,KAAK,EAAGjE;IAAmB,CAC3B,CAAC,EACFoD,aAAA,CAACpE,YAAY,MAAE,CACd,CACF,EACC6B,UAAU,KAAK,MAAM,IAAI2B,UAAU,IACpCY,aAAA,CAAC9E,UAAU,MAAE,CACb,EACCkE,UAAU,IACXY,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAC7E,yBAAyB,MAAE,CAAC,EAC7B6E,aAAA,CAACzF,+BAA+B,MAAE,CAAC,EACnCyF,aAAA,CAACxF,uBAAuB,MAAE,CACzB,CAEF,CACF;IACDsG,gBAAgB,EACf1B,UAAU,KACNG,kBAAkB,IAAIS,aAAA,CAAC3D,eAAe,MAAE,CAAC,IAC1CmD,kBAAkB,IAAIQ,aAAA,CAAC1D,eAAe,MAAE,CAAG,CAC9C;IACDG,OAAO,EACN2C,UAAU,IACVxB,kBAAkB,IACjBoC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAAC3F,iBAAiB,CAAC0G,IAAI;MAACC,KAAK,EAAC;IAAgB,CAAE,CAC/C,CAEH;IACDrE,MAAM,EACL2C,0BAA0B,IACzBU,aAAA,CAAClG,eAAe;MACfmH,aAAa,EAAG/C;IAAe,CAC/B,CAEF;IACDgD,MAAM,EAAG;MACR,GAAG3E,eAAe;MAClBuE,gBAAgB,EAAErB;IACnB;EAAG,CACH,CACc,CAEhB,CAAC;AAEL"}
1
+ {"version":3,"names":["classnames","useSelect","Notice","useInstanceId","useViewportMatch","store","preferencesStore","BlockBreadcrumb","BlockToolbar","blockEditorStore","privateApis","blockEditorPrivateApis","BlockInspector","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorKeyboardShortcutsRegister","EditorKeyboardShortcuts","EditorNotices","EditorSnackbars","editorPrivateApis","editorStore","__","sprintf","coreDataStore","SidebarComplementaryAreaFills","SidebarInspectorFill","CodeEditor","KeyboardShortcutsEditMode","WelcomeGuide","StartTemplateOptions","editSiteStore","GlobalStylesRenderer","useTitle","CanvasLoader","unlock","useEditedEntityRecord","PatternModal","POST_TYPE_LABELS","TEMPLATE_POST_TYPE","SiteEditorCanvas","TemplatePartConverter","useSpecificEditorSettings","BlockRemovalWarningModal","ExperimentalEditorProvider","EditorProvider","InserterSidebar","ListViewSidebar","interfaceLabels","body","sidebar","actions","footer","blockRemovalRules","Editor","isLoading","record","editedPost","getTitle","isLoaded","hasLoadedPost","type","editedPostType","isLargeViewport","context","contextPost","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","isDistractionFree","showIconLabels","showBlockBreadcrumbs","postTypeLabel","select","get","getEditedPostContext","getEditorMode","getCanvasMode","__unstableGetEditorMode","getActiveComplementaryArea","getEntityRecord","isInserterOpened","isListViewOpened","getPostTypeLabel","_context","postId","postType","undefined","name","isViewMode","isEditMode","showVisualEditor","shouldShowBlockBreadcrumbs","shouldShowInserter","shouldShowListView","secondarySidebarLabel","postWithTemplate","title","_POST_TYPE_LABELS$edi","loadingProgressId","settings","isReady","createElement","Fragment","id","status","isDismissible","post","__unstableTemplate","useSubRegistry","enableRegionNavigation","className","notices","content","hideDragHandle","rules","secondarySidebar","Slot","scope","rootLabelText","labels"],"sources":["@wordpress/edit-site/src/components/editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { useInstanceId, useViewportMatch } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockBreadcrumb,\n\tBlockToolbar,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockInspector,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport {\n\tEditorKeyboardShortcutsRegister,\n\tEditorKeyboardShortcuts,\n\tEditorNotices,\n\tEditorSnackbars,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tSidebarComplementaryAreaFills,\n\tSidebarInspectorFill,\n} from '../sidebar-edit-mode';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcutsEditMode from '../keyboard-shortcuts/edit-mode';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport useTitle from '../routes/use-title';\nimport CanvasLoader from '../canvas-loader';\nimport { unlock } from '../../lock-unlock';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport PatternModal from '../pattern-modal';\nimport { POST_TYPE_LABELS, TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport SiteEditorCanvas from '../block-editor/site-editor-canvas';\nimport TemplatePartConverter from '../template-part-converter';\nimport { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';\n\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\nconst {\n\tExperimentalEditorProvider: EditorProvider,\n\tInserterSidebar,\n\tListViewSidebar,\n} = unlock( editorPrivateApis );\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'core/query': __( 'Query Loop displays a list of posts or pages.' ),\n\t'core/post-content': __(\n\t\t'Post Content displays the content of a post or page.'\n\t),\n\t'core/post-template': __(\n\t\t'Post Template displays each post or page in a Query Loop.'\n\t),\n\t'bindings/core/pattern-overrides': __(\n\t\t'Blocks from synced patterns that can have overriden content.'\n\t),\n};\n\nexport default function Editor( { isLoading } ) {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { type: editedPostType } = editedPost;\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\n\tconst {\n\t\tcontext,\n\t\tcontextPost,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t\tshowIconLabels,\n\t\tshowBlockBreadcrumbs,\n\t\tpostTypeLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getEditedPostContext, getEditorMode, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst { getEntityRecord } = select( coreDataStore );\n\t\tconst { isInserterOpened, isListViewOpened, getPostTypeLabel } =\n\t\t\tselect( editorStore );\n\t\tconst _context = getEditedPostContext();\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: _context,\n\t\t\tcontextPost: _context?.postId\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t_context.postType,\n\t\t\t\t\t\t_context.postId\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tisDistractionFree: get( 'core', 'distractionFree' ),\n\t\t\tshowBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),\n\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\tpostTypeLabel: getPostTypeLabel(),\n\t\t};\n\t}, [] );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst shouldShowBlockBreadcrumbs =\n\t\t! isDistractionFree &&\n\t\tshowBlockBreadcrumbs &&\n\t\tisEditMode &&\n\t\tshowVisualEditor &&\n\t\tblockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst postWithTemplate = !! context?.postId;\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail for the Admin document title. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s' ),\n\t\t\tgetTitle(),\n\t\t\tPOST_TYPE_LABELS[ editedPostType ] ??\n\t\t\t\tPOST_TYPE_LABELS[ TEMPLATE_POST_TYPE ]\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URLQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tconst loadingProgressId = useInstanceId(\n\t\tCanvasLoader,\n\t\t'edit-site-editor__loading-progress'\n\t);\n\n\tconst settings = useSpecificEditorSettings();\n\tconst isReady =\n\t\t! isLoading &&\n\t\t( ( postWithTemplate && !! contextPost && !! editedPost ) ||\n\t\t\t( ! postWithTemplate && !! editedPost ) );\n\n\treturn (\n\t\t<>\n\t\t\t{ ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t) }\n\t\t\t\t</Notice>\n\t\t\t) }\n\t\t\t{ isReady && (\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ postWithTemplate ? contextPost : editedPost }\n\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\tpostWithTemplate ? editedPost : undefined\n\t\t\t\t\t}\n\t\t\t\t\tsettings={ settings }\n\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t>\n\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\tisDistractionFree={ isDistractionFree }\n\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-editor__interface-skeleton',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'show-icon-labels': showIconLabels,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t{ showVisualEditor && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<TemplatePartConverter />\n\t\t\t\t\t\t\t\t\t\t<SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t\t\t\t\t\t</SidebarInspectorFill>\n\t\t\t\t\t\t\t\t\t\t{ ! isLargeViewport && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t<SiteEditorCanvas />\n\t\t\t\t\t\t\t\t\t\t<BlockRemovalWarningModal\n\t\t\t\t\t\t\t\t\t\t\trules={ blockRemovalRules }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<PatternModal />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ editorMode === 'text' && isEditMode && (\n\t\t\t\t\t\t\t\t\t<CodeEditor />\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ isEditMode && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<KeyboardShortcutsEditMode />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t( ( shouldShowInserter && <InserterSidebar /> ) ||\n\t\t\t\t\t\t\t\t( shouldShowListView && <ListViewSidebar /> ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t! isDistractionFree &&\n\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\tshouldShowBlockBreadcrumbs && (\n\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\trootLabelText={ postTypeLabel }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</EditorProvider>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,oBAAoB;AACpE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SACCC,eAAe,EACfC,YAAY,EACZH,KAAK,IAAII,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,EACrCC,cAAc,QACR,yBAAyB;AAChC,SACCC,iBAAiB,EACjBC,iBAAiB,EACjBT,KAAK,IAAIU,cAAc,QACjB,sBAAsB;AAC7B,SACCC,+BAA+B,EAC/BC,uBAAuB,EACvBC,aAAa,EACbC,eAAe,EACfT,WAAW,IAAIU,iBAAiB,EAChCf,KAAK,IAAIgB,WAAW,QACd,mBAAmB;AAC1B,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASlB,KAAK,IAAImB,aAAa,QAAQ,sBAAsB;;AAE7D;AACA;AACA;AACA,SACCC,6BAA6B,EAC7BC,oBAAoB,QACd,sBAAsB;AAC7B,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,YAAY,MAAM,kBAAkB;A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,CAEF;IACDgD,MAAM,EAAG;MACR,GAAG3E,eAAe;MAClBuE,gBAAgB,EAAErB;IACnB;EAAG,CACH,CACc,CAEhB,CAAC;AAEL"}
@@ -29,7 +29,7 @@ const BlockPreviewPanel = ({
29
29
  return getBlockFromExample(name, example);
30
30
  }, [name, blockExample, variation]);
31
31
  const viewportWidth = (_blockExample$viewpor = blockExample?.viewportWidth) !== null && _blockExample$viewpor !== void 0 ? _blockExample$viewpor : null;
32
- const previewHeight = '150px';
32
+ const previewHeight = 150;
33
33
  if (!blockExample) {
34
34
  return null;
35
35
  }
@@ -49,7 +49,7 @@ const BlockPreviewPanel = ({
49
49
  additionalStyles: [{
50
50
  css: `
51
51
  body{
52
- min-height:${previewHeight};
52
+ min-height:${previewHeight}px;
53
53
  display:flex;align-items:center;justify-content:center;
54
54
  }
55
55
  `
@@ -1 +1 @@
1
- {"version":3,"names":["BlockPreview","getBlockType","getBlockFromExample","__experimentalSpacer","Spacer","useMemo","BlockPreviewPanel","name","variation","_blockExample$viewpor","blockExample","example","blocks","attributes","className","viewportWidth","previewHeight","createElement","marginX","marginBottom","style","maxHeight","boxSizing","minHeight","additionalStyles","css"],"sources":["@wordpress/edit-site/src/components/global-styles/block-preview-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport { getBlockType, getBlockFromExample } from '@wordpress/blocks';\nimport { __experimentalSpacer as Spacer } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\n\nconst BlockPreviewPanel = ( { name, variation = '' } ) => {\n\tconst blockExample = getBlockType( name )?.example;\n\tconst blocks = useMemo( () => {\n\t\tif ( ! blockExample ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet example = blockExample;\n\t\tif ( variation ) {\n\t\t\texample = {\n\t\t\t\t...example,\n\t\t\t\tattributes: {\n\t\t\t\t\t...example.attributes,\n\t\t\t\t\tclassName: 'is-style-' + variation,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn getBlockFromExample( name, example );\n\t}, [ name, blockExample, variation ] );\n\n\tconst viewportWidth = blockExample?.viewportWidth ?? null;\n\tconst previewHeight = '150px';\n\n\tif ( ! blockExample ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Spacer marginX={ 4 } marginBottom={ 4 }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-global-styles__block-preview-panel\"\n\t\t\t\tstyle={ { maxHeight: previewHeight, boxSizing: 'initial' } }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\tminHeight={ previewHeight }\n\t\t\t\t\tadditionalStyles={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcss: `\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tmin-height:${ previewHeight };\n\t\t\t\t\t\t\t\t\tdisplay:flex;align-items:center;justify-content:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Spacer>\n\t);\n};\n\nexport default BlockPreviewPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,yBAAyB;AACtD,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,mBAAmB;AACrE,SAASC,oBAAoB,IAAIC,MAAM,QAAQ,uBAAuB;AACtE,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,MAAMC,iBAAiB,GAAGA,CAAE;EAAEC,IAAI;EAAEC,SAAS,GAAG;AAAG,CAAC,KAAM;EAAA,IAAAC,qBAAA;EACzD,MAAMC,YAAY,GAAGT,YAAY,CAAEM,IAAK,CAAC,EAAEI,OAAO;EAClD,MAAMC,MAAM,GAAGP,OAAO,CAAE,MAAM;IAC7B,IAAK,CAAEK,YAAY,EAAG;MACrB,OAAO,IAAI;IACZ;IAEA,IAAIC,OAAO,GAAGD,YAAY;IAC1B,IAAKF,SAAS,EAAG;MAChBG,OAAO,GAAG;QACT,GAAGA,OAAO;QACVE,UAAU,EAAE;UACX,GAAGF,OAAO,CAACE,UAAU;UACrBC,SAAS,EAAE,WAAW,GAAGN;QAC1B;MACD,CAAC;IACF;IAEA,OAAON,mBAAmB,CAAEK,IAAI,EAAEI,OAAQ,CAAC;EAC5C,CAAC,EAAE,CAAEJ,IAAI,EAAEG,YAAY,EAAEF,SAAS,CAAG,CAAC;EAEtC,MAAMO,aAAa,IAAAN,qBAAA,GAAGC,YAAY,EAAEK,aAAa,cAAAN,qBAAA,cAAAA,qBAAA,GAAI,IAAI;EACzD,MAAMO,aAAa,GAAG,OAAO;EAE7B,IAAK,CAAEN,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EAEA,OACCO,aAAA,CAACb,MAAM;IAACc,OAAO,EAAG,CAAG;IAACC,YAAY,EAAG;EAAG,GACvCF,aAAA;IACCH,SAAS,EAAC,8CAA8C;IACxDM,KAAK,EAAG;MAAEC,SAAS,EAAEL,aAAa;MAAEM,SAAS,EAAE;IAAU;EAAG,GAE5DL,aAAA,CAACjB,YAAY;IACZY,MAAM,EAAGA,MAAQ;IACjBG,aAAa,EAAGA,aAAe;IAC/BQ,SAAS,EAAGP,aAAe;IAC3BQ,gBAAgB,EAAG,CAClB;MACCC,GAAG,EAAG;AACb;AACA,sBAAuBT,aAAe;AACtC;AACA;AACA;IACM,CAAC;EACC,CACH,CACG,CACE,CAAC;AAEX,CAAC;AAED,eAAeV,iBAAiB"}
1
+ {"version":3,"names":["BlockPreview","getBlockType","getBlockFromExample","__experimentalSpacer","Spacer","useMemo","BlockPreviewPanel","name","variation","_blockExample$viewpor","blockExample","example","blocks","attributes","className","viewportWidth","previewHeight","createElement","marginX","marginBottom","style","maxHeight","boxSizing","minHeight","additionalStyles","css"],"sources":["@wordpress/edit-site/src/components/global-styles/block-preview-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockPreview } from '@wordpress/block-editor';\nimport { getBlockType, getBlockFromExample } from '@wordpress/blocks';\nimport { __experimentalSpacer as Spacer } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\n\nconst BlockPreviewPanel = ( { name, variation = '' } ) => {\n\tconst blockExample = getBlockType( name )?.example;\n\tconst blocks = useMemo( () => {\n\t\tif ( ! blockExample ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tlet example = blockExample;\n\t\tif ( variation ) {\n\t\t\texample = {\n\t\t\t\t...example,\n\t\t\t\tattributes: {\n\t\t\t\t\t...example.attributes,\n\t\t\t\t\tclassName: 'is-style-' + variation,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn getBlockFromExample( name, example );\n\t}, [ name, blockExample, variation ] );\n\n\tconst viewportWidth = blockExample?.viewportWidth ?? null;\n\tconst previewHeight = 150;\n\n\tif ( ! blockExample ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Spacer marginX={ 4 } marginBottom={ 4 }>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-global-styles__block-preview-panel\"\n\t\t\t\tstyle={ { maxHeight: previewHeight, boxSizing: 'initial' } }\n\t\t\t>\n\t\t\t\t<BlockPreview\n\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\tminHeight={ previewHeight }\n\t\t\t\t\tadditionalStyles={ [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcss: `\n\t\t\t\t\t\t\t\tbody{\n\t\t\t\t\t\t\t\t\tmin-height:${ previewHeight }px;\n\t\t\t\t\t\t\t\t\tdisplay:flex;align-items:center;justify-content:center;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t`,\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Spacer>\n\t);\n};\n\nexport default BlockPreviewPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,Q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P,aAAe;IAC3BQ,gBAAgB,EAAG,CAClB;MACCC,GAAG,EAAG;AACb;AACA,sBAAuBT,aAAe;AACtC;AACA;AACA;IACM,CAAC;EACC,CACH,CACG,CACE,CAAC;AAEX,CAAC;AAED,eAAeV,iBAAiB"}
@@ -35,7 +35,7 @@ function CollectionFontDetails({
35
35
  // If the font has no fontFace, we want to check if the font is in the outline
36
36
  fontToInstallOutline)
37
37
  }))), createElement(Spacer, {
38
- margin: 8
38
+ margin: 16
39
39
  }));
40
40
  }
41
41
  export default CollectionFontDetails;
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalVStack","VStack","__experimentalSpacer","Spacer","CollectionFontVariant","isFontFontFaceInOutline","sortFontFaces","CollectionFontDetails","font","handleToggleVariant","fontToInstallOutline","fontFaces","fontFace","length","fontFamily","fontStyle","fontWeight","createElement","Fragment","margin","spacing","map","face","i","key","selected","slug"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/collection-font-details.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport CollectionFontVariant from './collection-font-variant';\nimport { isFontFontFaceInOutline } from './utils/fonts-outline';\nimport { sortFontFaces } from './utils/sort-font-faces';\n\nfunction CollectionFontDetails( {\n\tfont,\n\thandleToggleVariant,\n\tfontToInstallOutline,\n} ) {\n\tconst fontFaces =\n\t\tfont.fontFace && font.fontFace.length\n\t\t\t? sortFontFaces( font.fontFace )\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfontFamily: font.fontFamily,\n\t\t\t\t\t\tfontStyle: 'normal',\n\t\t\t\t\t\tfontWeight: '400',\n\t\t\t\t\t},\n\t\t\t ];\n\n\treturn (\n\t\t<>\n\t\t\t<Spacer margin={ 4 } />\n\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t<Spacer margin={ 8 } />\n\t\t\t\t{ fontFaces.map( ( face, i ) => (\n\t\t\t\t\t<CollectionFontVariant\n\t\t\t\t\t\tfont={ font }\n\t\t\t\t\t\tface={ face }\n\t\t\t\t\t\tkey={ `face${ i }` }\n\t\t\t\t\t\thandleToggleVariant={ handleToggleVariant }\n\t\t\t\t\t\tselected={ isFontFontFaceInOutline(\n\t\t\t\t\t\t\tfont.slug,\n\t\t\t\t\t\t\tfont.fontFace ? face : null, // If the font has no fontFace, we want to check if the font is in the outline\n\t\t\t\t\t\t\tfontToInstallOutline\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</VStack>\n\t\t\t<Spacer margin={ 8 } />\n\t\t</>\n\t);\n}\n\nexport default CollectionFontDetails;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;;AAE9B;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,2BAA2B;AAC7D,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAASC,aAAa,QAAQ,yBAAyB;AAEvD,SAASC,qBAAqBA,CAAE;EAC/BC,IAAI;EACJC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GACdH,IAAI,CAACI,QAAQ,IAAIJ,IAAI,CAACI,QAAQ,CAACC,MAAM,GAClCP,aAAa,CAAEE,IAAI,CAACI,QAAS,CAAC,GAC9B,CACA;IACCE,UAAU,EAAEN,IAAI,CAACM,UAAU;IAC3BC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE;EACb,CAAC,CACA;EAEL,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACd,MAAM;IAACgB,MAAM,EAAG;EAAG,CAAE,CAAC,EACvBF,aAAA,CAAChB,MAAM;IAACmB,OAAO,EAAG;EAAG,GACpBH,aAAA,CAACd,MAAM;IAACgB,MAAM,EAAG;EAAG,CAAE,CAAC,EACrBR,SAAS,CAACU,GAAG,CAAE,CAAEC,IAAI,EAAEC,CAAC,KACzBN,aAAA,CAACb,qBAAqB;IACrBI,IAAI,EAAGA,IAAM;IACbc,IAAI,EAAGA,IAAM;IACbE,GAAG,EAAI,OAAOD,CAAG,EAAG;IACpBd,mBAAmB,EAAGA,mBAAqB;IAC3CgB,QAAQ,EAAGpB,uBAAuB,CACjCG,IAAI,CAACkB,IAAI,EACTlB,IAAI,CAACI,QAAQ,GAAGU,IAAI,GAAG,IAAI;IAAE;IAC7BZ,oBACD;EAAG,CACH,CACA,CACK,CAAC,EACTO,aAAA,CAACd,MAAM;IAACgB,MAAM,EAAG;EAAG,CAAE,CACrB,CAAC;AAEL;AAEA,eAAeZ,qBAAqB"}
1
+ {"version":3,"names":["__experimentalVStack","VStack","__experimentalSpacer","Spacer","CollectionFontVariant","isFontFontFaceInOutline","sortFontFaces","CollectionFontDetails","font","handleToggleVariant","fontToInstallOutline","fontFaces","fontFace","length","fontFamily","fontStyle","fontWeight","createElement","Fragment","margin","spacing","map","face","i","key","selected","slug"],"sources":["@wordpress/edit-site/src/components/global-styles/font-library-modal/collection-font-details.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalVStack as VStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport CollectionFontVariant from './collection-font-variant';\nimport { isFontFontFaceInOutline } from './utils/fonts-outline';\nimport { sortFontFaces } from './utils/sort-font-faces';\n\nfunction CollectionFontDetails( {\n\tfont,\n\thandleToggleVariant,\n\tfontToInstallOutline,\n} ) {\n\tconst fontFaces =\n\t\tfont.fontFace && font.fontFace.length\n\t\t\t? sortFontFaces( font.fontFace )\n\t\t\t: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfontFamily: font.fontFamily,\n\t\t\t\t\t\tfontStyle: 'normal',\n\t\t\t\t\t\tfontWeight: '400',\n\t\t\t\t\t},\n\t\t\t ];\n\n\treturn (\n\t\t<>\n\t\t\t<Spacer margin={ 4 } />\n\t\t\t<VStack spacing={ 0 }>\n\t\t\t\t<Spacer margin={ 8 } />\n\t\t\t\t{ fontFaces.map( ( face, i ) => (\n\t\t\t\t\t<CollectionFontVariant\n\t\t\t\t\t\tfont={ font }\n\t\t\t\t\t\tface={ face }\n\t\t\t\t\t\tkey={ `face${ i }` }\n\t\t\t\t\t\thandleToggleVariant={ handleToggleVariant }\n\t\t\t\t\t\tselected={ isFontFontFaceInOutline(\n\t\t\t\t\t\t\tfont.slug,\n\t\t\t\t\t\t\tfont.fontFace ? face : null, // If the font has no fontFace, we want to check if the font is in the outline\n\t\t\t\t\t\t\tfontToInstallOutline\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</VStack>\n\t\t\t<Spacer margin={ 16 } />\n\t\t</>\n\t);\n}\n\nexport default CollectionFontDetails;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;;AAE9B;AACA;AACA;AACA,OAAOC,qBAAqB,MAAM,2BAA2B;AAC7D,SAASC,uBAAuB,QAAQ,uBAAuB;AAC/D,SAASC,aAAa,QAAQ,yBAAyB;AAEvD,SAASC,qBAAqBA,CAAE;EAC/BC,IAAI;EACJC,mBAAmB;EACnBC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GACdH,IAAI,CAACI,QAAQ,IAAIJ,IAAI,CAACI,QAAQ,CAACC,MAAM,GAClCP,aAAa,CAAEE,IAAI,CAACI,QAAS,CAAC,GAC9B,CACA;IACCE,UAAU,EAAEN,IAAI,CAACM,UAAU;IAC3BC,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE;EACb,CAAC,CACA;EAEL,OACCC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACd,MAAM;IAACgB,MAAM,EAAG;EAAG,CAAE,CAAC,EACvBF,aAAA,CAAChB,MAAM;IAACmB,OAAO,EAAG;EAAG,GACpBH,aAAA,CAACd,MAAM;IAACgB,MAAM,EAAG;EAAG,CAAE,CAAC,EACrBR,SAAS,CAACU,GAAG,CAAE,CAAEC,IAAI,EAAEC,CAAC,KACzBN,aAAA,CAACb,qBAAqB;IACrBI,IAAI,EAAGA,IAAM;IACbc,IAAI,EAAGA,IAAM;IACbE,GAAG,EAAI,OAAOD,CAAG,EAAG;IACpBd,mBAAmB,EAAGA,mBAAqB;IAC3CgB,QAAQ,EAAGpB,uBAAuB,CACjCG,IAAI,CAACkB,IAAI,EACTlB,IAAI,CAACI,QAAQ,GAAGU,IAAI,GAAG,IAAI;IAAE;IAC7BZ,oBACD;EAAG,CACH,CACA,CACK,CAAC,EACTO,aAAA,CAACd,MAAM;IAACgB,MAAM,EAAG;EAAI,CAAE,CACtB,CAAC;AAEL;AAEA,eAAeZ,qBAAqB"}
@@ -257,7 +257,7 @@ function FontLibraryProvider({
257
257
  if (font.fontFace) {
258
258
  font.fontFace.forEach(face => {
259
259
  // Load font faces just in the iframe because they already are in the document.
260
- loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face.src), 'iframe');
260
+ loadFontFaceInBrowser(face, getDisplaySrcFromFontFace(face.src), 'all');
261
261
  });
262
262
  }
263
263
  });