@wordpress/edit-post 6.3.0 → 6.4.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 (38) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/header/header-toolbar/index.native.js +25 -7
  3. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  4. package/build/components/layout/index.js +7 -4
  5. package/build/components/layout/index.js.map +1 -1
  6. package/build/components/layout/index.native.js +5 -3
  7. package/build/components/layout/index.native.js.map +1 -1
  8. package/build/components/sidebar/plugin-document-setting-panel/index.js +0 -1
  9. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  10. package/build/components/start-page-options/index.js +116 -0
  11. package/build/components/start-page-options/index.js.map +1 -0
  12. package/build/components/visual-editor/index.js +19 -1
  13. package/build/components/visual-editor/index.js.map +1 -1
  14. package/build-module/components/header/header-toolbar/index.native.js +26 -8
  15. package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
  16. package/build-module/components/layout/index.js +6 -4
  17. package/build-module/components/layout/index.js.map +1 -1
  18. package/build-module/components/layout/index.native.js +5 -3
  19. package/build-module/components/layout/index.native.js.map +1 -1
  20. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +0 -1
  21. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  22. package/build-module/components/start-page-options/index.js +103 -0
  23. package/build-module/components/start-page-options/index.js.map +1 -0
  24. package/build-module/components/visual-editor/index.js +20 -2
  25. package/build-module/components/visual-editor/index.js.map +1 -1
  26. package/build-style/style-rtl.css +38 -0
  27. package/build-style/style.css +38 -0
  28. package/package.json +27 -27
  29. package/src/components/header/header-toolbar/index.native.js +45 -8
  30. package/src/components/header/header-toolbar/style.native.scss +8 -4
  31. package/src/components/layout/index.js +10 -2
  32. package/src/components/layout/index.native.js +8 -5
  33. package/src/components/sidebar/plugin-document-setting-panel/index.js +0 -1
  34. package/src/components/start-page-options/index.js +121 -0
  35. package/src/components/start-page-options/style.scss +42 -0
  36. package/src/components/visual-editor/index.js +14 -2
  37. package/src/style.scss +1 -0
  38. package/src/test/editor.native.js +3 -1
@@ -10,7 +10,7 @@ import classnames from 'classnames';
10
10
 
11
11
  import { VisualEditorGlobalKeyboardShortcuts, PostTitle, store as editorStore } from '@wordpress/editor';
12
12
  import { WritingFlow, BlockList, BlockTools, store as blockEditorStore, __unstableUseBlockSelectionClearer as useBlockSelectionClearer, __unstableUseTypewriter as useTypewriter, __unstableUseClipboardHandler as useClipboardHandler, __unstableUseTypingObserver as useTypingObserver, __unstableBlockSettingsMenuFirstItem, __experimentalUseResizeCanvas as useResizeCanvas, __unstableEditorStyles as EditorStyles, useSetting, __experimentalLayoutStyle as LayoutStyle, __unstableUseMouseMoveTypingReset as useMouseMoveTypingReset, __unstableIframe as Iframe, __experimentalUseNoRecursiveRenders as useNoRecursiveRenders } from '@wordpress/block-editor';
13
- import { useRef, useMemo } from '@wordpress/element';
13
+ import { useEffect, useRef, useMemo } from '@wordpress/element';
14
14
  import { Button, __unstableMotion as motion } from '@wordpress/components';
15
15
  import { useSelect, useDispatch } from '@wordpress/data';
16
16
  import { useMergeRefs } from '@wordpress/compose';
@@ -70,11 +70,13 @@ export default function VisualEditor(_ref2) {
70
70
  } = _ref2;
