@wordpress/edit-post 7.4.0 → 7.5.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 (39) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/device-preview/index.js +3 -7
  3. package/build/components/device-preview/index.js.map +1 -1
  4. package/build/components/header/fullscreen-mode-close/index.js +3 -3
  5. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  6. package/build/components/keyboard-shortcuts/index.js +11 -11
  7. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  8. package/build/components/layout/index.js +8 -7
  9. package/build/components/layout/index.js.map +1 -1
  10. package/build/components/sidebar/featured-image/index.js +3 -7
  11. package/build/components/sidebar/featured-image/index.js.map +1 -1
  12. package/build/components/sidebar/page-attributes/index.js +3 -7
  13. package/build/components/sidebar/page-attributes/index.js.map +1 -1
  14. package/build/components/visual-editor/index.js +4 -2
  15. package/build/components/visual-editor/index.js.map +1 -1
  16. package/build-module/components/device-preview/index.js +3 -6
  17. package/build-module/components/device-preview/index.js.map +1 -1
  18. package/build-module/components/header/fullscreen-mode-close/index.js +3 -2
  19. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  20. package/build-module/components/keyboard-shortcuts/index.js +11 -11
  21. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  22. package/build-module/components/layout/index.js +8 -7
  23. package/build-module/components/layout/index.js.map +1 -1
  24. package/build-module/components/sidebar/featured-image/index.js +3 -6
  25. package/build-module/components/sidebar/featured-image/index.js.map +1 -1
  26. package/build-module/components/sidebar/page-attributes/index.js +3 -6
  27. package/build-module/components/sidebar/page-attributes/index.js.map +1 -1
  28. package/build-module/components/visual-editor/index.js +3 -2
  29. package/build-module/components/visual-editor/index.js.map +1 -1
  30. package/build-style/style-rtl.css +6 -3
  31. package/build-style/style.css +6 -3
  32. package/package.json +30 -30
  33. package/src/components/device-preview/index.js +1 -6
  34. package/src/components/header/fullscreen-mode-close/index.js +1 -6
  35. package/src/components/keyboard-shortcuts/index.js +13 -11
  36. package/src/components/layout/index.js +9 -7
  37. package/src/components/sidebar/featured-image/index.js +3 -10
  38. package/src/components/sidebar/page-attributes/index.js +3 -10
  39. package/src/components/visual-editor/index.js +6 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/page-attributes/index.js"],"names":["get","__","PanelBody","PanelRow","store","editorStore","PageAttributesCheck","PageAttributesOrder","PageAttributesParent","useSelect","useDispatch","coreStore","editPostStore","PANEL_NAME","PageAttributes","isEnabled","isOpened","postType","select","getEditedPostAttribute","isEditorPanelEnabled","isEditorPanelOpened","getPostType","toggleEditorPanelOpened","onTogglePanel","args"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,uBAApC;AACA,SACCC,KAAK,IAAIC,WADV,EAECC,mBAFD,EAGCC,mBAHD,EAICC,oBAJD,QAKO,mBALP;AAMA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASN,KAAK,IAAIO,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASP,KAAK,IAAIQ,aAAlB,QAAuC,gBAAvC;AAEA;AACA;AACA;;AACA,MAAMC,UAAU,GAAG,iBAAnB;AAEA,OAAO,SAASC,cAAT,GAA0B;AAChC,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuBC,IAAAA;AAAvB,MAAoCR,SAAS,CAAIS,MAAF,IAAc;AAClE,UAAM;AAAEC,MAAAA;AAAF,QAA6BD,MAAM,CAAEb,WAAF,CAAzC;AACA,UAAM;AAAEe,MAAAA,oBAAF;AAAwBC,MAAAA;AAAxB,QACLH,MAAM,CAAEN,aAAF,CADP;AAEA,UAAM;AAAEU,MAAAA;AAAF,QAAkBJ,MAAM,CAAEP,SAAF,CAA9B;AACA,WAAO;AACNI,MAAAA,SAAS,EAAEK,oBAAoB,CAAEP,UAAF,CADzB;AAENG,MAAAA,QAAQ,EAAEK,mBAAmB,CAAER,UAAF,CAFvB;AAGNI,MAAAA,QAAQ,EAAEK,WAAW,CAAEH,sBAAsB,CAAE,MAAF,CAAxB;AAHf,KAAP;AAKA,GAVkD,EAUhD,EAVgD,CAAnD;AAYA,QAAM;AAAEI,IAAAA;AAAF,MAA8Bb,WAAW,CAAEE,aAAF,CAA/C;;AAEA,MAAK,CAAEG,SAAF,IAAe,CAAEE,QAAtB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,QAAMO,aAAa,GAAG;AAAA,sCAAKC,IAAL;AAAKA,MAAAA,IAAL;AAAA;;AAAA,WACrBF,uBAAuB,CAAEV,UAAF,EAAc,GAAGY,IAAjB,CADF;AAAA,GAAtB;;AAGA,SACC,cAAC,mBAAD,QACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAGzB,GAAG,CACViB,QADU,EAEV,CAAE,QAAF,EAAY,YAAZ,CAFU,EAGVhB,EAAE,CAAE,iBAAF,CAHQ,CADZ;AAMC,IAAA,MAAM,EAAGe,QANV;AAOC,IAAA,QAAQ,EAAGQ;AAPZ,KASC,cAAC,oBAAD,OATD,EAUC,cAAC,QAAD,QACC,cAAC,mBAAD,OADD,CAVD,CADD,CADD;AAkBA;AAED,eAAeV,cAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport {\n\tstore as editorStore,\n\tPageAttributesCheck,\n\tPageAttributesOrder,\n\tPageAttributesParent,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'page-attributes';\n\nexport function PageAttributes() {\n\tconst { isEnabled, isOpened, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editPostStore );\n\n\tif ( ! isEnabled || ! postType ) {\n\t\treturn null;\n\t}\n\n\tconst onTogglePanel = ( ...args ) =>\n\t\ttoggleEditorPanelOpened( PANEL_NAME, ...args );\n\n\treturn (\n\t\t<PageAttributesCheck>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ get(\n\t\t\t\t\tpostType,\n\t\t\t\t\t[ 'labels', 'attributes' ],\n\t\t\t\t\t__( 'Page attributes' )\n\t\t\t\t) }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ onTogglePanel }\n\t\t\t>\n\t\t\t\t<PageAttributesParent />\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<PageAttributesOrder />\n\t\t\t\t</PanelRow>\n\t\t\t</PanelBody>\n\t\t</PageAttributesCheck>\n\t);\n}\n\nexport default PageAttributes;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/page-attributes/index.js"],"names":["__","PanelBody","PanelRow","store","editorStore","PageAttributesCheck","PageAttributesOrder","PageAttributesParent","useSelect","useDispatch","coreStore","editPostStore","PANEL_NAME","PageAttributes","isEnabled","isOpened","postType","select","getEditedPostAttribute","isEditorPanelEnabled","isEditorPanelOpened","getPostType","toggleEditorPanelOpened","onTogglePanel","args","labels","attributes"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,EA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C,mBAAD,QACC,cAAC,SAAD;AACC,IAAA,KAAK,2BACJR,QADI,aACJA,QADI,2CACJA,QAAQ,CAAES,MADN,qDACJ,iBAAkBC,UADd,yEAC4B1B,EAAE,CAAE,iBAAF,CAFpC;AAIC,IAAA,MAAM,EAAGe,QAJV;AAKC,IAAA,QAAQ,EAAGQ;AALZ,KAOC,cAAC,oBAAD,OAPD,EAQC,cAAC,QAAD,QACC,cAAC,mBAAD,OADD,CARD,CADD,CADD;AAgBA;AAED,eAAeV,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport {\n\tstore as editorStore,\n\tPageAttributesCheck,\n\tPageAttributesOrder,\n\tPageAttributesParent,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'page-attributes';\n\nexport function PageAttributes() {\n\tconst { isEnabled, isOpened, postType } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\tselect( editPostStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\treturn {\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tpostType: getPostType( getEditedPostAttribute( 'type' ) ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editPostStore );\n\n\tif ( ! isEnabled || ! postType ) {\n\t\treturn null;\n\t}\n\n\tconst onTogglePanel = ( ...args ) =>\n\t\ttoggleEditorPanelOpened( PANEL_NAME, ...args );\n\n\treturn (\n\t\t<PageAttributesCheck>\n\t\t\t<PanelBody\n\t\t\t\ttitle={\n\t\t\t\t\tpostType?.labels?.attributes ?? __( 'Page attributes' )\n\t\t\t\t}\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ onTogglePanel }\n\t\t\t>\n\t\t\t\t<PageAttributesParent />\n\t\t\t\t<PanelRow>\n\t\t\t\t\t<PageAttributesOrder />\n\t\t\t\t</PanelRow>\n\t\t\t</PanelBody>\n\t\t</PageAttributesCheck>\n\t);\n}\n\nexport default PageAttributes;\n"]}
@@ -23,6 +23,7 @@ import { store as coreStore } from '@wordpress/core-data';
23
23
  */
24
24
 
25
25
  import { store as editPostStore } from '../../store';
26
+ const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
26
27
 
27
28
  function MaybeIframe(_ref) {
28
29
  let {
@@ -248,7 +249,7 @@ export default function VisualEditor(_ref2) {
248
249
  }, [layout === null || layout === void 0 ? void 0 : layout.type, layout === null || layout === void 0 ? void 0 : layout.inherit, layout === null || layout === void 0 ? void 0 : layout.contentSize, layout === null || layout === void 0 ? void 0 : layout.wideSize, globalLayoutSettings]); // If there is a Post Content block we use its layout for the block list;
249
250
  // if not, this must be a classic theme, in which case we use the fallback layout.
250
251
 
251
- const blockListLayout = postContentBlock ? postContentLayout : fallbackLayout;
252
+ const blockListLayout = postContentBlock !== null && postContentBlock !== void 0 && postContentBlock.isValid ? postContentLayout : fallbackLayout;
252
253
  const titleRef = useRef();
253
254
  useEffect(() => {
254
255
  var _titleRef$current;
@@ -286,7 +287,7 @@ export default function VisualEditor(_ref2) {
286
287
  initial: desktopCanvasStyles,
287
288
  className: previewMode
288
289
  }, createElement(MaybeIframe, {
289
- shouldIframe: isBlockBasedTheme && !hasMetaBoxes || isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile',
290
+ shouldIframe: isGutenbergPlugin && isBlockBasedTheme && !hasMetaBoxes || isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile',
290
291
  contentRef: contentRef,
291
292
  styles: styles
292
293
  }, themeSupportsLayout && !themeHasDisabledLayoutStyles && !isTemplateMode && createElement(Fragment, null, createElement(LayoutStyle, {
@@ -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","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalRecursionProvider","RecursionProvider","__experimentaluseLayoutClasses","useLayoutClasses","__experimentaluseLayoutStyles","useLayoutStyles","useEffect","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","parse","coreStore","editPostStore","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","findPostContent","blocks","i","length","name","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getEditedPostTemplate","getCurrentPostId","getCurrentPostType","getEditorSettings","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","getSettings","disableLayoutStyles","supportsLayout","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","postContentBlock","parseableContent","content","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","layout","attributes","postContentLayout","inherit","contentSize","wideSize","blockListLayout","titleRef","current","focus","css","padding","definitions"],"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,6BAA6B,IAAIC,eATlC,EAUCC,sBAAsB,IAAIC,YAV3B,EAWCC,UAXD,EAYCC,yBAAyB,IAAIC,WAZ9B,EAaCC,iCAAiC,IAAIC,uBAbtC,EAcCC,gBAAgB,IAAIC,MAdrB,EAeCC,+BAA+B,IAAIC,iBAfpC,EAgBCC,8BAA8B,IAAIC,gBAhBnC,EAiBCC,6BAA6B,IAAIC,eAjBlC,QAkBO,yBAlBP;AAmBA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,OAA5B,QAA2C,oBAA3C;AACA,SAASC,MAAT,EAAiBC,gBAAgB,IAAIC,MAArC,QAAmD,uBAAnD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAAS1C,KAAK,IAAI2C,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAAS3C,KAAK,IAAI4C,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,WAAT,OAA8E;AAAA,MAAxD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,UAAZ;AAAwBC,IAAAA,YAAxB;AAAsCC,IAAAA,MA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aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE0B;AAJxB,IATF,CAbH,EAgCG,CAAEpE,cAAF,IACD;AACC,IAAA,SAAS,EAAGrE,UAAU,EACrB;AACA;AACA,uBAHqB,EAIrB,iCAJqB,EAKrB,6CALqB,EAMrB;AACC,uBAAiB8F;AADlB,KANqB,EASrB6B,oBATqB,CADvB;AAYC,IAAA,eAAe,EAAG;AAZnB,KAcC,cAAC,SAAD;AAAW,IAAA,GAAG,EAAGS;AAAjB,IAdD,CAjCF,EAkDC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAG7D,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,cAAC,SAAD;AACC,IAAA,SAAS,EACRH,cAAc,GACX,gBADW,GAEV,GAAGsD,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGQ;AANxB,IAJD,CAlDD,CALD,CAnBD,CAPD,CADD;AAoGA","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__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__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\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';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\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\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\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction findPostContent( 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 ];\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = findPostContent(\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\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( 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\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\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\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so we check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\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 { themeHasDisabledLayoutStyles, themeSupportsLayout, isFocusMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\t\treturn {\n\t\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\t\tisFocusMode: _settings.focusMode,\n\t\t\t};\n\t\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 globalLayoutSettings = 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\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\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}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst postContentBlock = useMemo( () => {\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn findPostContent( 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 findPostContent( parse( parseableContent ) ) || {};\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst postContentLayoutClasses = useLayoutClasses( postContentBlock );\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tpostContentBlock,\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\tconst layout = postContentBlock?.attributes?.layout || {};\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 = postContentBlock\n\t\t? postContentLayout\n\t\t: fallbackLayout;\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\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\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\t( isBlockBasedTheme && ! hasMetaBoxes ) ||\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>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\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\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\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{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t// This wrapper div should have the same\n\t\t\t\t\t\t\t\t\t// classes as the block list beneath.\n\t\t\t\t\t\t\t\t\t'is-root-container',\n\t\t\t\t\t\t\t\t\t'block-editor-block-list__layout',\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tblockListLayoutClass\n\t\t\t\t\t\t\t\t) }\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\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\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: `${ 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__experimentalLayout={ blockListLayout }\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</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","__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","useSetting","__experimentalLayoutStyle","LayoutStyle","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","__unstableIframe","Iframe","__experimentalRecursionProvider","RecursionProvider","__experimentaluseLayoutClasses","useLayoutClasses","__experimentaluseLayoutStyles","useLayoutStyles","useEffect","useRef","useMemo","Button","__unstableMotion","motion","useSelect","useDispatch","useMergeRefs","arrowLeft","__","parse","coreStore","editPostStore","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","MaybeIframe","children","contentRef","shouldIframe","styles","style","ref","flex","width","height","display","findPostContent","blocks","i","length","name","innerBlocks","nestedPostContent","VisualEditor","deviceType","isWelcomeGuideVisible","isTemplateMode","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","select","isFeatureActive","isEditingTemplate","__experimentalGetPreviewDeviceType","getEditedPostTemplate","getCurrentPostId","getCurrentPostType","getEditorSettings","_isTemplateMode","_wrapperBlockName","editorSettings","supportsTemplateMode","canEditTemplate","canUser","undefined","__unstableIsBlockBasedTheme","isCleanNewPost","hasMetaBoxes","themeHasDisabledLayoutStyles","themeSupportsLayout","isFocusMode","_settings","getSettings","disableLayoutStyles","supportsLayout","focusMode","clearSelectedBlock","setIsEditingTemplate","desktopCanvasStyles","margin","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","blockSelectionClearerRef","fallbackLayout","type","postContentBlock","parseableContent","content","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","layout","attributes","postContentLayout","inherit","contentSize","wideSize","blockListLayout","isValid","titleRef","current","focus","css","padding","definitions"],"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,6BAA6B,IAAIC,eATlC,EAUCC,sBAAsB,IAAIC,YAV3B,EAWCC,UAXD,EAYCC,yBAAyB,IAAIC,WAZ9B,EAaCC,iCAAiC,IAAIC,uBAbtC,EAcCC,gBAAgB,IAAIC,MAdrB,EAeCC,+BAA+B,IAAIC,iBAfpC,EAgBCC,8BAA8B,IAAIC,gBAhBnC,EAiBCC,6BAA6B,IAAIC,eAjBlC,QAkBO,yBAlBP;AAmBA,SAASC,SAAT,EAAoBC,MAApB,EAA4BC,OAA5B,QAA2C,oBAA3C;AACA,SAASC,MAAT,EAAiBC,gBAAgB,IAAIC,MAArC,QAAmD,uBAAnD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAAS1C,KAAK,IAAI2C,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAAS3C,KAAK,IAAI4C,aAAlB,QAAuC,aAAvC;AAEA,MAAMC,iBAAiB,GAAGC,OAAO,CAACC,GAAR,CAAYC,mBAAZ,GAAkC,IAAlC,GAAyC,KAAnE;;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B,EAChBN,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE2B;AAJxB,IADD,EAQGd,uBAAuB,IACxB,cAAC,WAAD;AACC,IAAA,MAAM,EAAGG,iBADV;AAEC,IAAA,GAAG,EAAGH,uBAFP;AAGC,IAAA,iBAAiB,EAChBb,oBADgB,aAChBA,oBADgB,uBAChBA,oBAAoB,CAAE2B;AAJxB,IATF,CAfH,EAkCG,CAAErE,cAAF,IACD;AACC,IAAA,SAAS,EAAGzE,UAAU,EACrB;AACA;AACA,uBAHqB,EAIrB,iCAJqB,EAKrB,6CALqB,EAMrB;AACC,uBAAiBkG;AADlB,KANqB,EASrB6B,oBATqB,CADvB;AAYC,IAAA,eAAe,EAAG;AAZnB,KAcC,cAAC,SAAD;AAAW,IAAA,GAAG,EAAGU;AAAjB,IAdD,CAnCF,EAoDC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAG9D,gBADb;AAEC,IAAA,QAAQ,EAAGC;AAFZ,KAIC,cAAC,SAAD;AACC,IAAA,SAAS,EACRH,cAAc,GACX,gBADW,GAEV,GAAGsD,oBAAsB,wBAHrB,CAG6C;AAJvD;AAMC,IAAA,oBAAoB,EAAGQ;AANxB,IAJD,CApDD,CALD,CAnBD,CAPD,CADD;AAsGA","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__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__experimentalRecursionProvider as RecursionProvider,\n\t__experimentaluseLayoutClasses as useLayoutClasses,\n\t__experimentaluseLayoutStyles as useLayoutStyles,\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';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\nfunction MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {\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\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\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction findPostContent( 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 ];\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = findPostContent(\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\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t\tgetEditedPostTemplate,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( 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\tconst editorSettings = getEditorSettings();\n\t\tconst supportsTemplateMode = editorSettings.supportsTemplateMode;\n\t\tconst canEditTemplate = select( coreStore ).canUser(\n\t\t\t'create',\n\t\t\t'templates'\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\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so we check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tsupportsTemplateMode && canEditTemplate\n\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t: undefined,\n\t\t\twrapperBlockName: _wrapperBlockName,\n\t\t\twrapperUniqueId: getCurrentPostId(),\n\t\t\tisBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme,\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 { themeHasDisabledLayoutStyles, themeSupportsLayout, isFocusMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\t\treturn {\n\t\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\t\tisFocusMode: _settings.focusMode,\n\t\t\t};\n\t\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 globalLayoutSettings = 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\t// fallbackLayout is used if there is no Post Content,\n\t// and for Post Title.\n\tconst fallbackLayout = useMemo( () => {\n\t\tif ( isTemplateMode ) {\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}, [ isTemplateMode, themeSupportsLayout, globalLayoutSettings ] );\n\n\tconst postContentBlock = useMemo( () => {\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn findPostContent( 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 findPostContent( parse( parseableContent ) ) || {};\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst postContentLayoutClasses = useLayoutClasses( postContentBlock );\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tpostContentBlock,\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\tconst layout = postContentBlock?.attributes?.layout || {};\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 = postContentBlock?.isValid\n\t\t? postContentLayout\n\t\t: fallbackLayout;\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\tstyles = useMemo(\n\t\t() => [\n\t\t\t...styles,\n\t\t\t{\n\t\t\t\t// We should move this in to future to the body.\n\t\t\t\tcss:\n\t\t\t\t\t`.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` +\n\t\t\t\t\t( paddingBottom\n\t\t\t\t\t\t? `body{padding-bottom:${ paddingBottom }}`\n\t\t\t\t\t\t: '' ),\n\t\t\t},\n\t\t],\n\t\t[ styles ]\n\t);\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\t( isGutenbergPlugin &&\n\t\t\t\t\t\t\t\tisBlockBasedTheme &&\n\t\t\t\t\t\t\t\t! hasMetaBoxes ) ||\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>\n\t\t\t\t\t\t{ themeSupportsLayout &&\n\t\t\t\t\t\t\t! themeHasDisabledLayoutStyles &&\n\t\t\t\t\t\t\t! isTemplateMode && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\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\t\t\tlayout={ fallbackLayout }\n\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ postContentLayoutStyles && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle\n\t\t\t\t\t\t\t\t\t\t\tlayout={ postContentLayout }\n\t\t\t\t\t\t\t\t\t\t\tcss={ postContentLayoutStyles }\n\t\t\t\t\t\t\t\t\t\t\tlayoutDefinitions={\n\t\t\t\t\t\t\t\t\t\t\t\tglobalLayoutSettings?.definitions\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\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{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t// This wrapper div should have the same\n\t\t\t\t\t\t\t\t\t// classes as the block list beneath.\n\t\t\t\t\t\t\t\t\t'is-root-container',\n\t\t\t\t\t\t\t\t\t'block-editor-block-list__layout',\n\t\t\t\t\t\t\t\t\t'edit-post-visual-editor__post-title-wrapper',\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t'is-focus-mode': isFocusMode,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tblockListLayoutClass\n\t\t\t\t\t\t\t\t) }\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\tblockName={ wrapperBlockName }\n\t\t\t\t\t\t\tuniqueId={ wrapperUniqueId }\n\t\t\t\t\t\t>\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: `${ 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__experimentalLayout={ blockListLayout }\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</BlockTools>\n\t);\n}\n"]}
@@ -413,15 +413,18 @@ body.is-fullscreen-mode .interface-interface-skeleton {
413
413
  }
414
414
  }
415
415
  .interface-interface-skeleton__actions:focus, .interface-interface-skeleton__actions:focus-within {
416
- top: 46px;
416
+ top: auto;
417
417
  bottom: 0;
418
418
  }
419
+ .is-entity-save-view-open .interface-interface-skeleton__actions:focus, .is-entity-save-view-open .interface-interface-skeleton__actions:focus-within {
420
+ top: 46px;
421
+ }
419
422
  @media (min-width: 782px) {
420
- .interface-interface-skeleton__actions:focus, .interface-interface-skeleton__actions:focus-within {
423
+ .is-entity-save-view-open .interface-interface-skeleton__actions:focus, .is-entity-save-view-open .interface-interface-skeleton__actions:focus-within {
421
424
  border-right: 1px solid #ddd;
422
425
  top: 32px;
423
426
  }
424
- .is-fullscreen-mode .interface-interface-skeleton__actions:focus, .is-fullscreen-mode .interface-interface-skeleton__actions:focus-within {
427
+ .is-fullscreen-mode .is-entity-save-view-open .interface-interface-skeleton__actions:focus, .is-fullscreen-mode .is-entity-save-view-open .interface-interface-skeleton__actions:focus-within {
425
428
  top: 0;
426
429
  }
427
430
  }
@@ -413,15 +413,18 @@ body.is-fullscreen-mode .interface-interface-skeleton {
413
413
  }
414
414
  }
415
415
  .interface-interface-skeleton__actions:focus, .interface-interface-skeleton__actions:focus-within {
416
- top: 46px;
416
+ top: auto;
417
417
  bottom: 0;
418
418
  }
419
+ .is-entity-save-view-open .interface-interface-skeleton__actions:focus, .is-entity-save-view-open .interface-interface-skeleton__actions:focus-within {
420
+ top: 46px;
421
+ }
419
422
  @media (min-width: 782px) {
420
- .interface-interface-skeleton__actions:focus, .interface-interface-skeleton__actions:focus-within {
423
+ .is-entity-save-view-open .interface-interface-skeleton__actions:focus, .is-entity-save-view-open .interface-interface-skeleton__actions:focus-within {
421
424
  border-left: 1px solid #ddd;
422
425
  top: 32px;
423
426
  }
424
- .is-fullscreen-mode .interface-interface-skeleton__actions:focus, .is-fullscreen-mode .interface-interface-skeleton__actions:focus-within {
427
+ .is-fullscreen-mode .is-entity-save-view-open .interface-interface-skeleton__actions:focus, .is-fullscreen-mode .is-entity-save-view-open .interface-interface-skeleton__actions:focus-within {
425
428
  top: 0;
426
429
  }
427
430
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "7.4.0",
3
+ "version": "7.5.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,34 +27,34 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.27.0",
31
- "@wordpress/api-fetch": "^6.24.0",
32
- "@wordpress/block-editor": "^11.4.0",
33
- "@wordpress/block-library": "^8.4.0",
34
- "@wordpress/blocks": "^12.4.0",
35
- "@wordpress/components": "^23.4.0",
36
- "@wordpress/compose": "^6.4.0",
37
- "@wordpress/core-data": "^6.4.0",
38
- "@wordpress/data": "^8.4.0",
39
- "@wordpress/deprecated": "^3.27.0",
40
- "@wordpress/dom": "^3.27.0",
41
- "@wordpress/editor": "^13.4.0",
42
- "@wordpress/element": "^5.4.0",
43
- "@wordpress/hooks": "^3.27.0",
44
- "@wordpress/i18n": "^4.27.0",
45
- "@wordpress/icons": "^9.18.0",
46
- "@wordpress/interface": "^5.4.0",
47
- "@wordpress/keyboard-shortcuts": "^4.4.0",
48
- "@wordpress/keycodes": "^3.27.0",
49
- "@wordpress/media-utils": "^4.18.0",
50
- "@wordpress/notices": "^3.27.0",
51
- "@wordpress/plugins": "^5.4.0",
52
- "@wordpress/preferences": "^3.4.0",
53
- "@wordpress/private-apis": "^0.9.0",
54
- "@wordpress/url": "^3.28.0",
55
- "@wordpress/viewport": "^5.4.0",
56
- "@wordpress/warning": "^2.27.0",
57
- "@wordpress/widgets": "^3.4.0",
30
+ "@wordpress/a11y": "^3.28.0",
31
+ "@wordpress/api-fetch": "^6.25.0",
32
+ "@wordpress/block-editor": "^11.5.0",
33
+ "@wordpress/block-library": "^8.5.0",
34
+ "@wordpress/blocks": "^12.5.0",
35
+ "@wordpress/components": "^23.5.0",
36
+ "@wordpress/compose": "^6.5.0",
37
+ "@wordpress/core-data": "^6.5.0",
38
+ "@wordpress/data": "^8.5.0",
39
+ "@wordpress/deprecated": "^3.28.0",
40
+ "@wordpress/dom": "^3.28.0",
41
+ "@wordpress/editor": "^13.5.0",
42
+ "@wordpress/element": "^5.5.0",
43
+ "@wordpress/hooks": "^3.28.0",
44
+ "@wordpress/i18n": "^4.28.0",
45
+ "@wordpress/icons": "^9.19.0",
46
+ "@wordpress/interface": "^5.5.0",
47
+ "@wordpress/keyboard-shortcuts": "^4.5.0",
48
+ "@wordpress/keycodes": "^3.28.0",
49
+ "@wordpress/media-utils": "^4.19.0",
50
+ "@wordpress/notices": "^3.28.0",
51
+ "@wordpress/plugins": "^5.5.0",
52
+ "@wordpress/preferences": "^3.5.0",
53
+ "@wordpress/private-apis": "^0.10.0",
54
+ "@wordpress/url": "^3.29.0",
55
+ "@wordpress/viewport": "^5.5.0",
56
+ "@wordpress/warning": "^2.28.0",
57
+ "@wordpress/widgets": "^3.5.0",
58
58
  "classnames": "^2.3.1",
59
59
  "lodash": "^4.17.21",
60
60
  "memize": "^1.1.0",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "c25ff895413bad4354c55c0c2d732552618b0d56"
70
+ "gitHead": "d5e03a74b79e3ca84afda24375474a103a063ee4"
71
71
  }
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -35,7 +30,7 @@ export default function DevicePreview() {
35
30
  hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
36
31
  isSaving: select( editPostStore ).isSavingMetaBoxes(),
37
32
  isPostSaveable: select( editorStore ).isEditedPostSaveable(),
38
- isViewable: get( postType, [ 'viewable' ], false ),
33
+ isViewable: postType?.viewable ?? false,
39
34
  deviceType:
40
35
  select( editPostStore ).__experimentalGetPreviewDeviceType(),
41
36
  };
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get } from 'lodash';
5
4
  import classnames from 'classnames';
6
5
 
7
6
  /**
@@ -99,11 +98,7 @@ function FullscreenModeClose( { showTooltip, icon, href } ) {
99
98
  post_type: postType.slug,
100
99
  } )
101
100
  }
102
- label={ get(
103
- postType,
104
- [ 'labels', 'view_items' ],
105
- __( 'Back' )
106
- ) }
101
+ label={ postType?.labels?.view_items ?? __( 'Back' ) }
107
102
  showTooltip={ showTooltip }
108
103
  >
109
104
  { buttonIcon }
@@ -70,15 +70,18 @@ function KeyboardShortcuts() {
70
70
  if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
71
71
  return;
72
72
  }
73
- const currentAttributes = getBlockAttributes( currentClientId );
74
- const { content: currentContent, align: currentAlign } =
75
- currentAttributes;
73
+ const attributes = getBlockAttributes( currentClientId );
74
+ const textAlign =
75
+ blockName === 'core/paragraph' ? 'align' : 'textAlign';
76
+ const destinationTextAlign =
77
+ destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
78
+
76
79
  replaceBlocks(
77
80
  currentClientId,
78
81
  createBlock( destinationBlockName, {
79
82
  level,
80
- content: currentContent,
81
- align: currentAlign,
83
+ content: attributes.content,
84
+ ...{ [ destinationTextAlign ]: attributes[ textAlign ] },
82
85
  } )
83
86
  );
84
87
  };
@@ -181,7 +184,7 @@ function KeyboardShortcuts() {
181
184
  } );
182
185
 
183
186
  registerShortcut( {
184
- name: `core/block-editor/transform-heading-to-paragraph`,
187
+ name: `core/edit-post/transform-heading-to-paragraph`,
185
188
  category: 'block-library',
186
189
  description: __( 'Transform heading to paragraph.' ),
187
190
  keyCombination: {
@@ -192,7 +195,7 @@ function KeyboardShortcuts() {
192
195
 
193
196
  [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
194
197
  registerShortcut( {
195
- name: `core/block-editor/transform-paragraph-to-heading-${ level }`,
198
+ name: `core/edit-post/transform-paragraph-to-heading-${ level }`,
196
199
  category: 'block-library',
197
200
  description: __( 'Transform paragraph to heading.' ),
198
201
  keyCombination: {
@@ -257,9 +260,8 @@ function KeyboardShortcuts() {
257
260
  }
258
261
  } );
259
262
 
260
- useShortcut(
261
- 'core/block-editor/transform-heading-to-paragraph',
262
- ( event ) => handleTextLevelShortcut( event, 0 )
263
+ useShortcut( 'core/edit-post/transform-heading-to-paragraph', ( event ) =>
264
+ handleTextLevelShortcut( event, 0 )
263
265
  );
264
266
 
265
267
  [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
@@ -267,7 +269,7 @@ function KeyboardShortcuts() {
267
269
  //the hook will execute the same way every time
268
270
  //eslint-disable-next-line react-hooks/rules-of-hooks
269
271
  useShortcut(
270
- `core/block-editor/transform-paragraph-to-heading-${ level }`,
272
+ `core/edit-post/transform-paragraph-to-heading-${ level }`,
271
273
  ( event ) => handleTextLevelShortcut( event, level )
272
274
  );
273
275
  } );
@@ -128,13 +128,6 @@ function Layout( { styles } ) {
128
128
 
129
129
  const isDistractionFree = isDistractionFreeMode && isLargeViewport;
130
130
 
131
- const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
132
- 'is-sidebar-opened': sidebarIsOpened,
133
- 'has-fixed-toolbar': hasFixedToolbar,
134
- 'has-metaboxes': hasActiveMetaboxes,
135
- 'show-icon-labels': showIconLabels,
136
- 'is-distraction-free': isDistractionFree,
137
- } );
138
131
  const openSidebarPanel = () =>
139
132
  openGeneralSidebar(
140
133
  hasBlockSelected ? 'edit-post/block' : 'edit-post/document'
@@ -166,6 +159,15 @@ function Layout( { styles } ) {
166
159
  [ entitiesSavedStatesCallback ]
167
160
  );
168
161
 
162
+ const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
163
+ 'is-sidebar-opened': sidebarIsOpened,
164
+ 'has-fixed-toolbar': hasFixedToolbar,
165
+ 'has-metaboxes': hasActiveMetaboxes,
166
+ 'show-icon-labels': showIconLabels,
167
+ 'is-distraction-free': isDistractionFree,
168
+ 'is-entity-save-view-open': !! entitiesSavedStatesCallback,
169
+ } );
170
+
169
171
  const secondarySidebarLabel = isListViewOpened
170
172
  ? __( 'Document Overview' )
171
173
  : __( 'Block Library' );
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -35,11 +30,9 @@ function FeaturedImage( { isEnabled, isOpened, postType, onTogglePanel } ) {
35
30
  return (
36
31
  <PostFeaturedImageCheck>
37
32
  <PanelBody
38
- title={ get(
39
- postType,
40
- [ 'labels', 'featured_image' ],
41
- __( 'Featured image' )
42
- ) }
33
+ title={
34
+ postType?.labels?.featured_image ?? __( 'Featured image' )
35
+ }
43
36
  opened={ isOpened }
44
37
  onToggle={ onTogglePanel }
45
38
  >
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -52,11 +47,9 @@ export function PageAttributes() {
52
47
  return (
53
48
  <PageAttributesCheck>
54
49
  <PanelBody
55
- title={ get(
56
- postType,
57
- [ 'labels', 'attributes' ],
58
- __( 'Page attributes' )
59
- ) }
50
+ title={
51
+ postType?.labels?.attributes ?? __( 'Page attributes' )
52
+ }
60
53
  opened={ isOpened }
61
54
  onToggle={ onTogglePanel }
62
55
  >
@@ -44,6 +44,8 @@ import { store as coreStore } from '@wordpress/core-data';
44
44
  */
45
45
  import { store as editPostStore } from '../../store';
46
46
 
47
+ const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
48
+
47
49
  function MaybeIframe( { children, contentRef, shouldIframe, styles, style } ) {
48
50
  const ref = useMouseMoveTypingReset();
49
51
 
@@ -278,7 +280,7 @@ export default function VisualEditor( { styles } ) {
278
280
 
279
281
  // If there is a Post Content block we use its layout for the block list;
280
282
  // if not, this must be a classic theme, in which case we use the fallback layout.
281
- const blockListLayout = postContentBlock
283
+ const blockListLayout = postContentBlock?.isValid
282
284
  ? postContentLayout
283
285
  : fallbackLayout;
284
286
 
@@ -339,7 +341,9 @@ export default function VisualEditor( { styles } ) {
339
341
  >
340
342
  <MaybeIframe
341
343
  shouldIframe={
342
- ( isBlockBasedTheme && ! hasMetaBoxes ) ||
344
+ ( isGutenbergPlugin &&
345
+ isBlockBasedTheme &&
346
+ ! hasMetaBoxes ) ||
343
347
  isTemplateMode ||
344
348
  deviceType === 'Tablet' ||
345
349
  deviceType === 'Mobile'