@wordpress/editor 14.18.0 → 14.19.0

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 (141) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +2 -0
  3. package/build/components/document-outline/index.js +16 -16
  4. package/build/components/document-outline/index.js.map +1 -1
  5. package/build/components/entities-saved-states/entity-record-item.js +2 -1
  6. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  7. package/build/components/entities-saved-states/entity-type-list.js +2 -1
  8. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  9. package/build/components/entities-saved-states/index.js +66 -42
  10. package/build/components/entities-saved-states/index.js.map +1 -1
  11. package/build/components/post-actions/index.js +19 -28
  12. package/build/components/post-actions/index.js.map +1 -1
  13. package/build/components/post-card-panel/index.js +2 -2
  14. package/build/components/post-card-panel/index.js.map +1 -1
  15. package/build/components/post-featured-image/index.js +4 -2
  16. package/build/components/post-featured-image/index.js.map +1 -1
  17. package/build/components/post-template/block-theme.js +68 -48
  18. package/build/components/post-template/block-theme.js.map +1 -1
  19. package/build/components/post-template/classic-theme.js +30 -18
  20. package/build/components/post-template/classic-theme.js.map +1 -1
  21. package/build/components/post-template/create-new-template-modal.js +3 -1
  22. package/build/components/post-template/create-new-template-modal.js.map +1 -1
  23. package/build/components/post-template/panel.js +3 -11
  24. package/build/components/post-template/panel.js.map +1 -1
  25. package/build/components/preferences-modal/block-visibility.js +2 -1
  26. package/build/components/preferences-modal/block-visibility.js.map +1 -1
  27. package/build/components/preferences-modal/index.js +1 -1
  28. package/build/components/preferences-modal/index.js.map +1 -1
  29. package/build/components/preview-dropdown/index.js +6 -3
  30. package/build/components/preview-dropdown/index.js.map +1 -1
  31. package/build/components/provider/index.js +19 -18
  32. package/build/components/provider/index.js.map +1 -1
  33. package/build/components/sidebar/header.js +1 -1
  34. package/build/components/sidebar/header.js.map +1 -1
  35. package/build/components/sidebar/index.js +1 -1
  36. package/build/components/sidebar/index.js.map +1 -1
  37. package/build/components/start-page-options/index.js +148 -23
  38. package/build/components/start-page-options/index.js.map +1 -1
  39. package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
  40. package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  41. package/build/store/private-actions.js +29 -2
  42. package/build/store/private-actions.js.map +1 -1
  43. package/build/store/private-selectors.js +44 -0
  44. package/build/store/private-selectors.js.map +1 -1
  45. package/build/utils/media-upload/index.js +5 -2
  46. package/build/utils/media-upload/index.js.map +1 -1
  47. package/build-module/components/document-outline/index.js +17 -17
  48. package/build-module/components/document-outline/index.js.map +1 -1
  49. package/build-module/components/entities-saved-states/entity-record-item.js +2 -1
  50. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  51. package/build-module/components/entities-saved-states/entity-type-list.js +2 -1
  52. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  53. package/build-module/components/entities-saved-states/index.js +67 -43
  54. package/build-module/components/entities-saved-states/index.js.map +1 -1
  55. package/build-module/components/post-actions/index.js +19 -28
  56. package/build-module/components/post-actions/index.js.map +1 -1
  57. package/build-module/components/post-card-panel/index.js +2 -2
  58. package/build-module/components/post-card-panel/index.js.map +1 -1
  59. package/build-module/components/post-featured-image/index.js +4 -2
  60. package/build-module/components/post-featured-image/index.js.map +1 -1
  61. package/build-module/components/post-template/block-theme.js +68 -48
  62. package/build-module/components/post-template/block-theme.js.map +1 -1
  63. package/build-module/components/post-template/classic-theme.js +30 -18
  64. package/build-module/components/post-template/classic-theme.js.map +1 -1
  65. package/build-module/components/post-template/create-new-template-modal.js +3 -1
  66. package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
  67. package/build-module/components/post-template/panel.js +3 -11
  68. package/build-module/components/post-template/panel.js.map +1 -1
  69. package/build-module/components/preferences-modal/block-visibility.js +2 -1
  70. package/build-module/components/preferences-modal/block-visibility.js.map +1 -1
  71. package/build-module/components/preferences-modal/index.js +1 -1
  72. package/build-module/components/preferences-modal/index.js.map +1 -1
  73. package/build-module/components/preview-dropdown/index.js +6 -3
  74. package/build-module/components/preview-dropdown/index.js.map +1 -1
  75. package/build-module/components/provider/index.js +19 -18
  76. package/build-module/components/provider/index.js.map +1 -1
  77. package/build-module/components/sidebar/header.js +1 -1
  78. package/build-module/components/sidebar/header.js.map +1 -1
  79. package/build-module/components/sidebar/index.js +1 -1
  80. package/build-module/components/sidebar/index.js.map +1 -1
  81. package/build-module/components/start-page-options/index.js +148 -24
  82. package/build-module/components/start-page-options/index.js.map +1 -1
  83. package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
  84. package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
  85. package/build-module/store/private-actions.js +25 -0
  86. package/build-module/store/private-actions.js.map +1 -1
  87. package/build-module/store/private-selectors.js +43 -0
  88. package/build-module/store/private-selectors.js.map +1 -1
  89. package/build-module/utils/media-upload/index.js +5 -2
  90. package/build-module/utils/media-upload/index.js.map +1 -1
  91. package/build-style/style-rtl.css +49 -8
  92. package/build-style/style.css +49 -8
  93. package/build-types/components/document-outline/index.d.ts.map +1 -1
  94. package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
  95. package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
  96. package/build-types/components/entities-saved-states/index.d.ts +6 -2
  97. package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
  98. package/build-types/components/post-actions/index.d.ts.map +1 -1
  99. package/build-types/components/post-card-panel/index.d.ts.map +1 -1
  100. package/build-types/components/post-template/block-theme.d.ts.map +1 -1
  101. package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
  102. package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -1
  103. package/build-types/components/post-template/panel.d.ts.map +1 -1
  104. package/build-types/components/preferences-modal/block-visibility.d.ts.map +1 -1
  105. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  106. package/build-types/components/provider/index.d.ts.map +1 -1
  107. package/build-types/components/start-page-options/index.d.ts +2 -1
  108. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  109. package/build-types/store/private-actions.d.ts +4 -0
  110. package/build-types/store/private-actions.d.ts.map +1 -1
  111. package/build-types/store/private-selectors.d.ts +13 -0
  112. package/build-types/store/private-selectors.d.ts.map +1 -1
  113. package/build-types/utils/media-upload/index.d.ts +3 -1
  114. package/build-types/utils/media-upload/index.d.ts.map +1 -1
  115. package/package.json +37 -37
  116. package/src/components/document-outline/index.js +22 -16
  117. package/src/components/entities-saved-states/entity-record-item.js +1 -0
  118. package/src/components/entities-saved-states/entity-type-list.js +6 -2
  119. package/src/components/entities-saved-states/index.js +98 -58
  120. package/src/components/entities-saved-states/style.scss +40 -5
  121. package/src/components/post-actions/index.js +19 -37
  122. package/src/components/post-card-panel/index.js +7 -5
  123. package/src/components/post-featured-image/index.js +2 -0
  124. package/src/components/post-template/block-theme.js +76 -56
  125. package/src/components/post-template/classic-theme.js +31 -15
  126. package/src/components/post-template/create-new-template-modal.js +1 -0
  127. package/src/components/post-template/panel.js +2 -12
  128. package/src/components/post-text-editor/style.scss +0 -2
  129. package/src/components/preferences-modal/block-visibility.js +2 -1
  130. package/src/components/preferences-modal/index.js +1 -1
  131. package/src/components/preview-dropdown/index.js +8 -6
  132. package/src/components/provider/index.js +21 -30
  133. package/src/components/sidebar/header.js +1 -1
  134. package/src/components/sidebar/index.js +1 -1
  135. package/src/components/start-page-options/index.js +149 -23
  136. package/src/components/start-page-options/style.scss +27 -0
  137. package/src/components/visual-editor/edit-template-blocks-notification.js +1 -1
  138. package/src/store/private-actions.js +33 -0
  139. package/src/store/private-selectors.js +57 -0
  140. package/src/utils/media-upload/index.js +3 -0
  141. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_i18n","_coreData","_blockEditor","_notices","_patterns","_blocks","_withRegistryProvider","_interopRequireDefault","_store","_useBlockEditorSettings","_lockUnlock","_disableNonPageContentBlocks","_navigationBlockEditingMode","_useHideBlocksFromInserter","_commands","_blockRemovalWarnings","_startPageOptions","_keyboardShortcutHelpModal","_contentOnlySettingsMenu","_startTemplateOptions","_globalKeyboardShortcuts","_patternRenameModal","_patternDuplicateModal","_templatePartMenuItems","_jsxRuntime","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","PatternsMenuItems","editPatternsPrivateApis","noop","NON_CONTEXTUAL_POST_TYPES","RENDERING_MODES","useBlockEditorProps","post","template","mode","rootLevelPost","postBlocks","onInput","onChange","useEntityBlockEditor","type","id","templateBlocks","onInputTemplate","onChangeTemplate","maybeNavigationBlocks","useMemo","createBlock","ref","templateLock","blocks","disableRootLevelChanges","ExperimentalEditorProvider","exports","withRegistryProvider","settings","recovery","initialEdits","children","BlockEditorProviderComponent","__unstableTemplate","hasTemplate","editorSettings","selection","isReady","defaultMode","postTypeEntities","useSelect","select","getEditorSettings","getEditorSelection","getRenderingMode","__unstableIsEditorReady","editorStore","getEntitiesConfig","getPostType","hasFinishedResolution","coreStore","postTypeSupports","supports","hasLoadedPostObject","_defaultMode","Array","isArray","editor","find","features","undefined","hasDefaultMode","includes","shouldRenderTemplate","defaultBlockContext","postContext","slug","postType","split","postTypeNames","map","entity","name","match","join","postId","templateSlug","blockEditorSettings","useBlockEditorSettings","updatePostLock","setupEditor","updateEditorSettings","setCurrentTemplateId","setEditedPost","setRenderingMode","useDispatch","createWarningNotice","noticesStore","useLayoutEffect","postLock","autosave","__","actions","label","url","editLink","useEffect","useHideBlocksFromInserter","useCommands","jsx","EntityProvider","kind","BlockContextProvider","value","jsxs","useSubRegistry","isPreviewMode","Fragment","default","EditorProvider","props","BlockEditorProvider","_default"],"sources":["@wordpress/editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tEntityProvider,\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBlockEditorProvider,\n\tBlockContextProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport { store as editorStore } from '../../store';\nimport useBlockEditorSettings from './use-block-editor-settings';\nimport { unlock } from '../../lock-unlock';\nimport DisableNonPageContentBlocks from './disable-non-page-content-blocks';\nimport NavigationBlockEditingMode from './navigation-block-editing-mode';\nimport { useHideBlocksFromInserter } from './use-hide-blocks-from-inserter';\nimport useCommands from '../commands';\nimport BlockRemovalWarnings from '../block-removal-warnings';\nimport StartPageOptions from '../start-page-options';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';\nimport StartTemplateOptions from '../start-template-options';\nimport EditorKeyboardShortcuts from '../global-keyboard-shortcuts';\nimport PatternRenameModal from '../pattern-rename-modal';\nimport PatternDuplicateModal from '../pattern-duplicate-modal';\nimport TemplatePartMenuItems from '../template-part-menu-items';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\n\nconst noop = () => {};\n\n/**\n * These are global entities that are only there to split blocks into logical units\n * They don't provide a \"context\" for the current post/page being rendered.\n * So we should not use their ids as post context. This is important to allow post blocks\n * (post content, post title) to be used within them without issues.\n */\nconst NON_CONTEXTUAL_POST_TYPES = [\n\t'wp_block',\n\t'wp_navigation',\n\t'wp_template_part',\n];\n\n/**\n * These are rendering modes that the editor supports.\n */\nconst RENDERING_MODES = [ 'post-only', 'template-locked' ];\n\n/**\n * Depending on the post, template and template mode,\n * returns the appropriate blocks and change handlers for the block editor provider.\n *\n * @param {Array} post Block list.\n * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.\n * @param {string} mode Rendering mode.\n *\n * @example\n * ```jsx\n * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode );\n * ```\n *\n * @return {Array} Block editor props.\n */\nfunction useBlockEditorProps( post, template, mode ) {\n\tconst rootLevelPost = mode === 'template-locked' ? 'template' : 'post';\n\tconst [ postBlocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpost.type,\n\t\t{ id: post.id }\n\t);\n\tconst [ templateBlocks, onInputTemplate, onChangeTemplate ] =\n\t\tuseEntityBlockEditor( 'postType', template?.type, {\n\t\t\tid: template?.id,\n\t\t} );\n\tconst maybeNavigationBlocks = useMemo( () => {\n\t\tif ( post.type === 'wp_navigation' ) {\n\t\t\treturn [\n\t\t\t\tcreateBlock( 'core/navigation', {\n\t\t\t\t\tref: post.id,\n\t\t\t\t\t// As the parent editor is locked with `templateLock`, the template locking\n\t\t\t\t\t// must be explicitly \"unset\" on the block itself to allow the user to modify\n\t\t\t\t\t// the block's content.\n\t\t\t\t\ttemplateLock: false,\n\t\t\t\t} ),\n\t\t\t];\n\t\t}\n\t}, [ post.type, post.id ] );\n\n\t// It is important that we don't create a new instance of blocks on every change\n\t// We should only create a new instance if the blocks them selves change, not a dependency of them.\n\tconst blocks = useMemo( () => {\n\t\tif ( maybeNavigationBlocks ) {\n\t\t\treturn maybeNavigationBlocks;\n\t\t}\n\n\t\tif ( rootLevelPost === 'template' ) {\n\t\t\treturn templateBlocks;\n\t\t}\n\n\t\treturn postBlocks;\n\t}, [ maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks ] );\n\n\t// Handle fallback to postBlocks outside of the above useMemo, to ensure\n\t// that constructed block templates that call `createBlock` are not generated\n\t// too frequently. This ensures that clientIds are stable.\n\tconst disableRootLevelChanges =\n\t\t( !! template && mode === 'template-locked' ) ||\n\t\tpost.type === 'wp_navigation';\n\tif ( disableRootLevelChanges ) {\n\t\treturn [ blocks, noop, noop ];\n\t}\n\n\treturn [\n\t\tblocks,\n\t\trootLevelPost === 'post' ? onInput : onInputTemplate,\n\t\trootLevelPost === 'post' ? onChange : onChangeTemplate,\n\t];\n}\n\n/**\n * This component provides the editor context and manages the state of the block editor.\n *\n * @param {Object} props The component props.\n * @param {Object} props.post The post object.\n * @param {Object} props.settings The editor settings.\n * @param {boolean} props.recovery Indicates if the editor is in recovery mode.\n * @param {Array} props.initialEdits The initial edits for the editor.\n * @param {Object} props.children The child components.\n * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider.\n * @param {Object} [props.__unstableTemplate] The template object.\n *\n * @example\n * ```jsx\n * <ExperimentalEditorProvider\n * post={ post }\n * settings={ settings }\n * recovery={ recovery }\n * initialEdits={ initialEdits }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </ExperimentalEditorProvider>\n *\n * @return {Object} The rendered ExperimentalEditorProvider component.\n */\nexport const ExperimentalEditorProvider = withRegistryProvider(\n\t( {\n\t\tpost,\n\t\tsettings,\n\t\trecovery,\n\t\tinitialEdits,\n\t\tchildren,\n\t\tBlockEditorProviderComponent = ExperimentalBlockEditorProvider,\n\t\t__unstableTemplate: template,\n\t} ) => {\n\t\tconst hasTemplate = !! template;\n\t\tconst {\n\t\t\teditorSettings,\n\t\t\tselection,\n\t\t\tisReady,\n\t\t\tmode,\n\t\t\tdefaultMode,\n\t\t\tpostTypeEntities,\n\t\t} = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEditorSettings,\n\t\t\t\t\tgetEditorSelection,\n\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\t__unstableIsEditorReady,\n\t\t\t\t} = select( editorStore );\n\t\t\t\tconst {\n\t\t\t\t\tgetEntitiesConfig,\n\t\t\t\t\tgetPostType,\n\t\t\t\t\thasFinishedResolution,\n\t\t\t\t} = select( coreStore );\n\n\t\t\t\tconst postTypeSupports = getPostType( post.type )?.supports;\n\t\t\t\tconst hasLoadedPostObject = hasFinishedResolution(\n\t\t\t\t\t'getPostType',\n\t\t\t\t\t[ post.type ]\n\t\t\t\t);\n\n\t\t\t\tconst _defaultMode = Array.isArray( postTypeSupports?.editor )\n\t\t\t\t\t? postTypeSupports.editor.find(\n\t\t\t\t\t\t\t( features ) => 'default-mode' in features\n\t\t\t\t\t )?.[ 'default-mode' ]\n\t\t\t\t\t: undefined;\n\t\t\t\tconst hasDefaultMode = RENDERING_MODES.includes( _defaultMode );\n\n\t\t\t\treturn {\n\t\t\t\t\teditorSettings: getEditorSettings(),\n\t\t\t\t\tisReady: __unstableIsEditorReady() && hasLoadedPostObject,\n\t\t\t\t\tmode: getRenderingMode(),\n\t\t\t\t\tdefaultMode:\n\t\t\t\t\t\thasTemplate && hasDefaultMode\n\t\t\t\t\t\t\t? _defaultMode\n\t\t\t\t\t\t\t: 'post-only',\n\t\t\t\t\tselection: getEditorSelection(),\n\t\t\t\t\tpostTypeEntities:\n\t\t\t\t\t\tpost.type === 'wp_template'\n\t\t\t\t\t\t\t? getEntitiesConfig( 'postType' )\n\t\t\t\t\t\t\t: null,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ post.type, hasTemplate ]\n\t\t);\n\n\t\tconst shouldRenderTemplate = !! template && mode !== 'post-only';\n\t\tconst rootLevelPost = shouldRenderTemplate ? template : post;\n\t\tconst defaultBlockContext = useMemo( () => {\n\t\t\tconst postContext = {};\n\t\t\t// If it is a template, try to inherit the post type from the name.\n\t\t\tif ( post.type === 'wp_template' ) {\n\t\t\t\tif ( post.slug === 'page' ) {\n\t\t\t\t\tpostContext.postType = 'page';\n\t\t\t\t} else if ( post.slug === 'single' ) {\n\t\t\t\t\tpostContext.postType = 'post';\n\t\t\t\t} else if ( post.slug.split( '-' )[ 0 ] === 'single' ) {\n\t\t\t\t\t// If the slug is single-{postType}, infer the post type from the name.\n\t\t\t\t\tconst postTypeNames =\n\t\t\t\t\t\tpostTypeEntities?.map( ( entity ) => entity.name ) ||\n\t\t\t\t\t\t[];\n\t\t\t\t\tconst match = post.slug.match(\n\t\t\t\t\t\t`^single-(${ postTypeNames.join( '|' ) })(?:-.+)?$`\n\t\t\t\t\t);\n\t\t\t\t\tif ( match ) {\n\t\t\t\t\t\tpostContext.postType = match[ 1 ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t! NON_CONTEXTUAL_POST_TYPES.includes( rootLevelPost.type ) ||\n\t\t\t\tshouldRenderTemplate\n\t\t\t) {\n\t\t\t\tpostContext.postId = post.id;\n\t\t\t\tpostContext.postType = post.type;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...postContext,\n\t\t\t\ttemplateSlug:\n\t\t\t\t\trootLevelPost.type === 'wp_template'\n\t\t\t\t\t\t? rootLevelPost.slug\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}, [\n\t\t\tshouldRenderTemplate,\n\t\t\tpost.id,\n\t\t\tpost.type,\n\t\t\tpost.slug,\n\t\t\trootLevelPost.type,\n\t\t\trootLevelPost.slug,\n\t\t\tpostTypeEntities,\n\t\t] );\n\t\tconst { id, type } = rootLevelPost;\n\t\tconst blockEditorSettings = useBlockEditorSettings(\n\t\t\teditorSettings,\n\t\t\ttype,\n\t\t\tid,\n\t\t\tmode\n\t\t);\n\t\tconst [ blocks, onInput, onChange ] = useBlockEditorProps(\n\t\t\tpost,\n\t\t\ttemplate,\n\t\t\tmode\n\t\t);\n\n\t\tconst {\n\t\t\tupdatePostLock,\n\t\t\tsetupEditor,\n\t\t\tupdateEditorSettings,\n\t\t\tsetCurrentTemplateId,\n\t\t\tsetEditedPost,\n\t\t\tsetRenderingMode,\n\t\t} = unlock( useDispatch( editorStore ) );\n\t\tconst { createWarningNotice } = useDispatch( noticesStore );\n\n\t\t// Ideally this should be synced on each change and not just something you do once.\n\t\tuseLayoutEffect( () => {\n\t\t\t// Assume that we don't need to initialize in the case of an error recovery.\n\t\t\tif ( recovery ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdatePostLock( settings.postLock );\n\t\t\tsetupEditor( post, initialEdits, settings.template );\n\t\t\tif ( settings.autosave ) {\n\t\t\t\tcreateWarningNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'There is an autosave of this post that is more recent than the version below.'\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'autosave-exists',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'View the autosave' ),\n\t\t\t\t\t\t\t\turl: settings.autosave.editLink,\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\n\t\t\t// The dependencies of the hook are omitted deliberately\n\t\t\t// We only want to run setupEditor (with initialEdits) only once per post.\n\t\t\t// A better solution in the future would be to split this effect into multiple ones.\n\t\t}, [] );\n\n\t\t// Synchronizes the active post with the state\n\t\tuseEffect( () => {\n\t\t\tsetEditedPost( post.type, post.id );\n\t\t}, [ post.type, post.id, setEditedPost ] );\n\n\t\t// Synchronize the editor settings as they change.\n\t\tuseEffect( () => {\n\t\t\tupdateEditorSettings( settings );\n\t\t}, [ settings, updateEditorSettings ] );\n\n\t\t// Synchronizes the active template with the state.\n\t\tuseEffect( () => {\n\t\t\tsetCurrentTemplateId( template?.id );\n\t\t}, [ template?.id, setCurrentTemplateId ] );\n\n\t\t// Sets the right rendering mode when loading the editor.\n\t\tuseEffect( () => {\n\t\t\tsetRenderingMode( defaultMode );\n\t\t}, [ defaultMode, setRenderingMode ] );\n\n\t\tuseHideBlocksFromInserter( post.type, mode );\n\n\t\t// Register the editor commands.\n\t\tuseCommands();\n\n\t\tif ( ! isReady || ! mode ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ post.type }\n\t\t\t\t\tid={ post.id }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ defaultBlockContext }>\n\t\t\t\t\t\t<BlockEditorProviderComponent\n\t\t\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tsettings={ blockEditorSettings }\n\t\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t{ ! settings.isPreviewMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<PatternsMenuItems />\n\t\t\t\t\t\t\t\t\t<TemplatePartMenuItems />\n\t\t\t\t\t\t\t\t\t<ContentOnlySettingsMenu />\n\t\t\t\t\t\t\t\t\t{ mode === 'template-locked' && (\n\t\t\t\t\t\t\t\t\t\t<DisableNonPageContentBlocks />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ type === 'wp_navigation' && (\n\t\t\t\t\t\t\t\t\t\t<NavigationBlockEditingMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t\t\t\t\t\t\t<BlockRemovalWarnings />\n\t\t\t\t\t\t\t\t\t<StartPageOptions />\n\t\t\t\t\t\t\t\t\t<StartTemplateOptions />\n\t\t\t\t\t\t\t\t\t<PatternRenameModal />\n\t\t\t\t\t\t\t\t\t<PatternDuplicateModal />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockEditorProviderComponent>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t);\n\t}\n);\n\n/**\n * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor).\n *\n * It supports a large number of post types, including post, page, templates,\n * custom post types, patterns, template parts.\n *\n * All modification and changes are performed to the `@wordpress/core-data` store.\n *\n * @param {Object} props The component props.\n * @param {Object} [props.post] The post object to edit. This is required.\n * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post.\n * This is optional and can only be used when the post type supports templates (like posts and pages).\n * @param {Object} [props.settings] The settings object to use for the editor.\n * This is optional and can be used to override the default settings.\n * @param {React.ReactNode} [props.children] Children elements for which the BlockEditorProvider context should apply.\n * This is optional.\n *\n * @example\n * ```jsx\n * <EditorProvider\n * post={ post }\n * settings={ settings }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </EditorProvider>\n * ```\n *\n * @return {React.ReactNode} The rendered EditorProvider component.\n */\nexport function EditorProvider( props ) {\n\treturn (\n\t\t<ExperimentalEditorProvider\n\t\t\t{ ...props }\n\t\t\tBlockEditorProviderComponent={ BlockEditorProvider }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalEditorProvider>\n\t);\n}\n\nexport default EditorProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,qBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,4BAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,2BAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,0BAAA,GAAAf,OAAA;AACA,IAAAgB,SAAA,GAAAP,sBAAA,CAAAT,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AAA6H,OAA0B,IAAE,CAC7B,eACD,IAAAjH,WAAA,CAAAwG,GAAA,EAAC5G,wBAAA,CAAAqH,OAAuB,IAAE,CAAC,eAC3B,IAAAjH,WAAA,CAAAwG,GAAA,EAAC/G,0BAAA,CAAAwH,OAAyB,IAAE,CAAC,eAC7B,IAAAjH,WAAA,CAAAwG,GAAA,EAACjH,qBAAA,CAAA0H,OAAoB,IAAE,CAAC,eACxB,IAAAjH,WAAA,CAAAwG,GAAA,EAAChH,iBAAA,CAAAyH,OAAgB,IAAE,CAAC,eACpB,IAAAjH,WAAA,CAAAwG,GAAA,EAAC7G,qBAAA,CAAAsH,OAAoB,IAAE,CAAC,eACxB,IAAAjH,WAAA,CAAAwG,GAAA,EAAC3G,mBAAA,CAAAoH,OAAkB,IAAE,CAAC,eACtB,IAAAjH,WAAA,CAAAwG,GAAA,EAAC1G,sBAAA,CAAAmH,OAAqB,IAAE,CAAC;UAAA,CACxB,CACF;QAAA,CAC4B;MAAC,CACV;IAAC,CACR;EAAC,CACF,CAAC;AAEnB,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAEC,KAAK,EAAG;EACvC,oBACC,IAAAnH,WAAA,CAAAwG,GAAA,EAAC1E,0BAA0B;IAAA,GACrBqF,KAAK;IACV9E,4BAA4B,EAAG+E,gCAAqB;IAAAhF,QAAA,EAElD+E,KAAK,CAAC/E;EAAQ,CACW,CAAC;AAE/B;AAAC,IAAAiF,QAAA,GAAAtF,OAAA,CAAAkF,OAAA,GAEcC,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["_element","require","_data","_i18n","_coreData","_blockEditor","_notices","_patterns","_blocks","_withRegistryProvider","_interopRequireDefault","_store","_useBlockEditorSettings","_lockUnlock","_disableNonPageContentBlocks","_navigationBlockEditingMode","_useHideBlocksFromInserter","_commands","_blockRemovalWarnings","_startPageOptions","_keyboardShortcutHelpModal","_contentOnlySettingsMenu","_startTemplateOptions","_globalKeyboardShortcuts","_patternRenameModal","_patternDuplicateModal","_templatePartMenuItems","_jsxRuntime","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","PatternsMenuItems","editPatternsPrivateApis","noop","NON_CONTEXTUAL_POST_TYPES","useBlockEditorProps","post","template","mode","rootLevelPost","postBlocks","onInput","onChange","useEntityBlockEditor","type","id","templateBlocks","onInputTemplate","onChangeTemplate","maybeNavigationBlocks","useMemo","createBlock","ref","templateLock","blocks","disableRootLevelChanges","ExperimentalEditorProvider","exports","withRegistryProvider","settings","recovery","initialEdits","children","BlockEditorProviderComponent","__unstableTemplate","hasTemplate","editorSettings","selection","isReady","defaultMode","postTypeEntities","useSelect","select","getEditorSettings","getEditorSelection","getRenderingMode","__unstableIsEditorReady","getDefaultRenderingMode","editorStore","getEntitiesConfig","coreStore","_defaultMode","hasResolvedMode","undefined","shouldRenderTemplate","defaultBlockContext","postContext","slug","postType","split","postTypeNames","map","entity","name","match","join","includes","postId","templateSlug","blockEditorSettings","useBlockEditorSettings","updatePostLock","setupEditor","updateEditorSettings","setCurrentTemplateId","setEditedPost","setRenderingMode","useDispatch","createWarningNotice","noticesStore","useLayoutEffect","postLock","autosave","__","actions","label","url","editLink","useEffect","useHideBlocksFromInserter","useCommands","jsx","EntityProvider","kind","BlockContextProvider","value","jsxs","useSubRegistry","isPreviewMode","Fragment","default","EditorProvider","props","BlockEditorProvider","_default"],"sources":["@wordpress/editor/src/components/provider/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useLayoutEffect, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tEntityProvider,\n\tuseEntityBlockEditor,\n\tstore as coreStore,\n} from '@wordpress/core-data';\nimport {\n\tBlockEditorProvider,\n\tBlockContextProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport withRegistryProvider from './with-registry-provider';\nimport { store as editorStore } from '../../store';\nimport useBlockEditorSettings from './use-block-editor-settings';\nimport { unlock } from '../../lock-unlock';\nimport DisableNonPageContentBlocks from './disable-non-page-content-blocks';\nimport NavigationBlockEditingMode from './navigation-block-editing-mode';\nimport { useHideBlocksFromInserter } from './use-hide-blocks-from-inserter';\nimport useCommands from '../commands';\nimport BlockRemovalWarnings from '../block-removal-warnings';\nimport StartPageOptions from '../start-page-options';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport ContentOnlySettingsMenu from '../block-settings-menu/content-only-settings-menu';\nimport StartTemplateOptions from '../start-template-options';\nimport EditorKeyboardShortcuts from '../global-keyboard-shortcuts';\nimport PatternRenameModal from '../pattern-rename-modal';\nimport PatternDuplicateModal from '../pattern-duplicate-modal';\nimport TemplatePartMenuItems from '../template-part-menu-items';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\nconst { PatternsMenuItems } = unlock( editPatternsPrivateApis );\n\nconst noop = () => {};\n\n/**\n * These are global entities that are only there to split blocks into logical units\n * They don't provide a \"context\" for the current post/page being rendered.\n * So we should not use their ids as post context. This is important to allow post blocks\n * (post content, post title) to be used within them without issues.\n */\nconst NON_CONTEXTUAL_POST_TYPES = [\n\t'wp_block',\n\t'wp_navigation',\n\t'wp_template_part',\n];\n\n/**\n * Depending on the post, template and template mode,\n * returns the appropriate blocks and change handlers for the block editor provider.\n *\n * @param {Array} post Block list.\n * @param {boolean} template Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.\n * @param {string} mode Rendering mode.\n *\n * @example\n * ```jsx\n * const [ blocks, onInput, onChange ] = useBlockEditorProps( post, template, mode );\n * ```\n *\n * @return {Array} Block editor props.\n */\nfunction useBlockEditorProps( post, template, mode ) {\n\tconst rootLevelPost = mode === 'template-locked' ? 'template' : 'post';\n\tconst [ postBlocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\tpost.type,\n\t\t{ id: post.id }\n\t);\n\tconst [ templateBlocks, onInputTemplate, onChangeTemplate ] =\n\t\tuseEntityBlockEditor( 'postType', template?.type, {\n\t\t\tid: template?.id,\n\t\t} );\n\tconst maybeNavigationBlocks = useMemo( () => {\n\t\tif ( post.type === 'wp_navigation' ) {\n\t\t\treturn [\n\t\t\t\tcreateBlock( 'core/navigation', {\n\t\t\t\t\tref: post.id,\n\t\t\t\t\t// As the parent editor is locked with `templateLock`, the template locking\n\t\t\t\t\t// must be explicitly \"unset\" on the block itself to allow the user to modify\n\t\t\t\t\t// the block's content.\n\t\t\t\t\ttemplateLock: false,\n\t\t\t\t} ),\n\t\t\t];\n\t\t}\n\t}, [ post.type, post.id ] );\n\n\t// It is important that we don't create a new instance of blocks on every change\n\t// We should only create a new instance if the blocks them selves change, not a dependency of them.\n\tconst blocks = useMemo( () => {\n\t\tif ( maybeNavigationBlocks ) {\n\t\t\treturn maybeNavigationBlocks;\n\t\t}\n\n\t\tif ( rootLevelPost === 'template' ) {\n\t\t\treturn templateBlocks;\n\t\t}\n\n\t\treturn postBlocks;\n\t}, [ maybeNavigationBlocks, rootLevelPost, templateBlocks, postBlocks ] );\n\n\t// Handle fallback to postBlocks outside of the above useMemo, to ensure\n\t// that constructed block templates that call `createBlock` are not generated\n\t// too frequently. This ensures that clientIds are stable.\n\tconst disableRootLevelChanges =\n\t\t( !! template && mode === 'template-locked' ) ||\n\t\tpost.type === 'wp_navigation';\n\tif ( disableRootLevelChanges ) {\n\t\treturn [ blocks, noop, noop ];\n\t}\n\n\treturn [\n\t\tblocks,\n\t\trootLevelPost === 'post' ? onInput : onInputTemplate,\n\t\trootLevelPost === 'post' ? onChange : onChangeTemplate,\n\t];\n}\n\n/**\n * This component provides the editor context and manages the state of the block editor.\n *\n * @param {Object} props The component props.\n * @param {Object} props.post The post object.\n * @param {Object} props.settings The editor settings.\n * @param {boolean} props.recovery Indicates if the editor is in recovery mode.\n * @param {Array} props.initialEdits The initial edits for the editor.\n * @param {Object} props.children The child components.\n * @param {Object} [props.BlockEditorProviderComponent] The block editor provider component to use. Defaults to ExperimentalBlockEditorProvider.\n * @param {Object} [props.__unstableTemplate] The template object.\n *\n * @example\n * ```jsx\n * <ExperimentalEditorProvider\n * post={ post }\n * settings={ settings }\n * recovery={ recovery }\n * initialEdits={ initialEdits }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </ExperimentalEditorProvider>\n *\n * @return {Object} The rendered ExperimentalEditorProvider component.\n */\nexport const ExperimentalEditorProvider = withRegistryProvider(\n\t( {\n\t\tpost,\n\t\tsettings,\n\t\trecovery,\n\t\tinitialEdits,\n\t\tchildren,\n\t\tBlockEditorProviderComponent = ExperimentalBlockEditorProvider,\n\t\t__unstableTemplate: template,\n\t} ) => {\n\t\tconst hasTemplate = !! template;\n\t\tconst {\n\t\t\teditorSettings,\n\t\t\tselection,\n\t\t\tisReady,\n\t\t\tmode,\n\t\t\tdefaultMode,\n\t\t\tpostTypeEntities,\n\t\t} = useSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst {\n\t\t\t\t\tgetEditorSettings,\n\t\t\t\t\tgetEditorSelection,\n\t\t\t\t\tgetRenderingMode,\n\t\t\t\t\t__unstableIsEditorReady,\n\t\t\t\t\tgetDefaultRenderingMode,\n\t\t\t\t} = unlock( select( editorStore ) );\n\t\t\t\tconst { getEntitiesConfig } = select( coreStore );\n\n\t\t\t\tconst _defaultMode = getDefaultRenderingMode( post.type );\n\t\t\t\t/**\n\t\t\t\t * To avoid content \"flash\", wait until rendering mode has been resolved.\n\t\t\t\t * This is important for the initial render of the editor.\n\t\t\t\t *\n\t\t\t\t * - Wait for template to be resolved if the default mode is 'template-locked'.\n\t\t\t\t * - Wait for default mode to be resolved otherwise.\n\t\t\t\t */\n\t\t\t\tconst hasResolvedMode =\n\t\t\t\t\t_defaultMode === 'template-locked'\n\t\t\t\t\t\t? hasTemplate\n\t\t\t\t\t\t: _defaultMode !== undefined;\n\n\t\t\t\treturn {\n\t\t\t\t\teditorSettings: getEditorSettings(),\n\t\t\t\t\tisReady: __unstableIsEditorReady() && hasResolvedMode,\n\t\t\t\t\tmode: getRenderingMode(),\n\t\t\t\t\tdefaultMode: _defaultMode,\n\t\t\t\t\tselection: getEditorSelection(),\n\t\t\t\t\tpostTypeEntities:\n\t\t\t\t\t\tpost.type === 'wp_template'\n\t\t\t\t\t\t\t? getEntitiesConfig( 'postType' )\n\t\t\t\t\t\t\t: null,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ post.type, hasTemplate ]\n\t\t);\n\n\t\tconst shouldRenderTemplate = hasTemplate && mode !== 'post-only';\n\t\tconst rootLevelPost = shouldRenderTemplate ? template : post;\n\t\tconst defaultBlockContext = useMemo( () => {\n\t\t\tconst postContext = {};\n\t\t\t// If it is a template, try to inherit the post type from the name.\n\t\t\tif ( post.type === 'wp_template' ) {\n\t\t\t\tif ( post.slug === 'page' ) {\n\t\t\t\t\tpostContext.postType = 'page';\n\t\t\t\t} else if ( post.slug === 'single' ) {\n\t\t\t\t\tpostContext.postType = 'post';\n\t\t\t\t} else if ( post.slug.split( '-' )[ 0 ] === 'single' ) {\n\t\t\t\t\t// If the slug is single-{postType}, infer the post type from the name.\n\t\t\t\t\tconst postTypeNames =\n\t\t\t\t\t\tpostTypeEntities?.map( ( entity ) => entity.name ) ||\n\t\t\t\t\t\t[];\n\t\t\t\t\tconst match = post.slug.match(\n\t\t\t\t\t\t`^single-(${ postTypeNames.join( '|' ) })(?:-.+)?$`\n\t\t\t\t\t);\n\t\t\t\t\tif ( match ) {\n\t\t\t\t\t\tpostContext.postType = match[ 1 ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t! NON_CONTEXTUAL_POST_TYPES.includes( rootLevelPost.type ) ||\n\t\t\t\tshouldRenderTemplate\n\t\t\t) {\n\t\t\t\tpostContext.postId = post.id;\n\t\t\t\tpostContext.postType = post.type;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...postContext,\n\t\t\t\ttemplateSlug:\n\t\t\t\t\trootLevelPost.type === 'wp_template'\n\t\t\t\t\t\t? rootLevelPost.slug\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}, [\n\t\t\tshouldRenderTemplate,\n\t\t\tpost.id,\n\t\t\tpost.type,\n\t\t\tpost.slug,\n\t\t\trootLevelPost.type,\n\t\t\trootLevelPost.slug,\n\t\t\tpostTypeEntities,\n\t\t] );\n\t\tconst { id, type } = rootLevelPost;\n\t\tconst blockEditorSettings = useBlockEditorSettings(\n\t\t\teditorSettings,\n\t\t\ttype,\n\t\t\tid,\n\t\t\tmode\n\t\t);\n\t\tconst [ blocks, onInput, onChange ] = useBlockEditorProps(\n\t\t\tpost,\n\t\t\ttemplate,\n\t\t\tmode\n\t\t);\n\n\t\tconst {\n\t\t\tupdatePostLock,\n\t\t\tsetupEditor,\n\t\t\tupdateEditorSettings,\n\t\t\tsetCurrentTemplateId,\n\t\t\tsetEditedPost,\n\t\t\tsetRenderingMode,\n\t\t} = unlock( useDispatch( editorStore ) );\n\t\tconst { createWarningNotice } = useDispatch( noticesStore );\n\n\t\t// Ideally this should be synced on each change and not just something you do once.\n\t\tuseLayoutEffect( () => {\n\t\t\t// Assume that we don't need to initialize in the case of an error recovery.\n\t\t\tif ( recovery ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tupdatePostLock( settings.postLock );\n\t\t\tsetupEditor( post, initialEdits, settings.template );\n\t\t\tif ( settings.autosave ) {\n\t\t\t\tcreateWarningNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'There is an autosave of this post that is more recent than the version below.'\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'autosave-exists',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'View the autosave' ),\n\t\t\t\t\t\t\t\turl: settings.autosave.editLink,\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\n\t\t\t// The dependencies of the hook are omitted deliberately\n\t\t\t// We only want to run setupEditor (with initialEdits) only once per post.\n\t\t\t// A better solution in the future would be to split this effect into multiple ones.\n\t\t}, [] );\n\n\t\t// Synchronizes the active post with the state\n\t\tuseEffect( () => {\n\t\t\tsetEditedPost( post.type, post.id );\n\t\t}, [ post.type, post.id, setEditedPost ] );\n\n\t\t// Synchronize the editor settings as they change.\n\t\tuseEffect( () => {\n\t\t\tupdateEditorSettings( settings );\n\t\t}, [ settings, updateEditorSettings ] );\n\n\t\t// Synchronizes the active template with the state.\n\t\tuseEffect( () => {\n\t\t\tsetCurrentTemplateId( template?.id );\n\t\t}, [ template?.id, setCurrentTemplateId ] );\n\n\t\t// Sets the right rendering mode when loading the editor.\n\t\tuseEffect( () => {\n\t\t\tif ( defaultMode ) {\n\t\t\t\tsetRenderingMode( defaultMode );\n\t\t\t}\n\t\t}, [ defaultMode, setRenderingMode ] );\n\n\t\tuseHideBlocksFromInserter( post.type, mode );\n\n\t\t// Register the editor commands.\n\t\tuseCommands();\n\n\t\tif ( ! isReady || ! mode ) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn (\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ post.type }\n\t\t\t\t\tid={ post.id }\n\t\t\t\t>\n\t\t\t\t\t<BlockContextProvider value={ defaultBlockContext }>\n\t\t\t\t\t\t<BlockEditorProviderComponent\n\t\t\t\t\t\t\tvalue={ blocks }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tonInput={ onInput }\n\t\t\t\t\t\t\tselection={ selection }\n\t\t\t\t\t\t\tsettings={ blockEditorSettings }\n\t\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t{ ! settings.isPreviewMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<PatternsMenuItems />\n\t\t\t\t\t\t\t\t\t<TemplatePartMenuItems />\n\t\t\t\t\t\t\t\t\t<ContentOnlySettingsMenu />\n\t\t\t\t\t\t\t\t\t{ mode === 'template-locked' && (\n\t\t\t\t\t\t\t\t\t\t<DisableNonPageContentBlocks />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ type === 'wp_navigation' && (\n\t\t\t\t\t\t\t\t\t\t<NavigationBlockEditingMode />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<EditorKeyboardShortcuts />\n\t\t\t\t\t\t\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t\t\t\t\t\t\t<BlockRemovalWarnings />\n\t\t\t\t\t\t\t\t\t<StartPageOptions />\n\t\t\t\t\t\t\t\t\t<StartTemplateOptions />\n\t\t\t\t\t\t\t\t\t<PatternRenameModal />\n\t\t\t\t\t\t\t\t\t<PatternDuplicateModal />\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</BlockEditorProviderComponent>\n\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t);\n\t}\n);\n\n/**\n * This component establishes a new post editing context, and serves as the entry point for a new post editor (or post with template editor).\n *\n * It supports a large number of post types, including post, page, templates,\n * custom post types, patterns, template parts.\n *\n * All modification and changes are performed to the `@wordpress/core-data` store.\n *\n * @param {Object} props The component props.\n * @param {Object} [props.post] The post object to edit. This is required.\n * @param {Object} [props.__unstableTemplate] The template object wrapper the edited post.\n * This is optional and can only be used when the post type supports templates (like posts and pages).\n * @param {Object} [props.settings] The settings object to use for the editor.\n * This is optional and can be used to override the default settings.\n * @param {React.ReactNode} [props.children] Children elements for which the BlockEditorProvider context should apply.\n * This is optional.\n *\n * @example\n * ```jsx\n * <EditorProvider\n * post={ post }\n * settings={ settings }\n * __unstableTemplate={ template }\n * >\n * { children }\n * </EditorProvider>\n * ```\n *\n * @return {React.ReactNode} The rendered EditorProvider component.\n */\nexport function EditorProvider( props ) {\n\treturn (\n\t\t<ExperimentalEditorProvider\n\t\t\t{ ...props }\n\t\t\tBlockEditorProviderComponent={ BlockEditorProvider }\n\t\t>\n\t\t\t{ props.children }\n\t\t</ExperimentalEditorProvider>\n\t);\n}\n\nexport default EditorProvider;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAKA,IAAAI,YAAA,GAAAJ,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,qBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,uBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,4BAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,2BAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,0BAAA,GAAAf,OAAA;AACA,IAAAgB,SAAA,GAAAP,sBAAA,CAAAT,OAAA;AACA,IAAAiB,qBAAA,GAAAR,sBAAA,CAAAT,OAAA;AACA,IAAAkB,iBAAA,GAAAT,sBAAA,CAAAT,OAAA;AACA,IAAAmB,0BAAA,GAAAV,sBAAA,CAAAT,OAAA;AACA,IAAAoB,wBAAA,GAAAX,sBAAA,CAAAT,OAAA;AAC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AAAyG,OAAqB,IAAE,CAAC;UAAA,CACxB,CACF;QAAA,CAC4B;MAAC,CACV;IAAC,CACR;EAAC,CACF,CAAC;AAEnB,CACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAAEC,KAAK,EAAG;EACvC,oBACC,IAAAzG,WAAA,CAAA8F,GAAA,EAACjE,0BAA0B;IAAA,GACrB4E,KAAK;IACVrE,4BAA4B,EAAGsE,gCAAqB;IAAAvE,QAAA,EAElDsE,KAAK,CAACtE;EAAQ,CACW,CAAC;AAE/B;AAAC,IAAAwE,QAAA,GAAA7E,OAAA,CAAAyE,OAAA,GAEcC,cAAc","ignoreList":[]}
@@ -33,7 +33,7 @@ const SidebarHeader = (_, ref) => {
33
33
  return {
34
34
  documentLabel:
35
35
  // translators: Default label for the Document sidebar tab, not selected.
36
- getPostTypeLabel() || (0, _i18n._x)('Document', 'noun, sidebar')
36
+ getPostTypeLabel() || (0, _i18n._x)('Document', 'noun, panel')
37
37
  };
38
38
  }, []);
39
39
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Tabs.TabList, {
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_data","_element","_store","_lockUnlock","_constants","_jsxRuntime","Tabs","unlock","componentsPrivateApis","SidebarHeader","_","ref","documentLabel","useSelect","select","getPostTypeLabel","editorStore","_x","jsxs","TabList","children","jsx","Tab","tabId","sidebars","document","block","__","_default","exports","default","forwardRef"],"sources":["@wordpress/editor/src/components/sidebar/header.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { sidebars } from './constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SidebarHeader = ( _, ref ) => {\n\tconst { documentLabel } = useSelect( ( select ) => {\n\t\tconst { getPostTypeLabel } = select( editorStore );\n\n\t\treturn {\n\t\t\tdocumentLabel:\n\t\t\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\t\t\tgetPostTypeLabel() || _x( 'Document', 'noun, sidebar' ),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Tabs.TabList ref={ ref }>\n\t\t\t<Tabs.Tab\n\t\t\t\ttabId={ sidebars.document }\n\t\t\t\t// Used for focus management in the SettingsSidebar component.\n\t\t\t\tdata-tab-id={ sidebars.document }\n\t\t\t>\n\t\t\t\t{ documentLabel }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab\n\t\t\t\ttabId={ sidebars.block }\n\t\t\t\t// Used for focus management in the SettingsSidebar component.\n\t\t\t\tdata-tab-id={ sidebars.block }\n\t\t\t>\n\t\t\t\t{ /* translators: Text label for the Block Settings Sidebar tab. */ }\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n};\n\nexport default forwardRef( SidebarHeader );\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAAuC,IAAAO,WAAA,GAAAP,OAAA;AAbvC;AACA;AACA;;AAMA;AACA;AACA;;AAKA,MAAM;EAAEQ;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEhD,MAAMC,aAAa,GAAGA,CAAEC,CAAC,EAAEC,GAAG,KAAM;EACnC,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAClD,MAAM;MAAEC;IAAiB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IAElD,OAAO;MACNJ,aAAa;MACZ;MACAG,gBAAgB,CAAC,CAAC,IAAI,IAAAE,QAAE,EAAE,UAAU,EAAE,eAAgB;IACxD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,oBACC,IAAAZ,WAAA,CAAAa,IAAA,EAACZ,IAAI,CAACa,OAAO;IAACR,GAAG,EAAGA,GAAK;IAAAS,QAAA,gBACxB,IAAAf,WAAA,CAAAgB,GAAA,EAACf,IAAI,CAACgB,GAAG;MACRC,KAAK,EAAGC,mBAAQ,CAACC;MACjB;MAAA;MACA,eAAcD,mBAAQ,CAACC,QAAU;MAAAL,QAAA,EAE/BR;IAAa,CACN,CAAC,eACX,IAAAP,WAAA,CAAAgB,GAAA,EAACf,IAAI,CAACgB,GAAG;MACRC,KAAK,EAAGC,mBAAQ,CAACE;MACjB;MAAA;MACA,eAAcF,mBAAQ,CAACE,KAAO;MAAAN,QAAA,EAG5B,IAAAO,QAAE,EAAE,OAAQ;IAAC,CACN,CAAC;EAAA,CACE,CAAC;AAEjB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,IAAAC,mBAAU,EAAEtB,aAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_data","_element","_store","_lockUnlock","_constants","_jsxRuntime","Tabs","unlock","componentsPrivateApis","SidebarHeader","_","ref","documentLabel","useSelect","select","getPostTypeLabel","editorStore","_x","jsxs","TabList","children","jsx","Tab","tabId","sidebars","document","block","__","_default","exports","default","forwardRef"],"sources":["@wordpress/editor/src/components/sidebar/header.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { sidebars } from './constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SidebarHeader = ( _, ref ) => {\n\tconst { documentLabel } = useSelect( ( select ) => {\n\t\tconst { getPostTypeLabel } = select( editorStore );\n\n\t\treturn {\n\t\t\tdocumentLabel:\n\t\t\t\t// translators: Default label for the Document sidebar tab, not selected.\n\t\t\t\tgetPostTypeLabel() || _x( 'Document', 'noun, panel' ),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<Tabs.TabList ref={ ref }>\n\t\t\t<Tabs.Tab\n\t\t\t\ttabId={ sidebars.document }\n\t\t\t\t// Used for focus management in the SettingsSidebar component.\n\t\t\t\tdata-tab-id={ sidebars.document }\n\t\t\t>\n\t\t\t\t{ documentLabel }\n\t\t\t</Tabs.Tab>\n\t\t\t<Tabs.Tab\n\t\t\t\ttabId={ sidebars.block }\n\t\t\t\t// Used for focus management in the SettingsSidebar component.\n\t\t\t\tdata-tab-id={ sidebars.block }\n\t\t\t>\n\t\t\t\t{ /* translators: Text label for the Block Settings Sidebar tab. */ }\n\t\t\t\t{ __( 'Block' ) }\n\t\t\t</Tabs.Tab>\n\t\t</Tabs.TabList>\n\t);\n};\n\nexport default forwardRef( SidebarHeader );\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAAuC,IAAAO,WAAA,GAAAP,OAAA;AAbvC;AACA;AACA;;AAMA;AACA;AACA;;AAKA,MAAM;EAAEQ;AAAK,CAAC,GAAG,IAAAC,kBAAM,EAAEC,uBAAsB,CAAC;AAEhD,MAAMC,aAAa,GAAGA,CAAEC,CAAC,EAAEC,GAAG,KAAM;EACnC,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAClD,MAAM;MAAEC;IAAiB,CAAC,GAAGD,MAAM,CAAEE,YAAY,CAAC;IAElD,OAAO;MACNJ,aAAa;MACZ;MACAG,gBAAgB,CAAC,CAAC,IAAI,IAAAE,QAAE,EAAE,UAAU,EAAE,aAAc;IACtD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,oBACC,IAAAZ,WAAA,CAAAa,IAAA,EAACZ,IAAI,CAACa,OAAO;IAACR,GAAG,EAAGA,GAAK;IAAAS,QAAA,gBACxB,IAAAf,WAAA,CAAAgB,GAAA,EAACf,IAAI,CAACgB,GAAG;MACRC,KAAK,EAAGC,mBAAQ,CAACC;MACjB;MAAA;MACA,eAAcD,mBAAQ,CAACC,QAAU;MAAAL,QAAA,EAE/BR;IAAa,CACN,CAAC,eACX,IAAAP,WAAA,CAAAgB,GAAA,EAACf,IAAI,CAACgB,GAAG;MACRC,KAAK,EAAGC,mBAAQ,CAACE;MACjB;MAAA;MACA,eAAcF,mBAAQ,CAACE,KAAO;MAAAN,QAAA,EAG5B,IAAAO,QAAE,EAAE,OAAQ;IAAC,CACN,CAAC;EAAA,CACE,CAAC;AAEjB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,IAAAC,mBAAU,EAAEtB,aAAc,CAAC","ignoreList":[]}
@@ -90,7 +90,7 @@ const SidebarContent = ({
90
90
  className: "editor-sidebar__panel",
91
91
  headerClassName: "editor-sidebar__panel-tabs",
92
92
  title: /* translators: button label text should, if possible, be under 16 characters. */
93
- (0, _i18n._x)('Settings', 'sidebar button label'),
93
+ (0, _i18n._x)('Settings', 'panel button label'),
94
94
  toggleShortcut: keyboardShortcut,
95
95
  icon: (0, _i18n.isRTL)() ? _icons.drawerLeft : _icons.drawerRight,
96
96
  isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT,
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_icons","_keyboardShortcuts","_components","_interface","_patternOverridesPanel","_interopRequireDefault","_pluginDocumentSettingPanel","_pluginSidebar","_postSummary","_panel","_postTransformPanel","_header","_templateContentPanel","_templatePartContentPanel","_useAutoSwitchEditorSidebars","_constants","_lockUnlock","_store","_constants2","_jsxRuntime","Tabs","unlock","componentsPrivateApis","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","SidebarContent","tabName","keyboardShortcut","onActionPerformed","extraPanels","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","jsx","default","identifier","header","Provider","value","children","ref","closeLabel","__","className","headerClassName","title","_x","toggleShortcut","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","jsxs","TabPanel","tabId","sidebars","document","focusable","Slot","block","BlockInspector","Sidebar","useAutoSwitchEditorSidebars","showSummary","useSelect","shortcut","keyboardShortcutsStore","getShortcutRepresentation","sidebar","interfaceStore","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","blockEditorStore","getBlockSelectionStart","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","editorStore","getCurrentPostType","enableComplementaryArea","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove","_default","exports"],"sources":["@wordpress/editor/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __, _x } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostSummary from './post-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateContentPanel from '../template-content-panel';\nimport TemplatePartContentPanel from '../template-part-content-panel';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\tonActionPerformed,\n\textraPanels,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<PluginSidebar\n\t\t\tidentifier={ tabName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"editor-sidebar__panel\"\n\t\t\theaderClassName=\"editor-sidebar__panel-tabs\"\n\t\t\ttitle={\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t_x( 'Settings', 'sidebar button label' )\n\t\t\t}\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t<PostSummary onActionPerformed={ onActionPerformed } />\n\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t<TemplateContentPanel />\n\t\t\t\t\t<TemplatePartContentPanel />\n\t\t\t\t\t<PostTransformPanel />\n\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t{ extraPanels }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebar>\n\t);\n};\n\nconst Sidebar = ( { extraPanels, onActionPerformed } ) => {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, keyboardShortcut, showSummary } = useSelect(\n\t\t( select ) => {\n\t\t\tconst shortcut = select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' );\n\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tsidebars.block,\n\t\t\t\tsidebars.document,\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? sidebars.block\n\t\t\t\t\t: sidebars.document;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tkeyboardShortcut: shortcut,\n\t\t\t\tshowSummary: ! [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\t].includes( select( editorStore ).getCurrentPostType() ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\ttabName={ tabName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tshowSummary={ showSummary }\n\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\textraPanels={ extraPanels }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n};\n\nexport default Sidebar;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAKA,IAAAQ,sBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,2BAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,cAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,YAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,MAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,mBAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,OAAA,GAAAN,sBAAA,CAAAT,OAAA;AACA,IAAAgB,qBAAA,GAAAP,sBAAA,CAAAT,OAAA;AACA,IAAAiB,yBAAA,GAAAR,sBAAA,CAAAT,OAAA;AACA,IAAAkB,4BAAA,GAAAT,sBAAA,CAAAT,OAAA;AACA,IAAAmB,UAAA,GAAAnB,OAAA;AACA,IAAAoB,WAAA,GAAApB,OAAA;AACA,IAAAqB,MA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BE,QAAQ,GAAG,CAAC,CAAEtE,MAAM,CACnBuE,kBACD,CAAC,CAACC,sBAAsB,CAAC,CAAC,GACvBpB,mBAAQ,CAACI,KAAK,GACdJ,mBAAQ,CAACC,QAAQ;IACrB;IAEA,OAAO;MACNjD,OAAO,EAAEkE,QAAQ;MACjBjE,gBAAgB,EAAEyD,QAAQ;MAC1BF,WAAW,EAAE,CAAE,CACda,8BAAkB,EAClBC,mCAAuB,EACvBC,gCAAoB,CACpB,CAACN,QAAQ,CAAErE,MAAM,CAAE4E,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAE;IACxD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEb,gBAAe,CAAC;EAEjE,MAAMc,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BJ,uBAAuB,CAAE,MAAM,EAAEI,gBAAiB,CAAC;IACpD;EACD,CAAC,EACD,CAAEJ,uBAAuB,CAC1B,CAAC;EAED,oBACC,IAAApF,WAAA,CAAAmC,GAAA,EAAClC,IAAI;IACJwF,aAAa,EAAG/E,OAAS;IACzBgF,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG,KAAO;IAAAlD,QAAA,eAEtB,IAAAzC,WAAA,CAAAmC,GAAA,EAAC1B,cAAc;MACdC,OAAO,EAAGA,OAAS;MACnBC,gBAAgB,EAAGA,gBAAkB;MACrCuD,WAAW,EAAGA,WAAa;MAC3BtD,iBAAiB,EAAGA,iBAAmB;MACvCC,WAAW,EAAGA;IAAa,CAC3B;EAAC,CACG,CAAC;AAET,CAAC;AAAC,IAAA+E,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAEa4B,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_icons","_keyboardShortcuts","_components","_interface","_patternOverridesPanel","_interopRequireDefault","_pluginDocumentSettingPanel","_pluginSidebar","_postSummary","_panel","_postTransformPanel","_header","_templateContentPanel","_templatePartContentPanel","_useAutoSwitchEditorSidebars","_constants","_lockUnlock","_store","_constants2","_jsxRuntime","Tabs","unlock","componentsPrivateApis","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","SidebarContent","tabName","keyboardShortcut","onActionPerformed","extraPanels","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","jsx","default","identifier","header","Provider","value","children","ref","closeLabel","__","className","headerClassName","title","_x","toggleShortcut","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","jsxs","TabPanel","tabId","sidebars","document","focusable","Slot","block","BlockInspector","Sidebar","useAutoSwitchEditorSidebars","showSummary","useSelect","shortcut","keyboardShortcutsStore","getShortcutRepresentation","sidebar","interfaceStore","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","blockEditorStore","getBlockSelectionStart","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","editorStore","getCurrentPostType","enableComplementaryArea","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove","_default","exports"],"sources":["@wordpress/editor/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __, _x } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostSummary from './post-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateContentPanel from '../template-content-panel';\nimport TemplatePartContentPanel from '../template-part-content-panel';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\tonActionPerformed,\n\textraPanels,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<PluginSidebar\n\t\t\tidentifier={ tabName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"editor-sidebar__panel\"\n\t\t\theaderClassName=\"editor-sidebar__panel-tabs\"\n\t\t\ttitle={\n\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t_x( 'Settings', 'panel button label' )\n\t\t\t}\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t<PostSummary onActionPerformed={ onActionPerformed } />\n\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t<TemplateContentPanel />\n\t\t\t\t\t<TemplatePartContentPanel />\n\t\t\t\t\t<PostTransformPanel />\n\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t{ extraPanels }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebar>\n\t);\n};\n\nconst Sidebar = ( { extraPanels, onActionPerformed } ) => {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, keyboardShortcut, showSummary } = useSelect(\n\t\t( select ) => {\n\t\t\tconst shortcut = select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' );\n\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tsidebars.block,\n\t\t\t\tsidebars.document,\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? sidebars.block\n\t\t\t\t\t: sidebars.document;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tkeyboardShortcut: shortcut,\n\t\t\t\tshowSummary: ! [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\t].includes( select( editorStore ).getCurrentPostType() ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\ttabName={ tabName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tshowSummary={ showSummary }\n\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\textraPanels={ extraPanels }\n\t\t\t/>\n\t\t</Tabs>\n\t);\n};\n\nexport default Sidebar;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAOA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAKA,IAAAQ,sBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,2BAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,cAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,YAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,MAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,mBAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,OAAA,GAAAN,sBAAA,CAAAT,OAAA;AACA,IAAAgB,qBAAA,GAAAP,sBAAA,CAAAT,OAAA;AACA,IAAAiB,yBAAA,GAAAR,sBAAA,CAAAT,OAAA;AACA,IAAAkB,4BAAA,GAAAT,sBAAA,CAAAT,OAAA;AACA,IAAAmB,UAAA,GAAAnB,OAAA;AACA,IAAAoB,WAAA,GAAApB,OAAA;AACA,IAAAqB,MAAA,GAAArB,OAAA;AACA,IAAAsB,WAAA,GAAAtB,OAAA;AAI+B,IAAAuB,WAAA,GAAAvB,OAAA;AAzC/B;AACA;AACA;;AAmBA;AACA;AACA;;AAoBA,MAAM;EAAEwB;AAAK,CAAC,GAA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ACNjD,OAAO,EAAEkE,QAAQ;MACjBjE,gBAAgB,EAAEyD,QAAQ;MAC1BF,WAAW,EAAE,CAAE,CACda,8BAAkB,EAClBC,mCAAuB,EACvBC,gCAAoB,CACpB,CAACN,QAAQ,CAAErE,MAAM,CAAE4E,YAAY,CAAC,CAACC,kBAAkB,CAAC,CAAE;IACxD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEb,gBAAe,CAAC;EAEjE,MAAMc,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BJ,uBAAuB,CAAE,MAAM,EAAEI,gBAAiB,CAAC;IACpD;EACD,CAAC,EACD,CAAEJ,uBAAuB,CAC1B,CAAC;EAED,oBACC,IAAApF,WAAA,CAAAmC,GAAA,EAAClC,IAAI;IACJwF,aAAa,EAAG/E,OAAS;IACzBgF,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG,KAAO;IAAAlD,QAAA,eAEtB,IAAAzC,WAAA,CAAAmC,GAAA,EAAC1B,cAAc;MACdC,OAAO,EAAGA,OAAS;MACnBC,gBAAgB,EAAGA,gBAAkB;MACrCuD,WAAW,EAAGA,WAAa;MAC3BtD,iBAAiB,EAAGA,iBAAmB;MACvCC,WAAW,EAAGA;IAAa,CAC3B;EAAC,CACG,CAAC;AAET,CAAC;AAAC,IAAA+E,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAEa4B,OAAO","ignoreList":[]}
@@ -4,11 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = StartPageOptions;
7
+ exports.useStartPatterns = useStartPatterns;
8
+ var _components = require("@wordpress/components");
9
+ var _i18n = require("@wordpress/i18n");
7
10
  var _element = require("@wordpress/element");
11
+ var _blockEditor = require("@wordpress/block-editor");
8
12
  var _data = require("@wordpress/data");
13
+ var _coreData = require("@wordpress/core-data");
14
+ var _blocks = require("@wordpress/blocks");
9
15
  var _preferences = require("@wordpress/preferences");
10
16
  var _interface = require("@wordpress/interface");
11
17
  var _store = require("../../store");
18
+ var _jsxRuntime = require("react/jsx-runtime");
12
19
  /**
13
20
  * WordPress dependencies
14
21
  */
@@ -17,44 +24,162 @@ var _store = require("../../store");
17
24
  * Internal dependencies
18
25
  */
19
26
 
20
- function StartPageOptions() {
27
+ function useStartPatterns() {
28
+ // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
29
+ // and it has no postTypes declared and the current post type is page or if
30
+ // the current post type is part of the postTypes declared.
21
31
  const {
22
- postId,
23
- enabled
32
+ blockPatternsWithPostContentBlockType,
33
+ postType
24
34
  } = (0, _data.useSelect)(select => {
25
35
  const {
26
- getCurrentPostId,
27
- getCurrentPostType
36
+ getPatternsByBlockTypes,
37
+ getBlocksByName
38
+ } = select(_blockEditor.store);
39
+ const {
40
+ getCurrentPostType,
41
+ getRenderingMode
28
42
  } = select(_store.store);
29
- const preferencesModalActive = select(_interface.store).isModalActive('editor/preferences');
30
- const choosePatternModalEnabled = select(_preferences.store).get('core', 'enableChoosePatternModal');
43
+ const rootClientId = getRenderingMode() === 'post-only' ? '' : getBlocksByName('core/post-content')?.[0];
31
44
  return {
32
- postId: getCurrentPostId(),
33
- enabled: choosePatternModalEnabled && !preferencesModalActive && 'page' === getCurrentPostType()
45
+ blockPatternsWithPostContentBlockType: getPatternsByBlockTypes('core/post-content', rootClientId),
46
+ postType: getCurrentPostType()
47
+ };
48
+ }, []);
49
+ return (0, _element.useMemo)(() => {
50
+ if (!blockPatternsWithPostContentBlockType?.length) {
51
+ return [];
52
+ }
53
+
54
+ /*
55
+ * Filter patterns without postTypes declared if the current postType is page
56
+ * or patterns that declare the current postType in its post type array.
57
+ */
58
+ return blockPatternsWithPostContentBlockType.filter(pattern => {
59
+ return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType);
60
+ });
61
+ }, [postType, blockPatternsWithPostContentBlockType]);
62
+ }
63
+ function PatternSelection({
64
+ blockPatterns,
65
+ onChoosePattern
66
+ }) {
67
+ const {
68
+ editEntityRecord
69
+ } = (0, _data.useDispatch)(_coreData.store);
70
+ const {
71
+ postType,
72
+ postId
73
+ } = (0, _data.useSelect)(select => {
74
+ const {
75
+ getCurrentPostType,
76
+ getCurrentPostId
77
+ } = select(_store.store);
78
+ return {
79
+ postType: getCurrentPostType(),
80
+ postId: getCurrentPostId()
34
81
  };
35
82
  }, []);
83
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.__experimentalBlockPatternsList, {
84
+ blockPatterns: blockPatterns,
85
+ onClickPattern: (_pattern, blocks) => {
86
+ editEntityRecord('postType', postType, postId, {
87
+ blocks,
88
+ content: ({
89
+ blocks: blocksForSerialization = []
90
+ }) => (0, _blocks.__unstableSerializeAndClean)(blocksForSerialization)
91
+ });
92
+ onChoosePattern();
93
+ }
94
+ });
95
+ }
96
+ function StartPageOptionsModal({
97
+ onClose
98
+ }) {
99
+ const [showStartPatterns, setShowStartPatterns] = (0, _element.useState)(true);
100
+ const {
101
+ set: setPreference
102
+ } = (0, _data.useDispatch)(_preferences.store);
103
+ const startPatterns = useStartPatterns();
104
+ const hasStartPattern = startPatterns.length > 0;
105
+ if (!hasStartPattern) {
106
+ return null;
107
+ }
108
+ function handleClose() {
109
+ onClose();
110
+ setPreference('core', 'enableChoosePatternModal', showStartPatterns);
111
+ }
112
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Modal, {
113
+ className: "editor-start-page-options__modal",
114
+ title: (0, _i18n.__)('Choose a pattern'),
115
+ isFullScreen: true,
116
+ onRequestClose: handleClose,
117
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
118
+ className: "editor-start-page-options__modal-content",
119
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PatternSelection, {
120
+ blockPatterns: startPatterns,
121
+ onChoosePattern: handleClose
122
+ })
123
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Flex, {
124
+ className: "editor-start-page-options__modal__actions",
125
+ justify: "flex-end",
126
+ expanded: false,
127
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
128
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToggleControl, {
129
+ __nextHasNoMarginBottom: true,
130
+ checked: showStartPatterns,
131
+ label: (0, _i18n.__)('Show starter patterns'),
132
+ help: (0, _i18n.__)('Shows starter patterns when creating a new page.'),
133
+ onChange: newValue => {
134
+ setShowStartPatterns(newValue);
135
+ }
136
+ })
137
+ })
138
+ })]
139
+ });
140
+ }
141
+ function StartPageOptions() {
142
+ const [isOpen, setIsOpen] = (0, _element.useState)(false);
36
143
  const {
37
144
  isEditedPostDirty,
38
145
  isEditedPostEmpty
39
146
  } = (0, _data.useSelect)(_store.store);
40
147
  const {
41
- setIsInserterOpened
42
- } = (0, _data.useDispatch)(_store.store);
148
+ isModalActive
149
+ } = (0, _data.useSelect)(_interface.store);
150
+ const {
151
+ enabled,
152
+ postId
153
+ } = (0, _data.useSelect)(select => {
154
+ const {
155
+ getCurrentPostId,
156
+ getCurrentPostType
157
+ } = select(_store.store);
158
+ const choosePatternModalEnabled = select(_preferences.store).get('core', 'enableChoosePatternModal');
159
+ return {
160
+ postId: getCurrentPostId(),
161
+ enabled: choosePatternModalEnabled && 'page' === getCurrentPostType()
162
+ };
163
+ }, []);
164
+
165
+ // Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component.
166
+ // Examples: changing pages in the List View, creating a new page via Command Palette.
43
167
  (0, _element.useEffect)(() => {
44
- if (!enabled) {
45
- return;
46
- }
47
168
  const isFreshPage = !isEditedPostDirty() && isEditedPostEmpty();
48
- if (isFreshPage) {
49
- setIsInserterOpened({
50
- tab: 'patterns',
51
- category: 'core/starter-content'
52
- });
169
+ // Prevents immediately opening when features is enabled via preferences modal.
170
+ const isPreferencesModalActive = isModalActive('editor/preferences');
171
+ if (!enabled || !isFreshPage || isPreferencesModalActive) {
172
+ return;
53
173
  }
54
174
 
55
- // Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component.
56
- // Examples: changing pages in the List View, creating a new page via Command Palette.
57
- }, [postId, enabled, setIsInserterOpened, isEditedPostDirty, isEditedPostEmpty]);
58
- return null;
175
+ // Open the modal after the initial render for a new page.
176
+ setIsOpen(true);
177
+ }, [enabled, postId, isEditedPostDirty, isEditedPostEmpty, isModalActive]);
178
+ if (!isOpen) {
179
+ return null;
180
+ }
181
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(StartPageOptionsModal, {
182
+ onClose: () => setIsOpen(false)
183
+ });
59
184
  }
60
185
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_preferences","_interface","_store","StartPageOptions","postId","enabled","useSelect","select","getCurrentPostId","getCurrentPostType","editorStore","preferencesModalActive","interfaceStore","isModalActive","choosePatternModalEnabled","preferencesStore","get","isEditedPostDirty","isEditedPostEmpty","setIsInserterOpened","useDispatch","useEffect","isFreshPage","tab","category"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function StartPageOptions() {\n\tconst { postId, enabled } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst preferencesModalActive =\n\t\t\tselect( interfaceStore ).isModalActive( 'editor/preferences' );\n\t\tconst choosePatternModalEnabled = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'enableChoosePatternModal'\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tenabled:\n\t\t\t\tchoosePatternModalEnabled &&\n\t\t\t\t! preferencesModalActive &&\n\t\t\t\t'page' === getCurrentPostType(),\n\t\t};\n\t}, [] );\n\tconst { isEditedPostDirty, isEditedPostEmpty } = useSelect( editorStore );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\n\tuseEffect( () => {\n\t\tif ( ! enabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst isFreshPage = ! isEditedPostDirty() && isEditedPostEmpty();\n\t\tif ( isFreshPage ) {\n\t\t\tsetIsInserterOpened( {\n\t\t\t\ttab: 'patterns',\n\t\t\t\tcategory: 'core/starter-content',\n\t\t\t} );\n\t\t}\n\n\t\t// Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component.\n\t\t// Examples: changing pages in the List View, creating a new page via Command Palette.\n\t}, [\n\t\tpostId,\n\t\tenabled,\n\t\tsetIsInserterOpened,\n\t\tisEditedPostDirty,\n\t\tisEditedPostEmpty,\n\t] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGe,SAASK,gBAAgBA,CAAA,EAAG;EAC1C,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACpD,MAAM;MAAEC,gBAAgB;MAAEC;IAAmB,CAAC,GAAGF,MAAM,CAAEG,YAAY,CAAC;IACtE,MAAMC,sBAAsB,GAC3BJ,MAAM,CAAEK,gBAAe,CAAC,CAACC,aAAa,CAAE,oBAAqB,CAAC;IAC/D,MAAMC,yBAAyB,GAAGP,MAAM,CAAEQ,kBAAiB,CAAC,CAACC,GAAG,CAC/D,MAAM,EACN,0BACD,CAAC;IACD,OAAO;MACNZ,MAAM,EAAEI,gBAAgB,CAAC,CAAC;MAC1BH,OAAO,EACNS,yBAAyB,IACzB,CAAEH,sBAAsB,IACxB,MAAM,KAAKF,kBAAkB,CAAC;IAChC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEQ,iBAAiB;IAAEC;EAAkB,CAAC,GAAG,IAAAZ,eAAS,EAAEI,YAAY,CAAC;EACzE,MAAM;IAAES;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEV,YAAY,CAAC;EAE1D,IAAAW,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAEhB,OAAO,EAAG;MAChB;IACD;IAEA,MAAMiB,WAAW,GAAG,CAAEL,iBAAiB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;IAChE,IAAKI,WAAW,EAAG;MAClBH,mBAAmB,CAAE;QACpBI,GAAG,EAAE,UAAU;QACfC,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ;;IAEA;IACA;EACD,CAAC,EAAE,CACFpB,MAAM,EACNC,OAAO,EACPc,mBAAmB,EACnBF,iBAAiB,EACjBC,iBAAiB,CAChB,CAAC;EAEH,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {"version":3,"names":["_components","require","_i18n","_element","_blockEditor","_data","_coreData","_blocks","_preferences","_interface","_store","_jsxRuntime","useStartPatterns","blockPatternsWithPostContentBlockType","postType","useSelect","select","getPatternsByBlockTypes","getBlocksByName","blockEditorStore","getCurrentPostType","getRenderingMode","editorStore","rootClientId","useMemo","length","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","editEntityRecord","useDispatch","coreStore","postId","getCurrentPostId","jsx","__experimentalBlockPatternsList","onClickPattern","_pattern","blocks","content","blocksForSerialization","__unstableSerializeAndClean","StartPageOptionsModal","onClose","showStartPatterns","setShowStartPatterns","useState","set","setPreference","preferencesStore","startPatterns","hasStartPattern","handleClose","jsxs","Modal","className","title","__","isFullScreen","onRequestClose","children","Flex","justify","expanded","FlexItem","ToggleControl","__nextHasNoMarginBottom","checked","label","help","onChange","newValue","StartPageOptions","isOpen","setIsOpen","isEditedPostDirty","isEditedPostEmpty","isModalActive","interfaceStore","enabled","choosePatternModalEnabled","get","useEffect","isFreshPage","isPreferencesModalActive"],"sources":["@wordpress/editor/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Flex, FlexItem, Modal, ToggleControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __unstableSerializeAndClean } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes, getBlocksByName } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getCurrentPostType, getRenderingMode } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst rootClientId =\n\t\t\t\tgetRenderingMode() === 'post-only'\n\t\t\t\t\t? ''\n\t\t\t\t\t: getBlocksByName( 'core/post-content' )?.[ 0 ];\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType: getPatternsByBlockTypes(\n\t\t\t\t\t'core/post-content',\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\tif ( ! blockPatternsWithPostContentBlockType?.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t/*\n\t\t * Filter patterns without postTypes declared if the current postType is page\n\t\t * or patterns that declare the current postType in its post type array.\n\t\t */\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tpostId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\teditEntityRecord( 'postType', postType, postId, {\n\t\t\t\t\tblocks,\n\t\t\t\t\tcontent: ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t\t\t\t__unstableSerializeAndClean( blocksForSerialization ),\n\t\t\t\t} );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst [ showStartPatterns, setShowStartPatterns ] = useState( true );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\tfunction handleClose() {\n\t\tonClose();\n\t\tsetPreference( 'core', 'enableChoosePatternModal', showStartPatterns );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-page-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ handleClose }\n\t\t>\n\t\t\t<div className=\"editor-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ handleClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-page-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tchecked={ showStartPatterns }\n\t\t\t\t\t\tlabel={ __( 'Show starter patterns' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Shows starter patterns when creating a new page.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tsetShowStartPatterns( newValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isOpen, setIsOpen ] = useState( false );\n\tconst { isEditedPostDirty, isEditedPostEmpty } = useSelect( editorStore );\n\tconst { isModalActive } = useSelect( interfaceStore );\n\tconst { enabled, postId } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst choosePatternModalEnabled = select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'enableChoosePatternModal'\n\t\t);\n\t\treturn {\n\t\t\tpostId: getCurrentPostId(),\n\t\t\tenabled:\n\t\t\t\tchoosePatternModalEnabled && 'page' === getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\t// Note: The `postId` ensures the effect re-runs when pages are switched without remounting the component.\n\t// Examples: changing pages in the List View, creating a new page via Command Palette.\n\tuseEffect( () => {\n\t\tconst isFreshPage = ! isEditedPostDirty() && isEditedPostEmpty();\n\t\t// Prevents immediately opening when features is enabled via preferences modal.\n\t\tconst isPreferencesModalActive = isModalActive( 'editor/preferences' );\n\t\tif ( ! enabled || ! isFreshPage || isPreferencesModalActive ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Open the modal after the initial render for a new page.\n\t\tsetIsOpen( true );\n\t}, [\n\t\tenabled,\n\t\tpostId,\n\t\tisEditedPostDirty,\n\t\tisEditedPostEmpty,\n\t\tisModalActive,\n\t] );\n\n\tif ( ! isOpen ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsOpen( false ) } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AAAmD,IAAAU,WAAA,GAAAV,OAAA;AAnBnD;AACA;AACA;;AAcA;AACA;AACA;;AAGO,SAASW,gBAAgBA,CAAA,EAAG;EAClC;EACA;EACA;EACA,MAAM;IAAEC,qCAAqC;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EAClEC,MAAM,IAAM;IACb,MAAM;MAAEC,uBAAuB;MAAEC;IAAgB,CAAC,GACjDF,MAAM,CAAEG,kBAAiB,CAAC;IAC3B,MAAM;MAAEC,kBAAkB;MAAEC;IAAiB,CAAC,GAC7CL,MAAM,CAAEM,YAAY,CAAC;IACtB,MAAMC,YAAY,GACjBF,gBAAgB,CAAC,CAAC,KAAK,WAAW,GAC/B,EAAE,GACFH,eAAe,CAAE,mBAAoB,CAAC,GAAI,CAAC,C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EP;EACA;EACA,IAAAoE,kBAAS,EAAE,MAAM;IAChB,MAAMC,WAAW,GAAG,CAAER,iBAAiB,CAAC,CAAC,IAAIC,iBAAiB,CAAC,CAAC;IAChE;IACA,MAAMQ,wBAAwB,GAAGP,aAAa,CAAE,oBAAqB,CAAC;IACtE,IAAK,CAAEE,OAAO,IAAI,CAAEI,WAAW,IAAIC,wBAAwB,EAAG;MAC7D;IACD;;IAEA;IACAV,SAAS,CAAE,IAAK,CAAC;EAClB,CAAC,EAAE,CACFK,OAAO,EACP/C,MAAM,EACN2C,iBAAiB,EACjBC,iBAAiB,EACjBC,aAAa,CACZ,CAAC;EAEH,IAAK,CAAEJ,MAAM,EAAG;IACf,OAAO,IAAI;EACZ;EAEA,oBAAO,IAAApE,WAAA,CAAA6B,GAAA,EAACQ,qBAAqB;IAACC,OAAO,EAAGA,CAAA,KAAM+B,SAAS,CAAE,KAAM;EAAG,CAAE,CAAC;AACtE","ignoreList":[]}
@@ -87,7 +87,7 @@ var _jsxRuntime = require("react/jsx-runtime");
87
87
  },