71
71
  const {
72
72
  deviceType,
73
+ isWelcomeGuideVisible,
73
74
  isTemplateMode,
74
75
  wrapperBlockName,
75
76
  wrapperUniqueId
76
77
  } = useSelect(select => {
77
78
  const {
79
+ isFeatureActive,
78
80
  isEditingTemplate,
79
81
  __experimentalGetPreviewDeviceType
80
82
  } = select(editPostStore);
@@ -95,11 +97,15 @@ export default function VisualEditor(_ref2) {
95
97
 
96
98
  return {
97
99
  deviceType: __experimentalGetPreviewDeviceType(),
100
+ isWelcomeGuideVisible: isFeatureActive('welcomeGuide'),
98
101
  isTemplateMode: _isTemplateMode,
99
102
  wrapperBlockName: _wrapperBlockName,
100
103
  wrapperUniqueId: getCurrentPostId()
101
104
  };
102
105
  }, []);
106
+ const {
107
+ isCleanNewPost
108
+ } = useSelect(editorStore);
103
109
  const hasMetaBoxes = useSelect(select => select(editPostStore).hasMetaBoxes(), []);
104
110
  const {
105
111
  themeSupportsLayout,
@@ -166,6 +172,16 @@ export default function VisualEditor(_ref2) {
166
172
 
167
173
  return undefined;
168
174
  }, [isTemplateMode, themeSupportsLayout, defaultLayout]);
175
+ const titleRef = useRef();
176
+ useEffect(() => {
177
+ var _titleRef$current;
178
+
179
+ if (isWelcomeGuideVisible || !isCleanNewPost()) {
180
+ return;
181
+ }
182
+
183
+ titleRef === null || titleRef === void 0 ? void 0 : (_titleRef$current = titleRef.current) === null || _titleRef$current === void 0 ? void 0 : _titleRef$current.focus();
184
+ }, [isWelcomeGuideVisible, isCleanNewPost]);
169
185
  return createElement(BlockTools, {
170
186
  __unstableContentRef: ref,
171
187
  className: classnames('edit-post-visual-editor', {
@@ -202,7 +218,9 @@ export default function VisualEditor(_ref2) {
202
218
  }), !isTemplateMode && createElement("div", {
203
219
  className: "edit-post-visual-editor__post-title-wrapper",
204
220
  contentEditable: false
205
- }, createElement(PostTitle, null)), createElement(RecursionProvider, null, createElement(BlockList, {
221
+ }, createElement(PostTitle, {
222
+ ref: titleRef
223
+ })), createElement(RecursionProvider, null, createElement(BlockList, {
206
224
  className: isTemplateMode ? 'wp-site-blocks' : undefined,
207
225
  __experimentalLayout: layout
208
226
  }))))), createElement(__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["classnames","VisualEditorGlobalKeyboardShortcuts","PostTitle","store","editorStore","WritingFlow","BlockList","BlockTools","blockEditorStore","__unstableUseBlockSelectionClearer","useBlockSelectionClearer","__unstableUseTypewriter","useTypewriter","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","__unstableBlockSettingsMenuFirstItem","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalUseNoRecursiveRenders","useNoRecursiveRenders","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","BlockInspectorButton","editPostStore","MaybeIframe","children","contentRef","shouldIframe","styles","assets","style","ref","flex","width","height","display","VisualEditor","deviceType","isTemplateMode","wrapperBlockName","wrapperUniqueId","select","isEditingTemplate","__experimentalGetPreviewDeviceType","getCurrentPostId","getCurrentPostType","_isTemplateMode","_wrapperBlockName","hasMetaBoxes","themeSupportsLayout","_settings","getSettings","supportsLayout","__unstableResolvedAssets","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","defaultLayout","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","RecursionProvider","layout","type","undefined","padding","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,mCADD,EAECC,SAFD,EAGCC,KAAK,IAAIC,WAHV,QAIO,mBAJP;AAKA,SACCC,WADD,EAECC,SAFD,EAGCC,UAHD,EAICJ,KAAK,IAAIK,gBAJV,EAKCC,kCAAkC,IAAIC,wBALvC,EAMCC,uBAAuB,IAAIC,aAN5B,EAOCC,6BAA6B,IAAIC,mBAPlC,EAQCC,2BAA2B,IAAIC,iBARhC,EASCC,oCATD,EAUCC,6BAA6B,IAAIC,eAVlC,EAWCC,sBAAsB,IAAIC,YAX3B,EAYCC,UAZD,EAaCC,yBAAyB,IAAIC,WAb9B,EAcCC,iCAAiC,IAAIC,uBAdtC,EAeCC,gBAAgB,IAAIC,MAfrB,EAgBCC,mCAAmC,IAAIC,qBAhBxC,QAiBO,yBAjBP;AAkBA,SAASC,MAAT,EAAiBC,OAAjB,QAAgC,oBAAhC;AACA,SA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UAAU,KAAK,QAJjB;AAMC,IAAA,UAAU,EAAGX,UANd;AAOC,IAAA,MAAM,EAAGE,MAPV;AAQC,IAAA,MAAM,EAAGC,MARV;AASC,IAAA,KAAK,EAAG;AAAEwC,MAAAA;AAAF;AATT,KAWGpB,mBAAmB,IAAI,CAAEX,cAAzB,IACD,cAAC,WAAD;AACC,IAAA,QAAQ,EAAC,kGADV;AAEC,IAAA,MAAM,EAAG2B;AAFV,IAZF,EAiBG,CAAE3B,cAAF,IACD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,eAAe,EAAG;AAFnB,KAIC,cAAC,SAAD,OAJD,CAlBF,EAyBC,cAAC,iBAAD,QACC,cAAC,SAAD;AACC,IAAA,SAAS,EACRA,cAAc,GACX,gBADW,GAEXoC,SAJL;AAMC,IAAA,oBAAoB,EAAGF;AANxB,IADD,CAzBD,CALD,CAnBD,CAPD,EAqEC,cAAC,oCAAD,QACG;AAAA,QAAE;AAAEI,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,oBAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CArED,CADD;AA6EA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n} from '@wordpress/block-editor';\nimport { useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( {\n\tchildren,\n\tcontentRef,\n\tshouldIframe,\n\tstyles,\n\tassets,\n\tstyle,\n} ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tassets={ assets }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisTemplateMode,\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst { themeSupportsLayout, assets } = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tassets: _settings.__unstableResolvedAssets,\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst defaultLayout = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\tconst [ , RecursionProvider ] = useNoRecursiveRenders(\n\t\twrapperUniqueId,\n\t\twrapperBlockName\n\t);\n\n\tconst layout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\treturn defaultLayout;\n\t\t}\n\n\t\treturn undefined;\n\t}, [ isTemplateMode, themeSupportsLayout, defaultLayout ] );\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tassets={ assets }\n\t\t\t\t\t\tstyle={ { paddingBottom } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout && ! isTemplateMode && (\n\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\tlayout={ defaultLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"edit-post-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ layout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</BlockTools>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"names":["classnames","VisualEditorGlobalKeyboardShortcuts","PostTitle","store","editorStore","WritingFlow","BlockList","BlockTools","blockEditorStore","__unstableUseBlockSelectionClearer","useBlockSelectionClearer","__unstableUseTypewriter","useTypewriter","__unstableUseClipboardHandler","useClipboardHandler","__unstableUseTypingObserver","useTypingObserver","__unstableBlockSettingsMenuFirstItem","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalUseNoRecursiveRenders","useNoRecursiveRenders","useEffect","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","BlockInspectorButton","editPostStore","MaybeIframe","children","contentRef","shouldIframe","styles","assets","style","ref","flex","width","height","display","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","wrapperBlockName","wrapperUniqueId","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getCurrentPostId","getCurrentPostType","_isTemplateMode","_wrapperBlockName","isCleanNewPost","hasMetaBoxes","themeSupportsLayout","_settings","getSettings","supportsLayout","__unstableResolvedAssets","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","defaultLayout","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","RecursionProvider","layout","type","undefined","titleRef","current","focus","padding","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AA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AEb,cAAzB,IACD,cAAC,WAAD;AACC,IAAA,QAAQ,EAAC,kGADV;AAEC,IAAA,MAAM,EAAG6B;AAFV,IAZF,EAiBG,CAAE7B,cAAF,IACD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,eAAe,EAAG;AAFnB,KAIC,cAAC,SAAD;AAAW,IAAA,GAAG,EAAGuC;AAAjB,IAJD,CAlBF,EAyBC,cAAC,iBAAD,QACC,cAAC,SAAD;AACC,IAAA,SAAS,EACRvC,cAAc,GACX,gBADW,GAEXsC,SAJL;AAMC,IAAA,oBAAoB,EAAGF;AANxB,IADD,CAzBD,CALD,CAnBD,CAPD,EAqEC,cAAC,oCAAD,QACG;AAAA,QAAE;AAAEO,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,oBAAD;AAAsB,MAAA,OAAO,EAAGA;AAAhC,MADC;AAAA,GADH,CArED,CADD;AA6EA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tVisualEditorGlobalKeyboardShortcuts,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tWritingFlow,\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseBlockSelectionClearer as useBlockSelectionClearer,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseClipboardHandler as useClipboardHandler,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__unstableBlockSettingsMenuFirstItem,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\tuseSetting,\n\t__experimentalLayoutStyle as LayoutStyle,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\t__unstableIframe as Iframe,\n\t__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { Button, __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { arrowLeft } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from './block-inspector-button';\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( {\n\tchildren,\n\tcontentRef,\n\tshouldIframe,\n\tstyles,\n\tassets,\n\tstyle,\n} ) {\n\tconst ref = useMouseMoveTypingReset();\n\n\tif ( ! shouldIframe ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<EditorStyles styles={ styles } />\n\t\t\t\t<WritingFlow\n\t\t\t\t\tref={ contentRef }\n\t\t\t\t\tclassName=\"editor-styles-wrapper\"\n\t\t\t\t\tstyle={ { flex: '1', ...style } }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</WritingFlow>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Iframe\n\t\t\thead={ <EditorStyles styles={ styles } /> }\n\t\t\tassets={ assets }\n\t\t\tref={ ref }\n\t\t\tcontentRef={ contentRef }\n\t\t\tstyle={ { width: '100%', height: '100%', display: 'block' } }\n\t\t\tname=\"editor-canvas\"\n\t\t>\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType } = select( editorStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( getCurrentPostType() === 'wp_block' ) {\n\t\t\t_wrapperBlockName = 'core/block';\n\t\t} else if ( ! _isTemplateMode ) {\n\t\t\t_wrapperBlockName = 'core/post-content';\n\t\t}\n\n\t\treturn {\n\t\t\tdeviceType: __experimentalGetPreviewDeviceType(),\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t\tisTemplateMode: _isTemplateMode,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t};\n\t}, [] );\n\tconst { isCleanNewPost } = useSelect( editorStore );\n\tconst hasMetaBoxes = useSelect(\n\t\t( select ) => select( editPostStore ).hasMetaBoxes(),\n\t\t[]\n\t);\n\tconst { themeSupportsLayout, assets } = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tassets: _settings.__unstableResolvedAssets,\n\t\t};\n\t}, [] );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmargin: 0,\n\t\tdisplay: 'flex',\n\t\tflexFlow: 'column',\n\t\t// Default background color so that grey\n\t\t// .edit-post-editor-regions__content color doesn't show through.\n\t\tbackground: 'white',\n\t};\n\tconst templateModeStyles = {\n\t\t...desktopCanvasStyles,\n\t\tborderRadius: '2px 2px 0 0',\n\t\tborder: '1px solid #ddd',\n\t\tborderBottom: 0,\n\t};\n\tconst resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );\n\tconst defaultLayout = useSetting( 'layout' );\n\tconst previewMode = 'is-' + deviceType.toLowerCase() + '-preview';\n\n\tlet animatedStyles = isTemplateMode\n\t\t? templateModeStyles\n\t\t: desktopCanvasStyles;\n\tif ( resizedCanvasStyles ) {\n\t\tanimatedStyles = resizedCanvasStyles;\n\t}\n\n\tlet paddingBottom;\n\n\t// Add a constant padding for the typewritter effect. When typing at the\n\t// bottom, there needs to be room to scroll up.\n\tif ( ! hasMetaBoxes && ! resizedCanvasStyles && ! isTemplateMode ) {\n\t\tpaddingBottom = '40vh';\n\t}\n\n\tconst ref = useRef();\n\tconst contentRef = useMergeRefs( [\n\t\tref,\n\t\tuseClipboardHandler(),\n\t\tuseTypewriter(),\n\t\tuseTypingObserver(),\n\t\tuseBlockSelectionClearer(),\n\t] );\n\n\tconst blockSelectionClearerRef = useBlockSelectionClearer();\n\n\tconst [ , RecursionProvider ] = useNoRecursiveRenders(\n\t\twrapperUniqueId,\n\t\twrapperBlockName\n\t);\n\n\tconst layout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\n\t\t\treturn { type: 'default' };\n\t\t}\n\n\t\tif ( themeSupportsLayout ) {\n\t\t\treturn defaultLayout;\n\t\t}\n\n\t\treturn undefined;\n\t}, [ isTemplateMode, themeSupportsLayout, defaultLayout ] );\n\n\tconst titleRef = useRef();\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible || ! isCleanNewPost() ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible, isCleanNewPost ] );\n\n\treturn (\n\t\t<BlockTools\n\t\t\t__unstableContentRef={ ref }\n\t\t\tclassName={ classnames( 'edit-post-visual-editor', {\n\t\t\t\t'is-template-mode': isTemplateMode,\n\t\t\t} ) }\n\t\t>\n\t\t\t<VisualEditorGlobalKeyboardShortcuts />\n\t\t\t<motion.div\n\t\t\t\tclassName=\"edit-post-visual-editor__content-area\"\n\t\t\t\tanimate={ {\n\t\t\t\t\tpadding: isTemplateMode ? '48px 48px 0' : '0',\n\t\t\t\t} }\n\t\t\t\tref={ blockSelectionClearerRef }\n\t\t\t>\n\t\t\t\t{ isTemplateMode && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-visual-editor__exit-template-mode\"\n\t\t\t\t\t\ticon={ arrowLeft }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Back' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t<motion.div\n\t\t\t\t\tanimate={ animatedStyles }\n\t\t\t\t\tinitial={ desktopCanvasStyles }\n\t\t\t\t\tclassName={ previewMode }\n\t\t\t\t>\n\t\t\t\t\t<MaybeIframe\n\t\t\t\t\t\tshouldIframe={\n\t\t\t\t\t\t\tisTemplateMode ||\n\t\t\t\t\t\t\tdeviceType === 'Tablet' ||\n\t\t\t\t\t\t\tdeviceType === 'Mobile'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\tassets={ assets }\n\t\t\t\t\t\tstyle={ { paddingBottom } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ themeSupportsLayout && ! isTemplateMode && (\n\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\tselector=\".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\tlayout={ defaultLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"edit-post-visual-editor__post-title-wrapper\"\n\t\t\t\t\t\t\t\tcontentEditable={ false }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<PostTitle ref={ titleRef } />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<RecursionProvider>\n\t\t\t\t\t\t\t<BlockList\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tisTemplateMode\n\t\t\t\t\t\t\t\t\t\t? 'wp-site-blocks'\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t__experimentalLayout={ layout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</MaybeIframe>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton onClick={ onClose } />\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</BlockTools>\n\t);\n}\n"]}
@@ -1782,6 +1782,44 @@ h2.edit-post-template-summary__title {
1782
1782
  fill: #fff;
1783
1783
  }
1784
1784
 
1785
+ @media (min-width: 600px) {
1786
+ .edit-post-start-page-options__modal {
1787
+ width: calc(100% - 32px);
1788
+ height: calc(100% - 120px);
1789
+ }
1790
+ }
1791
+ @media (min-width: 782px) {
1792
+ .edit-post-start-page-options__modal {
1793
+ width: 750px;
1794
+ }
1795
+ }
1796
+ @media (min-width: 960px) {
1797
+ .edit-post-start-page-options__modal {
1798
+ height: 70%;
1799
+ }
1800
+ }
1801
+ .edit-post-start-page-options__modal .components-modal__header {
1802
+ border-bottom: none;
1803
+ }
1804
+ .edit-post-start-page-options__modal .components-modal__content::before {
1805
+ content: none;
1806
+ }
1807
+
1808
+ .edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
1809
+ column-count: 2;
1810
+ column-gap: 24px;
1811
+ }
1812
+ .edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
1813
+ break-inside: avoid-column;
1814
+ margin-bottom: 24px;
1815
+ }
1816
+ .edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
1817
+ min-height: 100px;
1818
+ }
1819
+ .edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
1820
+ width: 100%;
1821
+ }
1822
+
1785
1823
  /**
1786
1824
  * Animations
1787
1825
  */
