@wordpress/edit-post 6.10.0 → 6.12.1-next.d6164808d3.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 (42) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -7
  3. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  4. package/build/components/header/header-toolbar/index.js +9 -7
  5. package/build/components/header/header-toolbar/index.js.map +1 -1
  6. package/build/components/header/template-title/delete-template.js +1 -1
  7. package/build/components/header/template-title/delete-template.js.map +1 -1
  8. package/build/components/sidebar/post-template/form.js +9 -4
  9. package/build/components/sidebar/post-template/form.js.map +1 -1
  10. package/build/components/sidebar/post-template/index.js +16 -14
  11. package/build/components/sidebar/post-template/index.js.map +1 -1
  12. package/build/components/visual-editor/index.js +19 -8
  13. package/build/components/visual-editor/index.js.map +1 -1
  14. package/build/editor.js +7 -2
  15. package/build/editor.js.map +1 -1
  16. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -6
  17. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  18. package/build-module/components/header/header-toolbar/index.js +10 -7
  19. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  20. package/build-module/components/header/template-title/delete-template.js +1 -1
  21. package/build-module/components/header/template-title/delete-template.js.map +1 -1
  22. package/build-module/components/sidebar/post-template/form.js +9 -4
  23. package/build-module/components/sidebar/post-template/form.js.map +1 -1
  24. package/build-module/components/sidebar/post-template/index.js +15 -14
  25. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  26. package/build-module/components/visual-editor/index.js +20 -9
  27. package/build-module/components/visual-editor/index.js.map +1 -1
  28. package/build-module/editor.js +7 -2
  29. package/build-module/editor.js.map +1 -1
  30. package/build-style/style-rtl.css +1 -9
  31. package/build-style/style.css +1 -9
  32. package/package.json +27 -27
  33. package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -6
  34. package/src/components/header/header-toolbar/index.js +11 -10
  35. package/src/components/header/header-toolbar/style.scss +2 -5
  36. package/src/components/header/style.scss +0 -6
  37. package/src/components/header/template-title/delete-template.js +1 -1
  38. package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +28 -0
  39. package/src/components/sidebar/post-template/form.js +13 -16
  40. package/src/components/sidebar/post-template/index.js +12 -9
  41. package/src/components/visual-editor/index.js +31 -25
  42. package/src/editor.js +6 -2