88
88
  onCancel: () => setIsDialogOpen(false),
89
89
  size: "medium",
90
- children: (0, _i18n.__)('You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?')
90
+ children: (0, _i18n.__)('You’ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?')
91
91
  });
92
92
  }
93
93
  //# sourceMappingURL=edit-template-blocks-notification.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_coreData","_element","_i18n","_components","_store","_jsxRuntime","EditTemplateBlocksNotification","contentRef","onNavigateToEntityRecord","templateId","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","canEditTemplate","coreStore","canUser","kind","name","isDialogOpen","setIsDialogOpen","useState","useEffect","handleDblClick","event","target","classList","contains","dataset","type","defaultPrevented","preventDefault","canvas","current","addEventListener","removeEventListener","jsx","__experimentalConfirmDialog","isOpen","confirmButtonText","__","onConfirm","postId","postType","onCancel","size","children"],"sources":["@wordpress/editor/src/components/visual-editor/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page content and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\n\tconst canEditTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( ! canEditTemplate ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t! event.target.classList.contains( 'is-root-container' ) ||\n\t\t\t\tevent.target.dataset?.type === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsDialogOpen( true );\n\t\t\t}\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ contentRef, canEditTemplate ] );\n\n\tif ( ! canEditTemplate ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\tpostId: templateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAmD,IAAAM,WAAA,GAAAN,OAAA;AAZnD;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASO,8BAA8BA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACxE,MAAM;IAAEC,wBAAwB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzE,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEG,YAAY,CAAC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,MAAM,EAAGnB,YAAc;IACvBoB,iBAAiB,EAAG,IAAAC,QAAE,EAAE,eAAgB,CAAG;IAC3CC,SAAS,EAAGA,CAAA,KAAM;MACjBrB,eAAe,CAAE,KAAM,CAAC;MACxBb,wBAAwB,CAAE;QACzBmC,MAAM,EAAElC,UAAU;QAClBmC,QAAQ,EAAE;MACX,CAAE,CAAC;IACJ,CAAG;IACHC,QAAQ,EAAGA,CAAA,KAAMxB,eAAe,CAAE,KAAM,CAAG;IAC3CyB,IAAI,EAAC,QAAQ;IAAAC,QAAA,EAEX,IAAAN,QAAE,EACH,6IACD;EAAC,CACa,CAAC;AAElB","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_coreData","_element","_i18n","_components","_store","_jsxRuntime","EditTemplateBlocksNotification","contentRef","onNavigateToEntityRecord","templateId","useSelect","select","getEditorSettings","getCurrentTemplateId","editorStore","canEditTemplate","coreStore","canUser","kind","name","isDialogOpen","setIsDialogOpen","useState","useEffect","handleDblClick","event","target","classList","contains","dataset","type","defaultPrevented","preventDefault","canvas","current","addEventListener","removeEventListener","jsx","__experimentalConfirmDialog","isOpen","confirmButtonText","__","onConfirm","postId","postType","onCancel","size","children"],"sources":["@wordpress/editor/src/components/visual-editor/edit-template-blocks-notification.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component that:\n *\n * - Displays a 'Edit your template to edit this block' notification when the\n * user is focusing on editing page content and clicks on a disabled template\n * block.\n * - Displays a 'Edit your template to edit this block' dialog when the user\n * is focusing on editing page content and double clicks on a disabled\n * template block.\n *\n * @param {Object} props\n * @param {import('react').RefObject<HTMLElement>} props.contentRef Ref to the block\n * editor iframe canvas.\n */\nexport default function EditTemplateBlocksNotification( { contentRef } ) {\n\tconst { onNavigateToEntityRecord, templateId } = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getCurrentTemplateId } =\n\t\t\tselect( editorStore );\n\n\t\treturn {\n\t\t\tonNavigateToEntityRecord:\n\t\t\t\tgetEditorSettings().onNavigateToEntityRecord,\n\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t};\n\t}, [] );\n\n\tconst canEditTemplate = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_template',\n\t\t\t} ),\n\t\t[]\n\t);\n\n\tconst [ isDialogOpen, setIsDialogOpen ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst handleDblClick = ( event ) => {\n\t\t\tif ( ! canEditTemplate ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t! event.target.classList.contains( 'is-root-container' ) ||\n\t\t\t\tevent.target.dataset?.type === 'core/template-part'\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetIsDialogOpen( true );\n\t\t\t}\n\t\t};\n\n\t\tconst canvas = contentRef.current;\n\t\tcanvas?.addEventListener( 'dblclick', handleDblClick );\n\t\treturn () => {\n\t\t\tcanvas?.removeEventListener( 'dblclick', handleDblClick );\n\t\t};\n\t}, [ contentRef, canEditTemplate ] );\n\n\tif ( ! canEditTemplate ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ isDialogOpen }\n\t\t\tconfirmButtonText={ __( 'Edit template' ) }\n\t\t\tonConfirm={ () => {\n\t\t\t\tsetIsDialogOpen( false );\n\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\tpostId: templateId,\n\t\t\t\t\tpostType: 'wp_template',\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tonCancel={ () => setIsDialogOpen( false ) }\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t{ __(\n\t\t\t\t'You’ve tried to select a block that is part of a template that may be used elsewhere on your site. Would you like to edit the template?'\n\t\t\t) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAAmD,IAAAM,WAAA,GAAAN,OAAA;AAZnD;AACA;AACA;;AAOA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASO,8BAA8BA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACxE,MAAM;IAAEC,wBAAwB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzE,MAAM;MAAEC,iBAAiB;MAAEC;IAAqB,CAAC,GAChDF,MAAM,CAAEG,YAAY,CAAC;IAEtB,OAAO;MACNN,wBAAwB,EACvBI,iBAAiB,CAAC,CAAC,CAACJ,wBAAwB;MAC7CC,UAAU,EAAEI,oBAAoB,CAAC;IAClC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,eAAe,GAAG,IAAAL,eAAS,EAC9BC,MAAM,IACP,CAAC,CAAEA,MAAM,CAAEK,eAAU,CAAC,CAACC,OAAO,CAAE,QAAQ,EAAE;IACzCC,IAAI,EAAE,UAAU;IAChBC,IAAI,EAAE;EACP,CAAE,CAAC,EACJ,EACD,CAAC;EAED,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAE3D,IAAAC,kBAAS,EAAE,MAAM;IAChB,MAAMC,cAAc,GAAK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: true,
