@wordpress/editor 14.11.0 → 14.12.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 (165) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +0 -8
  3. package/build/components/collab-sidebar/add-comment.js +5 -6
  4. package/build/components/collab-sidebar/add-comment.js.map +1 -1
  5. package/build/components/collab-sidebar/index.js +75 -73
  6. package/build/components/collab-sidebar/index.js.map +1 -1
  7. package/build/components/commands/index.js +142 -34
  8. package/build/components/commands/index.js.map +1 -1
  9. package/build/components/create-template-part-modal/index.js +1 -0
  10. package/build/components/create-template-part-modal/index.js.map +1 -1
  11. package/build/components/document-bar/index.js +9 -3
  12. package/build/components/document-bar/index.js.map +1 -1
  13. package/build/components/document-tools/index.js +8 -4
  14. package/build/components/document-tools/index.js.map +1 -1
  15. package/build/components/editor-interface/index.js +1 -2
  16. package/build/components/editor-interface/index.js.map +1 -1
  17. package/build/components/global-styles-provider/index.js +20 -8
  18. package/build/components/global-styles-provider/index.js.map +1 -1
  19. package/build/components/header/index.js +10 -12
  20. package/build/components/header/index.js.map +1 -1
  21. package/build/components/more-menu/index.js +9 -7
  22. package/build/components/more-menu/index.js.map +1 -1
  23. package/build/components/post-taxonomies/flat-term-selector.js +10 -8
  24. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  25. package/build/components/post-template/swap-template-button.js +0 -3
  26. package/build/components/post-template/swap-template-button.js.map +1 -1
  27. package/build/components/post-transform-panel/index.js +0 -3
  28. package/build/components/post-transform-panel/index.js.map +1 -1
  29. package/build/components/preferences-modal/index.js +26 -22
  30. package/build/components/preferences-modal/index.js.map +1 -1
  31. package/build/components/preview-dropdown/index.js +23 -4
  32. package/build/components/preview-dropdown/index.js.map +1 -1
  33. package/build/components/provider/use-block-editor-settings.js +10 -9
  34. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  35. package/build/components/sidebar/post-summary.js +2 -2
  36. package/build/components/sidebar/post-summary.js.map +1 -1
  37. package/build/components/start-page-options/index.js +0 -3
  38. package/build/components/start-page-options/index.js.map +1 -1
  39. package/build/components/start-template-options/index.js +0 -3
  40. package/build/components/start-template-options/index.js.map +1 -1
  41. package/build/components/visual-editor/index.js +5 -2
  42. package/build/components/visual-editor/index.js.map +1 -1
  43. package/build/store/actions.js +65 -16
  44. package/build/store/actions.js.map +1 -1
  45. package/build/store/constants.js +0 -2
  46. package/build/store/constants.js.map +1 -1
  47. package/build/store/index.js +0 -4
  48. package/build/store/index.js.map +1 -1
  49. package/build/store/selectors.js +2 -2
  50. package/build/store/selectors.js.map +1 -1
  51. package/build-module/components/collab-sidebar/add-comment.js +5 -6
  52. package/build-module/components/collab-sidebar/add-comment.js.map +1 -1
  53. package/build-module/components/collab-sidebar/index.js +76 -74
  54. package/build-module/components/collab-sidebar/index.js.map +1 -1
  55. package/build-module/components/commands/index.js +145 -38
  56. package/build-module/components/commands/index.js.map +1 -1
  57. package/build-module/components/create-template-part-modal/index.js +1 -0
  58. package/build-module/components/create-template-part-modal/index.js.map +1 -1
  59. package/build-module/components/document-bar/index.js +10 -4
  60. package/build-module/components/document-bar/index.js.map +1 -1
  61. package/build-module/components/document-tools/index.js +8 -4
  62. package/build-module/components/document-tools/index.js.map +1 -1
  63. package/build-module/components/editor-interface/index.js +1 -2
  64. package/build-module/components/editor-interface/index.js.map +1 -1
  65. package/build-module/components/global-styles-provider/index.js +20 -8
  66. package/build-module/components/global-styles-provider/index.js.map +1 -1
  67. package/build-module/components/header/index.js +10 -12
  68. package/build-module/components/header/index.js.map +1 -1
  69. package/build-module/components/more-menu/index.js +9 -7
  70. package/build-module/components/more-menu/index.js.map +1 -1
  71. package/build-module/components/post-taxonomies/flat-term-selector.js +10 -8
  72. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  73. package/build-module/components/post-template/swap-template-button.js +0 -3
  74. package/build-module/components/post-template/swap-template-button.js.map +1 -1
  75. package/build-module/components/post-transform-panel/index.js +0 -3
  76. package/build-module/components/post-transform-panel/index.js.map +1 -1
  77. package/build-module/components/preferences-modal/index.js +26 -22
  78. package/build-module/components/preferences-modal/index.js.map +1 -1
  79. package/build-module/components/preview-dropdown/index.js +24 -5
  80. package/build-module/components/preview-dropdown/index.js.map +1 -1
  81. package/build-module/components/provider/use-block-editor-settings.js +11 -10
  82. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  83. package/build-module/components/sidebar/post-summary.js +2 -2
  84. package/build-module/components/sidebar/post-summary.js.map +1 -1
  85. package/build-module/components/start-page-options/index.js +0 -3
  86. package/build-module/components/start-page-options/index.js.map +1 -1
  87. package/build-module/components/start-template-options/index.js +0 -3
  88. package/build-module/components/start-template-options/index.js.map +1 -1
  89. package/build-module/components/visual-editor/index.js +5 -2
  90. package/build-module/components/visual-editor/index.js.map +1 -1
  91. package/build-module/store/actions.js +61 -14
  92. package/build-module/store/actions.js.map +1 -1
  93. package/build-module/store/constants.js +0 -2
  94. package/build-module/store/constants.js.map +1 -1
  95. package/build-module/store/index.js +0 -4
  96. package/build-module/store/index.js.map +1 -1
  97. package/build-module/store/selectors.js +2 -2
  98. package/build-module/store/selectors.js.map +1 -1
  99. package/build-style/style-rtl.css +22 -6
  100. package/build-style/style.css +22 -6
  101. package/build-types/components/collab-sidebar/add-comment.d.ts.map +1 -1
  102. package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
  103. package/build-types/components/commands/index.d.ts.map +1 -1
  104. package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
  105. package/build-types/components/document-bar/index.d.ts.map +1 -1
  106. package/build-types/components/document-tools/index.d.ts.map +1 -1
  107. package/build-types/components/editor-interface/index.d.ts.map +1 -1
  108. package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
  109. package/build-types/components/header/index.d.ts +1 -2
  110. package/build-types/components/header/index.d.ts.map +1 -1
  111. package/build-types/components/more-menu/index.d.ts.map +1 -1
  112. package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
  113. package/build-types/components/post-template/hooks.d.ts +2 -2
  114. package/build-types/components/post-template/swap-template-button.d.ts.map +1 -1
  115. package/build-types/components/post-transform-panel/index.d.ts.map +1 -1
  116. package/build-types/components/preferences-modal/index.d.ts.map +1 -1
  117. package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
  118. package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
  119. package/build-types/components/start-page-options/index.d.ts.map +1 -1
  120. package/build-types/components/start-template-options/index.d.ts.map +1 -1
  121. package/build-types/components/visual-editor/index.d.ts.map +1 -1
  122. package/build-types/dataviews/store/reducer.d.ts +5 -2
  123. package/build-types/dataviews/store/reducer.d.ts.map +1 -1
  124. package/build-types/lock-unlock.d.ts +2 -2
  125. package/build-types/store/actions.d.ts +9 -1
  126. package/build-types/store/actions.d.ts.map +1 -1
  127. package/build-types/store/constants.d.ts +0 -2
  128. package/build-types/store/constants.d.ts.map +1 -1
  129. package/build-types/store/index.d.ts +9 -11
  130. package/build-types/store/index.d.ts.map +1 -1
  131. package/build-types/store/reducer.d.ts +24 -4
  132. package/build-types/store/reducer.d.ts.map +1 -1
  133. package/build-types/store/selectors.d.ts +3 -3
  134. package/build-types/store/selectors.d.ts.map +1 -1
  135. package/package.json +4 -3
  136. package/src/components/collab-sidebar/add-comment.js +17 -20
  137. package/src/components/collab-sidebar/index.js +79 -88
  138. package/src/components/commands/index.js +390 -270
  139. package/src/components/create-template-part-modal/index.js +1 -0
  140. package/src/components/document-bar/index.js +10 -1
  141. package/src/components/document-bar/style.scss +13 -0
  142. package/src/components/document-tools/index.js +7 -1
  143. package/src/components/editor-interface/index.js +0 -1
  144. package/src/components/global-styles-provider/index.js +20 -8
  145. package/src/components/header/index.js +18 -10
  146. package/src/components/more-menu/index.js +12 -7
  147. package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -1
  148. package/src/components/post-taxonomies/flat-term-selector.js +8 -8
  149. package/src/components/post-template/swap-template-button.js +0 -3
  150. package/src/components/post-transform-panel/index.js +0 -3
  151. package/src/components/preferences-modal/index.js +26 -19
  152. package/src/components/preferences-modal/test/index.js +1 -1
  153. package/src/components/preview-dropdown/index.js +45 -16
  154. package/src/components/provider/use-block-editor-settings.js +10 -9
  155. package/src/components/sidebar/post-summary.js +1 -1
  156. package/src/components/sidebar/style.scss +1 -3
  157. package/src/components/start-page-options/index.js +0 -3
  158. package/src/components/start-template-options/index.js +0 -3
  159. package/src/components/visual-editor/index.js +7 -1
  160. package/src/components/visual-editor/style.scss +11 -0
  161. package/src/store/actions.js +110 -33
  162. package/src/store/constants.ts +0 -2
  163. package/src/store/index.js +0 -4
  164. package/src/store/selectors.js +2 -2
  165. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["Modal","Flex","FlexItem","Button","__","useState","useMemo","useEffect","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useAsyncList","parse","store","coreStore","useEntityBlockEditor","editorStore","TEMPLATE_POST_TYPE","jsx","_jsx","jsxs","_jsxs","useFallbackTemplateContent","slug","isCustom","select","getEntityRecord","getDefaultTemplateId","templateId","is_custom","ignore_empty","content","raw","undefined","useStartPatterns","fallbackContent","patterns","getCurrentPostType","getCurrentPostId","getBlockPatterns","postId","postType","record","currentThemeStylesheet","getCurrentTheme","stylesheet","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","attributes","theme","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","PatternSelection","onChoosePattern","onChange","blockPatterns","shownBlockPatterns","shownPatterns","onClickPattern","selection","StartModal","onClose","className","closeLabel","focusOnMount","onRequestClose","isFullScreen","children","justify","expanded","__next40pxDefaultSize","variant","onClick","StartTemplateOptions","isClosed","setIsClosed","shouldOpenModal","_postType","_postId","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits"],"sources":["@wordpress/editor/src/components/start-template-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getDefaultTemplateId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateId = getDefaultTemplateId( {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} );\n\t\t\treturn templateId\n\t\t\t\t? getEntityRecord( 'postType', TEMPLATE_POST_TYPE, templateId )\n\t\t\t\t\t\t?.content?.raw\n\t\t\t\t: undefined;\n\t\t},\n\t\t[ slug, isCustom ]\n\t);\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEntityRecord, getBlockPatterns } = select( coreStore );\n\t\tconst postId = getCurrentPostId();\n\t\tconst postType = getCurrentPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getBlockPatterns(),\n\t\t};\n\t}, [] );\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme().stylesheet\n\t);\n\n\t// Duplicated from packages/block-library/src/pattern/edit.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...pattern,\n\t\t\t\t\t\tblocks: parse( pattern.content ).map( ( block ) =>\n\t\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<div className=\"editor-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-template-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<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartTemplateOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldOpenModal, slug, isCustom, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getCurrentPostId } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postType = getCurrentPostType();\n\t\t\tconst _postId = getCurrentPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\tTEMPLATE_POST_TYPE === _postType,\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldOpenModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () => setIsClosed( true ) }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACrE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACjE,SAASC,+BAA+B,IAAIC,iBAAiB,QAAQ,yBAAyB;AAC9F,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,KAAK,QAAQ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AEX,SAAU,CAAC;IACpB,MAAMgF,cAAc,GAAGF,qBAAqB,CAC3C,UAAU,EACVF,SAAS,EACTC,OACD,CAAC;IACD,MAAMI,QAAQ,GAAGF,uBAAuB,CACvC,UAAU,EACVH,SAAS,EACTC,OACD,CAAC;IAED,OAAO;MACNF,eAAe,EACd,CAAEM,QAAQ,IACV,EAAE,KAAKD,cAAc,CAAC/D,OAAO,IAC7Bd,kBAAkB,KAAKyE,SAAS;MACjCnE,IAAI,EAAEuE,cAAc,CAACvE,IAAI;MACzBC,QAAQ,EAAEsE,cAAc,CAACjE,SAAS;MAClCY,QAAQ,EAAEiD,SAAS;MACnBlD,MAAM,EAAEmD;IACT,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAEDpF,SAAS,CAAE,MAAM;IAChB;IACAiF,WAAW,CAAE,KAAM,CAAC;EACrB,CAAC,EAAE,CAAE/C,QAAQ,EAAED,MAAM,CAAG,CAAC;EAEzB,IAAK,CAAEiD,eAAe,IAAIF,QAAQ,EAAG;IACpC,OAAO,IAAI;EACZ;EAEA,oBACCpE,IAAA,CAACsD,UAAU;IACVlD,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBiB,QAAQ,EAAGA,QAAU;IACrBiC,OAAO,EAAGA,CAAA,KAAMc,WAAW,CAAE,IAAK;EAAG,CACrC,CAAC;AAEJ","ignoreList":[]}