@@ -1786,6 +1786,44 @@ h2.edit-post-template-summary__title {
1786
1786
  fill: #fff;
1787
1787
  }
1788
1788
 
1789
+ @media (min-width: 600px) {
1790
+ .edit-post-start-page-options__modal {
1791
+ width: calc(100% - 32px);
1792
+ height: calc(100% - 120px);
1793
+ }
1794
+ }
1795
+ @media (min-width: 782px) {
1796
+ .edit-post-start-page-options__modal {
1797
+ width: 750px;
1798
+ }
1799
+ }
1800
+ @media (min-width: 960px) {
1801
+ .edit-post-start-page-options__modal {
1802
+ height: 70%;
1803
+ }
1804
+ }
1805
+ .edit-post-start-page-options__modal .components-modal__header {
1806
+ border-bottom: none;
1807
+ }
1808
+ .edit-post-start-page-options__modal .components-modal__content::before {
1809
+ content: none;
1810
+ }
1811
+
1812
+ .edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
1813
+ column-count: 2;
1814
+ column-gap: 24px;
1815
+ }
1816
+ .edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item {
1817
+ break-inside: avoid-column;
1818
+ margin-bottom: 24px;
1819
+ }
1820
+ .edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__container {
1821
+ min-height: 100px;
1822
+ }
1823
+ .edit-post-start-page-options__modal-content .block-editor-block-patterns-list .block-editor-block-patterns-list__list-item .block-editor-block-preview__content {
1824
+ width: 100%;
1825
+ }
1826
+
1789
1827
  /**
1790
1828
  * Animations
1791
1829
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "6.3.0",
3
+ "version": "6.4.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.6.0",
31
- "@wordpress/api-fetch": "^6.3.0",
32
- "@wordpress/block-editor": "^8.5.0",
33
- "@wordpress/block-library": "^7.3.0",
34
- "@wordpress/blocks": "^11.5.0",
35
- "@wordpress/components": "^19.8.0",
36
- "@wordpress/compose": "^5.4.0",
37
- "@wordpress/core-data": "^4.4.0",
38
- "@wordpress/data": "^6.6.0",
39
- "@wordpress/deprecated": "^3.6.0",
40
- "@wordpress/editor": "^12.5.0",
41
- "@wordpress/element": "^4.4.0",
42
- "@wordpress/hooks": "^3.6.0",
43
- "@wordpress/i18n": "^4.6.0",
44
- "@wordpress/icons": "^8.2.0",
45
- "@wordpress/interface": "^4.5.0",
46
- "@wordpress/keyboard-shortcuts": "^3.4.0",
47
- "@wordpress/keycodes": "^3.6.0",
48
- "@wordpress/media-utils": "^3.4.0",
49
- "@wordpress/notices": "^3.6.0",
50
- "@wordpress/plugins": "^4.4.0",
51
- "@wordpress/preferences": "^1.2.0",
52
- "@wordpress/url": "^3.7.0",
53
- "@wordpress/viewport": "^4.4.0",
54
- "@wordpress/warning": "^2.6.0",
30
+ "@wordpress/a11y": "^3.7.0",
31
+ "@wordpress/api-fetch": "^6.4.0",
32
+ "@wordpress/block-editor": "^8.6.0",
33
+ "@wordpress/block-library": "^7.4.0",
34
+ "@wordpress/blocks": "^11.6.0",
35
+ "@wordpress/components": "^19.9.0",
36
+ "@wordpress/compose": "^5.5.0",
37
+ "@wordpress/core-data": "^4.5.0",
38
+ "@wordpress/data": "^6.7.0",
39
+ "@wordpress/deprecated": "^3.7.0",
40
+ "@wordpress/editor": "^12.6.0",
41
+ "@wordpress/element": "^4.5.0",
42
+ "@wordpress/hooks": "^3.7.0",
43
+ "@wordpress/i18n": "^4.7.0",
44
+ "@wordpress/icons": "^8.3.0",
45
+ "@wordpress/interface": "^4.6.0",
46
+ "@wordpress/keyboard-shortcuts": "^3.5.0",
47
+ "@wordpress/keycodes": "^3.7.0",
48
+ "@wordpress/media-utils": "^3.5.0",
49
+ "@wordpress/notices": "^3.7.0",
50
+ "@wordpress/plugins": "^4.5.0",
51
+ "@wordpress/preferences": "^1.3.0",
52
+ "@wordpress/url": "^3.8.0",
53
+ "@wordpress/viewport": "^4.5.0",
54
+ "@wordpress/warning": "^2.7.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": "11eb1241e63c9240018323551c6753f8a5fa96f9"
67
+ "gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
68
68
  }
@@ -6,7 +6,7 @@ import { Platform, ScrollView, View } from 'react-native';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { useRef } from '@wordpress/element';
9
+ import { useCallback, useRef, useState } from '@wordpress/element';
10
10
  import { compose, withPreferredColorScheme } from '@wordpress/compose';
11
11
  import { withSelect, withDispatch } from '@wordpress/data';
12
12
  import { withViewportMatch } from '@wordpress/viewport';
@@ -40,7 +40,11 @@ function HeaderToolbar( {
40
40
  getStylesFromColorScheme,
41
41
  onHideKeyboard,
42
42
  isRTL,
43
+ noContentSelected,
43
44
  } ) {
45
+ const wasNoContentSelected = useRef( noContentSelected );
46
+ const [ isInserterOpen, setIsInserterOpen ] = useState( false );
47
+
44
48
  const scrollViewRef = useRef( null );
45
49
  const scrollToStart = () => {
46
50
  // scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android
@@ -79,12 +83,32 @@ function HeaderToolbar( {
79
83
  return isRTL ? buttons.reverse() : buttons;
80
84
  };
81
85
 
86
+ const onToggleInserter = useCallback(
87
+ ( isOpen ) => {
88
+ if ( isOpen ) {
89
+ wasNoContentSelected.current = noContentSelected;
90
+ }
91
+ setIsInserterOpen( isOpen );
92
+ },
93
+ [ noContentSelected ]
94
+ );
95
+
96
+ // Expanded mode should be preserved while the inserter is open.
97
+ // This way we prevent style updates during the opening transition.
98
+ const useExpandedMode = isInserterOpen
99
+ ? wasNoContentSelected.current
100
+ : noContentSelected;
101
+
82
102
  return (
83
103
  <View
84
- style={ getStylesFromColorScheme(
85
- styles.container,
86
- styles.containerDark
87
- ) }
104
+ style={ [
105
+ getStylesFromColorScheme(
106
+ styles[ 'header-toolbar__container' ],
107
+ styles[ 'header-toolbar__container--dark' ]
108
+ ),
109
+ useExpandedMode &&
110
+ styles[ 'header-toolbar__container--expanded' ],
111
+ ] }
88
112
  >
89
113
  <ScrollView
90
114
  ref={ scrollViewRef }
@@ -93,14 +117,24 @@ function HeaderToolbar( {
93
117
  showsHorizontalScrollIndicator={ false }
94
118
  keyboardShouldPersistTaps="always"
95
119
  alwaysBounceHorizontal={ false }
96
- contentContainerStyle={ styles.scrollableContent }
120
+ contentContainerStyle={
121
+ styles[ 'header-toolbar__scrollable-content' ]
122
+ }
97
123
  >
98
- <Inserter disabled={ ! showInserter } />
124
+ <Inserter
125
+ disabled={ ! showInserter }
126
+ useExpandedMode={ useExpandedMode }
127
+ onToggle={ onToggleInserter }
128
+ />
99
129
  { renderHistoryButtons() }
100
130
  <BlockToolbar />
101
131
  </ScrollView>
102
132
  { showKeyboardHideButton && (
103
- <ToolbarGroup passedStyle={ styles.keyboardHideContainer }>
133
+ <ToolbarGroup
134
+ passedStyle={
135
+ styles[ 'header-toolbar__keyboard-hide-container' ]
136
+ }
137
+ >
104
138
  <ToolbarButton
105
139
  title={ __( 'Hide keyboard' ) }
106
140
  icon={ keyboardClose }
@@ -121,8 +155,10 @@ export default compose( [
121
155
  getBlockRootClientId,
122
156
  getBlockSelectionEnd,
123
157
  hasInserterItems,
158
+ hasSelectedBlock,
124
159
  } = select( blockEditorStore );
125
160
  const { getEditorSettings } = select( editorStore );
161
+ const isAnyBlockSelected = hasSelectedBlock();
126
162
  return {
127
163
  hasRedo: select( editorStore ).hasEditorRedo(),
128
164
  hasUndo: select( editorStore ).hasEditorUndo(),
@@ -136,6 +172,7 @@ export default compose( [
136
172
  isTextModeEnabled:
137
173
  select( editPostStore ).getEditorMode() === 'text',
138
174
  isRTL: select( blockEditorStore ).getSettings().isRTL,
175
+ noContentSelected: ! isAnyBlockSelected,
139
176
  };
140
177
  } ),
141
178
  withDispatch( ( dispatch ) => {
@@ -1,5 +1,5 @@
1
1
 
2
- .container {
2
+ .header-toolbar__container {
3
3
  height: $mobile-header-toolbar-height;
4
4
  flex-direction: row;
5
5
  background-color: $app-background;
@@ -7,16 +7,20 @@
7
7
  border-top-width: 1px;
8
8
  }
9
9
 
10
- .containerDark {
10
+ .header-toolbar__container--dark {
11
11
  background-color: $app-background-dark-alt;
12
12
  border-top-color: $background-dark-elevated;
13
13
  }
14
14
 
15
- .scrollableContent {
15
+ .header-toolbar__container--expanded {
16
+ height: $mobile-header-toolbar-expanded-height;
17
+ }
18
+
19
+ .header-toolbar__scrollable-content {
16
20
  flex-grow: 1; // Fixes RTL issue on Android.
17
21
  }
18
22
 
19
- .keyboardHideContainer {
23
+ .header-toolbar__keyboard-hide-container {
20
24
  padding-right: 0;
21
25
  padding-left: 0;
22
26
  padding-top: 4px;
@@ -47,10 +47,10 @@ import SettingsSidebar from '../sidebar/settings-sidebar';
47
47
  import MetaBoxes from '../meta-boxes';
48
48
  import WelcomeGuide from '../welcome-guide';
49
49
  import ActionsPanel from './actions-panel';
50
+ import StartPageOptions from '../start-page-options';
50
51
  import { store as editPostStore } from '../../store';
51
52
 
52
53
  const interfaceLabels = {
53
- secondarySidebar: __( 'Block library' ),
54
54
  /* translators: accessibility text for the editor top bar landmark region. */