14
- removeTemplates: true
14
+ removeTemplates: true,
15
+ setDefaultRenderingMode: true
15
16
  };
16
17
  exports.saveDirtyEntities = exports.revertTemplate = exports.removeTemplates = exports.hideBlockTypes = exports.createTemplate = void 0;
17
18
  exports.setCurrentTemplateId = setCurrentTemplateId;
18
- exports.showBlockTypes = void 0;
19
+ exports.showBlockTypes = exports.setDefaultRenderingMode = void 0;
19
20
  var _coreData = require("@wordpress/core-data");
20
21
  var _i18n = require("@wordpress/i18n");
21
22
  var _notices = require("@wordpress/notices");
@@ -361,5 +362,31 @@ const removeTemplates = items => async ({
361
362
  });
362
363
  }
363
364
  };
365
+
366
+ /**
367
+ * Set the default rendering mode preference for the current post type.
368
+ *
369
+ * @param {string} mode The rendering mode to set as default.
370
+ */
364
371
  exports.removeTemplates = removeTemplates;
372
+ const setDefaultRenderingMode = mode => ({
373
+ select,
374
+ registry
375
+ }) => {
376
+ var _registry$select$get$;
377
+ const postType = select.getCurrentPostType();
378
+ const theme = registry.select(_coreData.store).getCurrentTheme()?.stylesheet;
379
+ const renderingModes = (_registry$select$get$ = registry.select(_preferences.store).get('core', 'renderingModes')?.[theme]) !== null && _registry$select$get$ !== void 0 ? _registry$select$get$ : {};
380
+ if (renderingModes[postType] === mode) {
381
+ return;
382
+ }
383
+ const newModes = {
384
+ [theme]: {
385
+ ...renderingModes,
386
+ [postType]: mode
387
+ }
388
+ };
389
+ registry.dispatch(_preferences.store).set('core', 'renderingModes', newModes);
390
+ };
391
+ exports.setDefaultRenderingMode = setDefaultRenderingMode;
365
392
  //# sourceMappingURL=private-actions.js.map