1
+ {"version":3,"names":["Modal","Flex","FlexItem","Button","__","useState","useMemo","useEffect","__experimentalBlockPatternsList","BlockPatternsList","useSelect","parse","store","coreStore","useEntityBlockEditor","editorStore","TEMPLATE_POST_TYPE","jsx","_jsx","jsxs","_jsxs","useFallbackTemplateContent","slug","isCustom","select","getEntityRecord","getDefaultTemplateId","templateId","is_custom","ignore_empty","content","raw","undefined","useStartPatterns","fallbackContent","patterns","getCurrentPostType","getCurrentPostId","getBlockPatterns","postId","postType","record","currentThemeStylesheet","getCurrentTheme","stylesheet","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","attributes","theme","blocks","title","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","PatternSelection","onChoosePattern","onChange","blockPatterns","onClickPattern","selection","StartModal","onClose","className","closeLabel","focusOnMount","onRequestClose","isFullScreen","children","justify","expanded","__next40pxDefaultSize","variant","onClick","StartTemplateOptions","isClosed","setIsClosed","shouldOpenModal","_postType","_postId","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits"],"sources":["@wordpress/editor/src/components/start-template-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../store/constants';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getDefaultTemplateId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateId = getDefaultTemplateId( {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} );\n\t\t\treturn templateId\n\t\t\t\t? getEntityRecord( 'postType', TEMPLATE_POST_TYPE, templateId )\n\t\t\t\t\t\t?.content?.raw\n\t\t\t\t: undefined;\n\t\t},\n\t\t[ slug, isCustom ]\n\t);\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEntityRecord, getBlockPatterns } = select( coreStore );\n\t\tconst postId = getCurrentPostId();\n\t\tconst postType = getCurrentPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getBlockPatterns(),\n\t\t};\n\t}, [] );\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme().stylesheet\n\t);\n\n\t// Duplicated from packages/block-library/src/pattern/edit.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...pattern,\n\t\t\t\t\t\tblocks: parse( pattern.content ).map( ( block ) =>\n\t\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"editor-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen\n\t\t>\n\t\t\t<div className=\"editor-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"editor-start-template-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<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartTemplateOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { shouldOpenModal, slug, isCustom, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getCurrentPostId } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst _postType = getCurrentPostType();\n\t\t\tconst _postId = getCurrentPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\t_postId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\tTEMPLATE_POST_TYPE === _postType,\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\t// Should reset the modal state when navigating to a new page/post.\n\t\tsetIsClosed( false );\n\t}, [ postType, postId ] );\n\n\tif ( ! shouldOpenModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () => setIsClosed( true ) }\n\t\t/>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,IAAI,EAA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MwE,SAAS,GAAGnD,kBAAkB,CAAC,CAAC;IACtC,MAAMoD,OAAO,GAAGnD,gBAAgB,CAAC,CAAC;IAClC,MAAM;MAAEoD,qBAAqB;MAAEC;IAAwB,CAAC,GACvDlE,MAAM,CAAEX,SAAU,CAAC;IACpB,MAAM8E,cAAc,GAAGF,qBAAqB,CAC3C,UAAU,EACVF,SAAS,EACTC,OACD,CAAC;IACD,MAAMI,QAAQ,GAAGF,uBAAuB,CACvC,UAAU,EACVH,SAAS,EACTC,OACD,CAAC;IAED,OAAO;MACNF,eAAe,EACd,CAAEM,QAAQ,IACV,EAAE,KAAKD,cAAc,CAAC7D,OAAO,IAC7Bd,kBAAkB,KAAKuE,SAAS;MACjCjE,IAAI,EAAEqE,cAAc,CAACrE,IAAI;MACzBC,QAAQ,EAAEoE,cAAc,CAAC/D,SAAS;MAClCY,QAAQ,EAAE+C,SAAS;MACnBhD,MAAM,EAAEiD;IACT,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAEDjF,SAAS,CAAE,MAAM;IAChB;IACA8E,WAAW,CAAE,KAAM,CAAC;EACrB,CAAC,EAAE,CAAE7C,QAAQ,EAAED,MAAM,CAAG,CAAC;EAEzB,IAAK,CAAE+C,eAAe,IAAIF,QAAQ,EAAG;IACpC,OAAO,IAAI;EACZ;EAEA,oBACClE,IAAA,CAACoD,UAAU;IACVhD,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBiB,QAAQ,EAAGA,QAAU;IACrB+B,OAAO,EAAGA,CAAA,KAAMc,WAAW,CAAE,IAAK;EAAG,CACrC,CAAC;AAEJ","ignoreList":[]}
@@ -333,8 +333,11 @@ function VisualEditor({
333
333
  blockName: wrapperBlockName,
334
334
  uniqueId: wrapperUniqueId,
335
335
  children: [/*#__PURE__*/_jsx(BlockList, {
336
- className: clsx('is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' || isDesignPostType ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
337
- ),
336
+ className: clsx('is-' + deviceType.toLowerCase() + '-preview', renderingMode !== 'post-only' || isDesignPostType ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content`,
337
+ // Ensure root level blocks receive default/flow blockGap styling rules.
338
+ {
339
+ 'has-global-padding': renderingMode === 'post-only' && !isDesignPostType && hasRootPaddingAwareAlignments
340
+ }),
338
341
  layout: blockListLayout,
339
342
  dropZoneElement:
340
343
  // When iframed, pass in the html element of the iframe to
@@ -1 +1 @@
1
- {"version":3,"names":["clsx","BlockList","store","blockEditorStore","__unstableUseTypewriter","useTypewriter","__unstableUseTypingObserver","useTypingObserver","useSettings","RecursionProvider","privateApis","blockEditorPrivateApis","__experimentalUseResizeCanvas","useResizeCanvas","useEffect","useRef","useMemo","useState","useSelect","parse","coreStore","useMergeRefs","useViewportMatch","useResizeObserver","PostTitle","editorStore","unlock","EditTemplateBlocksNotification","ResizableEditor","useSelectNearestEditableBlock","NAVIGATION_POST_TYPE","PATTERN_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","useZoomOutModeExit","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","LayoutStyle","useLayoutClasses","useLayoutStyles","ExperimentalBlockCanvas","BlockCanvas","useFlashEditableBlocks","DESIGN_POST_TYPES","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","checkForPostContentAtRootLevel","VisualEditor","autoFocus","styles","disableIframe","iframeProps","contentRef","className","contentHeight","setContentHeight","effectContentHeight","entry","borderBoxSize","blockSize","isMobileViewport","renderingMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","deviceType","isFocusedEntity","isDesignPostType","postType","isPreview","select","getCurrentPostId","getCurrentPostType","getCurrentTemplateId","getEditorSettings","getRenderingMode","getDeviceType","getPostType","getEditedEntityRecord","postTypeSlug","_renderingMode","_wrapperBlockName","editorSettings","supportsTemplateMode","postTypeObject","currentTemplateId","template","undefined","includes","viewable","onNavigateToPreviousEntityRecord","isPreviewMode","isCleanNewPost","hasRootPaddingAwareAlignments","themeHasDisabledLayoutStyles","themeSupportsLayout","isZoomedOut","getSettings","isZoomOut","_isZoomOut","_settings","disableLayoutStyles","supportsLayout","__experimentalFeatures","useRootPaddingAwareAlignments","deviceStyles","globalLayoutSettings","fallbackLayout","type","newestPostContentAttributes","content","parseableContent","hasPostContentAtRootLevel","layout","align","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","postEditorLayout","observeTypingRef","titleRef","current","focus","alignCSS","forceFullHeight","enableResizing","iframeStyles","css","localRef","typewriterRef","isEnabled","children","height","shouldIframe","style","selector","contentEditable","ref","marginTop","blockName","uniqueId","toLowerCase","dropZoneElement","parentNode","__unstableDisableDropZone"],"sources":["@wordpress/editor/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tuseSettings,\n\tRecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTitle from '../post-title';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditTemplateBlocksNotification from './edit-template-blocks-notification';\nimport ResizableEditor from '../resizable-editor';\nimport useSelectNearestEditableBlock from './use-select-nearest-editable-block';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { useZoomOutModeExit } from './use-zoom-out-mode-exit';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n\tuseFlashEditableBlocks,\n} = unlock( blockEditorPrivateApis );\n\n/**\n * These post types have a special editor where they don't allow you to fill the title\n * and they don't apply the layout styles.\n */\nconst DESIGN_POST_TYPES = [\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n];\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction VisualEditor( {\n\t// Ideally as we unify post and site editors, we won't need these props.\n\tautoFocus,\n\tstyles,\n\tdisableIframe = false,\n\tiframeProps,\n\tcontentRef,\n\tclassName,\n} ) {\n\tconst [ contentHeight, setContentHeight ] = useState( '' );\n\tconst effectContentHeight = useResizeObserver( ( [ entry ] ) => {\n\t\tsetContentHeight( entry.borderBoxSize[ 0 ].blockSize );\n\t} );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst {\n\t\trenderingMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tdeviceType,\n\t\tisFocusedEntity,\n\t\tisDesignPostType,\n\t\tpostType,\n\t\tisPreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, getEditedEntityRecord } = select( coreStore );\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tconst _renderingMode = getRenderingMode();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === PATTERN_POST_TYPE ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( _renderingMode === 'post-only' ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst postTypeObject = getPostType( postTypeSlug );\n\t\tconst currentTemplateId = getCurrentTemplateId();\n\t\tconst template = currentTemplateId\n\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tcurrentTemplateId\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trenderingMode: _renderingMode,\n\t\t\tpostContentAttributes: editorSettings.postContentAttributes,\n\t\t\tisDesignPostType: DESIGN_POST_TYPES.includes( postTypeSlug ),\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostTypeObject?.viewable && supportsTemplateMode\n\t\t\t\t\t? template\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tdeviceType: getDeviceType(),\n\t\t\tisFocusedEntity: !! editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\tpostType: postTypeSlug,\n\t\t\tisPreview: editorSettings.isPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tisZoomedOut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings, isZoomOut: _isZoomOut } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\tconst _settings = getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t\tisZoomedOut: _isZoomOut(),\n\t\t};\n\t}, [] );\n\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ globalLayoutSettings ] = useSettings( 'layout' );\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( renderingMode !== 'post-only' || isDesignPostType ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [\n\t\trenderingMode,\n\t\tthemeSupportsLayout,\n\t\tglobalLayoutSettings,\n\t\tisDesignPostType,\n\t] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif (\n\t\t\t! editedPostTemplate?.content &&\n\t\t\t! editedPostTemplate?.blocks &&\n\t\t\tpostContentAttributes\n\t\t) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = clsx(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\tconst observeTypingRef = useTypingObserver();\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( ! autoFocus || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ autoFocus, isCleanNewPost ] );\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst forceFullHeight = postType === NAVIGATION_POST_TYPE;\n\tconst enableResizing =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) &&\n\t\t// Disable in previews / view mode.\n\t\t! isPreview &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport &&\n\t\t// Dsiable resizing in zoomed-out mode.\n\t\t! isZoomedOut;\n\n\tconst iframeStyles = useMemo( () => {\n\t\treturn [\n\t\t\t...( styles ?? [] ),\n\t\t\t{\n\t\t\t\t// Ensures margins of children are contained so that the body background paints behind them.\n\t\t\t\t// Otherwise, the background of html (when zoomed out) would show there and appear broken. It’s\n\t\t\t\t// important mostly for post-only views yet conceivably an issue in templated views too.\n\t\t\t\tcss: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}`,\n\t\t\t},\n\t\t];\n\t}, [ styles, enableResizing ] );\n\n\tconst localRef = useRef();\n\tconst typewriterRef = useTypewriter();\n\tcontentRef = useMergeRefs( [\n\t\tlocalRef,\n\t\tcontentRef,\n\t\trenderingMode === 'post-only' ? typewriterRef : null,\n\t\tuseFlashEditableBlocks( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseSelectNearestEditableBlock( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseZoomOutModeExit(),\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width.\n\t\tenableResizing ? effectContentHeight : null,\n\t] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-visual-editor',\n\t\t\t\t// this class is here for backward compatibility reasons.\n\t\t\t\t'edit-post-visual-editor',\n\t\t\t\tclassName,\n\t\t\t\t{\n\t\t\t\t\t'has-padding': isFocusedEntity || enableResizing,\n\t\t\t\t\t'is-resizable': enableResizing,\n\t\t\t\t\t'is-iframed': ! disableIframe,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<ResizableEditor\n\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\theight={\n\t\t\t\t\tcontentHeight && ! forceFullHeight ? contentHeight : '100%'\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ ! disableIframe }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tstyles={ iframeStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tiframeProps={ {\n\t\t\t\t\t\t...iframeProps,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t\t\t\t...deviceStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t! isDesignPostType && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".editor-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ align && <LayoutStyle css={ alignCSS } /> }\n\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{ renderingMode === 'post-only' && ! isDesignPostType && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'editor-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t// The following class is only here for backward comapatibility\n\t\t\t\t\t\t\t\t// some themes might be using it to style the post title.\n\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\tref={ observeTypingRef }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t// This is using inline styles\n\t\t\t\t\t\t\t\t// so it's applied for both iframed and non iframed editors.\n\t\t\t\t\t\t\t\tmarginTop: '4rem',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'is-' + deviceType.toLowerCase() + '-preview',\n\t\t\t\t\t\t\t\trenderingMode !== 'post-only' ||\n\t\t\t\t\t\t\t\t\tisDesignPostType\n\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\t\t\tdisableIframe\n\t\t\t\t\t\t\t\t\t? localRef.current\n\t\t\t\t\t\t\t\t\t: localRef.current?.parentNode\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__unstableDisableDropZone={\n\t\t\t\t\t\t\t\t// In template preview mode, disable drop zones at the root of the template.\n\t\t\t\t\t\t\t\trenderingMode === 'template-locked'\n\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ renderingMode === 'template-locked' && (\n\t\t\t\t\t\t\t<EditTemplateBlocksNotification\n\t\t\t\t\t\t\t\tcontentRef={ localRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RecursionProvider>\n\t\t\t\t</BlockCanvas>\n\t\t\t</ResizableEditor>\n\t\t</div>\n\t);\n}\n\nexport default VisualEditor;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,SAAS,EACTC,KAAK,IAAIC,gBAAgB,EACzBC,uBAAuB,IAAIC,aAAa,EACxCC,2BAA2B,IAAIC,iBAAiB,EAChDC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,IAAIC,sBAAsB,EACrCC,6BAA6B,IAAIC,eAAe,QAC1C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACzE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASjB,KAAK,IAAIkB,SA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B;UAAU,CAAE;QAAC,CAC1B,CACL,eACDhG,KAAA,CAAC/B,iBAAiB;UACjBkJ,SAAS,EAAGjF,gBAAkB;UAC9BkF,QAAQ,EAAGjF,eAAiB;UAAAwE,QAAA,gBAE5B/G,IAAA,CAACnC,SAAS;YACT8D,SAAS,EAAG/D,IAAI,CACf,KAAK,GAAG4E,UAAU,CAACiF,WAAW,CAAC,CAAC,GAAG,UAAU,EAC7CtF,aAAa,KAAK,WAAW,IAC5BO,gBAAgB,GACd,gBAAgB,GAChB,GAAIiD,oBAAoB,wBAAyB,CAAC;YACtD,CAAG;YACHH,MAAM,EAAGS,eAAiB;YAC1ByB,eAAe;YACd;YACA;YACAlG,aAAa,GACVoF,QAAQ,CAACP,OAAO,GAChBO,QAAQ,CAACP,OAAO,EAAEsB,UACrB;YACDC,yBAAyB;YACxB;YACAzF,aAAa,KAAK,iBAAiB,GAChC,IAAI,GACJ;UACH,CACD,CAAC,EACAA,aAAa,KAAK,iBAAiB,iBACpCnC,IAAA,CAACT,8BAA8B;YAC9BmC,UAAU,EAAGkF;UAAU,CACvB,CACD;QAAA,CACiB,CAAC;MAAA,CACR;IAAC,CACE;EAAC,CACd,CAAC;AAER;AAEA,eAAevF,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["clsx","BlockList","store","blockEditorStore","__unstableUseTypewriter","useTypewriter","__unstableUseTypingObserver","useTypingObserver","useSettings","RecursionProvider","privateApis","blockEditorPrivateApis","__experimentalUseResizeCanvas","useResizeCanvas","useEffect","useRef","useMemo","useState","useSelect","parse","coreStore","useMergeRefs","useViewportMatch","useResizeObserver","PostTitle","editorStore","unlock","EditTemplateBlocksNotification","ResizableEditor","useSelectNearestEditableBlock","NAVIGATION_POST_TYPE","PATTERN_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","useZoomOutModeExit","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","LayoutStyle","useLayoutClasses","useLayoutStyles","ExperimentalBlockCanvas","BlockCanvas","useFlashEditableBlocks","DESIGN_POST_TYPES","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","checkForPostContentAtRootLevel","VisualEditor","autoFocus","styles","disableIframe","iframeProps","contentRef","className","contentHeight","setContentHeight","effectContentHeight","entry","borderBoxSize","blockSize","isMobileViewport","renderingMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","deviceType","isFocusedEntity","isDesignPostType","postType","isPreview","select","getCurrentPostId","getCurrentPostType","getCurrentTemplateId","getEditorSettings","getRenderingMode","getDeviceType","getPostType","getEditedEntityRecord","postTypeSlug","_renderingMode","_wrapperBlockName","editorSettings","supportsTemplateMode","postTypeObject","currentTemplateId","template","undefined","includes","viewable","onNavigateToPreviousEntityRecord","isPreviewMode","isCleanNewPost","hasRootPaddingAwareAlignments","themeHasDisabledLayoutStyles","themeSupportsLayout","isZoomedOut","getSettings","isZoomOut","_isZoomOut","_settings","disableLayoutStyles","supportsLayout","__experimentalFeatures","useRootPaddingAwareAlignments","deviceStyles","globalLayoutSettings","fallbackLayout","type","newestPostContentAttributes","content","parseableContent","hasPostContentAtRootLevel","layout","align","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","postEditorLayout","observeTypingRef","titleRef","current","focus","alignCSS","forceFullHeight","enableResizing","iframeStyles","css","localRef","typewriterRef","isEnabled","children","height","shouldIframe","style","selector","contentEditable","ref","marginTop","blockName","uniqueId","toLowerCase","dropZoneElement","parentNode","__unstableDisableDropZone"],"sources":["@wordpress/editor/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockList,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\tuseSettings,\n\tRecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tuseMergeRefs,\n\tuseViewportMatch,\n\tuseResizeObserver,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport PostTitle from '../post-title';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport EditTemplateBlocksNotification from './edit-template-blocks-notification';\nimport ResizableEditor from '../resizable-editor';\nimport useSelectNearestEditableBlock from './use-select-nearest-editable-block';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\nimport { useZoomOutModeExit } from './use-zoom-out-mode-exit';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n\tuseFlashEditableBlocks,\n} = unlock( blockEditorPrivateApis );\n\n/**\n * These post types have a special editor where they don't allow you to fill the title\n * and they don't apply the layout styles.\n */\nconst DESIGN_POST_TYPES = [\n\tPATTERN_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n];\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction VisualEditor( {\n\t// Ideally as we unify post and site editors, we won't need these props.\n\tautoFocus,\n\tstyles,\n\tdisableIframe = false,\n\tiframeProps,\n\tcontentRef,\n\tclassName,\n} ) {\n\tconst [ contentHeight, setContentHeight ] = useState( '' );\n\tconst effectContentHeight = useResizeObserver( ( [ entry ] ) => {\n\t\tsetContentHeight( entry.borderBoxSize[ 0 ].blockSize );\n\t} );\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst {\n\t\trenderingMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tdeviceType,\n\t\tisFocusedEntity,\n\t\tisDesignPostType,\n\t\tpostType,\n\t\tisPreview,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetCurrentPostId,\n\t\t\tgetCurrentPostType,\n\t\t\tgetCurrentTemplateId,\n\t\t\tgetEditorSettings,\n\t\t\tgetRenderingMode,\n\t\t\tgetDeviceType,\n\t\t} = select( editorStore );\n\t\tconst { getPostType, getEditedEntityRecord } = select( coreStore );\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tconst _renderingMode = getRenderingMode();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === PATTERN_POST_TYPE ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( _renderingMode === 'post-only' ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst postTypeObject = getPostType( postTypeSlug );\n\t\tconst currentTemplateId = getCurrentTemplateId();\n\t\tconst template = currentTemplateId\n\t\t\t? getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tcurrentTemplateId\n\t\t\t )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trenderingMode: _renderingMode,\n\t\t\tpostContentAttributes: editorSettings.postContentAttributes,\n\t\t\tisDesignPostType: DESIGN_POST_TYPES.includes( postTypeSlug ),\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostTypeObject?.viewable && supportsTemplateMode\n\t\t\t\t\t? template\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tdeviceType: getDeviceType(),\n\t\t\tisFocusedEntity: !! editorSettings.onNavigateToPreviousEntityRecord,\n\t\t\tpostType: postTypeSlug,\n\t\t\tisPreview: editorSettings.isPreviewMode,\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst {\n\t\thasRootPaddingAwareAlignments,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t\tisZoomedOut,\n\t} = useSelect( ( select ) => {\n\t\tconst { getSettings, isZoomOut: _isZoomOut } = unlock(\n\t\t\tselect( blockEditorStore )\n\t\t);\n\n\t\tconst _settings = getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t\tisZoomedOut: _isZoomOut(),\n\t\t};\n\t}, [] );\n\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst [ globalLayoutSettings ] = useSettings( 'layout' );\n\n\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( renderingMode !== 'post-only' || isDesignPostType ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\t// We need to ensure support for wide and full alignments,\n\t\t\t// so we add the constrained type.\n\t\t\treturn { ...globalLayoutSettings, type: 'constrained' };\n\t\t}\n\t\t// Set default layout for classic themes so all alignments are supported.\n\t\treturn { type: 'default' };\n\t}, [\n\t\trenderingMode,\n\t\tthemeSupportsLayout,\n\t\tglobalLayoutSettings,\n\t\tisDesignPostType,\n\t] );\n\n\tconst newestPostContentAttributes = useMemo( () => {\n\t\tif (\n\t\t\t! editedPostTemplate?.content &&\n\t\t\t! editedPostTemplate?.blocks &&\n\t\t\tpostContentAttributes\n\t\t) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = clsx(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\tconst observeTypingRef = useTypingObserver();\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( ! autoFocus || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ autoFocus, isCleanNewPost ] );\n\n\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst forceFullHeight = postType === NAVIGATION_POST_TYPE;\n\tconst enableResizing =\n\t\t[\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\tPATTERN_POST_TYPE,\n\t\t].includes( postType ) &&\n\t\t// Disable in previews / view mode.\n\t\t! isPreview &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport &&\n\t\t// Dsiable resizing in zoomed-out mode.\n\t\t! isZoomedOut;\n\n\tconst iframeStyles = useMemo( () => {\n\t\treturn [\n\t\t\t...( styles ?? [] ),\n\t\t\t{\n\t\t\t\t// Ensures margins of children are contained so that the body background paints behind them.\n\t\t\t\t// Otherwise, the background of html (when zoomed out) would show there and appear broken. It’s\n\t\t\t\t// important mostly for post-only views yet conceivably an issue in templated views too.\n\t\t\t\tcss: `:where(.block-editor-iframe__body){display:flow-root;}.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}`,\n\t\t\t},\n\t\t];\n\t}, [ styles, enableResizing ] );\n\n\tconst localRef = useRef();\n\tconst typewriterRef = useTypewriter();\n\tcontentRef = useMergeRefs( [\n\t\tlocalRef,\n\t\tcontentRef,\n\t\trenderingMode === 'post-only' ? typewriterRef : null,\n\t\tuseFlashEditableBlocks( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseSelectNearestEditableBlock( {\n\t\t\tisEnabled: renderingMode === 'template-locked',\n\t\t} ),\n\t\tuseZoomOutModeExit(),\n\t\t// Avoid resize listeners when not needed, these will trigger\n\t\t// unnecessary re-renders when animating the iframe width.\n\t\tenableResizing ? effectContentHeight : null,\n\t] );\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'editor-visual-editor',\n\t\t\t\t// this class is here for backward compatibility reasons.\n\t\t\t\t'edit-post-visual-editor',\n\t\t\t\tclassName,\n\t\t\t\t{\n\t\t\t\t\t'has-padding': isFocusedEntity || enableResizing,\n\t\t\t\t\t'is-resizable': enableResizing,\n\t\t\t\t\t'is-iframed': ! disableIframe,\n\t\t\t\t}\n\t\t\t) }\n\t\t>\n\t\t\t<ResizableEditor\n\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\theight={\n\t\t\t\t\tcontentHeight && ! forceFullHeight ? contentHeight : '100%'\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ ! disableIframe }\n\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\tstyles={ iframeStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t\tiframeProps={ {\n\t\t\t\t\t\t...iframeProps,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t...iframeProps?.style,\n\t\t\t\t\t\t\t...deviceStyles,\n\t\t\t\t\t\t},\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t! isDesignPostType && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".editor-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\tselector=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ align && <LayoutStyle css={ alignCSS } /> }\n\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t{ renderingMode === 'post-only' && ! isDesignPostType && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'editor-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t// The following class is only here for backward comapatibility\n\t\t\t\t\t\t\t\t// some themes might be using it to style the post title.\n\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\tref={ observeTypingRef }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t// This is using inline styles\n\t\t\t\t\t\t\t\t// so it's applied for both iframed and non iframed editors.\n\t\t\t\t\t\t\t\tmarginTop: '4rem',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<RecursionProvider\n\t\t\t\t\t\tblockName={ wrapperBlockName }\n\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t'is-' + deviceType.toLowerCase() + '-preview',\n\t\t\t\t\t\t\t\trenderingMode !== 'post-only' ||\n\t\t\t\t\t\t\t\t\tisDesignPostType\n\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t: `${ blockListLayoutClass } wp-block-post-content`, // Ensure root level blocks receive default/flow blockGap styling rules.\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\trenderingMode === 'post-only' &&\n\t\t\t\t\t\t\t\t\t\t! isDesignPostType &&\n\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlayout={ blockListLayout }\n\t\t\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\t\t\tdisableIframe\n\t\t\t\t\t\t\t\t\t? localRef.current\n\t\t\t\t\t\t\t\t\t: localRef.current?.parentNode\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t__unstableDisableDropZone={\n\t\t\t\t\t\t\t\t// In template preview mode, disable drop zones at the root of the template.\n\t\t\t\t\t\t\t\trenderingMode === 'template-locked'\n\t\t\t\t\t\t\t\t\t? true\n\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ renderingMode === 'template-locked' && (\n\t\t\t\t\t\t\t<EditTemplateBlocksNotification\n\t\t\t\t\t\t\t\tcontentRef={ localRef }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</RecursionProvider>\n\t\t\t\t</BlockCanvas>\n\t\t\t</ResizableEditor>\n\t\t</div>\n\t);\n}\n\nexport default VisualEditor;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SACCC,SAAS,EACTC,KAAK,IAAIC,gBAAgB,EACzBC,uBAAuB,IAAIC,aAAa,EACxCC,2BAA2B,IAAIC,iBAAiB,EAChDC,WAAW,EACXC,iBAAiB,EACjBC,WAAW,IAAIC,sBAAsB,EACrCC,6BAA6B,IAAIC,eAAe,QAC1C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACzE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASjB,KAAK,IAAIkB,SAAS,QAAQ,sBAAsB;AACzD,SACCC,YAAY,EACZC,gBAAgB,EAChBC,iBAAiB,QACX,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,SAAS,MAAM,eAAe;AACrC,SAAStB,KAAK,IAAIuB,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,8BAA8B,MAAM,qCAAqC;AAChF,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,6BAA6B,MAAM,qCAAqC;AAC/E,SACCC,oBAAoB,EACpBC,iBAAiB,EACjBC,uBAAuB,EACvBC,kBAAkB,QACZ,uBAAuB;AAC9B,SAASC,kBAAkB,QAAQ,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAE9D,MAAM;EACLC,WAAW;EACXC,gBAAgB;EAChBC,eAAe;EACfC,uBAAuB,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yBAAyB;YACxB;YACAzF,aAAa,KAAK,iBAAiB,GAChC,IAAI,GACJ;UACH,CACD,CAAC,EACAA,aAAa,KAAK,iBAAiB,iBACpCnC,IAAA,CAACT,8BAA8B;YAC9BmC,UAAU,EAAGkF;UAAU,CACvB,CACD;QAAA,CACiB,CAAC;MAAA,CACR;IAAC,CACE;EAAC,CACd,CAAC;AAER;AAEA,eAAevF,YAAY","ignoreList":[]}
@@ -765,8 +765,13 @@ export function setIsListViewOpened(isOpen) {
765
765
  * Action that toggles Distraction free mode.
766
766
  * Distraction free mode expects there are no sidebars, as due to the
767
767
  * z-index values set, you can't close sidebars.
768
+ *
769
+ * @param {Object} [options={}] Optional configuration object
770
+ * @param {boolean} [options.createNotice=true] Whether to create a notice
768
771
  */
769
- export const toggleDistractionFree = () => ({
772
+ export const toggleDistractionFree = ({
773
+ createNotice = true
774
+ } = {}) => ({
770
775
  dispatch,
771
776
  registry
772
777
  }) => {
@@ -783,19 +788,61 @@ export const toggleDistractionFree = () => ({
783
788
  }
784
789
  registry.batch(() => {
785
790
  registry.dispatch(preferencesStore).set('core', 'distractionFree', !isDistractionFree);
786
- registry.dispatch(noticesStore).createInfoNotice(isDistractionFree ? __('Distraction free mode deactivated.') : __('Distraction free mode activated.'), {
787
- id: 'core/editor/distraction-free-mode/notice',
788
- type: 'snackbar',
789
- actions: [{
790
- label: __('Undo'),
791
- onClick: () => {
792
- registry.batch(() => {
793
- registry.dispatch(preferencesStore).set('core', 'fixedToolbar', isDistractionFree ? true : false);
794
- registry.dispatch(preferencesStore).toggle('core', 'distractionFree');
795
- });
796
- }
797
- }]
798
- });
791
+ if (createNotice) {
792
+ registry.dispatch(noticesStore).createInfoNotice(isDistractionFree ? __('Distraction free mode deactivated.') : __('Distraction free mode activated.'), {
793
+ id: 'core/editor/distraction-free-mode/notice',
794
+ type: 'snackbar',
795
+ actions: [{
796
+ label: __('Undo'),
797
+ onClick: () => {
798
+ registry.batch(() => {
799
+ registry.dispatch(preferencesStore).set('core', 'fixedToolbar', isDistractionFree);
800
+ registry.dispatch(preferencesStore).toggle('core', 'distractionFree');
801
+ });
802
+ }
803
+ }]
804
+ });
805
+ }
806
+ });
807
+ };
808
+
809
+ /**
810
+ * Action that toggles the Spotlight Mode view option.
811
+ */
812
+ export const toggleSpotlightMode = () => ({
813
+ registry
814
+ }) => {
815
+ registry.dispatch(preferencesStore).toggle('core', 'focusMode');
816
+ const isFocusMode = registry.select(preferencesStore).get('core', 'focusMode');
817
+ registry.dispatch(noticesStore).createInfoNotice(isFocusMode ? __('Spotlight mode activated.') : __('Spotlight mode deactivated.'), {
818
+ id: 'core/editor/toggle-spotlight-mode/notice',
819
+ type: 'snackbar',
820
+ actions: [{
821
+ label: __('Undo'),
822
+ onClick: () => {
823
+ registry.dispatch(preferencesStore).toggle('core', 'focusMode');
824
+ }
825
+ }]
826
+ });
827
+ };
828
+
829
+ /**
830
+ * Action that toggles the Top Toolbar view option.
831
+ */
832
+ export const toggleTopToolbar = () => ({
833
+ registry
834
+ }) => {
835
+ registry.dispatch(preferencesStore).toggle('core', 'fixedToolbar');
836
+ const isTopToolbar = registry.select(preferencesStore).get('core', 'fixedToolbar');
837
+ registry.dispatch(noticesStore).createInfoNotice(isTopToolbar ? __('Top toolbar activated.') : __('Top toolbar deactivated.'), {
838
+ id: 'core/editor/toggle-top-toolbar/notice',
839
+ type: 'snackbar',
840
+ actions: [{
841
+ label: __('Undo'),
842
+ onClick: () => {
843
+ registry.dispatch(preferencesStore).toggle('core', 'fixedToolbar');
844
+ }
845
+ }]
799
846
  });
800
847
  };
801
848