55
55
  header: __( 'Editor top bar' ),
56
56
  /* translators: accessibility text for the editor content landmark region. */
@@ -170,6 +170,10 @@ function Layout( { styles } ) {
170
170
  [ entitiesSavedStatesCallback ]
171
171
  );
172
172
 
173
+ const secondarySidebarLabel = isListViewOpened
174
+ ? __( 'List View' )
175
+ : __( 'Block Library' );
176
+
173
177
  const secondarySidebar = () => {
174
178
  if ( mode === 'visual' && isInserterOpened ) {
175
179
  return <InserterSidebar />;
@@ -204,7 +208,10 @@ function Layout( { styles } ) {
204
208
  <SettingsSidebar />
205
209
  <InterfaceSkeleton
206
210
  className={ className }
207
- labels={ interfaceLabels }
211
+ labels={ {
212
+ ...interfaceLabels,
213
+ secondarySidebar: secondarySidebarLabel,
214
+ } }
208
215
  header={
209
216
  <Header
210
217
  setEntitiesSavedStatesCallback={
@@ -286,6 +293,7 @@ function Layout( { styles } ) {
286
293
  <EditPostPreferencesModal />
287
294
  <KeyboardShortcutHelpModal />
288
295
  <WelcomeGuide />
296
+ <StartPageOptions />
289
297
  <Popover.Slot />
290
298
  <PluginArea onError={ onPluginAreaError } />
291
299
  </>
@@ -115,14 +115,20 @@ class Layout extends Component {
115
115
  // Add a margin view at the bottom for the header.
116
116
  const marginBottom =
117
117
  Platform.OS === 'android' && ! isHtmlView
118
- ? headerToolbarStyles.container.height
118
+ ? headerToolbarStyles[ 'header-toolbar__container' ].height
119
119
  : 0;
120
120
 
121
+ const containerStyles = getStylesFromColorScheme(
122
+ styles.container,
123
+ styles.containerDark
124
+ );
125
+
121
126
  const toolbarKeyboardAvoidingViewStyle = {
122
127
  ...styles.toolbarKeyboardAvoidingView,
123
128
  left: this.state.safeAreaInsets.left,
124
129
  right: this.state.safeAreaInsets.right,
125
130
  bottom: this.state.safeAreaInsets.bottom,
131
+ backgroundColor: containerStyles.backgroundColor,
126
132
  };
127
133
 
128
134
  const editorStyles = [
@@ -138,10 +144,7 @@ class Layout extends Component {
138
144
  return (
139
145
  <Tooltip.Slot>
140
146
  <SafeAreaView
141
- style={ getStylesFromColorScheme(
142
- styles.container,
143
- styles.containerDark
144
- ) }
147
+ style={ containerStyles }
145
148
  onLayout={ this.onRootViewLayout }
146
149
  >
147
150
  <AutosaveMonitor disableIntervalChecks />
@@ -108,7 +108,6 @@ const PluginDocumentSettingPanel = compose(
108
108
  warning( 'PluginDocumentSettingPanel requires a name property.' );
109
109
  }
110
110
  return {
111
- icon: ownProps.icon || context.icon,
112
111
  panelName: `${ context.name }/${ ownProps.name }`,
113
112
  };
114
113
  } ),
@@ -0,0 +1,121 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Modal } from '@wordpress/components';
5
+ import { __ } from '@wordpress/i18n';
6
+ import { useState, useEffect } from '@wordpress/element';
7
+ import {
8
+ store as blockEditorStore,
9
+ __experimentalBlockPatternsList as BlockPatternsList,
10
+ } from '@wordpress/block-editor';
11
+ import { useSelect, useDispatch } from '@wordpress/data';
12
+ import { useAsyncList } from '@wordpress/compose';
13
+ import { store as editorStore } from '@wordpress/editor';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { store as editPostStore } from '../../store';
19
+
20
+ function PatternSelection( { onChoosePattern } ) {
21
+ const { blockPatterns } = useSelect( ( select ) => {
22
+ const { __experimentalGetPatternsByBlockTypes } = select(
23
+ blockEditorStore
24
+ );
25
+ return {
26
+ blockPatterns: __experimentalGetPatternsByBlockTypes(
27
+ 'core/post-content'
28
+ ),
29
+ };
30
+ }, [] );
31
+ const shownBlockPatterns = useAsyncList( blockPatterns );
32
+ const { resetEditorBlocks } = useDispatch( editorStore );
33
+ useEffect( () => {
34
+ if ( blockPatterns.length <= 1 ) {
35
+ onChoosePattern();
36
+ }
37
+ }, [ blockPatterns.length ] );
38
+ return (
39
+ <BlockPatternsList
40
+ blockPatterns={ blockPatterns }
41
+ shownPatterns={ shownBlockPatterns }
42
+ onClickPattern={ ( _pattern, blocks ) => {
43
+ resetEditorBlocks( blocks );
44
+ onChoosePattern();
45
+ } }
46
+ />
47
+ );
48
+ }
49
+
50
+ const START_PAGE_MODAL_STATES = {
51
+ INITIAL: 'INITIAL',
52
+ PATTERN: 'PATTERN',
53
+ CLOSED: 'CLOSED',
54
+ };
55
+
56
+ export default function StartPageOptions() {
57
+ const [ modalState, setModalState ] = useState(
58
+ START_PAGE_MODAL_STATES.INITIAL
59
+ );
60
+ const shouldOpenModel = useSelect(
61
+ ( select ) => {
62
+ if ( modalState !== START_PAGE_MODAL_STATES.INITIAL ) {
63
+ return false;
64
+ }
65
+ const { __experimentalGetPatternsByBlockTypes } = select(
66
+ blockEditorStore
67
+ );
68
+ const {
69
+ getCurrentPostType,
70
+ getEditedPostContent,
71
+ isEditedPostSaveable,
72
+ } = select( editorStore );
73
+ const { isEditingTemplate, isFeatureActive } = select(
74
+ editPostStore
75
+ );
76
+ return (
77
+ getCurrentPostType() === 'page' &&
78
+ ! isEditedPostSaveable() &&
79
+ '' === getEditedPostContent() &&
80
+ ! isEditingTemplate() &&
81
+ ! isFeatureActive( 'welcomeGuide' ) &&
82
+ __experimentalGetPatternsByBlockTypes( 'core/post-content' )
83
+ .length >= 1
84
+ );
85
+ },
86
+ [ modalState ]
87
+ );
88
+
89
+ useEffect( () => {
90
+ if ( shouldOpenModel ) {
91
+ setModalState( START_PAGE_MODAL_STATES.PATTERN );
92
+ }
93
+ }, [ shouldOpenModel ] );
94
+
95
+ if (
96
+ modalState === START_PAGE_MODAL_STATES.INITIAL ||
97
+ modalState === START_PAGE_MODAL_STATES.CLOSED
98
+ ) {
99
+ return null;
100
+ }
101
+ return (
102
+ <Modal
103
+ className="edit-post-start-page-options__modal"
104
+ title={ __( 'Choose a pattern' ) }
105
+ closeLabel={ __( 'Cancel' ) }
106
+ onRequestClose={ () => {
107
+ setModalState( START_PAGE_MODAL_STATES.CLOSED );
108
+ } }
109
+ >
110
+ <div className="edit-post-start-page-options__modal-content">
111
+ { modalState === START_PAGE_MODAL_STATES.PATTERN && (
112
+ <PatternSelection
113
+ onChoosePattern={ () => {
114
+ setModalState( START_PAGE_MODAL_STATES.CLOSED );
115
+ } }
116
+ />
117
+ ) }
118
+ </div>
119
+ </Modal>
120
+ );
121
+ }