@wordpress/editor 13.24.1 → 13.25.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 (175) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/document-bar/index.js +152 -0
  3. package/build/components/document-bar/index.js.map +1 -0
  4. package/build/components/editor-canvas/edit-template-blocks-notification.js +106 -0
  5. package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
  6. package/build/components/editor-canvas/index.js +292 -0
  7. package/build/components/editor-canvas/index.js.map +1 -0
  8. package/build/components/index.js +24 -8
  9. package/build/components/index.js.map +1 -1
  10. package/build/components/post-publish-button/index.js +1 -0
  11. package/build/components/post-publish-button/index.js.map +1 -1
  12. package/build/components/post-publish-panel/maybe-upload-media.js +2 -4
  13. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  14. package/build/components/post-saved-state/index.js +1 -0
  15. package/build/components/post-saved-state/index.js.map +1 -1
  16. package/build/components/post-schedule/panel.js +1 -1
  17. package/build/components/post-schedule/panel.js.map +1 -1
  18. package/build/components/post-template/block-theme.js +99 -0
  19. package/build/components/post-template/block-theme.js.map +1 -0
  20. package/build/components/post-template/classic-theme.js +171 -0
  21. package/build/components/post-template/classic-theme.js.map +1 -0
  22. package/build/components/post-template/create-new-template-modal.js +98 -0
  23. package/build/components/post-template/create-new-template-modal.js.map +1 -0
  24. package/build/components/post-template/create-new-template.js +55 -0
  25. package/build/components/post-template/create-new-template.js.map +1 -0
  26. package/build/components/post-template/hooks.js +88 -0
  27. package/build/components/post-template/hooks.js.map +1 -0
  28. package/build/components/post-template/panel.js +71 -0
  29. package/build/components/post-template/panel.js.map +1 -0
  30. package/build/components/post-template/reset-default-template.js +48 -0
  31. package/build/components/post-template/reset-default-template.js.map +1 -0
  32. package/build/components/post-template/swap-template-button.js +84 -0
  33. package/build/components/post-template/swap-template-button.js.map +1 -0
  34. package/build/components/post-title/index.native.js +0 -1
  35. package/build/components/post-title/index.native.js.map +1 -1
  36. package/build/components/preview-dropdown/index.js +113 -0
  37. package/build/components/preview-dropdown/index.js.map +1 -0
  38. package/build/components/provider/index.js +24 -82
  39. package/build/components/provider/index.js.map +1 -1
  40. package/build/components/provider/index.native.js +17 -8
  41. package/build/components/provider/index.native.js.map +1 -1
  42. package/build/components/provider/navigation-block-editing-mode.js +40 -0
  43. package/build/components/provider/navigation-block-editing-mode.js.map +1 -0
  44. package/build/components/provider/use-block-editor-settings.js +9 -10
  45. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  46. package/build/hooks/index.js +1 -0
  47. package/build/hooks/index.js.map +1 -1
  48. package/build/hooks/pattern-partial-syncing.js +49 -0
  49. package/build/hooks/pattern-partial-syncing.js.map +1 -0
  50. package/build/private-apis.js +4 -0
  51. package/build/private-apis.js.map +1 -1
  52. package/build/store/actions.js +59 -11
  53. package/build/store/actions.js.map +1 -1
  54. package/build/store/defaults.js +2 -1
  55. package/build/store/defaults.js.map +1 -1
  56. package/build/store/index.js +3 -0
  57. package/build/store/index.js.map +1 -1
  58. package/build/store/private-actions.js +52 -0
  59. package/build/store/private-actions.js.map +1 -0
  60. package/build/store/reducer.js +32 -27
  61. package/build/store/reducer.js.map +1 -1
  62. package/build/store/reducer.native.js +0 -1
  63. package/build/store/reducer.native.js.map +1 -1
  64. package/build/store/selectors.js +31 -10
  65. package/build/store/selectors.js.map +1 -1
  66. package/build-module/components/document-bar/index.js +144 -0
  67. package/build-module/components/document-bar/index.js.map +1 -0
  68. package/build-module/components/editor-canvas/edit-template-blocks-notification.js +100 -0
  69. package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -0
  70. package/build-module/components/editor-canvas/index.js +283 -0
  71. package/build-module/components/editor-canvas/index.js.map +1 -0
  72. package/build-module/components/index.js +3 -1
  73. package/build-module/components/index.js.map +1 -1
  74. package/build-module/components/post-publish-button/index.js +1 -0
  75. package/build-module/components/post-publish-button/index.js.map +1 -1
  76. package/build-module/components/post-publish-panel/maybe-upload-media.js +2 -4
  77. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  78. package/build-module/components/post-saved-state/index.js +1 -0
  79. package/build-module/components/post-saved-state/index.js.map +1 -1
  80. package/build-module/components/post-schedule/panel.js +1 -1
  81. package/build-module/components/post-schedule/panel.js.map +1 -1
  82. package/build-module/components/post-template/block-theme.js +91 -0
  83. package/build-module/components/post-template/block-theme.js.map +1 -0
  84. package/build-module/components/post-template/classic-theme.js +162 -0
  85. package/build-module/components/post-template/classic-theme.js.map +1 -0
  86. package/build-module/components/post-template/create-new-template-modal.js +91 -0
  87. package/build-module/components/post-template/create-new-template-modal.js.map +1 -0
  88. package/build-module/components/post-template/create-new-template.js +47 -0
  89. package/build-module/components/post-template/create-new-template.js.map +1 -0
  90. package/build-module/components/post-template/hooks.js +78 -0
  91. package/build-module/components/post-template/hooks.js.map +1 -0
  92. package/build-module/components/post-template/panel.js +63 -0
  93. package/build-module/components/post-template/panel.js.map +1 -0
  94. package/build-module/components/post-template/reset-default-template.js +41 -0
  95. package/build-module/components/post-template/reset-default-template.js.map +1 -0
  96. package/build-module/components/post-template/swap-template-button.js +77 -0
  97. package/build-module/components/post-template/swap-template-button.js.map +1 -0
  98. package/build-module/components/post-title/index.native.js +0 -1
  99. package/build-module/components/post-title/index.native.js.map +1 -1
  100. package/build-module/components/preview-dropdown/index.js +105 -0
  101. package/build-module/components/preview-dropdown/index.js.map +1 -0
  102. package/build-module/components/provider/index.js +25 -83
  103. package/build-module/components/provider/index.js.map +1 -1
  104. package/build-module/components/provider/index.native.js +18 -9
  105. package/build-module/components/provider/index.native.js.map +1 -1
  106. package/build-module/components/provider/navigation-block-editing-mode.js +34 -0
  107. package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -0
  108. package/build-module/components/provider/use-block-editor-settings.js +9 -10
  109. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  110. package/build-module/hooks/index.js +1 -0
  111. package/build-module/hooks/index.js.map +1 -1
  112. package/build-module/hooks/pattern-partial-syncing.js +46 -0
  113. package/build-module/hooks/pattern-partial-syncing.js.map +1 -0
  114. package/build-module/private-apis.js +4 -0
  115. package/build-module/private-apis.js.map +1 -1
  116. package/build-module/store/actions.js +53 -9
  117. package/build-module/store/actions.js.map +1 -1
  118. package/build-module/store/defaults.js +2 -1
  119. package/build-module/store/defaults.js.map +1 -1
  120. package/build-module/store/index.js +3 -0
  121. package/build-module/store/index.js.map +1 -1
  122. package/build-module/store/private-actions.js +44 -0
  123. package/build-module/store/private-actions.js.map +1 -0
  124. package/build-module/store/reducer.js +30 -26
  125. package/build-module/store/reducer.js.map +1 -1
  126. package/build-module/store/reducer.native.js +1 -2
  127. package/build-module/store/reducer.native.js.map +1 -1
  128. package/build-module/store/selectors.js +26 -6
  129. package/build-module/store/selectors.js.map +1 -1
  130. package/build-style/style-rtl.css +182 -0
  131. package/build-style/style.css +182 -0
  132. package/package.json +32 -31
  133. package/src/components/document-bar/index.js +182 -0
  134. package/src/components/document-bar/style.scss +130 -0
  135. package/src/components/editor-canvas/edit-template-blocks-notification.js +108 -0
  136. package/src/components/editor-canvas/index.js +381 -0
  137. package/src/components/index.js +3 -1
  138. package/src/components/post-publish-button/index.js +1 -0
  139. package/src/components/post-publish-panel/maybe-upload-media.js +3 -8
  140. package/src/components/post-saved-state/index.js +1 -0
  141. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +2 -2
  142. package/src/components/post-schedule/panel.js +1 -1
  143. package/src/components/post-template/block-theme.js +109 -0
  144. package/src/components/post-template/classic-theme.js +213 -0
  145. package/src/components/post-template/create-new-template-modal.js +139 -0
  146. package/src/components/post-template/create-new-template.js +50 -0
  147. package/src/components/post-template/hooks.js +95 -0
  148. package/src/components/post-template/panel.js +67 -0
  149. package/src/components/post-template/reset-default-template.js +43 -0
  150. package/src/components/post-template/style.scss +52 -0
  151. package/src/components/post-template/swap-template-button.js +83 -0
  152. package/src/components/post-title/index.native.js +0 -1
  153. package/src/components/preview-dropdown/index.js +136 -0
  154. package/src/components/preview-dropdown/style.scss +5 -0
  155. package/src/components/provider/index.js +28 -118
  156. package/src/components/provider/index.native.js +26 -12
  157. package/src/components/provider/navigation-block-editing-mode.js +37 -0
  158. package/src/components/provider/use-block-editor-settings.js +6 -9
  159. package/src/hooks/index.js +1 -0
  160. package/src/hooks/pattern-partial-syncing.js +73 -0
  161. package/src/private-apis.js +4 -0
  162. package/src/store/actions.js +51 -9
  163. package/src/store/defaults.js +1 -0
  164. package/src/store/index.js +3 -0
  165. package/src/store/private-actions.js +61 -0
  166. package/src/store/reducer.js +32 -27
  167. package/src/store/reducer.native.js +0 -2
  168. package/src/store/selectors.js +64 -42
  169. package/src/store/test/selectors.js +88 -147
  170. package/src/style.scss +3 -0
  171. package/build/components/post-template/index.js +0 -66
  172. package/build/components/post-template/index.js.map +0 -1
  173. package/build-module/components/post-template/index.js +0 -57
  174. package/build-module/components/post-template/index.js.map +0 -1
  175. package/src/components/post-template/index.js +0 -64
