@wordpress/edit-post 7.22.0 → 7.24.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 (115) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/device-preview/index.js +6 -3
  3. package/build/components/device-preview/index.js.map +1 -1
  4. package/build/components/header/document-actions/index.js +3 -7
  5. package/build/components/header/document-actions/index.js.map +1 -1
  6. package/build/components/header/header-toolbar/index.js +3 -8
  7. package/build/components/header/header-toolbar/index.js.map +1 -1
  8. package/build/components/header/index.js +65 -11
  9. package/build/components/header/index.js.map +1 -1
  10. package/build/components/header/writing-menu/index.js +1 -1
  11. package/build/components/header/writing-menu/index.js.map +1 -1
  12. package/build/components/keyboard-shortcuts/index.js +2 -4
  13. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  14. package/build/components/preferences-modal/index.js +1 -1
  15. package/build/components/preferences-modal/index.js.map +1 -1
  16. package/build/components/sidebar/post-pending-status/index.js +9 -2
  17. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  18. package/build/components/sidebar/post-status/index.js +1 -4
  19. package/build/components/sidebar/post-status/index.js.map +1 -1
  20. package/build/components/sidebar/post-sticky/index.js +9 -2
  21. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  22. package/build/components/sidebar/post-template/index.js +7 -4
  23. package/build/components/sidebar/post-template/index.js.map +1 -1
  24. package/build/components/sidebar/post-visibility/index.js +12 -4
  25. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  26. package/build/components/start-page-options/index.js +11 -13
  27. package/build/components/start-page-options/index.js.map +1 -1
  28. package/build/components/text-editor/index.js +21 -1
  29. package/build/components/text-editor/index.js.map +1 -1
  30. package/build/components/view-link/index.js +11 -3
  31. package/build/components/view-link/index.js.map +1 -1
  32. package/build/components/visual-editor/index.js +5 -1
  33. package/build/components/visual-editor/index.js.map +1 -1
  34. package/build/store/actions.js +1 -1
  35. package/build/store/actions.js.map +1 -1
  36. package/build-module/components/device-preview/index.js +6 -3
  37. package/build-module/components/device-preview/index.js.map +1 -1
  38. package/build-module/components/header/document-actions/index.js +3 -7
  39. package/build-module/components/header/document-actions/index.js.map +1 -1
  40. package/build-module/components/header/header-toolbar/index.js +3 -8
  41. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  42. package/build-module/components/header/index.js +66 -12
  43. package/build-module/components/header/index.js.map +1 -1
  44. package/build-module/components/header/writing-menu/index.js +1 -1
  45. package/build-module/components/header/writing-menu/index.js.map +1 -1
  46. package/build-module/components/keyboard-shortcuts/index.js +2 -4
  47. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  48. package/build-module/components/preferences-modal/index.js +1 -1
  49. package/build-module/components/preferences-modal/index.js.map +1 -1
  50. package/build-module/components/sidebar/post-pending-status/index.js +10 -3
  51. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  52. package/build-module/components/sidebar/post-status/index.js +2 -5
  53. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  54. package/build-module/components/sidebar/post-sticky/index.js +10 -3
  55. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  56. package/build-module/components/sidebar/post-template/index.js +9 -6
  57. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  58. package/build-module/components/sidebar/post-visibility/index.js +14 -6
  59. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  60. package/build-module/components/start-page-options/index.js +12 -14
  61. package/build-module/components/start-page-options/index.js.map +1 -1
  62. package/build-module/components/text-editor/index.js +22 -2
  63. package/build-module/components/text-editor/index.js.map +1 -1
  64. package/build-module/components/view-link/index.js +11 -3
  65. package/build-module/components/view-link/index.js.map +1 -1
  66. package/build-module/components/visual-editor/index.js +5 -1
  67. package/build-module/components/visual-editor/index.js.map +1 -1
  68. package/build-module/store/actions.js +1 -1
  69. package/build-module/store/actions.js.map +1 -1
  70. package/build-style/style-rtl.css +31 -185
  71. package/build-style/style.css +31 -185
  72. package/package.json +32 -32
  73. package/src/components/device-preview/index.js +21 -15
  74. package/src/components/header/document-actions/index.js +4 -7
  75. package/src/components/header/header-toolbar/index.js +1 -5
  76. package/src/components/header/index.js +104 -17
  77. package/src/components/header/style.scss +31 -2
  78. package/src/components/header/writing-menu/index.js +1 -1
  79. package/src/components/keyboard-shortcuts/index.js +6 -3
  80. package/src/components/layout/style.scss +0 -11
  81. package/src/components/preferences-modal/index.js +1 -1
  82. package/src/components/sidebar/post-pending-status/index.js +10 -3
  83. package/src/components/sidebar/post-status/index.js +11 -8
  84. package/src/components/sidebar/post-sticky/index.js +10 -3
  85. package/src/components/sidebar/post-template/index.js +10 -6
  86. package/src/components/sidebar/post-template/style.scss +0 -16
  87. package/src/components/sidebar/post-visibility/index.js +12 -5
  88. package/src/components/sidebar/post-visibility/style.scss +0 -12
  89. package/src/components/start-page-options/index.js +8 -15
  90. package/src/components/text-editor/index.js +20 -2
  91. package/src/components/text-editor/style.scss +3 -1
  92. package/src/components/view-link/index.js +21 -10
  93. package/src/components/visual-editor/index.js +7 -0
  94. package/src/components/visual-editor/style.scss +0 -90
  95. package/src/store/actions.js +1 -1
  96. package/src/store/test/actions.js +1 -1
  97. package/src/style.scss +0 -3
  98. package/build/components/sidebar/post-author/index.js +0 -22
  99. package/build/components/sidebar/post-author/index.js.map +0 -1
  100. package/build/components/sidebar/post-schedule/index.js +0 -66
  101. package/build/components/sidebar/post-schedule/index.js.map +0 -1
  102. package/build/components/sidebar/post-url/index.js +0 -62
  103. package/build/components/sidebar/post-url/index.js.map +0 -1
  104. package/build-module/components/sidebar/post-author/index.js +0 -13
  105. package/build-module/components/sidebar/post-author/index.js.map +0 -1
  106. package/build-module/components/sidebar/post-schedule/index.js +0 -59
  107. package/build-module/components/sidebar/post-schedule/index.js.map +0 -1
  108. package/build-module/components/sidebar/post-url/index.js +0 -55
  109. package/build-module/components/sidebar/post-url/index.js.map +0 -1
  110. package/src/components/sidebar/post-author/index.js +0 -20
  111. package/src/components/sidebar/post-author/style.scss +0 -5
  112. package/src/components/sidebar/post-schedule/index.js +0 -66
  113. package/src/components/sidebar/post-schedule/style.scss +0 -34
  114. package/src/components/sidebar/post-url/index.js +0 -58
  115. package/src/components/sidebar/post-url/style.scss +0 -26