@@ -38,6 +38,7 @@ function Editor(_ref) {
38
38
  hasFixedToolbar,
39
39
  focusMode,
40
40
  hasReducedUI,
41
+ hasInlineToolbar,
41
42
  hasThemeStyles,
42
43
  post,
43
44
  preferredStyleVariations,
@@ -59,7 +60,8 @@ function Editor(_ref) {
59
60
  const {
60
61
  getEntityRecord,
61
62
  getPostType,
62
- getEntityRecords
63
+ getEntityRecords,
64
+ canUser
63
65
  } = select(coreStore);
64
66
  const {
65
67
  getEditorSettings
@@ -83,17 +85,19 @@ function Editor(_ref) {
83
85
 
84
86
  const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
85
87
  const isViewable = (_getPostType$viewable = (_getPostType = getPostType(postType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
88
+ const canEditTemplate = canUser('create', 'templates');
86
89
  return {
87
90
  hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
88
91
  focusMode: isFeatureActive('focusMode'),
89
92
  hasReducedUI: isFeatureActive('reducedUI'),
93
+ hasInlineToolbar: isFeatureActive('inlineToolbar'),
90
94
  hasThemeStyles: isFeatureActive('themeStyles'),
91
95
  preferredStyleVariations: select(preferencesStore).get('core/edit-post', 'preferredStyleVariations'),
92
96
  hiddenBlockTypes: getHiddenBlockTypes(),
93
97
  blockTypes: getBlockTypes(),
94
98
  keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'),
95
99
  isTemplateMode: isEditingTemplate(),
96
- template: supportsTemplateMode && isViewable ? getEditedPostTemplate() : null,
100
+ template: supportsTemplateMode && isViewable && canEditTemplate ? getEditedPostTemplate() : null,
97
101
  post: postObject
98
102
  };
99
103
  }, [postType, postId]);
@@ -110,6 +114,7 @@ function Editor(_ref) {
110
114
  hasFixedToolbar,
111
115
  focusMode,
112
116
  hasReducedUI,
117
+ hasInlineToolbar,
113
118
  // This is marked as experimental to give time for the quick inserter to mature.
114
119
  __experimentalSetIsInserterOpened: setIsInserterOpened,
115
120
  keepCaretInsideBlock,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["forEach","map","without","store","blocksStore","useSelect","useDispatch","EditorProvider","ErrorBoundary","PostLockedModal","editorStore","StrictMode","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","Layout","EditorInitialization","editPostStore","Editor","postId","postType","settings","initialEdits","onError","props","hasFixedToolbar","focusMode","hasReducedUI","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","styles","themeStyles","presetStyles","style","__unstableType","push","defaultEditorStyles","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,OAAT,EAAkBC,GAAlB,EAAuBC,OAAvB,QAAsC,QAAtC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,cADD,EAECC,aAFD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ACAvE,IAAAA,OAAO,CAAEuB,QAAQ,CAAC8C,MAAX,EAAqBG,KAAF,IAAa;AACtC,UAAK,CAAEA,KAAK,CAACC,cAAR,IAA0BD,KAAK,CAACC,cAAN,KAAyB,OAAxD,EAAkE;AACjEH,QAAAA,WAAW,CAACI,IAAZ,CAAkBF,KAAlB;AACA,OAFD,MAEO;AACND,QAAAA,YAAY,CAACG,IAAb,CAAmBF,KAAnB;AACA;AACD,KANM,CAAP;AAOA,UAAMG,mBAAmB,GAAG,CAC3B,GAAGpD,QAAQ,CAACoD,mBADe,EAE3B,GAAGJ,YAFwB,CAA5B;AAIA,WAAOzC,cAAc,IAAIwC,WAAW,CAACF,MAA9B,GACJ7C,QAAQ,CAAC8C,MADL,GAEJM,mBAFH;AAGA,GAjBqB,EAiBnB,CAAEpD,QAAF,EAAYO,cAAZ,CAjBmB,CAAtB;;AAmBA,MAAK,CAAEC,IAAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,cAAC,UAAD,QACC,cAAC,gBAAD,QACC,cAAC,gBAAD,QACC,cAAC,cAAD;AACC,IAAA,QAAQ,EAAG6B,cADZ;AAEC,IAAA,IAAI,EAAG7B,IAFR;AAGC,IAAA,YAAY,EAAGP,YAHhB;AAIC,IAAA,cAAc,EAAG,KAJlB;AAKC,IAAA,kBAAkB,EACjBY,cAAc,GAAGC,QAAH,GAAcuC;AAN9B,KAQMlD,KARN,GAUC,cAAC,aAAD;AAAe,IAAA,OAAO,EAAGD;AAAzB,KACC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IADD,EAEC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGgD;AAAjB,IAFD,CAVD,EAcC,cAAC,eAAD,OAdD,CADD,CADD,CADD,CADD;AAwBA;;AAED,eAAejD,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { forEach, map, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tEditorProvider,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { StrictMode, useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\n\nfunction Editor( {\n\tpostId,\n\tpostType,\n\tsettings,\n\tinitialEdits,\n\tonError,\n\t...props\n} ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\thasReducedUI: isFeatureActive( 'reducedUI' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thasReducedUI,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? map( blockTypes, 'name' )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = without(\n\t\t\t\tdefaultAllowedBlockTypes,\n\t\t\t\t...hiddenBlockTypes\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tforEach( settings.styles, ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StrictMode>\n\t\t\t<ShortcutProvider>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ post }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\t\tisTemplateMode ? template : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</ShortcutProvider>\n\t\t</StrictMode>\n\t);\n}\n\nexport default Editor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/editor.js"],"names":["forEach","map","without","store","blocksStore","useSelect","useDispatch","EditorProvider","ErrorBoundary","PostLockedModal","editorStore","StrictMode","useMemo","SlotFillProvider","coreStore","ShortcutProvider","preferencesStore","Layout","EditorInitialization","editPostStore","Editor","postId","postType","settings","initialEdits","onError","props","hasFixedToolbar","focusMode","hasReducedUI","hasInlineToolbar","hasThemeStyles","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","keepCaretInsideBlock","isTemplateMode","template","select","isFeatureActive","__experimentalGetPreviewDeviceType","isEditingTemplate","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","setIsInserterOpened","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","__experimentalSetIsInserterOpened","defaultAllowedBlockTypes","allowedBlockTypes","length","styles","themeStyles","presetStyles","style","__unstableType","push","defaultEditorStyles","undefined"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,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C,QAAH,GAAcyC;AAN9B,KAQMrD,KARN,GAUC,cAAC,aAAD;AAAe,IAAA,OAAO,EAAGD;AAAzB,KACC,cAAC,oBAAD;AAAsB,IAAA,MAAM,EAAGJ;AAA/B,IADD,EAEC,cAAC,MAAD;AAAQ,IAAA,MAAM,EAAGmD;AAAjB,IAFD,CAVD,EAcC,cAAC,eAAD,OAdD,CADD,CADD,CADD,CADD;AAwBA;;AAED,eAAepD,MAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { forEach, map, without } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tEditorProvider,\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { StrictMode, useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\n\nfunction Editor( {\n\tpostId,\n\tpostType,\n\tsettings,\n\tinitialEdits,\n\tonError,\n\t...props\n} ) {\n\tconst {\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thasInlineToolbar,\n\t\thasThemeStyles,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tkeepCaretInsideBlock,\n\t\tisTemplateMode,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\t\tisEditingTemplate,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tpostType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords( 'postType', postType, {\n\t\t\t\t\twp_id: postId,\n\t\t\t\t} );\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord( 'postType', postType, postId );\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable = getPostType( postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\n\t\t\treturn {\n\t\t\t\thasFixedToolbar:\n\t\t\t\t\tisFeatureActive( 'fixedToolbar' ) ||\n\t\t\t\t\t__experimentalGetPreviewDeviceType() !== 'Desktop',\n\t\t\t\tfocusMode: isFeatureActive( 'focusMode' ),\n\t\t\t\thasReducedUI: isFeatureActive( 'reducedUI' ),\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\thasThemeStyles: isFeatureActive( 'themeStyles' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\tkeepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),\n\t\t\t\tisTemplateMode: isEditingTemplate(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations, setIsInserterOpened } =\n\t\tuseDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasFixedToolbar,\n\t\t\tfocusMode,\n\t\t\thasReducedUI,\n\t\t\thasInlineToolbar,\n\n\t\t\t// This is marked as experimental to give time for the quick inserter to mature.\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? map( blockTypes, 'name' )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = without(\n\t\t\t\tdefaultAllowedBlockTypes,\n\t\t\t\t...hiddenBlockTypes\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasFixedToolbar,\n\t\tfocusMode,\n\t\thasReducedUI,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tsetIsInserterOpened,\n\t\tupdatePreferredStyleVariations,\n\t\tkeepCaretInsideBlock,\n\t] );\n\n\tconst styles = useMemo( () => {\n\t\tconst themeStyles = [];\n\t\tconst presetStyles = [];\n\t\tforEach( settings.styles, ( style ) => {\n\t\t\tif ( ! style.__unstableType || style.__unstableType === 'theme' ) {\n\t\t\t\tthemeStyles.push( style );\n\t\t\t} else {\n\t\t\t\tpresetStyles.push( style );\n\t\t\t}\n\t\t} );\n\t\tconst defaultEditorStyles = [\n\t\t\t...settings.defaultEditorStyles,\n\t\t\t...presetStyles,\n\t\t];\n\t\treturn hasThemeStyles && themeStyles.length\n\t\t\t? settings.styles\n\t\t\t: defaultEditorStyles;\n\t}, [ settings, hasThemeStyles ] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StrictMode>\n\t\t\t<ShortcutProvider>\n\t\t\t\t<SlotFillProvider>\n\t\t\t\t\t<EditorProvider\n\t\t\t\t\t\tsettings={ editorSettings }\n\t\t\t\t\t\tpost={ post }\n\t\t\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t\t\t__unstableTemplate={\n\t\t\t\t\t\t\tisTemplateMode ? template : undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ErrorBoundary onError={ onError }>\n\t\t\t\t\t\t\t<EditorInitialization postId={ postId } />\n\t\t\t\t\t\t\t<Layout styles={ styles } />\n\t\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t\t\t<PostLockedModal />\n\t\t\t\t\t</EditorProvider>\n\t\t\t\t</SlotFillProvider>\n\t\t\t</ShortcutProvider>\n\t\t</StrictMode>\n\t);\n}\n\nexport default Editor;\n"]}
@@ -686,11 +686,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
686
686
  padding-left: 12px;
687
687
  }
688
688
  }
689
- .show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
690
- .show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
691
- .edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after {
692
- content: none;
693
- }
694
689
  .show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft::after,
695
690
  .show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft::after,
696
691
  .edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft::after {
@@ -907,11 +902,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
907
902
  padding: 0;
908
903
  }
909
904
  .show-icon-labels .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon {
910
- height: 36px;
911
- }
912
-
913
- .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-text.has-icon {
914
905
  width: auto;
906
+ height: 36px;
915
907
  padding: 0 8px;
916
908
  }
917
909
 
@@ -686,11 +686,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
686
686
  padding-right: 12px;
687
687
  }
688
688
  }
689
- .show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
690
- .show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
691
- .edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after {
692
- content: none;
693
- }
694
689
  .show-icon-labels.interface-pinned-items .editor-post-save-draft.editor-post-save-draft::after,
695
690
  .show-icon-labels .edit-post-header .editor-post-save-draft.editor-post-save-draft::after,
696
691
  .edit-post-header__dropdown .editor-post-save-draft.editor-post-save-draft::after {
@@ -907,11 +902,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
907
902
  padding: 0;
908
903
  }
909
904
  .show-icon-labels .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon {
910
- height: 36px;
911
- }
912
-
913
- .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-text.has-icon {
914
905
  width: auto;
906
+ height: 36px;
915
907
  padding: 0 8px;
916
908
  }
917
909
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "6.10.0",
3
+ "version": "6.12.1-next.d6164808d3.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,31 +27,31 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.13.0",
31
- "@wordpress/api-fetch": "^6.10.0",
32
- "@wordpress/block-editor": "^9.5.0",
33
- "@wordpress/block-library": "^7.10.0",
34
- "@wordpress/blocks": "^11.12.0",
35
- "@wordpress/components": "^19.15.0",
36
- "@wordpress/compose": "^5.11.0",
37
- "@wordpress/core-data": "^4.11.0",
38
- "@wordpress/data": "^6.13.0",
39
- "@wordpress/deprecated": "^3.13.0",
40
- "@wordpress/editor": "^12.12.0",
41
- "@wordpress/element": "^4.11.0",
42
- "@wordpress/hooks": "^3.13.0",
43
- "@wordpress/i18n": "^4.13.0",
44
- "@wordpress/icons": "^9.4.0",
45
- "@wordpress/interface": "^4.12.0",
46
- "@wordpress/keyboard-shortcuts": "^3.11.0",
47
- "@wordpress/keycodes": "^3.13.0",
48
- "@wordpress/media-utils": "^4.4.0",
49
- "@wordpress/notices": "^3.13.0",
50
- "@wordpress/plugins": "^4.11.0",
51
- "@wordpress/preferences": "^2.5.0",
52
- "@wordpress/url": "^3.14.0",
53
- "@wordpress/viewport": "^4.11.0",
54
- "@wordpress/warning": "^2.13.0",
30
+ "@wordpress/a11y": "^3.15.1-next.d6164808d3.0",
31
+ "@wordpress/api-fetch": "^6.12.1-next.d6164808d3.0",
32
+ "@wordpress/block-editor": "^9.7.1-next.d6164808d3.0",
33
+ "@wordpress/block-library": "^7.12.2-next.d6164808d3.0",
34
+ "@wordpress/blocks": "^11.14.1-next.d6164808d3.0",
35
+ "@wordpress/components": "^20.0.1-next.d6164808d3.0",
36
+ "@wordpress/compose": "^5.13.1-next.d6164808d3.0",
37
+ "@wordpress/core-data": "^4.14.1-next.d6164808d3.0",
38
+ "@wordpress/data": "^7.0.1-next.d6164808d3.0",
39
+ "@wordpress/deprecated": "^3.15.1-next.d6164808d3.0",
40
+ "@wordpress/editor": "^12.14.1-next.d6164808d3.0",
41
+ "@wordpress/element": "^4.13.1-next.d6164808d3.0",
42
+ "@wordpress/hooks": "^3.15.1-next.d6164808d3.0",
43
+ "@wordpress/i18n": "^4.15.1-next.d6164808d3.0",
44
+ "@wordpress/icons": "^9.6.1-next.d6164808d3.0",
45
+ "@wordpress/interface": "^4.14.1-next.d6164808d3.0",
46
+ "@wordpress/keyboard-shortcuts": "^3.13.1-next.d6164808d3.0",
47
+ "@wordpress/keycodes": "^3.15.1-next.d6164808d3.0",
48
+ "@wordpress/media-utils": "^4.6.1-next.d6164808d3.0",
49
+ "@wordpress/notices": "^3.15.1-next.d6164808d3.0",
50
+ "@wordpress/plugins": "^4.13.1-next.d6164808d3.0",
51
+ "@wordpress/preferences": "^2.7.1-next.d6164808d3.0",
52
+ "@wordpress/url": "^3.16.1-next.d6164808d3.0",
53
+ "@wordpress/viewport": "^4.13.1-next.d6164808d3.0",
54
+ "@wordpress/warning": "^2.15.1-next.d6164808d3.0",
55
55
  "classnames": "^2.3.1",
56
56
  "lodash": "^4.17.21",
57
57
  "memize": "^1.1.0",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "9d9d33bbdf317a4381b8ca1713e43bb50df653b3"
67
+ "gitHead": "ba8a396d2f418e53a6c4c50575582f3f3eb11ff7"
68
68
  }
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { difference } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -11,7 +6,7 @@ import { MenuItem } from '@wordpress/components';
11
6
  import { compose } from '@wordpress/compose';
12
7
 
13
8
  const isEverySelectedBlockAllowed = ( selected, allowed ) =>
14
- difference( selected, allowed ).length === 0;
9
+ selected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;
15
10
 
16
11
  /**
17
12
  * Plugins may want to add an item to the menu either for every block
@@ -95,6 +95,7 @@ function HeaderToolbar() {
95
95
  onClick={ toggleListView }
96
96
  shortcut={ listViewShortcut }
97
97
  showTooltip={ ! showIconLabels }
98
+ variant={ showIconLabels ? 'tertiary' : undefined }
98
99
  />
99
100
  </>
100
101
  );
@@ -106,6 +107,14 @@ function HeaderToolbar() {
106
107
  setIsInserterOpened( true );
107
108
  }
108
109
  }, [ isInserterOpened, setIsInserterOpened ] );
110
+
111
+ /* translators: button label text should, if possible, be under 16 characters. */
112
+ const longLabel = _x(
113
+ 'Toggle block inserter',
114
+ 'Generic label for block inserter button'
115
+ );
116
+ const shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );
117
+
109
118
  return (
110
119
  <NavigableToolbar
111
120
  className="edit-post-header-toolbar"
@@ -122,17 +131,9 @@ function HeaderToolbar() {
122
131
  onClick={ openInserter }
123
132
  disabled={ ! isInserterEnabled }
124
133
  icon={ plus }
125
- /* translators: button label text should, if possible, be under 16
126
- characters. */
127
- label={ _x(
128
- 'Toggle block inserter',
129
- 'Generic label for block inserter button'
130
- ) }
134
+ label={ showIconLabels ? shortLabel : longLabel }
131
135
  showTooltip={ ! showIconLabels }
132
- >
133
- { showIconLabels &&
134
- ( ! isInserterOpened ? __( 'Add' ) : __( 'Close' ) ) }
135
- </ToolbarItem>
136
+ />
136
137
  { ( isWideViewport || ! showIconLabels ) && (
137
138
  <>
138
139
  { isLargeViewport && (
@@ -101,15 +101,12 @@
101
101
  padding: 0;
102
102
 
103
103
  .show-icon-labels & {
104
+ width: auto;
104
105
  height: 36px;
106
+ padding: 0 $grid-unit-10;
105
107
  }
106
108
  }
107
109
 
108
- .edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-text.has-icon {
109
- width: auto;
110
- padding: 0 $grid-unit-10;
111
- }
112
-
113
110
  .show-icon-labels .edit-post-header-toolbar__left > * + * {
114
111
  margin-left: $grid-unit-10;
115
112
  }
@@ -146,12 +146,6 @@
146
146
  }
147
147
  }
148
148
 
149
- // The inserter has a custom label, different from its aria-label, so we don't want to display both.
150
- .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle {
151
- &::after {
152
- content: none;
153
- }
154
- }
155
149
  // The post saved state button has a custom label only on small breakpoint
156
150
  .editor-post-save-draft.editor-post-save-draft {
157
151
  &::after {
@@ -84,7 +84,7 @@ export default function DeleteTemplate() {
84
84
  } }
85
85
  info={
86
86
  isRevertable
87
- ? __( 'Restore template to default state' )
87
+ ? __( 'Use the template as supplied by the theme.' )
88
88
  : undefined
89
89
  }
90
90
  >
@@ -4,6 +4,13 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
4
4
  .emotion-0 {
5
5
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
6
6
  font-size: 13px;
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ .emotion-0 *,
11
+ .emotion-0 *::before,
12
+ .emotion-0 *::after {
13
+ box-sizing: inherit;
7
14
  }
8
15
 
9
16
  .emotion-2 {
@@ -67,6 +74,13 @@ exports[`EnableCustomFieldsOption renders a checked checkbox when custom fields
67
74
  .emotion-0 {
68
75
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
69
76
  font-size: 13px;
77
+ box-sizing: border-box;
78
+ }
79
+
80
+ .emotion-0 *,
81
+ .emotion-0 *::before,
82
+ .emotion-0 *::after {
83
+ box-sizing: inherit;
70
84
  }
71
85
 
72
86
  .emotion-2 {
@@ -116,6 +130,13 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
116
130
  .emotion-0 {
117
131
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
118
132
  font-size: 13px;
133
+ box-sizing: border-box;
134
+ }
135
+
136
+ .emotion-0 *,
137
+ .emotion-0 *::before,
138
+ .emotion-0 *::after {
139
+ box-sizing: inherit;
119
140
  }
120
141
 
121
142
  .emotion-2 {
@@ -179,6 +200,13 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox when custom fiel
179
200
  .emotion-0 {
180
201
  font-family: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
181
202
  font-size: 13px;
203
+ box-sizing: border-box;
204
+ }
205
+
206
+ .emotion-0 *,
207
+ .emotion-0 *::before,
208
+ .emotion-0 *::after {
209
+ box-sizing: inherit;
182
210
  }
183
211
 
184
212
  .emotion-2 {
@@ -25,29 +25,26 @@ export default function PostTemplateForm( { onClose } ) {
25
25
  canCreate,
26
26
  canEdit,
27
27
  } = useSelect( ( select ) => {
28
+ const { canUser, getEntityRecord, getEntityRecords } =
29
+ select( coreStore );
28
30
  const editorSettings = select( editorStore ).getEditorSettings();
29
- const siteSettings = select( coreStore ).getEntityRecord(
30
- 'root',
31
- 'site'
32
- );
31
+ const siteSettings = canUser( 'read', 'settings' )
32
+ ? getEntityRecord( 'root', 'site' )
33
+ : undefined;
33
34
  const _isPostsPage =
34
35
  select( editorStore ).getCurrentPostId() ===
35
36
  siteSettings?.page_for_posts;
36
- const canCreateTemplates = select( coreStore ).canUser(
37
- 'create',
38
- 'templates'
39
- );
37
+ const canCreateTemplates = canUser( 'create', 'templates' );
38
+
40
39
  return {
41
40
  isPostsPage: _isPostsPage,
42
41
  availableTemplates: editorSettings.availableTemplates,
43
- fetchedTemplates: select( coreStore ).getEntityRecords(
44
- 'postType',
45
- 'wp_template',
46
- {
47
- post_type: select( editorStore ).getCurrentPostType(),
48
- per_page: -1,
49
- }
50
- ),
42
+ fetchedTemplates: canCreateTemplates
43
+ ? getEntityRecords( 'postType', 'wp_template', {
44
+ post_type: select( editorStore ).getCurrentPostType(),
45
+ per_page: -1,
46
+ } )
47
+ : undefined,
51
48
  selectedTemplateSlug:
52
49
  select( editorStore ).getEditedPostAttribute( 'template' ),
53
50
  canCreate:
@@ -12,6 +12,7 @@ import { store as coreStore } from '@wordpress/core-data';
12
12
  * Internal dependencies
13
13
  */
14
14
  import PostTemplateForm from './form';
15
+ import { store as editPostStore } from '../../../store';
15
16
 
16
17
  export default function PostTemplate() {
17
18
  const anchorRef = useRef();
@@ -27,7 +28,11 @@ export default function PostTemplate() {
27
28
  const hasTemplates =
28
29
  !! settings.availableTemplates &&
29
30
  Object.keys( settings.availableTemplates ).length > 0;
30
- if ( ! hasTemplates && ! settings.supportsTemplateMode ) {
31
+ if ( hasTemplates ) {
32
+ return true;
33
+ }
34
+
35
+ if ( ! settings.supportsTemplateMode ) {
31
36
  return false;
32
37
  }
33
38
 
@@ -68,16 +73,14 @@ function PostTemplateToggle( { isOpen, onClick } ) {
68
73
  const templateSlug =
69
74
  select( editorStore ).getEditedPostAttribute( 'template' );
70
75
 
71
- const settings = select( editorStore ).getEditorSettings();
72
- if ( settings.availableTemplates[ templateSlug ] ) {
73
- return settings.availableTemplates[ templateSlug ];
76
+ const { supportsTemplateMode, availableTemplates } =
77
+ select( editorStore ).getEditorSettings();
78
+ if ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {
79
+ return availableTemplates[ templateSlug ];
74
80
  }
75
81
 
76
- const template = select( coreStore )
77
- .getEntityRecords( 'postType', 'wp_template', { per_page: -1 } )
78
- ?.find( ( { slug } ) => slug === templateSlug );
79
-
80
- return template?.title.rendered;
82
+ const template = select( editPostStore ).getEditedPostTemplate();
83
+ return template?.title ?? template?.slug;
81
84
  }, [] );
82
85
 
83
86
  return (
@@ -27,7 +27,7 @@ import {
27
27
  __experimentalLayoutStyle as LayoutStyle,
28
28
  __unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,
29
29
  __unstableIframe as Iframe,
30
- __experimentalUseNoRecursiveRenders as useNoRecursiveRenders,
30
+ __experimentalRecursionProvider as RecursionProvider,
31
31
  } from '@wordpress/block-editor';
32
32
  import { useEffect, useRef, useMemo } from '@wordpress/element';
33
33
  import { Button, __unstableMotion as motion } from '@wordpress/components';
@@ -118,13 +118,15 @@ export default function VisualEditor( { styles } ) {
118
118
  ( select ) => select( editPostStore ).hasMetaBoxes(),
119
119
  []
120
120
  );
121
- const { themeSupportsLayout, assets } = useSelect( ( select ) => {
122
- const _settings = select( blockEditorStore ).getSettings();
123
- return {
124
- themeSupportsLayout: _settings.supportsLayout,
125
- assets: _settings.__unstableResolvedAssets,
126
- };
127
- }, [] );
121
+ const { themeHasDisabledLayoutStyles, themeSupportsLayout, assets } =
122
+ useSelect( ( select ) => {
123
+ const _settings = select( blockEditorStore ).getSettings();
124
+ return {
125
+ themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
126
+ themeSupportsLayout: _settings.supportsLayout,
127
+ assets: _settings.__unstableResolvedAssets,
128
+ };
129
+ }, [] );
128
130
  const { clearSelectedBlock } = useDispatch( blockEditorStore );
129
131
  const { setIsEditingTemplate } = useDispatch( editPostStore );
130
132
  const desktopCanvasStyles = {
@@ -173,21 +175,18 @@ export default function VisualEditor( { styles } ) {
173
175
 
174
176
  const blockSelectionClearerRef = useBlockSelectionClearer();
175
177
 
176
- const [ , RecursionProvider ] = useNoRecursiveRenders(
177
- wrapperUniqueId,
178
- wrapperBlockName
179
- );
180
-
181
178
  const layout = useMemo( () => {
182
179
  if ( isTemplateMode ) {
183
180
  return { type: 'default' };
184
181
  }
185
182
 
186
183
  if ( themeSupportsLayout ) {
187
- return defaultLayout;
184
+ // We need to ensure support for wide and full alignments,
185
+ // so we add the constrained type.
186
+ return { ...defaultLayout, type: 'constrained' };
188
187
  }
189
-
190
- return undefined;
188
+ // Set constrained layout for classic themes so all alignments are supported.
189
+ return { type: 'constrained' };
191
190
  }, [ isTemplateMode, themeSupportsLayout, defaultLayout ] );
192
191
 
193
192
  const titleRef = useRef();
@@ -241,13 +240,17 @@ export default function VisualEditor( { styles } ) {
241
240
  assets={ assets }
242
241
  style={ { paddingBottom } }
243
242
  >
244
- { themeSupportsLayout && ! isTemplateMode && (
245
- <LayoutStyle
246
- selector=".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container"
247
- layout={ defaultLayout }
248
- layoutDefinitions={ defaultLayout?.definitions }
249
- />
250
- ) }
243
+ { themeSupportsLayout &&
244
+ ! themeHasDisabledLayoutStyles &&
245
+ ! isTemplateMode && (
246
+ <LayoutStyle
247
+ selector=".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container"
248
+ layout={ layout }
249
+ layoutDefinitions={
250
+ defaultLayout?.definitions
251
+ }
252
+ />
253
+ ) }
251
254
  { ! isTemplateMode && (
252
255
  <div
253
256
  className="edit-post-visual-editor__post-title-wrapper"
@@ -256,12 +259,15 @@ export default function VisualEditor( { styles } ) {
256
259
  <PostTitle ref={ titleRef } />
257
260
  </div>
258
261
  ) }
259
- <RecursionProvider>
262
+ <RecursionProvider
263
+ blockName={ wrapperBlockName }
264
+ uniqueId={ wrapperUniqueId }
265
+ >
260
266
  <BlockList
261
267
  className={
262
268
  isTemplateMode
263
269
  ? 'wp-site-blocks'
264
- : 'is-layout-flow' // Ensure root level blocks receive default/flow blockGap styling rules.
270
+ : 'is-layout-constrained' // Ensure root level blocks receive default/flow blockGap styling rules.
265
271
  }
266
272
  __experimentalLayout={ layout }
267
273
  />
package/src/editor.js CHANGED
@@ -39,6 +39,7 @@ function Editor( {
39
39
  hasFixedToolbar,
40
40
  focusMode,
41
41
  hasReducedUI,
42
+ hasInlineToolbar,
42
43
  hasThemeStyles,
43
44
  post,
44
45
  preferredStyleVariations,
@@ -56,7 +57,7 @@ function Editor( {
56
57
  getEditedPostTemplate,
57
58
  getHiddenBlockTypes,
58
59
  } = select( editPostStore );
59
- const { getEntityRecord, getPostType, getEntityRecords } =
60
+ const { getEntityRecord, getPostType, getEntityRecords, canUser } =
60
61
  select( coreStore );
61
62
  const { getEditorSettings } = select( editorStore );
62
63
  const { getBlockTypes } = select( blocksStore );
@@ -77,6 +78,7 @@ function Editor( {
77
78
  const supportsTemplateMode =
78
79
  getEditorSettings().supportsTemplateMode;
79
80
  const isViewable = getPostType( postType )?.viewable ?? false;
81
+ const canEditTemplate = canUser( 'create', 'templates' );
80
82
 
81
83
  return {
82
84
  hasFixedToolbar:
@@ -84,6 +86,7 @@ function Editor( {
84
86
  __experimentalGetPreviewDeviceType() !== 'Desktop',
85
87
  focusMode: isFeatureActive( 'focusMode' ),
86
88
  hasReducedUI: isFeatureActive( 'reducedUI' ),
89
+ hasInlineToolbar: isFeatureActive( 'inlineToolbar' ),
87
90
  hasThemeStyles: isFeatureActive( 'themeStyles' ),
88
91
  preferredStyleVariations: select( preferencesStore ).get(
89
92
  'core/edit-post',
@@ -94,7 +97,7 @@ function Editor( {
94
97
  keepCaretInsideBlock: isFeatureActive( 'keepCaretInsideBlock' ),
95
98
  isTemplateMode: isEditingTemplate(),
96
99
  template:
97
- supportsTemplateMode && isViewable
100
+ supportsTemplateMode && isViewable && canEditTemplate
98
101
  ? getEditedPostTemplate()
99
102
  : null,
100
103
  post: postObject,
@@ -116,6 +119,7 @@ function Editor( {
116
119
  hasFixedToolbar,
117
120
  focusMode,
118
121
  hasReducedUI,
122
+ hasInlineToolbar,
119
123
 
120
124
  // This is marked as experimental to give time for the quick inserter to mature.
121
125
  __experimentalSetIsInserterOpened: setIsInserterOpened,