@@ -1 +1 @@
1
- {"version":3,"names":["_memize","_interopRequireDefault","require","_reactNativeSafeAreaContext","_reactNativeBridge","_interopRequireWildcard","_element","_wordcount","_blocks","_data","_compose","_hooks","_blockEditor","_components","_blockLibrary","_editor","_notices","_coreData","_editPost","_index","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","NativeEditorProvider","Component","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","memize","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","locale","hostAppNamespace","updateEditorSettings","updateBlockEditorSettings","getThemeColors","subscriptionParentGetHtml","subscribeParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","subscribeParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","subscribeSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","subscribeUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","subscribeReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","subscribeMediaAppend","blockName","mediaType","newBlock","createBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","subscriptionParentUpdateEditorSettings","subscribeUpdateEditorSettings","galleryWithImageBlocks","editorSettings","window","wp","galleryBlockV2Enabled","subscriptionParentUpdateCapabilities","subscribeUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","subscribeShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","subscribeShowEditorHelp","setState","requestBlockTypeImpressions","storedImpressions","impressions","NEW_BLOCK_TYPES","storedImpressionKeys","keys","storedImpressionsCurrent","every","newKey","includes","setBlockTypeImpressions","componentWillUnmount","remove","rawStyles","rawFeatures","defaultEditorColors","defaultEditorGradients","getGlobalStyles","getColorsAndGradients","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","getUnregisteredTypeHandlerName","unsupportedBlockNames","filter","block","attributes","originalName","RNReactNativeGutenbergBridge","editorDidMount","mode","applyFilters","serialize","hasChanges","raw","content","contentInfo","characterCount","wordCount","paragraphCount","provideToNative_Html","parsed","parse","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","render","children","_react","createElement","Fragment","SafeAreaProvider","EditorHelpTopics","isVisible","onClose","close","showSupport","supportSection","ComposedNativeProvider","compose","withSelect","select","_settings$colors","_settings$gradients","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","editorStore","getEditorMode","editPostStore","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","blockEditorStore","colors","gradients","selectedBlockClientId","withDispatch","dispatch","editPost","resetEditorBlocks","updateSettings","switchEditorMode","coreStore","noticesStore","__unstableShouldCreateUndoLevel","exports","ExperimentalEditorProvider","_default"],"sources":["@wordpress/editor/src/components/provider/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getGlobalStyles, getColorsAndGradients } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics, store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n// eslint-disable-next-line no-restricted-imports\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes.\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst {\n\t\t\tcapabilities,\n\t\t\tlocale,\n\t\t\thostAppNamespace,\n\t\t\tupdateEditorSettings,\n\t\t\tupdateBlockEditorSettings,\n\t\t} = this.props;\n\n\t\tupdateEditorSettings( {\n\t\t\tcapabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t\thostAppNamespace,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst newBlock = createBlock( blockName, {\n\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t[ payload.mediaType === 'image' ? 'url' : 'src' ]:\n\t\t\t\t\t\tpayload.mediaUrl,\n\t\t\t\t} );\n\n\t\t\t\tconst indexAfterSelected = this.props.selectedBlockIndex + 1;\n\t\t\t\tconst insertionIndex =\n\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings =\n\t\t\tsubscribeUpdateEditorSettings(\n\t\t\t\t( { galleryWithImageBlocks, ...editorSettings } ) => {\n\t\t\t\t\tif ( typeof galleryWithImageBlocks === 'boolean' ) {\n\t\t\t\t\t\twindow.wp.galleryBlockV2Enabled =\n\t\t\t\t\t\t\tgalleryWithImageBlocks;\n\t\t\t\t\t}\n\t\t\t\t\tupdateEditorSettings(\n\t\t\t\t\t\tthis.getThemeColors( editorSettings )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app.\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store.\n\t\t\tupdateBlockEditorSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration.\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { rawStyles, rawFeatures } ) {\n\t\tconst { defaultEditorColors, defaultEditorGradients } = this.props;\n\n\t\tif ( rawStyles && rawFeatures ) {\n\t\t\treturn getGlobalStyles( rawStyles, rawFeatures );\n\t\t}\n\n\t\treturn getColorsAndGradients(\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\trawFeatures\n\t\t);\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly.\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// Refresh html content first.\n\t\tthis.serializeToNativeAction();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateEditorSettings( { capabilities } );\n\t}\n\n\trender() {\n\t\tconst { children, post, capabilities, settings, ...props } = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<SafeAreaProvider>{ children }</SafeAreaProvider>\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tshowSupport={ capabilities?.supportSection === true }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nconst ComposedNativeProvider = compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\n\t\tconst { getBlockIndex, getSelectedBlockClientId, getGlobalBlockCount } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst settings = getEditorSettings();\n\t\tconst defaultEditorColors = settings?.colors ?? [];\n\t\tconst defaultEditorGradients = settings?.gradients ?? [];\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks, updateEditorSettings } =\n\t\t\tdispatch( editorStore );\n\t\tconst { updateSettings, insertBlock, replaceBlock } =\n\t\t\tdispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( coreStore );\n\t\tconst { createSuccessNotice } = dispatch( noticesStore );\n\n\t\treturn {\n\t\t\tupdateBlockEditorSettings: updateSettings,\n\t\t\tupdateEditorSettings,\n\t\t\taddEntities,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n\nexport default ComposedNativeProvider;\nexport { ComposedNativeProvider as ExperimentalEditorProvider };\n"],"mappings":";;;;;;;;AAGA,IAAAA,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AAA/B,sBAAA;AAAA,IAAAgC,QAAA,GAEbhC,sBAAsB;AAAA8B,OAAA,CAAA7L,OAAA,GAAA+L,QAAA"}
1
+ {"version":3,"names":["_memize","_interopRequireDefault","require","_reactNativeSafeAreaContext","_reactNativeBridge","_interopRequireWildcard","_element","_wordcount","_blocks","_data","_compose","_hooks","_blockEditor","_components","_blockLibrary","_i18n","_editor","_notices","_coreData","_editPost","_index","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","postTypeEntities","name","baseURL","map","postTypeEntity","kind","transientEdits","blocks","selection","mergedEdits","meta","rawAttributes","NativeEditorProvider","Component","constructor","arguments","post","props","addEntities","receiveEntityRecords","type","getEditorSettings","memize","settings","capabilities","maxSize","state","isHelpVisible","componentDidMount","createErrorNotice","locale","hostAppNamespace","updateEditorSettings","updateBlockEditorSettings","getThemeColors","subscriptionParentGetHtml","subscribeParentGetHtml","serializeToNativeAction","subscriptionParentToggleHTMLMode","subscribeParentToggleHTMLMode","toggleMode","subscriptionParentSetTitle","subscribeSetTitle","payload","editTitle","title","subscriptionParentUpdateHtml","subscribeUpdateHtml","updateHtmlAction","html","subscriptionParentReplaceBlock","subscribeReplaceBlock","replaceBlockAction","clientId","subscriptionParentMediaAppend","subscribeMediaAppend","blockName","mediaType","blockType","getBlockType","newBlock","createBlock","id","mediaId","mediaUrl","indexAfterSelected","selectedBlockIndex","insertionIndex","blockCount","insertBlock","__","subscriptionParentUpdateEditorSettings","subscribeUpdateEditorSettings","galleryWithImageBlocks","editorSettings","window","wp","galleryBlockV2Enabled","subscriptionParentUpdateCapabilities","subscribeUpdateCapabilities","updateCapabilitiesAction","subscriptionParentShowNotice","subscribeShowNotice","createSuccessNotice","message","subscriptionParentShowEditorHelp","subscribeShowEditorHelp","setState","requestBlockTypeImpressions","storedImpressions","impressions","NEW_BLOCK_TYPES","storedImpressionKeys","keys","storedImpressionsCurrent","every","newKey","includes","setBlockTypeImpressions","componentWillUnmount","remove","rawStyles","rawFeatures","defaultEditorColors","defaultEditorGradients","getGlobalStyles","getColorsAndGradients","componentDidUpdate","prevProps","isReady","isUnsupportedBlock","getUnregisteredTypeHandlerName","unsupportedBlockNames","filter","block","attributes","originalName","RNReactNativeGutenbergBridge","editorDidMount","mode","applyFilters","serialize","hasChanges","raw","content","contentInfo","characterCount","wordCount","paragraphCount","provideToNative_Html","parsed","parse","resetEditorBlocksWithoutUndoLevel","blockClientId","replaceBlock","switchMode","render","children","_react","createElement","Fragment","SafeAreaProvider","EditorHelpTopics","isVisible","onClose","close","showSupport","supportSection","ComposedNativeProvider","compose","withSelect","select","_settings$colors","_settings$gradients","__unstableIsEditorReady","isEditorReady","getEditorBlocks","getEditedPostAttribute","getEditedPostContent","editorStore","getEditorMode","editPostStore","getBlockIndex","getSelectedBlockClientId","getGlobalBlockCount","blockEditorStore","colors","gradients","selectedBlockClientId","withDispatch","dispatch","editPost","resetEditorBlocks","updateSettings","switchEditorMode","coreStore","noticesStore","__unstableShouldCreateUndoLevel","exports","ExperimentalEditorProvider","_default"],"sources":["@wordpress/editor/src/components/provider/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport memize from 'memize';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\n/**\n * WordPress dependencies\n */\nimport RNReactNativeGutenbergBridge, {\n\trequestBlockTypeImpressions,\n\tsetBlockTypeImpressions,\n\tsubscribeParentGetHtml,\n\tsubscribeParentToggleHTMLMode,\n\tsubscribeUpdateHtml,\n\tsubscribeSetTitle,\n\tsubscribeMediaAppend,\n\tsubscribeReplaceBlock,\n\tsubscribeUpdateEditorSettings,\n\tsubscribeUpdateCapabilities,\n\tsubscribeShowNotice,\n\tsubscribeShowEditorHelp,\n} from '@wordpress/react-native-bridge';\nimport { Component } from '@wordpress/element';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport {\n\tparse,\n\tserialize,\n\tgetUnregisteredTypeHandlerName,\n\tgetBlockType,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { applyFilters } from '@wordpress/hooks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { getGlobalStyles, getColorsAndGradients } from '@wordpress/components';\nimport { NEW_BLOCK_TYPES } from '@wordpress/block-library';\nimport { __ } from '@wordpress/i18n';\n\nconst postTypeEntities = [\n\t{ name: 'post', baseURL: '/wp/v2/posts' },\n\t{ name: 'page', baseURL: '/wp/v2/pages' },\n\t{ name: 'attachment', baseURL: '/wp/v2/media' },\n\t{ name: 'wp_block', baseURL: '/wp/v2/blocks' },\n].map( ( postTypeEntity ) => ( {\n\tkind: 'postType',\n\t...postTypeEntity,\n\ttransientEdits: {\n\t\tblocks: true,\n\t\tselection: true,\n\t},\n\tmergedEdits: {\n\t\tmeta: true,\n\t},\n\trawAttributes: [ 'title', 'excerpt', 'content' ],\n} ) );\nimport { EditorHelpTopics, store as editorStore } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n// eslint-disable-next-line no-restricted-imports\nimport { store as editPostStore } from '@wordpress/edit-post';\n\n/**\n * Internal dependencies\n */\nimport EditorProvider from './index.js';\n\nclass NativeEditorProvider extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\t// Keep a local reference to `post` to detect changes.\n\t\tthis.post = this.props.post;\n\t\tthis.props.addEntities( postTypeEntities );\n\t\tthis.props.receiveEntityRecords(\n\t\t\t'postType',\n\t\t\tthis.post.type,\n\t\t\tthis.post\n\t\t);\n\n\t\tthis.getEditorSettings = memize(\n\t\t\t( settings, capabilities ) => ( {\n\t\t\t\t...settings,\n\t\t\t\tcapabilities,\n\t\t\t} ),\n\t\t\t{\n\t\t\t\tmaxSize: 1,\n\t\t\t}\n\t\t);\n\t\tthis.state = {\n\t\t\tisHelpVisible: false,\n\t\t};\n\t}\n\n\tcomponentDidMount() {\n\t\tconst {\n\t\t\tcapabilities,\n\t\t\tcreateErrorNotice,\n\t\t\tlocale,\n\t\t\thostAppNamespace,\n\t\t\tupdateEditorSettings,\n\t\t\tupdateBlockEditorSettings,\n\t\t} = this.props;\n\n\t\tupdateEditorSettings( {\n\t\t\tcapabilities,\n\t\t\t...this.getThemeColors( this.props ),\n\t\t\tlocale,\n\t\t\thostAppNamespace,\n\t\t} );\n\n\t\tthis.subscriptionParentGetHtml = subscribeParentGetHtml( () => {\n\t\t\tthis.serializeToNativeAction();\n\t\t} );\n\n\t\tthis.subscriptionParentToggleHTMLMode = subscribeParentToggleHTMLMode(\n\t\t\t() => {\n\t\t\t\tthis.toggleMode();\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentSetTitle = subscribeSetTitle( ( payload ) => {\n\t\t\tthis.props.editTitle( payload.title );\n\t\t} );\n\n\t\tthis.subscriptionParentUpdateHtml = subscribeUpdateHtml(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateHtmlAction( payload.html );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentReplaceBlock = subscribeReplaceBlock(\n\t\t\t( payload ) => {\n\t\t\t\tthis.replaceBlockAction( payload.html, payload.clientId );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentMediaAppend = subscribeMediaAppend(\n\t\t\t( payload ) => {\n\t\t\t\tconst blockName = 'core/' + payload.mediaType;\n\t\t\t\tconst blockType = getBlockType( blockName );\n\n\t\t\t\tif ( blockType && blockType?.name ) {\n\t\t\t\t\tconst newBlock = createBlock( blockType.name, {\n\t\t\t\t\t\tid: payload.mediaId,\n\t\t\t\t\t\t[ payload.mediaType === 'image' ? 'url' : 'src' ]:\n\t\t\t\t\t\t\tpayload.mediaUrl,\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst indexAfterSelected =\n\t\t\t\t\t\tthis.props.selectedBlockIndex + 1;\n\t\t\t\t\tconst insertionIndex =\n\t\t\t\t\t\tindexAfterSelected || this.props.blockCount;\n\n\t\t\t\t\tthis.props.insertBlock( newBlock, insertionIndex );\n\t\t\t\t} else {\n\t\t\t\t\tcreateErrorNotice(\n\t\t\t\t\t\t__( 'File type not supported as a media file.' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentUpdateEditorSettings =\n\t\t\tsubscribeUpdateEditorSettings(\n\t\t\t\t( { galleryWithImageBlocks, ...editorSettings } ) => {\n\t\t\t\t\tif ( typeof galleryWithImageBlocks === 'boolean' ) {\n\t\t\t\t\t\twindow.wp.galleryBlockV2Enabled =\n\t\t\t\t\t\t\tgalleryWithImageBlocks;\n\t\t\t\t\t}\n\t\t\t\t\tupdateEditorSettings(\n\t\t\t\t\t\tthis.getThemeColors( editorSettings )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t);\n\n\t\tthis.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(\n\t\t\t( payload ) => {\n\t\t\t\tthis.updateCapabilitiesAction( payload );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowNotice = subscribeShowNotice(\n\t\t\t( payload ) => {\n\t\t\t\tthis.props.createSuccessNotice( payload.message );\n\t\t\t}\n\t\t);\n\n\t\tthis.subscriptionParentShowEditorHelp = subscribeShowEditorHelp( () => {\n\t\t\tthis.setState( { isHelpVisible: true } );\n\t\t} );\n\n\t\t// Request current block impressions from native app.\n\t\trequestBlockTypeImpressions( ( storedImpressions ) => {\n\t\t\tconst impressions = { ...NEW_BLOCK_TYPES, ...storedImpressions };\n\n\t\t\t// Persist impressions to JavaScript store.\n\t\t\tupdateBlockEditorSettings( { impressions } );\n\n\t\t\t// Persist impressions to native store if they do not include latest\n\t\t\t// `NEW_BLOCK_TYPES` configuration.\n\t\t\tconst storedImpressionKeys = Object.keys( storedImpressions );\n\t\t\tconst storedImpressionsCurrent = Object.keys(\n\t\t\t\tNEW_BLOCK_TYPES\n\t\t\t).every( ( newKey ) => storedImpressionKeys.includes( newKey ) );\n\t\t\tif ( ! storedImpressionsCurrent ) {\n\t\t\t\tsetBlockTypeImpressions( impressions );\n\t\t\t}\n\t\t} );\n\t}\n\n\tcomponentWillUnmount() {\n\t\tif ( this.subscriptionParentGetHtml ) {\n\t\t\tthis.subscriptionParentGetHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentToggleHTMLMode ) {\n\t\t\tthis.subscriptionParentToggleHTMLMode.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentSetTitle ) {\n\t\t\tthis.subscriptionParentSetTitle.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateHtml ) {\n\t\t\tthis.subscriptionParentUpdateHtml.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentReplaceBlock ) {\n\t\t\tthis.subscriptionParentReplaceBlock.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentMediaAppend ) {\n\t\t\tthis.subscriptionParentMediaAppend.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateEditorSettings ) {\n\t\t\tthis.subscriptionParentUpdateEditorSettings.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentUpdateCapabilities ) {\n\t\t\tthis.subscriptionParentUpdateCapabilities.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowNotice ) {\n\t\t\tthis.subscriptionParentShowNotice.remove();\n\t\t}\n\n\t\tif ( this.subscriptionParentShowEditorHelp ) {\n\t\t\tthis.subscriptionParentShowEditorHelp.remove();\n\t\t}\n\t}\n\n\tgetThemeColors( { rawStyles, rawFeatures } ) {\n\t\tconst { defaultEditorColors, defaultEditorGradients } = this.props;\n\n\t\tif ( rawStyles && rawFeatures ) {\n\t\t\treturn getGlobalStyles( rawStyles, rawFeatures );\n\t\t}\n\n\t\treturn getColorsAndGradients(\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\trawFeatures\n\t\t);\n\t}\n\n\tcomponentDidUpdate( prevProps ) {\n\t\tif ( ! prevProps.isReady && this.props.isReady ) {\n\t\t\tconst blocks = this.props.blocks;\n\t\t\tconst isUnsupportedBlock = ( { name } ) =>\n\t\t\t\tname === getUnregisteredTypeHandlerName();\n\t\t\tconst unsupportedBlockNames = blocks\n\t\t\t\t.filter( isUnsupportedBlock )\n\t\t\t\t.map( ( block ) => block.attributes.originalName );\n\t\t\tRNReactNativeGutenbergBridge.editorDidMount(\n\t\t\t\tunsupportedBlockNames\n\t\t\t);\n\t\t}\n\t}\n\n\tserializeToNativeAction() {\n\t\tconst title = this.props.title;\n\t\tlet html;\n\n\t\tif ( this.props.mode === 'text' ) {\n\t\t\t// The HTMLTextInput component does not update the store when user is doing changes\n\t\t\t// Let's request the HTML from the component's state directly.\n\t\t\thtml = applyFilters( 'native.persist-html' );\n\t\t} else {\n\t\t\thtml = serialize( this.props.blocks );\n\t\t}\n\n\t\tconst hasChanges =\n\t\t\ttitle !== this.post.title.raw || html !== this.post.content.raw;\n\n\t\t// Variable to store the content structure metrics.\n\t\tconst contentInfo = {};\n\t\tcontentInfo.characterCount = wordCount(\n\t\t\thtml,\n\t\t\t'characters_including_spaces'\n\t\t);\n\t\tcontentInfo.wordCount = wordCount( html, 'words' );\n\t\tcontentInfo.paragraphCount = this.props.paragraphCount;\n\t\tcontentInfo.blockCount = this.props.blockCount;\n\t\tRNReactNativeGutenbergBridge.provideToNative_Html(\n\t\t\thtml,\n\t\t\ttitle,\n\t\t\thasChanges,\n\t\t\tcontentInfo\n\t\t);\n\n\t\tif ( hasChanges ) {\n\t\t\tthis.post.title.raw = title;\n\t\t\tthis.post.content.raw = html;\n\t\t}\n\t}\n\n\tupdateHtmlAction( html ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.resetEditorBlocksWithoutUndoLevel( parsed );\n\t}\n\n\treplaceBlockAction( html, blockClientId ) {\n\t\tconst parsed = parse( html );\n\t\tthis.props.replaceBlock( blockClientId, parsed );\n\t}\n\n\ttoggleMode() {\n\t\tconst { mode, switchMode } = this.props;\n\t\t// Refresh html content first.\n\t\tthis.serializeToNativeAction();\n\t\tswitchMode( mode === 'visual' ? 'text' : 'visual' );\n\t}\n\n\tupdateCapabilitiesAction( capabilities ) {\n\t\tthis.props.updateEditorSettings( { capabilities } );\n\t}\n\n\trender() {\n\t\tconst { children, post, capabilities, settings, ...props } = this.props;\n\t\tconst editorSettings = this.getEditorSettings( settings, capabilities );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorProvider\n\t\t\t\t\tpost={ this.post }\n\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t<SafeAreaProvider>{ children }</SafeAreaProvider>\n\t\t\t\t</EditorProvider>\n\t\t\t\t<EditorHelpTopics\n\t\t\t\t\tisVisible={ this.state.isHelpVisible }\n\t\t\t\t\tonClose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tclose={ () => this.setState( { isHelpVisible: false } ) }\n\t\t\t\t\tshowSupport={ capabilities?.supportSection === true }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n}\n\nconst ComposedNativeProvider = compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\t__unstableIsEditorReady: isEditorReady,\n\t\t\tgetEditorBlocks,\n\t\t\tgetEditedPostAttribute,\n\t\t\tgetEditedPostContent,\n\t\t\tgetEditorSettings,\n\t\t} = select( editorStore );\n\t\tconst { getEditorMode } = select( editPostStore );\n\n\t\tconst { getBlockIndex, getSelectedBlockClientId, getGlobalBlockCount } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst settings = getEditorSettings();\n\t\tconst defaultEditorColors = settings?.colors ?? [];\n\t\tconst defaultEditorGradients = settings?.gradients ?? [];\n\n\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\treturn {\n\t\t\tmode: getEditorMode(),\n\t\t\tisReady: isEditorReady(),\n\t\t\tblocks: getEditorBlocks(),\n\t\t\ttitle: getEditedPostAttribute( 'title' ),\n\t\t\tgetEditedPostContent,\n\t\t\tdefaultEditorColors,\n\t\t\tdefaultEditorGradients,\n\t\t\tselectedBlockIndex: getBlockIndex( selectedBlockClientId ),\n\t\t\tblockCount: getGlobalBlockCount(),\n\t\t\tparagraphCount: getGlobalBlockCount( 'core/paragraph' ),\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { editPost, resetEditorBlocks, updateEditorSettings } =\n\t\t\tdispatch( editorStore );\n\t\tconst { updateSettings, insertBlock, replaceBlock } =\n\t\t\tdispatch( blockEditorStore );\n\t\tconst { switchEditorMode } = dispatch( editPostStore );\n\t\tconst { addEntities, receiveEntityRecords } = dispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tdispatch( noticesStore );\n\n\t\treturn {\n\t\t\tupdateBlockEditorSettings: updateSettings,\n\t\t\tupdateEditorSettings,\n\t\t\taddEntities,\n\t\t\tinsertBlock,\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditTitle( title ) {\n\t\t\t\teditPost( { title } );\n\t\t\t},\n\t\t\treceiveEntityRecords,\n\t\t\tresetEditorBlocksWithoutUndoLevel( blocks ) {\n\t\t\t\tresetEditorBlocks( blocks, {\n\t\t\t\t\t__unstableShouldCreateUndoLevel: false,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tswitchMode( mode ) {\n\t\t\t\tswitchEditorMode( mode );\n\t\t\t},\n\t\t\treplaceBlock,\n\t\t};\n\t} ),\n] )( NativeEditorProvider );\n\nexport default ComposedNativeProvider;\nexport { ComposedNativeProvider as ExperimentalEditorProvider };\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAD,OAAA;AAKA,IAAAE,kBAAA,GAAAC,uBAAA,CAAAH,OAAA;AAcA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,G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EvD,IAAK,CAAC;IACzB,CAAC;IACDe;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAE1H,oBAAqB,CAAC;AAACsK,OAAA,CAAAC,0BAAA,GAAA/B,sBAAA;AAAA,IAAAgC,QAAA,GAEbhC,sBAAsB;AAAA8B,OAAA,CAAAjM,OAAA,GAAAmM,QAAA"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = NavigationBlockEditingMode;
7
+ var _element = require("@wordpress/element");
8
+ var _data = require("@wordpress/data");
9
+ var _blockEditor = require("@wordpress/block-editor");
10
+ /**
11
+ * WordPress dependencies
12
+ */
13
+
14
+ /**
15
+ * For the Navigation block editor, we need to force the block editor to contentOnly for that block.
16
+ *
17
+ * Set block editing mode to contentOnly when entering Navigation focus mode.
18
+ * this ensures that non-content controls on the block will be hidden and thus
19
+ * the user can focus on editing the Navigation Menu content only.
20
+ */
21
+
22
+ function NavigationBlockEditingMode() {
23
+ // In the navigation block editor,
24
+ // the navigation block is the only root block.
25
+ const blockClientId = (0, _data.useSelect)(select => select(_blockEditor.store).getBlockOrder()?.[0], []);
26
+ const {
27
+ setBlockEditingMode,
28
+ unsetBlockEditingMode
29
+ } = (0, _data.useDispatch)(_blockEditor.store);
30
+ (0, _element.useEffect)(() => {
31
+ if (!blockClientId) {
32
+ return;
33
+ }
34
+ setBlockEditingMode(blockClientId, 'contentOnly');
35
+ return () => {
36
+ unsetBlockEditingMode(blockClientId);
37
+ };
38
+ }, [blockClientId, unsetBlockEditingMode, setBlockEditingMode]);
39
+ }
40
+ //# sourceMappingURL=navigation-block-editing-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_data","_blockEditor","NavigationBlockEditingMode","blockClientId","useSelect","select","blockEditorStore","getBlockOrder","setBlockEditingMode","unsetBlockEditingMode","useDispatch","useEffect"],"sources":["@wordpress/editor/src/components/provider/navigation-block-editing-mode.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * For the Navigation block editor, we need to force the block editor to contentOnly for that block.\n *\n * Set block editing mode to contentOnly when entering Navigation focus mode.\n * this ensures that non-content controls on the block will be hidden and thus\n * the user can focus on editing the Navigation Menu content only.\n */\n\nexport default function NavigationBlockEditingMode() {\n\t// In the navigation block editor,\n\t// the navigation block is the only root block.\n\tconst blockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockOrder()?.[ 0 ],\n\t\t[]\n\t);\n\tconst { setBlockEditingMode, unsetBlockEditingMode } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( ! blockClientId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetBlockEditingMode( blockClientId, 'contentOnly' );\n\n\t\treturn () => {\n\t\t\tunsetBlockEditingMode( blockClientId );\n\t\t};\n\t}, [ blockClientId, unsetBlockEditingMode, setBlockEditingMode ] );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEe,SAASG,0BAA0BA,CAAA,EAAG;EACpD;EACA;EACA,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAC5BC,MAAM,IAAMA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,aAAa,CAAC,CAAC,GAAI,CAAC,CAAE,EAC/D,EACD,CAAC;EACD,MAAM;IAAEC,mBAAmB;IAAEC;EAAsB,CAAC,GACnD,IAAAC,iBAAW,EAAEJ,kBAAiB,CAAC;EAEhC,IAAAK,kBAAS,EAAE,MAAM;IAChB,IAAK,CAAER,aAAa,EAAG;MACtB;IACD;IAEAK,mBAAmB,CAAEL,aAAa,EAAE,aAAc,CAAC;IAEnD,OAAO,MAAM;MACZM,qBAAqB,CAAEN,aAAc,CAAC;IACvC,CAAC;EACF,CAAC,EAAE,CAAEA,aAAa,EAAEM,qBAAqB,EAAED,mBAAmB,CAAG,CAAC;AACnE"}
@@ -41,7 +41,9 @@ function useBlockEditorSettings(settings, postType, postId) {
41
41
  userCanCreatePages,
42
42
  pageOnFront,
43
43
  pageForPosts,
44
- userPatternCategories
44
+ userPatternCategories,
45
+ restBlockPatterns,
46
+ restBlockPatternCategories
45
47
  } = (0, _data.useSelect)(select => {
46
48
  var _canUser;
47
49
  const isWeb = _element.Platform.OS === 'web';
@@ -50,7 +52,9 @@ function useBlockEditorSettings(settings, postType, postId) {
50
52
  getRawEntityRecord,
51
53
  getEntityRecord,
52
54
  getUserPatternCategories,
53
- getEntityRecords
55
+ getEntityRecords,
56
+ getBlockPatterns,
57
+ getBlockPatternCategories
54
58
  } = select(_coreData.store);
55
59
  const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
56
60
  return {
@@ -63,7 +67,9 @@ function useBlockEditorSettings(settings, postType, postId) {
63
67
  userCanCreatePages: canUser('create', 'pages'),
64
68
  pageOnFront: siteSettings?.page_on_front,
65
69
  pageForPosts: siteSettings?.page_for_posts,
66
- userPatternCategories: getUserPatternCategories()
70
+ userPatternCategories: getUserPatternCategories(),
71
+ restBlockPatterns: getBlockPatterns(),
72
+ restBlockPatternCategories: getBlockPatternCategories()
67
73
  };
68
74
  }, [postType, postId]);
69
75
  const settingsBlockPatterns = (_settings$__experimen = settings.__experimentalAdditionalBlockPatterns) !== null && _settings$__experimen !== void 0 ? _settings$__experimen :
@@ -73,13 +79,6 @@ function useBlockEditorSettings(settings, postType, postId) {
73
79
  // WP 6.0
74
80
  settings.__experimentalBlockPatternCategories; // WP 5.9
75
81
 
76
- const {
77
- restBlockPatterns,
78
- restBlockPatternCategories
79
- } = (0, _data.useSelect)(select => ({
80
- restBlockPatterns: select(_coreData.store).getBlockPatterns(),
81
- restBlockPatternCategories: select(_coreData.store).getBlockPatternCategories()
82
- }), []);
83
82
  const blockPatterns = (0, _element.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(({
84
83
  postTypes
85
84
  }) => {
@@ -1 +1 @@
1
- {"version":3,"names":["_element","require","_data","_coreData","_i18n","_mediaCategories","_interopRequireDefault","_utils","_store","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","postType","postId","_settings$__experimen","_settings$__experimen2","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","useSelect","select","_canUser","isWeb","Platform","OS","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getEntityRecords","coreStore","siteSettings","undefined","_links","hasOwnProperty","per_page","page_on_front","page_for_posts","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","useMemo","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","useDispatch","editorStore","saveEntityRecord","createPageEntity","useCallback","options","Promise","reject","message","__","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalUserPatternCategories","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","inserterMediaCategories","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","_default","exports","default"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__experimentalSetIsInserterOpened',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'focusMode',\n\t'distractionFree',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'hasFixedToolbar',\n\t'hasInlineToolbar',\n\t'isDistractionFree',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'keepCaretInsideBlock',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n\t'__experimentalArchiveTitleTypeLabel',\n\t'__experimentalArchiveTitleNameLabel',\n];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst isWeb = Platform.OS === 'web';\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetEntityRecords,\n\t\t\t} = select( coreStore );\n\n\t\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\treusableBlocks: isWeb\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tuserPatternCategories,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\tcreatePageEntity,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\tpostType,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,gBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,MAAMQ,iBAAiB,GAAG,EAAE;AAE5B,MAAMC,qBAAqB,GAAG,CAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,wBAAwB,EACxB,sCAAsC,EACtC,wCAAwC,EACxC,mCAAmC,EACnC,kCAAkC,EAClC,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,2BAA2B,EAC3B,wB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B,EACtB/C,oBAAoB,EACpBgD,IAAI,EACJI,gBAAgB,EAChBnD,kBAAkB,EAClBC,WAAW,EACXC,YAAY,EACZT,QAAQ,CAEV,CAAC;AACF;AAAC,IAAAuF,QAAA,GAEczF,sBAAsB;AAAA0F,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
1
+ {"version":3,"names":["_element","require","_data","_coreData","_i18n","_mediaCategories","_interopRequireDefault","_utils","_store","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","postType","postId","_settings$__experimen","_settings$__experimen2","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","pageForPosts","userPatternCategories","restBlockPatterns","restBlockPatternCategories","useSelect","select","_canUser","isWeb","Platform","OS","canUser","getRawEntityRecord","getEntityRecord","getUserPatternCategories","getEntityRecords","getBlockPatterns","getBlockPatternCategories","coreStore","siteSettings","undefined","_links","hasOwnProperty","per_page","page_on_front","page_for_posts","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","blockPatterns","useMemo","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","useDispatch","editorStore","saveEntityRecord","createPageEntity","useCallback","options","Promise","reject","message","__","Object","fromEntries","entries","key","mediaUpload","__experimentalReusableBlocks","__experimentalUserPatternCategories","__experimentalFetchLinkSuggestions","search","searchOptions","fetchLinkSuggestions","inserterMediaCategories","__experimentalFetchRichUrlData","fetchUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot","templateLock","template","_default","exports","default"],"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__experimentalSetIsInserterOpened',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'focusMode',\n\t'distractionFree',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'hasFixedToolbar',\n\t'hasInlineToolbar',\n\t'isDistractionFree',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'keepCaretInsideBlock',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postContentAttributes',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n\t'__unstableIsBlockBasedTheme',\n\t'__experimentalArchiveTitleTypeLabel',\n\t'__experimentalArchiveTitleNameLabel',\n];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {string} postType Editor root level post type.\n * @param {string} postId Editor root level post ID.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, postType, postId ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpageForPosts,\n\t\tuserPatternCategories,\n\t\trestBlockPatterns,\n\t\trestBlockPatternCategories,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst isWeb = Platform.OS === 'web';\n\t\t\tconst {\n\t\t\t\tcanUser,\n\t\t\t\tgetRawEntityRecord,\n\t\t\t\tgetEntityRecord,\n\t\t\t\tgetUserPatternCategories,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetBlockPatterns,\n\t\t\t\tgetBlockPatternCategories,\n\t\t\t} = select( coreStore );\n\n\t\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\n\t\t\treturn {\n\t\t\t\tcanUseUnfilteredHTML: getRawEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t)?._links?.hasOwnProperty( 'wp:action-unfiltered-html' ),\n\t\t\t\treusableBlocks: isWeb\n\t\t\t\t\t? getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t } )\n\t\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\t\tpageForPosts: siteSettings?.page_for_posts,\n\t\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t\t\trestBlockPatterns: getBlockPatterns(),\n\t\t\t\trestBlockPatternCategories: getBlockPatternCategories(),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = useCallback(\n\t\t( options ) => {\n\t\t\tif ( ! userCanCreatePages ) {\n\t\t\t\treturn Promise.reject( {\n\t\t\t\t\tmessage: __(\n\t\t\t\t\t\t'You do not have permission to create Pages.'\n\t\t\t\t\t),\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t\t},\n\t\t[ saveEntityRecord, userCanCreatePages ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalUserPatternCategories: userPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t// Todo: This only checks the top level post, not the post within a template or any other entity that can be edited.\n\t\t\t// This might be better as a generic \"canUser\" selector.\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t//Todo: this is only needed for native and should probably be removed.\n\t\t\t__experimentalUndo: undo,\n\t\t\t// Check whether we want all site editor frames to have outlines\n\t\t\t// including the navigation / pattern / parts editors.\n\t\t\toutlineMode: postType === 'wp_template',\n\t\t\t// Check these two properties: they were not present in the site editor.\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\t__experimentalPreferPatternsOnRoot: postType === 'wp_template',\n\t\t\ttemplateLock:\n\t\t\t\tpostType === 'wp_navigation' ? 'insert' : settings.templateLock,\n\t\t\ttemplate:\n\t\t\t\tpostType === 'wp_navigation'\n\t\t\t\t\t? [ [ 'core/navigation', {}, [] ] ]\n\t\t\t\t\t: settings.template,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tuserPatternCategories,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\tcreatePageEntity,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\tpageForPosts,\n\t\t\tpostType,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAKA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,gBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAjBA;AACA;AACA;;AAUA;AACA;AACA;;AAKA,MAAMQ,iBAAiB,GAAG,EAAE;AAE5B,MAAMC,qBAAqB,GAAG,CAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,wBAAwB,EACxB,sCAAsC,EACtC,wCAAwC,EACxC,mCAAmC,EACnC,kCAAkC,EAClC,WAAW,EACX,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,QAAQ,EACR,qBAAqB,EACrB,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,qBAAqB,EACrB,wBAA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GAEczF,sBAAsB;AAAA0F,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -2,4 +2,5 @@
2
2
 
3
3
  require("./custom-sources-backwards-compatibility");
4
4
  require("./default-autocompleters");
5
+ require("./pattern-partial-syncing");
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["require"],"sources":["@wordpress/editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './custom-sources-backwards-compatibility';\nimport './default-autocompleters';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA"}
1
+ {"version":3,"names":["require"],"sources":["@wordpress/editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './custom-sources-backwards-compatibility';\nimport './default-autocompleters';\nimport './pattern-partial-syncing';\n"],"mappings":";;AAGAA,OAAA;AACAA,OAAA;AACAA,OAAA"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _react = require("react");
4
+ var _hooks = require("@wordpress/hooks");
5
+ var _patterns = require("@wordpress/patterns");
6
+ var _compose = require("@wordpress/compose");
7
+ var _blockEditor = require("@wordpress/block-editor");
8
+ var _blocks = require("@wordpress/blocks");
9
+ var _data = require("@wordpress/data");
10
+ var _store = require("../store");
11
+ var _lockUnlock = require("../lock-unlock");
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ const {
21
+ PartialSyncingControls,
22
+ PATTERN_TYPES,
23
+ PARTIAL_SYNCING_SUPPORTED_BLOCKS
24
+ } = (0, _lockUnlock.unlock)(_patterns.privateApis);
25
+
26
+ /**
27
+ * Override the default edit UI to include a new block inspector control for
28
+ * assigning a partial syncing controls to supported blocks in the pattern editor.
29
+ * Currently, only the `core/paragraph` block is supported.
30
+ *
31
+ * @param {Component} BlockEdit Original component.
32
+ *
33
+ * @return {Component} Wrapped component.
34
+ */
35
+ const withPartialSyncingControls = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
36
+ const blockEditingMode = (0, _blockEditor.useBlockEditingMode)();
37
+ const hasCustomFieldsSupport = (0, _blocks.hasBlockSupport)(props.name, '__experimentalConnections', false);
38
+ const isEditingPattern = (0, _data.useSelect)(select => select(_store.store).getCurrentPostType() === PATTERN_TYPES.user, []);
39
+ const shouldShowPartialSyncingControls = hasCustomFieldsSupport && props.isSelected && isEditingPattern && blockEditingMode === 'default' && Object.keys(PARTIAL_SYNCING_SUPPORTED_BLOCKS).includes(props.name);
40
+ return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(BlockEdit, {
41
+ ...props
42
+ }), shouldShowPartialSyncingControls && (0, _react.createElement)(PartialSyncingControls, {
43
+ ...props
44
+ }));
45
+ });
46
+ if (window.__experimentalPatternPartialSyncing) {
47
+ (0, _hooks.addFilter)('editor.BlockEdit', 'core/editor/with-partial-syncing-controls', withPartialSyncingControls);
48
+ }
49
+ //# sourceMappingURL=pattern-partial-syncing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_hooks","require","_patterns","_compose","_blockEditor","_blocks","_data","_store","_lockUnlock","PartialSyncingControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","unlock","patternsPrivateApis","withPartialSyncingControls","createHigherOrderComponent","BlockEdit","props","blockEditingMode","useBlockEditingMode","hasCustomFieldsSupport","hasBlockSupport","name","isEditingPattern","useSelect","select","editorStore","getCurrentPostType","user","shouldShowPartialSyncingControls","isSelected","Object","keys","includes","_react","createElement","Fragment","window","__experimentalPatternPartialSyncing","addFilter"],"sources":["@wordpress/editor/src/hooks/pattern-partial-syncing.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\nconst {\n\tPartialSyncingControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPartialSyncingControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst blockEditingMode = useBlockEditingMode();\n\t\tconst hasCustomFieldsSupport = hasBlockSupport(\n\t\t\tprops.name,\n\t\t\t'__experimentalConnections',\n\t\t\tfalse\n\t\t);\n\t\tconst isEditingPattern = useSelect(\n\t\t\t( select ) =>\n\t\t\t\tselect( editorStore ).getCurrentPostType() ===\n\t\t\t\tPATTERN_TYPES.user,\n\t\t\t[]\n\t\t);\n\n\t\tconst shouldShowPartialSyncingControls =\n\t\t\thasCustomFieldsSupport &&\n\t\t\tprops.isSelected &&\n\t\t\tisEditingPattern &&\n\t\t\tblockEditingMode === 'default' &&\n\t\t\tObject.keys( PARTIAL_SYNCING_SUPPORTED_BLOCKS ).includes(\n\t\t\t\tprops.name\n\t\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ shouldShowPartialSyncingControls && (\n\t\t\t\t\t<PartialSyncingControls { ...props } />\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n);\n\nif ( window.__experimentalPatternPartialSyncing ) {\n\taddFilter(\n\t\t'editor.BlockEdit',\n\t\t'core/editor/with-partial-syncing-controls',\n\t\twithPartialSyncingControls\n\t);\n}\n"],"mappings":";;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA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AS,EACR,kBAAkB,EAClB,2CAA2C,EAC3CzB,0BACD,CAAC;AACF"}
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.privateApis = void 0;
8
+ var _editorCanvas = _interopRequireDefault(require("./components/editor-canvas"));
8
9
  var _provider = require("./components/provider");
9
10
  var _lockUnlock = require("./lock-unlock");
10
11
  var _entitiesSavedStates = require("./components/entities-saved-states");
11
12
  var _useBlockEditorSettings = _interopRequireDefault(require("./components/provider/use-block-editor-settings"));
12
13
  var _postPanelRow = _interopRequireDefault(require("./components/post-panel-row"));
14
+ var _previewDropdown = _interopRequireDefault(require("./components/preview-dropdown"));
13
15
  /**
14
16
  * Internal dependencies
15
17
  */
@@ -17,9 +19,11 @@ var _postPanelRow = _interopRequireDefault(require("./components/post-panel-row"
17
19
  const privateApis = {};
18
20
  exports.privateApis = privateApis;
19
21
  (0, _lockUnlock.lock)(privateApis, {
22
+ EditorCanvas: _editorCanvas.default,
20
23
  ExperimentalEditorProvider: _provider.ExperimentalEditorProvider,
21
24
  EntitiesSavedStatesExtensible: _entitiesSavedStates.EntitiesSavedStatesExtensible,
22
25
  PostPanelRow: _postPanelRow.default,
26
+ PreviewDropdown: _previewDropdown.default,
23
27
  // This is a temporary private API while we're updating the site editor to use EditorProvider.
24
28
  useBlockEditorSettings: _useBlockEditorSettings.default
25
29
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_provider","require","_lockUnlock","_entitiesSavedStates","_useBlockEditorSettings","_interopRequireDefault","_postPanelRow","privateApis","exports","lock","ExperimentalEditorProvider","EntitiesSavedStatesExtensible","PostPanelRow","useBlockEditorSettings"],"sources":["@wordpress/editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\nimport useBlockEditorSettings from './components/provider/use-block-editor-settings';\nimport PostPanelRow from './components/post-panel-row';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tExperimentalEditorProvider,\n\tEntitiesSavedStatesExtensible,\n\tPostPanelRow,\n\n\t// This is a temporary private API while we're updating the site editor to use EditorProvider.\n\tuseBlockEditorSettings,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAPA;AACA;AACA;;AAOO,MAAMM,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,0BAA0B,EAA1BA,oCAA0B;EAC1BC,6BAA6B,EAA7BA,kDAA6B;EAC7BC,YAAY,EAAZA,qBAAY;EAEZ;EACAC,sBAAsB,EAAtBA;AACD,CAAE,CAAC"}
1
+ {"version":3,"names":["_editorCanvas","_interopRequireDefault","require","_provider","_lockUnlock","_entitiesSavedStates","_useBlockEditorSettings","_postPanelRow","_previewDropdown","privateApis","exports","lock","EditorCanvas","ExperimentalEditorProvider","EntitiesSavedStatesExtensible","PostPanelRow","PreviewDropdown","useBlockEditorSettings"],"sources":["@wordpress/editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport EditorCanvas from './components/editor-canvas';\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { EntitiesSavedStatesExtensible } from './components/entities-saved-states';\nimport useBlockEditorSettings from './components/provider/use-block-editor-settings';\nimport PostPanelRow from './components/post-panel-row';\nimport PreviewDropdown from './components/preview-dropdown';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tEditorCanvas,\n\tExperimentalEditorProvider,\n\tEntitiesSavedStatesExtensible,\n\tPostPanelRow,\n\tPreviewDropdown,\n\n\t// This is a temporary private API while we're updating the site editor to use EditorProvider.\n\tuseBlockEditorSettings,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,uBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AATA;AACA;AACA;;AASO,MAAMO,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,YAAY,EAAZA,qBAAY;EACZC,0BAA0B,EAA1BA,oCAA0B;EAC1BC,6BAA6B,EAA7BA,kDAA6B;EAC7BC,YAAY,EAAZA,qBAAY;EACZC,eAAe,EAAfA,wBAAe;EAEf;EACAC,sBAAsB,EAAtBA;AACD,CAAE,CAAC"}
@@ -14,7 +14,10 @@ exports.redo = exports.receiveBlocks = exports.multiSelect = exports.moveBlocksU
14
14
  exports.refreshPost = refreshPost;
15
15
  exports.resetEditorBlocks = exports.resetBlocks = exports.replaceBlocks = exports.replaceBlock = exports.removeBlocks = exports.removeBlock = void 0;
16
16
  exports.resetPost = resetPost;
17
- exports.setupEditor = exports.setTemplateValidity = exports.setRenderingMode = exports.selectBlock = exports.savePost = void 0;
17
+ exports.selectBlock = exports.savePost = void 0;
18
+ exports.setDeviceType = setDeviceType;
19
+ exports.setEditedPost = setEditedPost;
20
+ exports.setupEditor = exports.setTemplateValidity = exports.setRenderingMode = void 0;
18
21
  exports.setupEditorState = setupEditorState;
19
22
  exports.undo = exports.trashPost = exports.toggleSelection = exports.toggleBlockMode = exports.synchronizeTemplate = exports.stopTyping = exports.stopMultiSelect = exports.startTyping = exports.startMultiSelect = exports.showInsertionPoint = void 0;
20
23
  exports.unlockPostAutosaving = unlockPostAutosaving;
@@ -53,7 +56,7 @@ var _noticeBuilder = require("./utils/notice-builder");
53
56
  const setupEditor = (post, edits, template) => ({
54
57
  dispatch
55
58
  }) => {
56
- dispatch.setupEditorState(post);
59
+ dispatch.setEditedPost(post.type, post.id);
57
60
  // Apply a template for new posts only, if exists.
58
61
  const isNewPost = post.status === 'auto-draft';
59
62
  if (isNewPost && template) {
@@ -84,12 +87,17 @@ const setupEditor = (post, edits, template) => ({
84
87
  * Returns an action object signalling that the editor is being destroyed and
85
88
  * that any necessary state or side-effect cleanup should occur.
86
89
  *
90
+ * @deprecated
91
+ *
87
92
  * @return {Object} Action object.
88
93
  */
89
94
  exports.setupEditor = setupEditor;
90
95
  function __experimentalTearDownEditor() {
96
+ (0, _deprecated.default)("wp.data.dispatch( 'core/editor' ).__experimentalTearDownEditor", {
97
+ since: '6.5'
98
+ });
91
99
  return {
92
- type: 'TEAR_DOWN_EDITOR'
100
+ type: 'DO_NOTHING'
93
101
  };
94
102
  }
95
103
 
@@ -128,17 +136,33 @@ function updatePost() {
128
136
  }
129
137
 
130
138
  /**
131
- * Returns an action object used to setup the editor state when first opening
132
- * an editor.
139
+ * Setup the editor state.
140
+ *
141
+ * @deprecated
133
142
  *
134
143
  * @param {Object} post Post object.
144
+ */
145
+ function setupEditorState(post) {
146
+ (0, _deprecated.default)("wp.data.dispatch( 'core/editor' ).setupEditorState", {
147
+ since: '6.5',
148
+ alternative: "wp.data.dispatch( 'core/editor' ).setEditedPost"
149
+ });
150
+ return setEditedPost(post.type, post.id);
151
+ }
152
+
153
+ /**
154
+ * Returns an action that sets the current post Type and post ID.
155
+ *
156
+ * @param {string} postType Post Type.
157
+ * @param {string} postId Post ID.
135
158
  *
136
159
  * @return {Object} Action object.
137
160
  */
138
- function setupEditorState(post) {
161
+ function setEditedPost(postType, postId) {
139
162
  return {
140
- type: 'SETUP_EDITOR_STATE',
141
- post
163
+ type: 'SET_EDITED_POST',
164
+ postType,
165
+ postId
142
166
  };
143
167
  }
144
168
 
@@ -582,9 +606,18 @@ function updateEditorSettings(settings) {
582
606
  */
583
607
  const setRenderingMode = mode => ({
584
608
  dispatch,
585
- registry
609
+ registry,
610
+ select
586
611
  }) => {
587
- registry.dispatch(_blockEditor.store).clearSelectedBlock();
612
+ if (select.__unstableIsEditorReady()) {
613
+ // We clear the block selection but we also need to clear the selection from the core store.
614
+ registry.dispatch(_blockEditor.store).clearSelectedBlock();
615
+ dispatch.editPost({
616
+ selection: undefined
617
+ }, {
618
+ undoIgnore: true
619
+ });
620
+ }
588
621
  dispatch({
589
622
  type: 'SET_RENDERING_MODE',
590
623
  mode
@@ -592,9 +625,24 @@ const setRenderingMode = mode => ({
592
625
  };
593
626
 
594
627
  /**
595
- * Backward compatibility
628
+ * Action that changes the width of the editing canvas.
629
+ *
630
+ * @param {string} deviceType
631
+ *
632
+ * @return {Object} Action object.
596
633
  */
597
634
  exports.setRenderingMode = setRenderingMode;
635
+ function setDeviceType(deviceType) {
636
+ return {
637
+ type: 'SET_DEVICE_TYPE',
638
+ deviceType
639
+ };
640
+ }
641
+
642
+ /**
643
+ * Backward compatibility
644
+ */
645
+
598
646
  const getBlockEditorAction = name => (...args) => ({
599
647
  registry
600
648
  }) => {