@@ -1 +1 @@
1
- {"version":3,"names":["useState","useMemo","PanelRow","Dropdown","Button","__","sprintf","useSelect","store","editorStore","coreStore","PostTemplateForm","editPostStore","PostTemplate","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","isVisible","select","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","getEditorSettings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","createElement","className","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostTemplateToggle","onClick","renderContent","onClose","templateTitle","templateSlug","getEditedPostAttribute","template","getEditedPostTemplate","title","slug","variant"],"sources":["@wordpress/edit-post/src/components/sidebar/post-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTemplateForm from './form';\nimport { store as editPostStore } from '../../../store';\n\nexport default function PostTemplate() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelRow className=\"edit-post-post-template\" ref={ setPopoverAnchor }>\n\t\t\t<span>{ __( 'Template' ) }</span>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tclassName=\"edit-post-post-template__dropdown\"\n\t\t\t\tcontentClassName=\"edit-post-post-template__dialog\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<PostTemplateToggle\n\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<PostTemplateForm onClose={ onClose } />\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PanelRow>\n\t);\n}\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) &&\n\t\t\tselect( editPostStore ).getEditedPostTemplate();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-template__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={\n\t\t\t\ttemplateTitle\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the currently selected template.\n\t\t\t\t\t\t\t__( 'Select template: %s' ),\n\t\t\t\t\t\t\ttemplateTitle\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Select template' )\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,QAAQ;AACrC,SAASH,KAAK,IAAII,aAAa,QAAQ,gBAAgB;AAEvD,eAAe,SAASC,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAGf,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMgB,YAAY,GAAGf,OAAO,CAC3B,OAAQ;IAAEgB,MAAM,EAAEH,aAAa;IAAEI,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEJ,aAAa,CAChB,CAAC;EAED,MAAMK,SAAS,GAAGZ,SAAS,CAAIa,MAAM,IAAM;IA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E,CAAE,kBAAmB,CACnC,CAAC;AAEX"}
1
+ {"version":3,"names":["useState","useMemo","Dropdown","Button","__","sprintf","useSelect","store","editorStore","privateApis","editorPrivateApis","coreStore","PostTemplateForm","editPostStore","unlock","PostPanelRow","PostTemplate","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","isVisible","select","_select$canUser","postTypeSlug","getCurrentPostType","postType","getPostType","viewable","settings","getEditorSettings","hasTemplates","availableTemplates","Object","keys","length","supportsTemplateMode","canCreateTemplates","canUser","createElement","label","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostTemplateToggle","onClick","renderContent","onClose","templateTitle","templateSlug","getEditedPostAttribute","template","getEditedPostTemplate","title","slug","className","variant"],"sources":["@wordpress/edit-post/src/components/sidebar/post-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport PostTemplateForm from './form';\nimport { store as editPostStore } from '../../../store';\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostPanelRow } = unlock( editorPrivateApis );\n\nexport default function PostTemplate() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst isVisible = useSelect( ( select ) => {\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\t\tif ( ! postType?.viewable ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst settings = select( editorStore ).getEditorSettings();\n\t\tconst hasTemplates =\n\t\t\t!! settings.availableTemplates &&\n\t\t\tObject.keys( settings.availableTemplates ).length > 0;\n\t\tif ( hasTemplates ) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ( ! settings.supportsTemplateMode ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst canCreateTemplates =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) ?? false;\n\t\treturn canCreateTemplates;\n\t}, [] );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostPanelRow label={ __( 'Template' ) } ref={ setPopoverAnchor }>\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tcontentClassName=\"edit-post-post-template__dialog\"\n\t\t\t\tfocusOnMount\n\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t<PostTemplateToggle\n\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<PostTemplateForm onClose={ onClose } />\n\t\t\t\t) }\n\t\t\t/>\n\t\t</PostPanelRow>\n\t);\n}\n\nfunction PostTemplateToggle( { isOpen, onClick } ) {\n\tconst templateTitle = useSelect( ( select ) => {\n\t\tconst templateSlug =\n\t\t\tselect( editorStore ).getEditedPostAttribute( 'template' );\n\n\t\tconst { supportsTemplateMode, availableTemplates } =\n\t\t\tselect( editorStore ).getEditorSettings();\n\t\tif ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {\n\t\t\treturn availableTemplates[ templateSlug ];\n\t\t}\n\t\tconst template =\n\t\t\tselect( coreStore ).canUser( 'create', 'templates' ) &&\n\t\t\tselect( editPostStore ).getEditedPostTemplate();\n\t\treturn (\n\t\t\ttemplate?.title ||\n\t\t\ttemplate?.slug ||\n\t\t\tavailableTemplates?.[ templateSlug ]\n\t\t);\n\t}, [] );\n\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-template__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\taria-label={\n\t\t\t\ttemplateTitle\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the currently selected template.\n\t\t\t\t\t\t\t__( 'Select template: %s' ),\n\t\t\t\t\t\t\ttemplateTitle\n\t\t\t\t\t )\n\t\t\t\t\t: __( 'Select template' )\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ templateTitle ?? __( 'Default template' ) }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,KAAK,IAAIC,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASH,KAAK,IAAII,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,QAAQ;AACrC,SAASL,KAAK,IAAIM,aAAa,QAAQ,gBAAgB;AACvD,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAM;EAAEC;AAAa,CAAC,GAAGD,MAAM,CAAEJ,iBAAkB,CAAC;AAEpD,eAAe,SAASM,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAGlB,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMmB,YAAY,GAAGlB,OAAO,CAC3B,OAAQ;IAAEmB,MAAM,EAAEH,aAAa;IAAEI,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEJ,aA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aAAa,GAAIhD,EAAE,CAAE,kBAAmB,CACnC,CAAC;AAEX"}
@@ -3,9 +3,17 @@ import { createElement } from "react";
3
3
  * WordPress dependencies
4
4
  */
5
5
  import { __, sprintf } from '@wordpress/i18n';
6
- import { PanelRow, Dropdown, Button } from '@wordpress/components';
7
- import { PostVisibility as PostVisibilityForm, PostVisibilityLabel, PostVisibilityCheck, usePostVisibilityLabel } from '@wordpress/editor';
6
+ import { Dropdown, Button } from '@wordpress/components';
7
+ import { PostVisibility as PostVisibilityForm, PostVisibilityLabel, PostVisibilityCheck, usePostVisibilityLabel, privateApis as editorPrivateApis } from '@wordpress/editor';
8
8
  import { useMemo, useState } from '@wordpress/element';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { unlock } from '../../../lock-unlock';
14
+ const {
15
+ PostPanelRow
16
+ } = unlock(editorPrivateApis);
9
17
  export function PostVisibility() {
10
18
  // Use internal state instead of a ref to make sure that the component
11
19
  // re-renders when the popover's anchor updates.
@@ -20,10 +28,10 @@ export function PostVisibility() {
20
28
  return createElement(PostVisibilityCheck, {
21
29
  render: ({
22
30
  canEdit
23
- }) => createElement(PanelRow, {
24
- ref: setPopoverAnchor,
25
- className: "edit-post-post-visibility"
26
- }, createElement("span", null, __('Visibility')), !canEdit && createElement("span", null, createElement(PostVisibilityLabel, null)), canEdit && createElement(Dropdown, {
31
+ }) => createElement(PostPanelRow, {
32
+ label: __('Visibility'),
33
+ ref: setPopoverAnchor
34
+ }, !canEdit && createElement("span", null, createElement(PostVisibilityLabel, null)), canEdit && createElement(Dropdown, {
27
35
  contentClassName: "edit-post-post-visibility__dialog",
28
36
  popoverProps: popoverProps,
29
37
  focusOnMount: true,
@@ -1 +1 @@
1
- {"version":3,"names":["__","sprintf","PanelRow","Dropdown","Button","PostVisibility","PostVisibilityForm","PostVisibilityLabel","PostVisibilityCheck","usePostVisibilityLabel","useMemo","useState","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","render","canEdit","ref","className","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostVisibilityToggle","onClick","renderContent","onClose","label","variant"],"sources":["@wordpress/edit-post/src/components/sidebar/post-visibility/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport {\n\tPostVisibility as PostVisibilityForm,\n\tPostVisibilityLabel,\n\tPostVisibilityCheck,\n\tusePostVisibilityLabel,\n} from '@wordpress/editor';\nimport { useMemo, useState } from '@wordpress/element';\n\nexport function PostVisibility() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'bottom-end',\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostVisibilityCheck\n\t\t\trender={ ( { canEdit } ) => (\n\t\t\t\t<PanelRow\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\tclassName=\"edit-post-post-visibility\"\n\t\t\t\t>\n\t\t\t\t\t<span>{ __( 'Visibility' ) }</span>\n\t\t\t\t\t{ ! canEdit && (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canEdit && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tcontentClassName=\"edit-post-post-visibility__dialog\"\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\tfocusOnMount\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<PostVisibilityToggle\n\t\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<PostVisibilityForm onClose={ onClose } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelRow>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nfunction PostVisibilityToggle( { isOpen, onClick } ) {\n\tconst label = usePostVisibilityLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-visibility__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post visibility.\n\t\t\taria-label={ sprintf( __( 'Select visibility: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default PostVisibility;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AAClE,SACCC,cAAc,IAAIC,kBAAkB,EACpCC,mBAAmB,EACnBC,mBAAmB,EACnBC,sBAAsB,QAChB,mBAAmB;AAC1B,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AAEtD,OAAO,SAASN,cAAcA,CAAA,EAAG;EAChC;EACA;EACA,MAAM,CAAEO,aAAa,EAAEC,gBAAgB,CAAE,GAAGF,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMG,YAAY,GAAGJ,OAAO,CAC3B,OAAQ;IACP;IACA;IACAK,MAAM,EAAEH,aAAa;IACrBI,SAAS,EAAE;EACZ,CAAC,CAAE,EACH,CAAEJ,aAAa,CAChB,CAAC;EAED,OACCK,aAAA,CAACT,mBAAmB;IACnBU,MAAM,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KACrBF,aAAA,CAACf,QAAQ;MACRkB,GAAG,EAAGP,gBAAkB;MACxBQ,SAAS,EAAC;IAA2B,GAErCJ,aAAA,eAAQjB,EAAE,CAAE,YAAa,CAAS,CAAC,EACjC,CAAEmB,OAAO,IACVF,aAAA,eACCA,aAAA,CAACV,mBAAmB,MAAE,CACjB,CACN,EACCY,OAAO,IACRF,aAAA,CAACd,QAAQ;MACRmB,gBAAgB,EAAC,mCAAmC;MACpDR,YAAY,EAAGA,YAAc;MAC7BS,YAAY;MACZC,YAAY,EAAGA,CAAE;QAAEC,MAAM;QAAEC;MAAS,CAAC,KACpCT,aAAA,CAACU,oBAAoB;QACpBF,MAAM,EAAGA,MAAQ;QACjBG,OAAO,EAAGF;MAAU,CACpB,CACC;MACHG,aAAa,EAAGA,CAAE;QAAEC;MAAQ,CAAC,KAC5Bb,aAAA,CAACX,kBAAkB;QAACwB,OAAO,EAAGA;MAAS,CAAE;IACvC,CACH,CAEO;EACR,CACH,CAAC;AAEJ;AAEA,SAASH,oBAAoBA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EACpD,MAAMG,KAAK,GAAGtB,sBAAsB,CAAC,CAAC;EACtC,OACCQ,aAAA,CAACb,MAAM;IACNiB,SAAS,EAAC,mCAAmC;IAC7CW,OAAO,EAAC,UAAU;IAClB,iBAAgBP;IAChB;IAAA;IACA,cAAaxB,OAAO,CAAED,EAAE,CAAE,uBAAwB,CAAC,EAAE+B,KAAM,CAAG;IAC9DH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX;AAEA,eAAe1B,cAAc"}
1
+ {"version":3,"names":["__","sprintf","Dropdown","Button","PostVisibility","PostVisibilityForm","PostVisibilityLabel","PostVisibilityCheck","usePostVisibilityLabel","privateApis","editorPrivateApis","useMemo","useState","unlock","PostPanelRow","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","render","canEdit","label","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostVisibilityToggle","onClick","renderContent","onClose","className","variant"],"sources":["@wordpress/edit-post/src/components/sidebar/post-visibility/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport {\n\tPostVisibility as PostVisibilityForm,\n\tPostVisibilityLabel,\n\tPostVisibilityCheck,\n\tusePostVisibilityLabel,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostPanelRow } = unlock( editorPrivateApis );\n\nexport function PostVisibility() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'bottom-end',\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostVisibilityCheck\n\t\t\trender={ ( { canEdit } ) => (\n\t\t\t\t<PostPanelRow\n\t\t\t\t\tlabel={ __( 'Visibility' ) }\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t>\n\t\t\t\t\t{ ! canEdit && (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<PostVisibilityLabel />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ canEdit && (\n\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\tcontentClassName=\"edit-post-post-visibility__dialog\"\n\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\tfocusOnMount\n\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t\t\t<PostVisibilityToggle\n\t\t\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<PostVisibilityForm onClose={ onClose } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PostPanelRow>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nfunction PostVisibilityToggle( { isOpen, onClick } ) {\n\tconst label = usePostVisibilityLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-visibility__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post visibility.\n\t\t\taria-label={ sprintf( __( 'Select visibility: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n\nexport default PostVisibility;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AACxD,SACCC,cAAc,IAAIC,kBAAkB,EACpCC,mBAAmB,EACnBC,mBAAmB,EACnBC,sBAAsB,EACtBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAM;EAAEC;AAAa,CAAC,GAAGD,MAAM,CAAEH,iBAAkB,CAAC;AAEpD,OAAO,SAASN,cAAcA,CAAA,EAAG;EAChC;EACA;EACA,MAAM,CAAEW,aAAa,EAAEC,gBAAgB,CAAE,GAAGJ,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAM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al } from '@wordpress/components';
6
6
  import { __ } from '@wordpress/i18n';
7
- import { useState, useEffect, useMemo } from '@wordpress/element';
7
+ import { useState, useMemo } from '@wordpress/element';
8
8
  import { store as blockEditorStore, __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';
9
9
  import { useSelect, useDispatch } from '@wordpress/data';
10
10
  import { useAsyncList } from '@wordpress/compose';
@@ -58,32 +58,28 @@ function PatternSelection({
58
58
  }
59
59
  });
60
60
  }
61
- function StartPageOptionsModal() {
62
- const [modalState, setModalState] = useState('initial');
61
+ function StartPageOptionsModal({
62
+ onClose
63
+ }) {
63
64
  const startPatterns = useStartPatterns();
64
65
  const hasStartPattern = startPatterns.length > 0;
65
- const shouldOpenModal = hasStartPattern && modalState === 'initial';
66
- useEffect(() => {
67
- if (shouldOpenModal) {
68
- setModalState('open');
69
- }
70
- }, [shouldOpenModal]);
71
- if (modalState !== 'open') {
66
+ if (!hasStartPattern) {
72
67
  return null;
73
68
  }
74
69
  return createElement(Modal, {
75
70
  className: "edit-post-start-page-options__modal",
76
71
  title: __('Choose a pattern'),
77
72
  isFullScreen: true,
78
- onRequestClose: () => setModalState('closed')
73
+ onRequestClose: onClose
79
74
  }, createElement("div", {
80
75
  className: "edit-post-start-page-options__modal-content"
81
76
  }, createElement(PatternSelection, {
82
77
  blockPatterns: startPatterns,
83
- onChoosePattern: () => setModalState('closed')
78
+ onChoosePattern: onClose
84
79
  })));
85
80
  }
86
81
  export default function StartPageOptions() {
82
+ const [isClosed, setIsClosed] = useState(false);
87
83
  const shouldEnableModal = useSelect(select => {
88
84
  const {
89
85
  isCleanNewPost
@@ -94,9 +90,11 @@ export default function StartPageOptions() {
94
90
  } = select(editPostStore);
95
91
  return !isEditingTemplate() && !isFeatureActive('welcomeGuide') && isCleanNewPost();
96
92
  }, []);
97
- if (!shouldEnableModal) {
93
+ if (!shouldEnableModal || isClosed) {
98
94
  return null;
99
95
  }
100
- return createElement(StartPageOptionsModal, null);
96
+ return createElement(StartPageOptionsModal, {
97
+ onClose: () => setIsClosed(true)
98
+ });
101
99
  }
102
100
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Modal","__","useState","useEffect","useMemo","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","useAsyncList","editorStore","editPostStore","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getCurrentPostType","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","resetEditorBlocks","createElement","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","modalState","setModalState","startPatterns","hasStartPattern","length","shouldOpenModal","className","title","isFullScreen","onRequestClose","StartPageOptions","shouldEnableModal","isCleanNewPost","isEditingTemplate","isFeatureActive"],"sources":["@wordpress/edit-post/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes } = select( blockEditorStore );\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType:\n\t\t\t\t\tgetPatternsByBlockTypes( 'core/post-content' ),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\t// filter patterns without postTypes declared if the current postType is page\n\t\t// or patterns that declare the current postType in its post type array.\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\tconst { resetEditorBlocks } = useDispatch( editorStore );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\tresetEditorBlocks( blocks );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal() {\n\tconst [ modalState, setModalState ] = useState( 'initial' );\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\tconst shouldOpenModal = hasStartPattern && modalState === 'initial';\n\n\tuseEffect( () => {\n\t\tif ( shouldOpenModal ) {\n\t\t\tsetModalState( 'open' );\n\t\t}\n\t}, [ shouldOpenModal ] );\n\n\tif ( modalState !== 'open' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-post-start-page-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ () => setModalState( 'closed' ) }\n\t\t>\n\t\t\t<div className=\"edit-post-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ () => setModalState( 'closed' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst shouldEnableModal = useSelect( ( select ) => {\n\t\tconst { isCleanNewPost } = select( editorStore );\n\t\tconst { isEditingTemplate, isFeatureActive } = select( editPostStore );\n\n\t\treturn (\n\t\t\t! isEditingTemplate() &&\n\t\t\t! isFeatureActive( 'welcomeGuide' ) &&\n\t\t\tisCleanNewPost()\n\t\t);\n\t}, [] );\n\n\tif ( ! shouldEnableModal ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACjE,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASN,KAAK,IAAIO,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASP,KAAK,IAAIQ,aAAa,QAAQ,aAAa;AAEpD,SAASC,gBAAgBA,CAAA,EAAG;EAC3B;EACA;EACA;EACA,MAAM;IAAEC,qCAAqC;IAAEC;EAAS,CAAC,GAAGP,SAAS,CAClEQ,MAAM,IAAM;IACb,MAAM;MAAEC;IAAwB,CAAC,GAAGD,MAAM,CAAEX,gBAAiB,CAAC;IAC9D,MAAM;MAAEa;IAAmB,CAAC,GAAGF,MAAM,CAAEL,WAAY,CAAC;IACpD,OAAO;MACNG,qCAAqC,EACpCG,uBAAuB,CAAE,mBAAoB,CAAC;MAC/CF,QAAQ,EAAEG,kBAAkB,CAAC;IAC9B,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,OAAOf,OAAO,CAAE,MAAM;IACrB;IACA;IACA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CAAC/B,KAAK;IACL2C,SAAS,EAAC,qCAAqC;IAC/CC,KAAK,EAAG3C,EAAE,CAAE,kBAAmB,CAAG;IAClC4C,YAAY;IACZC,cAAc,EAAGA,CAAA,KAAMR,aAAa,CAAE,QAAS;EAAG,GAElDP,aAAA;IAAKY,SAAS,EAAC;EAA6C,GAC3DZ,aAAA,CAACL,gBAAgB;IAChBC,aAAa,EAAGY,aAAe;IAC/BX,eAAe,EAAGA,CAAA,KAAMU,aAAa,CAAE,QAAS;EAAG,CACnD,CACG,CACC,CAAC;AAEV;AAEA,eAAe,SAASS,gBAAgBA,CAAA,EAAG;EAC1C,MAAMC,iBAAiB,GAAGvC,SAAS,CAAIQ,MAAM,IAAM;IAClD,MAAM;MAAEgC;IAAe,CAAC,GAAGhC,MAAM,CAAEL,WAAY,CAAC;IAChD,MAAM;MAAEsC,iBAAiB;MAAEC;IAAgB,CAAC,GAAGlC,MAAM,CAAEJ,aAAc,CAAC;IAEtE,OACC,CAAEqC,iBAAiB,CAAC,CAAC,IACrB,CAAEC,eAAe,CAAE,cAAe,CAAC,IACnCF,cAAc,CAAC,CAAC;EAElB,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAED,iBAAiB,EAAG;IAC1B,OAAO,IAAI;EACZ;EAEA,OAAOjB,aAAA,CAACK,qBAAqB,MAAE,CAAC;AACjC"}
1
+ {"version":3,"names":["Modal","__","useState","useMemo","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","useAsyncList","editorStore","editPostStore","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getCurrentPostType","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","resetEditorBlocks","createElement","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","className","title","isFullScreen","onRequestClose","StartPageOptions","isClosed","setIsClosed","shouldEnableModal","isCleanNewPost","isEditingTemplate","isFeatureActive"],"sources":["@wordpress/edit-post/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes } = select( blockEditorStore );\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType:\n\t\t\t\t\tgetPatternsByBlockTypes( 'core/post-content' ),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\t// filter patterns without postTypes declared if the current postType is page\n\t\t// or patterns that declare the current postType in its post type array.\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\tconst { resetEditorBlocks } = useDispatch( editorStore );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\tresetEditorBlocks( blocks );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-post-start-page-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"edit-post-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ onClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst shouldEnableModal = useSelect( ( select ) => {\n\t\tconst { isCleanNewPost } = select( editorStore );\n\t\tconst { isEditingTemplate, isFeatureActive } = select( editPostStore );\n\n\t\treturn (\n\t\t\t! isEditingTemplate() &&\n\t\t\t! isFeatureActive( 'welcomeGuide' ) &&\n\t\t\tisCleanNewPost()\n\t\t);\n\t}, [] );\n\n\tif ( ! shouldEnableModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAA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IAAK;EAAG,CAAE,CAAC;AACvE"}
@@ -2,11 +2,12 @@ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
5
- import { PostTextEditor, PostTitle, store as editorStore } from '@wordpress/editor';
5
+ import { PostTextEditor, PostTitleRaw, store as editorStore } from '@wordpress/editor';
6
6
  import { Button } from '@wordpress/components';
7
7
  import { useDispatch, useSelect } from '@wordpress/data';
8
8
  import { __ } from '@wordpress/i18n';
9
9
  import { displayShortcut } from '@wordpress/keycodes';
10
+ import { useEffect, useRef } from '@wordpress/element';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
@@ -19,6 +20,23 @@ export default function TextEditor() {
19
20
  const {
20
21
  switchEditorMode
21
22
  } = useDispatch(editPostStore);
23
+ const {
24
+ isWelcomeGuideVisible
25
+ } = useSelect(select => {
26
+ const {
27
+ isFeatureActive
28
+ } = select(editPostStore);
29
+ return {
30
+ isWelcomeGuideVisible: isFeatureActive('welcomeGuide')
31
+ };
32
+ }, []);
33
+ const titleRef = useRef();
34
+ useEffect(() => {
35
+ if (isWelcomeGuideVisible) {
36
+ return;
37
+ }
38
+ titleRef?.current?.focus();
39
+ }, [isWelcomeGuideVisible]);
22
40
  return createElement("div", {
23
41
  className: "edit-post-text-editor"
24
42
  }, isRichEditingEnabled && createElement("div", {
@@ -29,6 +47,8 @@ export default function TextEditor() {
29
47
  shortcut: displayShortcut.secondary('m')
30
48
  }, __('Exit code editor'))), createElement("div", {
31
49
  className: "edit-post-text-editor__body"
32
- }, createElement(PostTitle, null), createElement(PostTextEditor, null)));
50
+ }, createElement(PostTitleRaw, {
51
+ ref: titleRef
52
+ }), createElement(PostTextEditor, null)));
33
53
  }
34
54
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PostTextEditor","PostTitle","store","editorStore","Button","useDispatch","useSelect","__","displayShortcut","editPostStore","TextEditor","isRichEditingEnabled","select","getEditorSettings","richEditingEnabled","switchEditorMode","createElement","className","variant","onClick","shortcut","secondary"],"sources":["@wordpress/edit-post/src/components/text-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPostTextEditor,\n\tPostTitle,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function TextEditor() {\n\tconst isRichEditingEnabled = useSelect( ( select ) => {\n\t\treturn select( editorStore ).getEditorSettings().richEditingEnabled;\n\t}, [] );\n\tconst { switchEditorMode } = useDispatch( editPostStore );\n\n\treturn (\n\t\t<div className=\"edit-post-text-editor\">\n\t\t\t{ isRichEditingEnabled && (\n\t\t\t\t<div className=\"edit-post-text-editor__toolbar\">\n\t\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => switchEditorMode( 'visual' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'm' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"edit-post-text-editor__body\">\n\t\t\t\t<PostTitle />\n\t\t\t\t<PostTextEditor />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,SAAS,EACTC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,qBAAqB;;AAErD;AACA;AACA;AACA,SAASN,KAAK,IAAIO,aAAa,QAAQ,aAAa;AAEpD,eAAe,SAASC,UAAUA,CAAA,EAAG;EACpC,MAAMC,oBAAoB,GAAGL,SAAS,CAAIM,MAAM,IAAM;IACrD,OAAOA,MAAM,CAAET,WAAY,CAAC,CAACU,iBAAiB,CAAC,CAAC,CAACC,kBAAkB;EACpE,CAAC,EAAE,EAAG,CAAC;EACP,MAAM;IAAEC;EAAiB,CAAC,GAAGV,WAAW,CAAEI,aAAc,CAAC;EAEzD,OACCO,aAAA;IAAKC,SAAS,EAAC;EAAuB,GACnCN,oBAAoB,IACrBK,aAAA;IAAKC,SAAS,EAAC;EAAgC,GAC9CD,aAAA,aAAMT,EAAE,CAAE,cAAe,CAAO,CAAC,EACjCS,aAAA,CAACZ,MAAM;IACNc,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGA,CAAA,KAAMJ,gBAAgB,CAAE,QAAS,CAAG;IAC9CK,QAAQ,EAAGZ,eAAe,CAACa,SAAS,CAAE,GAAI;EAAG,GAE3Cd,EAAE,CAAE,kBAAmB,CAClB,CACJ,CACL,EACDS,aAAA;IAAKC,SAAS,EAAC;EAA6B,GAC3CD,aAAA,CAACf,SAAS,MAAE,CAAC,EACbe,aAAA,CAAChB,cAAc,MAAE,CACb,CACD,CAAC;AAER"}
1
+ {"version":3,"names":["PostTextEditor","PostTitleRaw","store","editorStore","Button","useDispatch","useSelect","__","displayShortcut","useEffect","useRef","editPostStore","TextEditor","isRichEditingEnabled","select","getEditorSettings","richEditingEnabled","switchEditorMode","isWelcomeGuideVisible","isFeatureActive","titleRef","current","focus","createElement","className","variant","onClick","shortcut","secondary","ref"],"sources":["@wordpress/edit-post/src/components/text-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPostTextEditor,\n\tPostTitleRaw,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { Button } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function TextEditor() {\n\tconst isRichEditingEnabled = useSelect( ( select ) => {\n\t\treturn select( editorStore ).getEditorSettings().richEditingEnabled;\n\t}, [] );\n\tconst { switchEditorMode } = useDispatch( editPostStore );\n\n\tconst { isWelcomeGuideVisible } = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( editPostStore );\n\n\t\treturn {\n\t\t\tisWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),\n\t\t};\n\t}, [] );\n\n\tconst titleRef = useRef();\n\n\tuseEffect( () => {\n\t\tif ( isWelcomeGuideVisible ) {\n\t\t\treturn;\n\t\t}\n\t\ttitleRef?.current?.focus();\n\t}, [ isWelcomeGuideVisible ] );\n\n\treturn (\n\t\t<div className=\"edit-post-text-editor\">\n\t\t\t{ isRichEditingEnabled && (\n\t\t\t\t<div className=\"edit-post-text-editor__toolbar\">\n\t\t\t\t\t<h2>{ __( 'Editing code' ) }</h2>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => switchEditorMode( 'visual' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.secondary( 'm' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Exit code editor' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"edit-post-text-editor__body\">\n\t\t\t\t<PostTitleRaw ref={ titleRef } />\n\t\t\t\t<PostTextEditor />\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,YAAY,EACZC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAA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AAC;EAA6B,GAC3CD,aAAA,CAACtB,YAAY;IAAC4B,GAAG,EAAGT;EAAU,CAAE,CAAC,EACjCG,aAAA,CAACvB,cAAc,MAAE,CACb,CACD,CAAC;AAER"}
@@ -8,11 +8,17 @@ import { external } from '@wordpress/icons';
8
8
  import { store as editorStore } from '@wordpress/editor';
9
9
  import { store as coreStore } from '@wordpress/core-data';
10
10
  import { useSelect } from '@wordpress/data';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { store as editPostStore } from '../../store';
11
16
  export default function ViewLink() {
12
17
  const {
13
18
  permalink,
14
19
  isPublished,
15
- label
20
+ label,
21
+ showIconLabels
16
22
  } = useSelect(select => {
17
23
  // Grab post type to retrieve the view_item label.
18
24
  const postTypeSlug = select(editorStore).getCurrentPostType();
@@ -20,7 +26,8 @@ export default function ViewLink() {
20
26
  return {
21
27
  permalink: select(editorStore).getPermalink(),
22
28
  isPublished: select(editorStore).isCurrentPostPublished(),
23
- label: postType?.labels.view_item
29
+ label: postType?.labels.view_item,
30
+ showIconLabels: select(editPostStore).isFeatureActive('showIconLabels')
24
31
  };
25
32
  }, []);
26
33
 
@@ -32,7 +39,8 @@ export default function ViewLink() {
32
39
  icon: external,
33
40
  label: label || __('View post'),
34
41
  href: permalink,
35
- target: "_blank"
42
+ target: "_blank",
43
+ showTooltip: !showIconLabels
36
44
  });
37
45
  }
38
46
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","Button","external","store","editorStore","coreStore","useSelect","ViewLink","permalink","isPublished","label","select","postTypeSlug","getCurrentPostType","postType","getPostType","getPermalink","isCurrentPostPublished","labels","view_item","createElement","icon","href","target"],"sources":["@wordpress/edit-post/src/components/view-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\nexport default function ViewLink() {\n\tconst { permalink, isPublished, label } = useSelect( ( select ) => {\n\t\t// Grab post type to retrieve the view_item label.\n\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\n\t\treturn {\n\t\t\tpermalink: select( editorStore ).getPermalink(),\n\t\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\t\tlabel: postType?.labels.view_item,\n\t\t};\n\t}, [] );\n\n\t// Only render the view button if the post is published and has a permalink.\n\tif ( ! isPublished || ! permalink ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\ticon={ external }\n\t\t\tlabel={ label || __( 'View post' ) }\n\t\t\thref={ permalink }\n\t\t\ttarget=\"_blank\"\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAE3C,eAAe,SAASC,QAAQA,CAAA,EAAG;EAClC,MAAM;IAAEC,SAAS;IAAEC,WAAW;IAAEC;EAAM,CAAC,GAAGJ,SAAS,CAAIK,MAAM,IAAM;IAClE;IACA,MAAMC,YAAY,GAAGD,MAAM,CAAEP,WAAY,CAAC,CAACS,kBAAkB,CAAC,CAAC;IAC/D,MAAMC,QAAQ,GAAGH,MAAM,CAAEN,SAAU,CAAC,CAACU,WAAW,CAAEH,YAAa,CAAC;IAEhE,OAAO;MACNJ,SAAS,EAAEG,MAAM,CAAEP,WAAY,CAAC,CAACY,YAAY,CAAC,CAAC;MAC/CP,WAAW,EAAEE,MAAM,CAAEP,WAAY,CAAC,CAACa,sBAAsB,CAAC,CAAC;MAC3DP,KAAK,EAAEI,QAAQ,EAAEI,MAAM,CAACC;IACzB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;;EAEP;EACA,IAAK,CAAEV,WAAW,IAAI,CAAED,SAAS,EAAG;IACnC,OAAO,IAAI;EACZ;EAEA,OACCY,aAAA,CAACnB,MAAM;IACNoB,IAAI,EAAGnB,QAAU;IACjBQ,KAAK,EAAGA,KAAK,IAAIV,EAAE,CAAE,WAAY,CAAG;IACpCsB,IAAI,EAAGd,SAAW;IAClBe,MAAM,EAAC;EAAQ,CACf,CAAC;AAEJ"}
1
+ {"version":3,"names":["__","Button","external","store","editorStore","coreStore","useSelect","editPostStore","ViewLink","permalink","isPublished","label","showIconLabels","select","postTypeSlug","getCurrentPostType","postType","getPostType","getPermalink","isCurrentPostPublished","labels","view_item","isFeatureActive","createElement","icon","href","target","showTooltip"],"sources":["@wordpress/edit-post/src/components/view-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function ViewLink() {\n\tconst { permalink, isPublished, label, showIconLabels } = useSelect(\n\t\t( select ) => {\n\t\t\t// Grab post type to retrieve the view_item label.\n\t\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\n\t\t\treturn {\n\t\t\t\tpermalink: select( editorStore ).getPermalink(),\n\t\t\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\t\t\tlabel: postType?.labels.view_item,\n\t\t\t\tshowIconLabels:\n\t\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\t// Only render the view button if the post is published and has a permalink.\n\tif ( ! isPublished || ! permalink ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\ticon={ external }\n\t\t\tlabel={ label || __( 'View post' ) }\n\t\t\thref={ permalink }\n\t\t\ttarget=\"_blank\"\n\t\t\tshowTooltip={ ! showIconLabels }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AAEpD,eAAe,SAASC,QAAQA,CAAA,EAAG;EAClC,MAAM;IAAEC,SAAS;IAAEC,WAAW;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGN,SAAS,CAChEO,MAAM,IAAM;IACb;IACA,MAAMC,YAAY,GAAGD,MAAM,CAAET,WAAY,CAAC,CAACW,kBAAkB,CAAC,CAAC;IAC/D,MAAMC,QAAQ,GAAGH,MAAM,CAAER,SAAU,CAAC,CAACY,WAAW,CAAEH,YAAa,CAAC;IAEhE,OAAO;MACNL,SAAS,EAAEI,MAAM,CAAET,WAAY,CAAC,CAACc,YAAY,CAAC,CAAC;MAC/CR,WAAW,EAAEG,MAAM,CAAET,WAAY,CAAC,CAACe,sBAAsB,CAAC,CAAC;MAC3DR,KAAK,EAAEK,QAAQ,EAAEI,MAAM,CAACC,SAAS;MACjCT,cAAc,EACbC,MAAM,CAAEN,aAAc,CAAC,CAACe,eAAe,CAAE,gBAAiB;IAC5D,CAAC;EACF,CAAC,EACD,EACD,CAAC;;EAED;EACA,IAAK,CAAEZ,WAAW,IAAI,CAAED,SAAS,EAAG;IACnC,OAAO,IAAI;EACZ;EAEA,OACCc,aAAA,CAACtB,MAAM;IACNuB,IAAI,EAAGtB,QAAU;IACjBS,KAAK,EAAGA,KAAK,IAAIX,EAAE,CAAE,WAAY,CAAG;IACpCyB,IAAI,EAAGhB,SAAW;IAClBiB,MAAM,EAAC,QAAQ;IACfC,WAAW,EAAG,CAAEf;EAAgB,CAChC,CAAC;AAEJ"}
@@ -307,7 +307,11 @@ export default function VisualEditor({
307
307
  className: isTemplateMode ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
308
308
  ,
309
309
 
310
- layout: blockListLayout
310
+ layout: blockListLayout,
311
+ dropZoneElement:
312
+ // When iframed, pass in the html element of the iframe to
313
+ // ensure the drop zone extends to the edges of the iframe.
314
+ isToBeIframed ? ref.current?.parentNode : ref.current
311
315
  }))))));
312
316
  }
313
317
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","PostTitle","store","editorStore","BlockList","BlockTools","blockEditorStore","__unstableUseTypewriter","useTypewriter","__unstableUseTypingObserver","useTypingObserver","__experimentalUseResizeCanvas","useResizeCanvas","useSettings","__experimentalRecursionProvider","RecursionProvider","privateApis","blockEditorPrivateApis","useEffect","useRef","useMemo","__unstableMotion","motion","useSelect","useMergeRefs","parse","blocksStore","coreStore","editPostStore","unlock","LayoutStyle","useLayoutClasses","useLayoutStyles","ExperimentalBlockCanvas","BlockCanvas","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","checkForPostContentAtRootLevel","VisualEditor","styles","deviceType","isWelcomeGuideVisible","isTemplateMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","hasV3BlocksOnly","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","__experimentalGetPreviewDeviceType","getCurrentPostId","getCurrentPostType","getEditorSettings","getBlockTypes","_isTemplateMode","postTypeSlug","_wrapperBlockName","editorSettings","supportsTemplateMode","postType","getPostType","canEditTemplate","canUser","viewable","undefined","__unstableIsBlockBasedTheme","every","type","apiVersion","isCleanNewPost","hasMetaBoxes","hasRootPaddingAwareAlignments","isFocusMode","themeHasDisabledLayoutStyles","themeSupportsLayout","_settings","getSettings","disableLayoutStyles","supportsLayout","focusMode","__experimentalFeatures","useRootPaddingAwareAlignments","desktopCanvasStyles","height","width","marginLeft","marginRight","display","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","ref","contentRef","fallbackLayout","newestPostContentAttributes","content","parseableContent","hasPostContentAtRootLevel","layout","align","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","postEditorLayout","observeTypingRef","titleRef","current","focus","css","alignCSS","isToBeIframed","createElement","__unstableContentRef","className","div","animate","padding","initial","shouldIframe","Fragment","selector","contentEditable","blockName","uniqueId"],"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { PostTitle, store as editorStore } from '@wordpress/editor';\nimport {\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\tuseSettings,\n\t__experimentalRecursionProvider as RecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { parse, store as blocksStore } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n} = unlock( blockEditorPrivateApis );\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\tgetEditedPostTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === '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 postType = select( coreStore ).getPostType( postTypeSlug );\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\tpostContentAttributes: getEditorSettings().postContentAttributes,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostType?.viewable && supportsTemplateMode && 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\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\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 {\n\t\thasRootPaddingAwareAlignments,\n\t\tisFocusMode,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t};\n\t}, [] );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmarginLeft: 'auto',\n\t\tmarginRight: 'auto',\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 ] = useSettings( '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( [ ref, useTypewriter() ] );\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 newestPostContentAttributes = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\n\tconst observeTypingRef = useTypingObserver();\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\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst isToBeIframed =\n\t\t( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t! hasMetaBoxes ) ||\n\t\tisTemplateMode ||\n\t\tdeviceType === 'Tablet' ||\n\t\tdeviceType === 'Mobile';\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\t'has-inline-canvas': ! isToBeIframed,\n\t\t\t} ) }\n\t\t>\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>\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<BlockCanvas\n\t\t\t\t\t\tshouldIframe={ isToBeIframed }\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\theight=\"100%\"\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\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\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=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ align && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle css={ alignCSS } />\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/>\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'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\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\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\tcontentEditable={ false }\n\t\t\t\t\t\t\t\tref={ observeTypingRef }\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\tlayout={ blockListLayout }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</BlockCanvas>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</BlockTools>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACnE,SACCC,SAAS,EACTC,UAAU,EACVH,KAAK,IAAII,gBAAgB,EACzBC,uBAAuB,IAAIC,aAAa,EACxCC,2BAA2B,IAAIC,iBAAiB,EAChDC,6BAA6B,IAAIC,eAAe,EAChDC,WAAW,EACXC,+BAA+B,IAAIC,iBAAiB,EACpDC,WAAW,IAAIC,sBAAsB,QAC/B,yBAAyB;AAChC,SAASC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,oBAAoB;AAC/D,SAASC,gBAAgB,IAAIC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,KAAK,EAAEvB,KAAK,IAAIwB,WAAW,QAAQ,mBAAmB;AAC/D,SAASxB,KAAK,IAAIyB,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASzB,KAAK,IAAI0B,aAAa,QAAQ,aAAa;AAC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WAAW;IAAC0G,GAAG,EAAGC;EAAU,CAAE,CAC/B,EACCZ,uBAAuB,IACxBc,aAAA,CAAC7G,WAAW;IACX2F,MAAM,EAAGK,iBAAmB;IAC5BU,GAAG,EAAGX;EAAyB,CAC/B,CAED,CACF,EACA,CAAEzE,cAAc,IACjBuF,aAAA;IACCE,SAAS,EAAG7I,UAAU,CACrB,6CAA6C,EAC7C;MACC,eAAe,EAAEsF,WAAW;MAC5B,oBAAoB,EACnBD;IACF,CACD,CAAG;IACHgE,eAAe,EAAG,KAAO;IACzBnC,GAAG,EAAGkB;EAAkB,GAExBO,aAAA,CAAC1I,SAAS;IAACiH,GAAG,EAAGmB;EAAU,CAAE,CACzB,CACL,EACDM,aAAA,CAAC5H,iBAAiB;IACjBuI,SAAS,EAAG/F,gBAAkB;IAC9BgG,QAAQ,EAAG/F;EAAiB,GAE5BmF,aAAA,CAACvI,SAAS;IACTyI,SAAS,EACRzF,cAAc,GACX,gBAAgB,GACf,GAAGwE,oBAAsB,wBAAuB,CAAC;IACrD;;IACDH,MAAM,EAAGS;EAAiB,CAC1B,CACiB,CACP,CACF,CACD,CACD,CAAC;AAEf"}
1
+ {"version":3,"names":["classnames","PostTitle","store","editorStore","BlockList","BlockTools","blockEditorStore","__unstableUseTypewriter","useTypewriter","__unstableUseTypingObserver","useTypingObserver","__experimentalUseResizeCanvas","useResizeCanvas","useSettings","__experimentalRecursionProvider","RecursionProvider","privateApis","blockEditorPrivateApis","useEffect","useRef","useMemo","__unstableMotion","motion","useSelect","useMergeRefs","parse","blocksStore","coreStore","editPostStore","unlock","LayoutStyle","useLayoutClasses","useLayoutStyles","ExperimentalBlockCanvas","BlockCanvas","isGutenbergPlugin","process","env","IS_GUTENBERG_PLUGIN","getPostContentAttributes","blocks","i","length","name","attributes","innerBlocks","nestedPostContent","checkForPostContentAtRootLevel","VisualEditor","styles","deviceType","isWelcomeGuideVisible","isTemplateMode","postContentAttributes","editedPostTemplate","wrapperBlockName","wrapperUniqueId","isBlockBasedTheme","hasV3BlocksOnly","select","isFeatureActive","isEditingTemplate","getEditedPostTemplate","__experimentalGetPreviewDeviceType","getCurrentPostId","getCurrentPostType","getEditorSettings","getBlockTypes","_isTemplateMode","postTypeSlug","_wrapperBlockName","editorSettings","supportsTemplateMode","postType","getPostType","canEditTemplate","canUser","viewable","undefined","__unstableIsBlockBasedTheme","every","type","apiVersion","isCleanNewPost","hasMetaBoxes","hasRootPaddingAwareAlignments","isFocusMode","themeHasDisabledLayoutStyles","themeSupportsLayout","_settings","getSettings","disableLayoutStyles","supportsLayout","focusMode","__experimentalFeatures","useRootPaddingAwareAlignments","desktopCanvasStyles","height","width","marginLeft","marginRight","display","flexFlow","background","templateModeStyles","borderRadius","border","borderBottom","resizedCanvasStyles","globalLayoutSettings","previewMode","toLowerCase","animatedStyles","paddingBottom","ref","contentRef","fallbackLayout","newestPostContentAttributes","content","parseableContent","hasPostContentAtRootLevel","layout","align","postContentLayoutClasses","blockListLayoutClass","postContentLayoutStyles","postContentLayout","inherit","contentSize","wideSize","blockListLayout","postEditorLayout","observeTypingRef","titleRef","current","focus","css","alignCSS","isToBeIframed","createElement","__unstableContentRef","className","div","animate","padding","initial","shouldIframe","Fragment","selector","contentEditable","blockName","uniqueId","dropZoneElement","parentNode"],"sources":["@wordpress/edit-post/src/components/visual-editor/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { PostTitle, store as editorStore } from '@wordpress/editor';\nimport {\n\tBlockList,\n\tBlockTools,\n\tstore as blockEditorStore,\n\t__unstableUseTypewriter as useTypewriter,\n\t__unstableUseTypingObserver as useTypingObserver,\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\tuseSettings,\n\t__experimentalRecursionProvider as RecursionProvider,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useEffect, useRef, useMemo } from '@wordpress/element';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { parse, store as blocksStore } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tLayoutStyle,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tExperimentalBlockCanvas: BlockCanvas,\n} = unlock( blockEditorPrivateApis );\n\nconst isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;\n\n/**\n * Given an array of nested blocks, find the first Post Content\n * block inside it, recursing through any nesting levels,\n * and return its attributes.\n *\n * @param {Array} blocks A list of blocks.\n *\n * @return {Object | undefined} The Post Content block.\n */\nfunction getPostContentAttributes( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn blocks[ i ].attributes;\n\t\t}\n\t\tif ( blocks[ i ].innerBlocks.length ) {\n\t\t\tconst nestedPostContent = getPostContentAttributes(\n\t\t\t\tblocks[ i ].innerBlocks\n\t\t\t);\n\n\t\t\tif ( nestedPostContent ) {\n\t\t\t\treturn nestedPostContent;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction checkForPostContentAtRootLevel( blocks ) {\n\tfor ( let i = 0; i < blocks.length; i++ ) {\n\t\tif ( blocks[ i ].name === 'core/post-content' ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nexport default function VisualEditor( { styles } ) {\n\tconst {\n\t\tdeviceType,\n\t\tisWelcomeGuideVisible,\n\t\tisTemplateMode,\n\t\tpostContentAttributes,\n\t\teditedPostTemplate = {},\n\t\twrapperBlockName,\n\t\twrapperUniqueId,\n\t\tisBlockBasedTheme,\n\t\thasV3BlocksOnly,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tisFeatureActive,\n\t\t\tisEditingTemplate,\n\t\t\tgetEditedPostTemplate,\n\t\t\t__experimentalGetPreviewDeviceType,\n\t\t} = select( editPostStore );\n\t\tconst { getCurrentPostId, getCurrentPostType, getEditorSettings } =\n\t\t\tselect( editorStore );\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\tconst _isTemplateMode = isEditingTemplate();\n\t\tconst postTypeSlug = getCurrentPostType();\n\t\tlet _wrapperBlockName;\n\n\t\tif ( postTypeSlug === '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 postType = select( coreStore ).getPostType( postTypeSlug );\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\tpostContentAttributes: getEditorSettings().postContentAttributes,\n\t\t\t// Post template fetch returns a 404 on classic themes, which\n\t\t\t// messes with e2e tests, so check it's a block theme first.\n\t\t\teditedPostTemplate:\n\t\t\t\tpostType?.viewable && supportsTemplateMode && 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\thasV3BlocksOnly: getBlockTypes().every( ( type ) => {\n\t\t\t\treturn type.apiVersion >= 3;\n\t\t\t} ),\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 {\n\t\thasRootPaddingAwareAlignments,\n\t\tisFocusMode,\n\t\tthemeHasDisabledLayoutStyles,\n\t\tthemeSupportsLayout,\n\t} = useSelect( ( select ) => {\n\t\tconst _settings = select( blockEditorStore ).getSettings();\n\t\treturn {\n\t\t\tthemeHasDisabledLayoutStyles: _settings.disableLayoutStyles,\n\t\t\tthemeSupportsLayout: _settings.supportsLayout,\n\t\t\tisFocusMode: _settings.focusMode,\n\t\t\thasRootPaddingAwareAlignments:\n\t\t\t\t_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,\n\t\t};\n\t}, [] );\n\tconst desktopCanvasStyles = {\n\t\theight: '100%',\n\t\twidth: '100%',\n\t\tmarginLeft: 'auto',\n\t\tmarginRight: 'auto',\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 ] = useSettings( '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( [ ref, useTypewriter() ] );\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 newestPostContentAttributes = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn postContentAttributes;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn getPostContentAttributes( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn getPostContentAttributes( parse( parseableContent ) ) || {};\n\t}, [\n\t\teditedPostTemplate?.content,\n\t\teditedPostTemplate?.blocks,\n\t\tpostContentAttributes,\n\t] );\n\n\tconst hasPostContentAtRootLevel = useMemo( () => {\n\t\tif ( ! editedPostTemplate?.content && ! editedPostTemplate?.blocks ) {\n\t\t\treturn false;\n\t\t}\n\t\t// When in template editing mode, we can access the blocks directly.\n\t\tif ( editedPostTemplate?.blocks ) {\n\t\t\treturn checkForPostContentAtRootLevel( editedPostTemplate?.blocks );\n\t\t}\n\t\t// If there are no blocks, we have to parse the content string.\n\t\t// Best double-check it's a string otherwise the parse function gets unhappy.\n\t\tconst parseableContent =\n\t\t\ttypeof editedPostTemplate?.content === 'string'\n\t\t\t\t? editedPostTemplate?.content\n\t\t\t\t: '';\n\n\t\treturn (\n\t\t\tcheckForPostContentAtRootLevel( parse( parseableContent ) ) || false\n\t\t);\n\t}, [ editedPostTemplate?.content, editedPostTemplate?.blocks ] );\n\n\tconst { layout = {}, align = '' } = newestPostContentAttributes || {};\n\n\tconst postContentLayoutClasses = useLayoutClasses(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content'\n\t);\n\n\tconst blockListLayoutClass = classnames(\n\t\t{\n\t\t\t'is-layout-flow': ! themeSupportsLayout,\n\t\t},\n\t\tthemeSupportsLayout && postContentLayoutClasses,\n\t\talign && `align${ align }`\n\t);\n\n\tconst postContentLayoutStyles = useLayoutStyles(\n\t\tnewestPostContentAttributes,\n\t\t'core/post-content',\n\t\t'.block-editor-block-list__layout.is-root-container'\n\t);\n\n\t// Update type for blocks using legacy layouts.\n\tconst postContentLayout = useMemo( () => {\n\t\treturn layout &&\n\t\t\t( layout?.type === 'constrained' ||\n\t\t\t\tlayout?.inherit ||\n\t\t\t\tlayout?.contentSize ||\n\t\t\t\tlayout?.wideSize )\n\t\t\t? { ...globalLayoutSettings, ...layout, type: 'constrained' }\n\t\t\t: { ...globalLayoutSettings, ...layout, type: 'default' };\n\t}, [\n\t\tlayout?.type,\n\t\tlayout?.inherit,\n\t\tlayout?.contentSize,\n\t\tlayout?.wideSize,\n\t\tglobalLayoutSettings,\n\t] );\n\n\t// If there is a Post Content block we use its layout for the block list;\n\t// if not, this must be a classic theme, in which case we use the fallback layout.\n\tconst blockListLayout = postContentAttributes\n\t\t? postContentLayout\n\t\t: fallbackLayout;\n\n\tconst postEditorLayout =\n\t\tblockListLayout?.type === 'default' && ! hasPostContentAtRootLevel\n\t\t\t? fallbackLayout\n\t\t\t: blockListLayout;\n\n\tconst observeTypingRef = useTypingObserver();\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\t// Add some styles for alignwide/alignfull Post Content and its children.\n\tconst alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);}\n\t\t.is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;}\n\t\t.is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`;\n\n\tconst isToBeIframed =\n\t\t( ( hasV3BlocksOnly || ( isGutenbergPlugin && isBlockBasedTheme ) ) &&\n\t\t\t! hasMetaBoxes ) ||\n\t\tisTemplateMode ||\n\t\tdeviceType === 'Tablet' ||\n\t\tdeviceType === 'Mobile';\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\t'has-inline-canvas': ! isToBeIframed,\n\t\t\t} ) }\n\t\t>\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>\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<BlockCanvas\n\t\t\t\t\t\tshouldIframe={ isToBeIframed }\n\t\t\t\t\t\tcontentRef={ contentRef }\n\t\t\t\t\t\tstyles={ styles }\n\t\t\t\t\t\theight=\"100%\"\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\"\n\t\t\t\t\t\t\t\t\t\tlayout={ fallbackLayout }\n\t\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=\".block-editor-block-list__layout.is-root-container\"\n\t\t\t\t\t\t\t\t\t\tlayout={ postEditorLayout }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ align && (\n\t\t\t\t\t\t\t\t\t\t<LayoutStyle css={ alignCSS } />\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/>\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'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\t'has-global-padding':\n\t\t\t\t\t\t\t\t\t\t\thasRootPaddingAwareAlignments,\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\tcontentEditable={ false }\n\t\t\t\t\t\t\t\tref={ observeTypingRef }\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\tlayout={ blockListLayout }\n\t\t\t\t\t\t\t\tdropZoneElement={\n\t\t\t\t\t\t\t\t\t// When iframed, pass in the html element of the iframe to\n\t\t\t\t\t\t\t\t\t// ensure the drop zone extends to the edges of the iframe.\n\t\t\t\t\t\t\t\t\tisToBeIframed\n\t\t\t\t\t\t\t\t\t\t? ref.current?.parentNode\n\t\t\t\t\t\t\t\t\t\t: ref.current\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</RecursionProvider>\n\t\t\t\t\t</BlockCanvas>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t</BlockTools>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACnE,SACCC,SAAS,EACTC,UAAU,EACVH,KAAK,IAAII,gBAAgB,EACzBC,uBAAuB,IAAIC,aAAa,EACxCC,2BAA2B,IAAIC,iBAAiB,EAChDC,6BAA6B,IAAIC,eAAe,EAChDC,WAAW,EACXC,+BAA+B,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f"}
@@ -512,7 +512,7 @@ export const toggleDistractionFree = () => ({
512
512
  const isDistractionFree = registry.select(preferencesStore).get('core/edit-post', 'distractionFree');
513
513
  if (!isDistractionFree) {
514
514
  registry.batch(() => {
515
- registry.dispatch(preferencesStore).set('core/edit-post', 'fixedToolbar', false);
515
+ registry.dispatch(preferencesStore).set('core/edit-post', 'fixedToolbar', true);
516
516
  dispatch.setIsInserterOpened(false);
517
517
  dispatch.setIsListViewOpened(false);
518
518
  dispatch.closeGeneralSidebar();