@wordpress/edit-post 7.27.1 → 7.28.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 (169) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -2
  3. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
  4. package/build/components/browser-url/index.js +1 -2
  5. package/build/components/browser-url/index.js.map +1 -1
  6. package/build/components/header/fullscreen-mode-close/index.js +11 -8
  7. package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
  8. package/build/components/header/header-toolbar/index.native.js +1 -2
  9. package/build/components/header/header-toolbar/index.native.js.map +1 -1
  10. package/build/components/header/index.js +8 -9
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/header/main-dashboard-button/index.js +1 -2
  13. package/build/components/header/main-dashboard-button/index.js.map +1 -1
  14. package/build/components/header/mode-switcher/index.js +1 -7
  15. package/build/components/header/mode-switcher/index.js.map +1 -1
  16. package/build/components/header/more-menu/index.js +1 -2
  17. package/build/components/header/more-menu/index.js.map +1 -1
  18. package/build/components/header/plugin-more-menu-item/index.js +1 -2
  19. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  20. package/build/components/header/post-publish-button-or-toggle.js +1 -2
  21. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  22. package/build/components/header/tools-more-menu-group/index.js +1 -2
  23. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  24. package/build/components/header/writing-menu/index.js +4 -18
  25. package/build/components/header/writing-menu/index.js.map +1 -1
  26. package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
  27. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  28. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -2
  29. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
  30. package/build/components/keyboard-shortcut-help-modal/index.js +2 -5
  31. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  32. package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -2
  33. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  34. package/build/components/keyboard-shortcuts/index.js +1 -2
  35. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  36. package/build/components/layout/actions-panel.js +1 -2
  37. package/build/components/layout/actions-panel.js.map +1 -1
  38. package/build/components/layout/index.js +7 -5
  39. package/build/components/layout/index.js.map +1 -1
  40. package/build/components/layout/index.native.js +1 -2
  41. package/build/components/layout/index.native.js.map +1 -1
  42. package/build/components/meta-boxes/meta-box-visibility.js +1 -2
  43. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  44. package/build/components/meta-boxes/meta-boxes-area/index.js +1 -2
  45. package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
  46. package/build/components/preferences-modal/enable-custom-fields.js +1 -2
  47. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
  48. package/build/components/preferences-modal/enable-panel.js +1 -2
  49. package/build/components/preferences-modal/enable-panel.js.map +1 -1
  50. package/build/components/preferences-modal/enable-publish-sidebar.js +1 -2
  51. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
  52. package/build/components/preferences-modal/index.js +1 -2
  53. package/build/components/preferences-modal/index.js.map +1 -1
  54. package/build/components/preferences-modal/meta-boxes-section.js +1 -2
  55. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  56. package/build/components/sidebar/plugin-document-setting-panel/index.js +1 -2
  57. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  58. package/build/components/sidebar/plugin-post-publish-panel/index.js +1 -2
  59. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  60. package/build/components/sidebar/plugin-post-status-info/index.js +1 -2
  61. package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  62. package/build/components/sidebar/plugin-pre-publish-panel/index.js +1 -2
  63. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  64. package/build/components/sidebar/post-format/index.js +1 -2
  65. package/build/components/sidebar/post-format/index.js.map +1 -1
  66. package/build/components/sidebar/post-pending-status/index.js +1 -2
  67. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  68. package/build/components/sidebar/post-slug/index.js +1 -2
  69. package/build/components/sidebar/post-slug/index.js.map +1 -1
  70. package/build/components/sidebar/post-sticky/index.js +1 -2
  71. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  72. package/build/components/sidebar/post-visibility/index.js +2 -2
  73. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  74. package/build/components/sidebar/settings-header/index.js +16 -11
  75. package/build/components/sidebar/settings-header/index.js.map +1 -1
  76. package/build/components/sidebar/settings-sidebar/index.js +34 -12
  77. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  78. package/build/components/sidebar/template-summary/index.js +5 -10
  79. package/build/components/sidebar/template-summary/index.js.map +1 -1
  80. package/build/components/visual-editor/block-inspector-button.js +1 -2
  81. package/build/components/visual-editor/block-inspector-button.js.map +1 -1
  82. package/build/components/visual-editor/header.native.js +1 -2
  83. package/build/components/visual-editor/header.native.js.map +1 -1
  84. package/build/components/visual-editor/index.js +5 -4
  85. package/build/components/visual-editor/index.js.map +1 -1
  86. package/build/components/welcome-guide/index.js +6 -6
  87. package/build/components/welcome-guide/index.js.map +1 -1
  88. package/build/editor.js +35 -34
  89. package/build/editor.js.map +1 -1
  90. package/build/editor.native.js +1 -2
  91. package/build/editor.native.js.map +1 -1
  92. package/build/hooks/{use-post-history.js → use-navigate-to-entity-record.js} +20 -26
  93. package/build/hooks/use-navigate-to-entity-record.js.map +1 -0
  94. package/build/hooks/validate-multiple-use/index.js +25 -4
  95. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  96. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -2
  97. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
  98. package/build/plugins/welcome-guide-menu-item/index.js +2 -2
  99. package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
  100. package/build/store/actions.js +8 -12
  101. package/build/store/actions.js.map +1 -1
  102. package/build/store/constants.js +3 -6
  103. package/build/store/constants.js.map +1 -1
  104. package/build/store/index.js +3 -4
  105. package/build/store/index.js.map +1 -1
  106. package/build/store/reducer.js +1 -2
  107. package/build/store/reducer.js.map +1 -1
  108. package/build/store/selectors.js +21 -42
  109. package/build/store/selectors.js.map +1 -1
  110. package/build-module/components/header/fullscreen-mode-close/index.js +10 -6
  111. package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
  112. package/build-module/components/header/index.js +7 -7
  113. package/build-module/components/header/index.js.map +1 -1
  114. package/build-module/components/header/mode-switcher/index.js +0 -5
  115. package/build-module/components/header/mode-switcher/index.js.map +1 -1
  116. package/build-module/components/header/writing-menu/index.js +4 -17
  117. package/build-module/components/header/writing-menu/index.js.map +1 -1
  118. package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
  119. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  120. package/build-module/components/layout/index.js +6 -3
  121. package/build-module/components/layout/index.js.map +1 -1
  122. package/build-module/components/sidebar/post-visibility/index.js +1 -0
  123. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  124. package/build-module/components/sidebar/settings-header/index.js +16 -10
  125. package/build-module/components/sidebar/settings-header/index.js.map +1 -1
  126. package/build-module/components/sidebar/settings-sidebar/index.js +33 -9
  127. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  128. package/build-module/components/sidebar/template-summary/index.js +4 -8
  129. package/build-module/components/sidebar/template-summary/index.js.map +1 -1
  130. package/build-module/components/visual-editor/index.js +5 -4
  131. package/build-module/components/visual-editor/index.js.map +1 -1
  132. package/build-module/components/welcome-guide/index.js +6 -6
  133. package/build-module/components/welcome-guide/index.js.map +1 -1
  134. package/build-module/editor.js +34 -32
  135. package/build-module/editor.js.map +1 -1
  136. package/build-module/hooks/{use-post-history.js → use-navigate-to-entity-record.js} +20 -26
  137. package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -0
  138. package/build-module/hooks/validate-multiple-use/index.js +26 -4
  139. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  140. package/build-module/plugins/welcome-guide-menu-item/index.js +2 -2
  141. package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
  142. package/build-module/store/actions.js +7 -10
  143. package/build-module/store/actions.js.map +1 -1
  144. package/build-style/style-rtl.css +29 -22
  145. package/build-style/style.css +29 -22
  146. package/package.json +32 -32
  147. package/src/components/header/fullscreen-mode-close/index.js +13 -10
  148. package/src/components/header/fullscreen-mode-close/test/index.js +31 -5
  149. package/src/components/header/index.js +10 -8
  150. package/src/components/header/mode-switcher/index.js +16 -25
  151. package/src/components/header/style.scss +40 -26
  152. package/src/components/header/writing-menu/index.js +3 -16
  153. package/src/components/layout/index.js +3 -2
  154. package/src/components/sidebar/post-visibility/index.js +1 -0
  155. package/src/components/sidebar/settings-header/index.js +17 -9
  156. package/src/components/sidebar/settings-sidebar/index.js +44 -9
  157. package/src/components/sidebar/template-summary/index.js +3 -7
  158. package/src/components/visual-editor/index.js +4 -2
  159. package/src/components/visual-editor/style.scss +1 -1
  160. package/src/components/welcome-guide/index.js +11 -6
  161. package/src/editor.js +50 -50
  162. package/src/hooks/{use-post-history.js → use-navigate-to-entity-record.js} +23 -27
  163. package/src/hooks/validate-multiple-use/index.js +28 -3
  164. package/src/plugins/welcome-guide-menu-item/index.js +3 -3
  165. package/src/store/actions.js +20 -12
  166. package/src/style.scss +0 -1
  167. package/src/test/editor.native.js +8 -5
  168. package/build/hooks/use-post-history.js.map +0 -1
  169. package/build-module/hooks/use-post-history.js.map +0 -1
@@ -9,6 +9,8 @@ import { SlotFillProvider } from '@wordpress/components';
9
9
  import { store as coreStore } from '@wordpress/core-data';
10
10
  import { store as preferencesStore } from '@wordpress/preferences';
11
11
  import { CommandMenu } from '@wordpress/commands';
12
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
13
+ import { __ } from '@wordpress/i18n';
12
14
 
13
15
  /**
14
16
  * Internal dependencies
@@ -17,10 +19,18 @@ import Layout from './components/layout';
17
19
  import EditorInitialization from './components/editor-initialization';
18
20
  import { store as editPostStore } from './store';
19
21
  import { unlock } from './lock-unlock';
20
- import usePostHistory from './hooks/use-post-history';
22
+ import useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';
21
23
  const {
22
24
  ExperimentalEditorProvider
23
25
  } = unlock(editorPrivateApis);
26
+ const {
27
+ BlockRemovalWarningModal
28
+ } = unlock(blockEditorPrivateApis);
29
+ // Prevent accidental removal of certain blocks, asking the user for
30
+ // confirmation.
31
+ const blockRemovalRules = {
32
+ 'bindings/core/pattern-overrides': __('Blocks from synced patterns that can have overriden content.')
33
+ };
24
34
  function Editor({
25
35
  postId: initialPostId,
26
36
  postType: initialPostType,
@@ -29,10 +39,11 @@ function Editor({
29
39
  ...props
30
40
  }) {
31
41
  const {
42
+ initialPost,
32
43
  currentPost,
33
- getPostLinkProps,
34
- goBack
35
- } = usePostHistory(initialPostId, initialPostType);
44
+ onNavigateToEntityRecord,
45
+ onNavigateToPreviousEntityRecord
46
+ } = useNavigateToEntityRecord(initialPostId, initialPostType);
36
47
  const {
37
48
  hasInlineToolbar,
38
49
  post,
@@ -47,50 +58,37 @@ function Editor({
47
58
  const {
48
59
  getEntityRecord,
49
60
  getPostType,
50
- getEntityRecords,
51
61
  canUser
52
62
  } = select(coreStore);
53
63
  const {
54
64
  getEditorSettings
55
65
  } = select(editorStore);
56
- const isTemplate = ['wp_template', 'wp_template_part'].includes(currentPost.postType);
57
- // Ideally the initializeEditor function should be called using the ID of the REST endpoint.
58
- // to avoid the special case.
59
- let postObject;
60
- if (isTemplate) {
61
- const posts = getEntityRecords('postType', currentPost.postType, {
62
- wp_id: currentPost.postId
63
- });
64
- postObject = posts?.[0];
65
- } else {
66
- postObject = getEntityRecord('postType', currentPost.postType, currentPost.postId);
67
- }
66
+ const postObject = getEntityRecord('postType', currentPost.postType, currentPost.postId);
68
67
  const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
69
68
  const isViewable = (_getPostType$viewable = getPostType(currentPost.postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
70
69
  const canEditTemplate = canUser('create', 'templates');
71
70
  return {
72
71
  hasInlineToolbar: isFeatureActive('inlineToolbar'),
73
72
  preferredStyleVariations: select(preferencesStore).get('core/edit-post', 'preferredStyleVariations'),
74
- template: supportsTemplateMode && isViewable && canEditTemplate ? getEditedPostTemplate() : null,
73
+ template: supportsTemplateMode && isViewable && canEditTemplate && currentPost.postType !== 'wp_template' ? getEditedPostTemplate() : null,
75
74
  post: postObject
76
75
  };
77
76
  }, [currentPost.postType, currentPost.postId]);
78
77
  const {
79
78
  updatePreferredStyleVariations
80
79
  } = useDispatch(editPostStore);
81
- const editorSettings = useMemo(() => {
82
- const result = {
83
- ...settings,
84
- getPostLinkProps,
85
- goBack,
86
- __experimentalPreferredStyleVariations: {
87
- value: preferredStyleVariations,
88
- onChange: updatePreferredStyleVariations
89
- },
90
- hasInlineToolbar
91
- };
92
- return result;
93
- }, [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, getPostLinkProps, goBack]);
80
+ const defaultRenderingMode = currentPost.postType === 'wp_template' ? 'all' : 'post-only';
81
+ const editorSettings = useMemo(() => ({
82
+ ...settings,
83
+ onNavigateToEntityRecord,
84
+ onNavigateToPreviousEntityRecord,
85
+ defaultRenderingMode,
86
+ __experimentalPreferredStyleVariations: {
87
+ value: preferredStyleVariations,
88
+ onChange: updatePreferredStyleVariations
89
+ },
90
+ hasInlineToolbar
91
+ }), [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord, defaultRenderingMode]);
94
92
  if (!post) {
95
93
  return null;
96
94
  }
@@ -103,7 +101,11 @@ function Editor({
103
101
  ...props
104
102
  }, createElement(ErrorBoundary, null, createElement(CommandMenu, null), createElement(EditorInitialization, {
105
103
  postId: currentPost.postId
106
- }), createElement(Layout, null)), createElement(PostLockedModal, null)));
104
+ }), createElement(Layout, {
105
+ initialPost: initialPost
106
+ }), createElement(BlockRemovalWarningModal, {
107
+ rules: blockRemovalRules
108
+ })), createElement(PostLockedModal, null)));
107
109
  }
108
110
  export default Editor;
109
111
  //# sourceMappingURL=editor.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","useDispatch","ErrorBoundary","PostLockedModal","store","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","preferencesStore","CommandMenu","Layout","EditorInitialization","editPostStore","unlock","usePostHistory","ExperimentalEditorProvider","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","currentPost","getPostLinkProps","goBack","hasInlineToolbar","post","preferredStyleVariations","template","select","_getPostType$viewable","isFeatureActive","getEditedPostTemplate","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","createElement","useSubRegistry","__unstableTemplate"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport usePostHistory from './hooks/use-post-history';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst { currentPost, getPostLinkProps, goBack } = usePostHistory(\n\t\tinitialPostId,\n\t\tinitialPostType\n\t);\n\n\tconst { hasInlineToolbar, post, preferredStyleVariations, template } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { isFeatureActive, getEditedPostTemplate } =\n\t\t\t\t\tselect( editPostStore );\n\t\t\t\tconst {\n\t\t\t\t\tgetEntityRecord,\n\t\t\t\t\tgetPostType,\n\t\t\t\t\tgetEntityRecords,\n\t\t\t\t\tcanUser,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\t\tconst isTemplate = [\n\t\t\t\t\t'wp_template',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t].includes( currentPost.postType );\n\t\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t\t// to avoid the special case.\n\t\t\t\tlet postObject;\n\t\t\t\tif ( isTemplate ) {\n\t\t\t\t\tconst posts = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twp_id: currentPost.postId,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t\t} else {\n\t\t\t\t\tpostObject = getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\t\tcurrentPost.postId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst supportsTemplateMode =\n\t\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\t\tconst isViewable =\n\t\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\t\treturn {\n\t\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t\t),\n\t\t\t\t\ttemplate:\n\t\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t\t: null,\n\t\t\t\t\tpost: postObject,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ currentPost.postType, currentPost.postId ]\n\t\t);\n\n\tconst { updatePreferredStyleVariations } = useDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\tgetPostLinkProps,\n\t\t\tgoBack,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasInlineToolbar,\n\t\t};\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasInlineToolbar,\n\t\tpreferredStyleVariations,\n\t\tupdatePreferredStyleVariations,\n\t\tgetPostLinkProps,\n\t\tgoBack,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\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AM,GAAG;MACd,GAAG/B,QAAQ;MACXI,gBAAgB;MAChBC,MAAM;MACN2B,sCAAsC,EAAE;QACvCC,KAAK,EAAEzB,wBAAwB;QAC/B0B,QAAQ,EAAEL;MACX,CAAC;MACDvB;IACD,CAAC;IACD,OAAOyB,MAAM;EACd,CAAC,EAAE,CACF/B,QAAQ,EACRM,gBAAgB,EAChBE,wBAAwB,EACxBqB,8BAA8B,EAC9BzB,gBAAgB,EAChBC,MAAM,CACL,CAAC;EAEH,IAAK,CAAEE,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;EAEA,OACC4B,aAAA,CAAClD,gBAAgB,QAChBkD,aAAA,CAACzC,0BAA0B;IAC1BM,QAAQ,EAAG8B,cAAgB;IAC3BvB,IAAI,EAAGA,IAAM;IACbN,YAAY,EAAGA,YAAc;IAC7BmC,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAG5B,QAAU;IAAA,GAC1BP;EAAK,GAEViC,aAAA,CAACzD,aAAa,QACbyD,aAAA,CAAC/C,WAAW,MAAE,CAAC,EACf+C,aAAA,CAAC7C,oBAAoB;IAACM,MAAM,EAAGO,WAAW,CAACP;EAAQ,CAAE,CAAC,EACtDuC,aAAA,CAAC9C,MAAM,MAAE,CACK,CAAC,EAChB8C,aAAA,CAACxD,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAEA,eAAegB,MAAM"}
1
+ {"version":3,"names":["useSelect","useDispatch","ErrorBoundary","PostLockedModal","store","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","preferencesStore","CommandMenu","blockEditorPrivateApis","__","Layout","EditorInitialization","editPostStore","unlock","useNavigateToEntityRecord","ExperimentalEditorProvider","BlockRemovalWarningModal","blockRemovalRules","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","initialPost","currentPost","onNavigateToEntityRecord","onNavigateToPreviousEntityRecord","hasInlineToolbar","post","preferredStyleVariations","template","select","_getPostType$viewable","isFeatureActive","getEditedPostTemplate","getEntityRecord","getPostType","canUser","getEditorSettings","postObject","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","defaultRenderingMode","editorSettings","__experimentalPreferredStyleVariations","value","onChange","createElement","useSubRegistry","__unstableTemplate","rules"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport useNavigateToEntityRecord from './hooks/use-navigate-to-entity-record';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\nconst { BlockRemovalWarningModal } = unlock( blockEditorPrivateApis );\n// Prevent accidental removal of certain blocks, asking the user for\n// confirmation.\nconst blockRemovalRules = {\n\t'bindings/core/pattern-overrides': __(\n\t\t'Blocks from synced patterns that can have overriden content.'\n\t),\n};\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst {\n\t\tinitialPost,\n\t\tcurrentPost,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t} = useNavigateToEntityRecord( initialPostId, initialPostType );\n\n\tconst { hasInlineToolbar, post, preferredStyleVariations, template } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { isFeatureActive, getEditedPostTemplate } =\n\t\t\t\t\tselect( editPostStore );\n\t\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\t\tselect( coreStore );\n\t\t\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\t\t\tconst postObject = getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\tcurrentPost.postId\n\t\t\t\t);\n\n\t\t\t\tconst supportsTemplateMode =\n\t\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\t\tconst isViewable =\n\t\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\t\treturn {\n\t\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t\t),\n\t\t\t\t\ttemplate:\n\t\t\t\t\t\tsupportsTemplateMode &&\n\t\t\t\t\t\tisViewable &&\n\t\t\t\t\t\tcanEditTemplate &&\n\t\t\t\t\t\tcurrentPost.postType !== 'wp_template'\n\t\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t\t: null,\n\t\t\t\t\tpost: postObject,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ currentPost.postType, currentPost.postId ]\n\t\t);\n\n\tconst { updatePreferredStyleVariations } = useDispatch( editPostStore );\n\tconst defaultRenderingMode =\n\t\tcurrentPost.postType === 'wp_template' ? 'all' : 'post-only';\n\n\tconst editorSettings = useMemo(\n\t\t() => ( {\n\t\t\t...settings,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasInlineToolbar,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasInlineToolbar,\n\t\t\tpreferredStyleVariations,\n\t\t\tupdatePreferredStyleVariations,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\tdefaultRenderingMode,\n\t\t]\n\t);\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout initialPost={ initialPost } />\n\t\t\t\t\t<BlockRemovalWarningModal rules={ blockRemovalRules } />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,aAAa,EACbC,eAAe,EACfC,KAAK,IAAIC,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASL,KAAK,IAAIM,SAAS,QAAQ,sBAAsB;AACzD,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASN,WAAW,IAAIO,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OA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A,YAAc;IAC7B+B,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAGvB,QAAU;IAAA,GAC1BR;EAAK,GAEV6B,aAAA,CAACzD,aAAa,QACbyD,aAAA,CAAC/C,WAAW,MAAE,CAAC,EACf+C,aAAA,CAAC3C,oBAAoB;IAACQ,MAAM,EAAGQ,WAAW,CAACR;EAAQ,CAAE,CAAC,EACtDmC,aAAA,CAAC5C,MAAM;IAACgB,WAAW,EAAGA;EAAa,CAAE,CAAC,EACtC4B,aAAA,CAACtC,wBAAwB;IAACyC,KAAK,EAAGxC;EAAmB,CAAE,CACzC,CAAC,EAChBqC,aAAA,CAACxD,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAEA,eAAeoB,MAAM"}
@@ -1,8 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useCallback, useReducer } from '@wordpress/element';
5
- import { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';
4
+ import { useCallback, useReducer, useMemo } from '@wordpress/element';
6
5
 
7
6
  /**
8
7
  * A hook that records the 'entity' history in the post editor as a user
@@ -16,9 +15,9 @@ import { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';
16
15
  * @param {string} initialPostType The post type of the post when the editor loaded.
17
16
  *
18
17
  * @return {Object} An object containing the `currentPost` variable and
19
- * `getPostLinkProps` and `goBack` functions.
18
+ * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.
20
19
  */
21
- export default function usePostHistory(initialPostId, initialPostType) {
20
+ export default function useNavigateToEntityRecord(initialPostId, initialPostType) {
22
21
  const [postHistory, dispatch] = useReducer((historyState, {
23
22
  type,
24
23
  post
@@ -37,28 +36,22 @@ export default function usePostHistory(initialPostId, initialPostType) {
37
36
  postId: initialPostId,
38
37
  postType: initialPostType
39
38
  }]);
40
- const getPostLinkProps = useCallback(params => {
41
- const currentArgs = getQueryArgs(window.location.href);
42
- const currentUrlWithoutArgs = removeQueryArgs(window.location.href, ...Object.keys(currentArgs));
43
- const newUrl = addQueryArgs(currentUrlWithoutArgs, {
44
- post: params.postId,
45
- action: 'edit'
46
- });
39
+ const initialPost = useMemo(() => {
47
40
  return {
48
- href: newUrl,
49
- onClick: event => {
50
- event.preventDefault();
51
- dispatch({
52
- type: 'push',
53
- post: {
54
- postId: params.postId,
55
- postType: params.postType
56
- }
57
- });
58
- }
41
+ type: initialPostType,
42
+ id: initialPostId
59
43
  };
44
+ }, [initialPostType, initialPostId]);
45
+ const onNavigateToEntityRecord = useCallback(params => {
46
+ dispatch({
47
+ type: 'push',
48
+ post: {
49
+ postId: params.postId,
50
+ postType: params.postType
51
+ }
52
+ });
60
53
  }, []);
61
- const goBack = useCallback(() => {
54
+ const onNavigateToPreviousEntityRecord = useCallback(() => {
62
55
  dispatch({
63
56
  type: 'pop'
64
57
  });
@@ -66,8 +59,9 @@ export default function usePostHistory(initialPostId, initialPostType) {
66
59
  const currentPost = postHistory[postHistory.length - 1];
67
60
  return {
68
61
  currentPost,
69
- getPostLinkProps,
70
- goBack: postHistory.length > 1 ? goBack : undefined
62
+ initialPost,
63
+ onNavigateToEntityRecord,
64
+ onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : undefined
71
65
  };
72
66
  }
73
- //# sourceMappingURL=use-post-history.js.map
67
+ //# sourceMappingURL=use-navigate-to-entity-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useCallback","useReducer","useMemo","useNavigateToEntityRecord","initialPostId","initialPostType","postHistory","dispatch","historyState","type","post","length","slice","postId","postType","initialPost","id","onNavigateToEntityRecord","params","onNavigateToPreviousEntityRecord","currentPost","undefined"],"sources":["@wordpress/edit-post/src/hooks/use-navigate-to-entity-record.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useCallback, useReducer, useMemo } from '@wordpress/element';\n\n/**\n * A hook that records the 'entity' history in the post editor as a user\n * navigates between editing a post and editing the post template or patterns.\n *\n * Implemented as a stack, so a little similar to the browser history API.\n *\n * Used to control displaying UI elements like the back button.\n *\n * @param {number} initialPostId The post id of the post when the editor loaded.\n * @param {string} initialPostType The post type of the post when the editor loaded.\n *\n * @return {Object} An object containing the `currentPost` variable and\n * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.\n */\nexport default function useNavigateToEntityRecord(\n\tinitialPostId,\n\tinitialPostType\n) {\n\tconst [ postHistory, dispatch ] = useReducer(\n\t\t( historyState, { type, post } ) => {\n\t\t\tif ( type === 'push' ) {\n\t\t\t\treturn [ ...historyState, post ];\n\t\t\t}\n\t\t\tif ( type === 'pop' ) {\n\t\t\t\t// Try to leave one item in the history.\n\t\t\t\tif ( historyState.length > 1 ) {\n\t\t\t\t\treturn historyState.slice( 0, -1 );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn historyState;\n\t\t},\n\t\t[ { postId: initialPostId, postType: initialPostType } ]\n\t);\n\n\tconst initialPost = useMemo( () => {\n\t\treturn {\n\t\t\ttype: initialPostType,\n\t\t\tid: initialPostId,\n\t\t};\n\t}, [ initialPostType, initialPostId ] );\n\n\tconst onNavigateToEntityRecord = useCallback( ( params ) => {\n\t\tdispatch( {\n\t\t\ttype: 'push',\n\t\t\tpost: { postId: params.postId, postType: params.postType },\n\t\t} );\n\t}, [] );\n\n\tconst onNavigateToPreviousEntityRecord = useCallback( () => {\n\t\tdispatch( { type: 'pop' } );\n\t}, [] );\n\n\tconst currentPost = postHistory[ postHistory.length - 1 ];\n\n\treturn {\n\t\tcurrentPost,\n\t\tinitialPost,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord:\n\t\t\tpostHistory.length > 1\n\t\t\t\t? onNavigateToPreviousEntityRecord\n\t\t\t\t: undefined,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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XE,wBAAwB;IACxBE,gCAAgC,EAC/Bb,WAAW,CAACK,MAAM,GAAG,CAAC,GACnBQ,gCAAgC,GAChCE;EACL,CAAC;AACF"}
@@ -9,6 +9,31 @@ import { Warning, store as blockEditorStore } from '@wordpress/block-editor';
9
9
  import { addFilter } from '@wordpress/hooks';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { compose, createHigherOrderComponent } from '@wordpress/compose';
12
+
13
+ /**
14
+ * Recursively find very first block of an specific block type.
15
+ *
16
+ * @param {Object[]} blocks List of blocks.
17
+ * @param {string} name Block name to search.
18
+ *
19
+ * @return {Object|undefined} Return block object or undefined.
20
+ */
21
+ function findFirstOfSameType(blocks, name) {
22
+ if (!Array.isArray(blocks) || !blocks.length) {
23
+ return;
24
+ }
25
+ for (const block of blocks) {
26
+ if (block.name === name) {
27
+ return block;
28
+ }
29
+
30
+ // Search inside innerBlocks.
31
+ const firstBlock = findFirstOfSameType(block.innerBlocks, name);
32
+ if (firstBlock) {
33
+ return firstBlock;
34
+ }
35
+ }
36
+ }
12
37
  const enhance = compose(
13
38
  /**
14
39
  * For blocks whose block type doesn't support `multiple`, provides the
@@ -33,9 +58,7 @@ withSelect((select, block) => {
33
58
  // Otherwise, only pass `originalBlockClientId` if it refers to a different
34
59
  // block from the current one.
35
60
  const blocks = select(blockEditorStore).getBlocks();
36
- const firstOfSameType = blocks.find(({
37
- name
38
- }) => block.name === name);
61
+ const firstOfSameType = findFirstOfSameType(blocks, block.name);
39
62
  const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
40
63
  return {
41
64
  originalBlockClientId: isInvalid && firstOfSameType.clientId
@@ -100,7 +123,6 @@ function getOutboundType(blockName) {
100
123
  blocks
101
124
  }) => type === 'block' && blocks.length === 1 // What about when .length > 1?
102
125
  );
103
-
104
126
  if (!transform) {
105
127
  return null;
106
128
  }
@@ -1 +1 @@
1
- {"version":3,"names":["createBlock","findTransform","getBlockTransforms","getBlockType","hasBlockSupport","Button","withSelect","withDispatch","Warning","store","blockEditorStore","addFilter","__","compose","createHigherOrderComponent","enhance","select","block","multiple","name","blocks","getBlocks","firstOfSameType","find","isInvalid","clientId","originalBlockClientId","dispatch","selectFirst","selectBlock","withMultipleValidation","BlockEdit","props","createElement","blockType","outboundType","getOutboundType","key","style","minHeight","actions","variant","onClick","onReplace","attributes","title","blockName","transform","type","length"],"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {Component} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {Component} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = blocks.find(\n\t\t\t( { name } ) => block.name === name\n\t\t);\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with-multiple-validation',\n\twithMultipleValidation\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,OAAO,EAAEC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AAC5E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,EAAEC,0BAA0B,QAAQ,oBAAoB;AAExE,MAAMC,OAAO,GAAGF,OAAO;AACtB;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACCP,UAAU,CAAE,CAAEU,MAAM,EAAEC,KAAK,KAAM;EAChC,MAAMC,QAAQ,GAAGd,eAAe,CAAEa,KAAK,CAACE,IAAI,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AAY,CAAE4C,SAAS,CAAC3B,MAAM,CAAE,CAAC,CAAG,CAAC;AAC7C;AAEAT,SAAS,CACR,kBAAkB,EAClB,+DAA+D,EAC/DmB,sBACD,CAAC"}
1
+ {"version":3,"names":["createBlock","findTransform","getBlockTransforms","getBlockType","hasBlockSupport","Button","withSelect","withDispatch","Warning","store","blockEditorStore","addFilter","__","compose","createHigherOrderComponent","findFirstOfSameType","blocks","name","Array","isArray","length","block","firstBlock","innerBlocks","enhance","select","multiple","getBlocks","firstOfSameType","isInvalid","clientId","originalBlockClientId","dispatch","selectFirst","selectBlock","withMultipleValidation","BlockEdit","props","createElement","blockType","outboundType","getOutboundType","key","style","minHeight","actions","variant","onClick","onReplace","attributes","title","blockName","transform","type"],"sources":["@wordpress/edit-post/src/hooks/validate-multiple-use/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcreateBlock,\n\tfindTransform,\n\tgetBlockTransforms,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { Button } from '@wordpress/components';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { Warning, store as blockEditorStore } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\nimport { __ } from '@wordpress/i18n';\nimport { compose, createHigherOrderComponent } from '@wordpress/compose';\n\n/**\n * Recursively find very first block of an specific block type.\n *\n * @param {Object[]} blocks List of blocks.\n * @param {string} name Block name to search.\n *\n * @return {Object|undefined} Return block object or undefined.\n */\nfunction findFirstOfSameType( blocks, name ) {\n\tif ( ! Array.isArray( blocks ) || ! blocks.length ) {\n\t\treturn;\n\t}\n\n\tfor ( const block of blocks ) {\n\t\tif ( block.name === name ) {\n\t\t\treturn block;\n\t\t}\n\n\t\t// Search inside innerBlocks.\n\t\tconst firstBlock = findFirstOfSameType( block.innerBlocks, name );\n\n\t\tif ( firstBlock ) {\n\t\t\treturn firstBlock;\n\t\t}\n\t}\n}\n\nconst enhance = compose(\n\t/**\n\t * For blocks whose block type doesn't support `multiple`, provides the\n\t * wrapped component with `originalBlockClientId` -- a reference to the\n\t * first block of the same type in the content -- if and only if that\n\t * \"original\" block is not the current one. Thus, an inexisting\n\t * `originalBlockClientId` prop signals that the block is valid.\n\t *\n\t * @param {Component} WrappedBlockEdit A filtered BlockEdit instance.\n\t *\n\t * @return {Component} Enhanced component with merged state data props.\n\t */\n\twithSelect( ( select, block ) => {\n\t\tconst multiple = hasBlockSupport( block.name, 'multiple', true );\n\n\t\t// For block types with `multiple` support, there is no \"original\n\t\t// block\" to be found in the content, as the block itself is valid.\n\t\tif ( multiple ) {\n\t\t\treturn {};\n\t\t}\n\n\t\t// Otherwise, only pass `originalBlockClientId` if it refers to a different\n\t\t// block from the current one.\n\t\tconst blocks = select( blockEditorStore ).getBlocks();\n\t\tconst firstOfSameType = findFirstOfSameType( blocks, block.name );\n\t\tconst isInvalid =\n\t\t\tfirstOfSameType && firstOfSameType.clientId !== block.clientId;\n\t\treturn {\n\t\t\toriginalBlockClientId: isInvalid && firstOfSameType.clientId,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch, { originalBlockClientId } ) => ( {\n\t\tselectFirst: () =>\n\t\t\tdispatch( blockEditorStore ).selectBlock( originalBlockClientId ),\n\t} ) )\n);\n\nconst withMultipleValidation = createHigherOrderComponent( ( BlockEdit ) => {\n\treturn enhance( ( { originalBlockClientId, selectFirst, ...props } ) => {\n\t\tif ( ! originalBlockClientId ) {\n\t\t\treturn <BlockEdit { ...props } />;\n\t\t}\n\n\t\tconst blockType = getBlockType( props.name );\n\t\tconst outboundType = getOutboundType( props.name );\n\n\t\treturn [\n\t\t\t<div key=\"invalid-preview\" style={ { minHeight: '60px' } }>\n\t\t\t\t<BlockEdit key=\"block-edit\" { ...props } />\n\t\t\t</div>,\n\t\t\t<Warning\n\t\t\t\tkey=\"multiple-use-warning\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"find-original\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ selectFirst }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Find original' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"remove\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => props.onReplace( [] ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Remove' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\toutboundType && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tkey=\"transform\"\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\tprops.onReplace(\n\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\toutboundType.name,\n\t\t\t\t\t\t\t\t\t\tprops.attributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform into:' ) } { outboundType.title }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t),\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t<strong>{ blockType?.title }: </strong>\n\t\t\t\t{ __( 'This block can only be used once.' ) }\n\t\t\t</Warning>,\n\t\t];\n\t} );\n}, 'withMultipleValidation' );\n\n/**\n * Given a base block name, returns the default block type to which to offer\n * transforms.\n *\n * @param {string} blockName Base block name.\n *\n * @return {?Object} The chosen default block type.\n */\nfunction getOutboundType( blockName ) {\n\t// Grab the first outbound transform.\n\tconst transform = findTransform(\n\t\tgetBlockTransforms( 'to', blockName ),\n\t\t( { type, blocks } ) => type === 'block' && blocks.length === 1 // What about when .length > 1?\n\t);\n\n\tif ( ! transform ) {\n\t\treturn null;\n\t}\n\n\treturn getBlockType( transform.blocks[ 0 ] );\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-post/validate-multiple-use/with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EAAE,CAAE,eAAgB,CACf,CAAC,EACT0B,aAAA,CAACjC,MAAM;QACNqC,GAAG,EAAC,QAAQ;QACZI,OAAO,EAAC,WAAW;QACnBC,OAAO,EAAGA,CAAA,KAAMV,KAAK,CAACW,SAAS,CAAE,EAAG;MAAG,GAErCpC,EAAE,CAAE,QAAS,CACR,CAAC,EACT4B,YAAY,IACXF,aAAA,CAACjC,MAAM;QACNqC,GAAG,EAAC,WAAW;QACfI,OAAO,EAAC,WAAW;QACnBC,OAAO,EAAGA,CAAA,KACTV,KAAK,CAACW,SAAS,CACdhD,WAAW,CACVwC,YAAY,CAACvB,IAAI,EACjBoB,KAAK,CAACY,UACP,CACD;MACA,GAECrC,EAAE,CAAE,iBAAkB,CAAC,EAAE,GAAC,EAAE4B,YAAY,CAACU,KACpC,CACR;IACC,GAEHZ,aAAA,iBAAUC,SAAS,EAAEW,KAAK,EAAE,IAAU,CAAC,EACrCtC,EAAE,CAAE,mCAAoC,CAClC,CAAC,CACV;EACF,CAAE,CAAC;AACJ,CAAC,EAAE,wBAAyB,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS6B,eAAeA,CAAEU,SAAS,EAAG;EACrC;EACA,MAAMC,SAAS,GAAGnD,aAAa,CAC9BC,kBAAkB,CAAE,IAAI,EAAEiD,SAAU,CAAC,EACrC,CAAE;IAAEE,IAAI;IAAErC;EAAO,CAAC,KAAMqC,IAAI,KAAK,OAAO,IAAIrC,MAAM,CAACI,MAAM,KAAK,CAAC,CAAC;EACjE,CAAC;EAED,IAAK,CAAEgC,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OAAOjD,YAAY,CAAEiD,SAAS,CAACpC,MAAM,CAAE,CAAC,CAAG,CAAC;AAC7C;AAEAL,SAAS,CACR,kBAAkB,EAClB,+DAA+D,EAC/DwB,sBACD,CAAC"}
@@ -7,10 +7,10 @@ import { PreferenceToggleMenuItem } from '@wordpress/preferences';
7
7
  import { __ } from '@wordpress/i18n';
8
8
  import { store as editorStore } from '@wordpress/editor';
9
9
  export default function WelcomeGuideMenuItem() {
10
- const isTemplateMode = useSelect(select => select(editorStore).getRenderingMode() === 'template-only', []);
10
+ const isEditingTemplate = useSelect(select => select(editorStore).getCurrentPostType() === 'wp_template', []);
11
11
  return createElement(PreferenceToggleMenuItem, {
12
12
  scope: "core/edit-post",
13
- name: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide',
13
+ name: isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide',
14
14
  label: __('Welcome Guide')
15
15
  });
16
16
  }
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","PreferenceToggleMenuItem","__","store","editorStore","WelcomeGuideMenuItem","isTemplateMode","select","getRenderingMode","createElement","scope","name","label"],"sources":["@wordpress/edit-post/src/plugins/welcome-guide-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isTemplateMode = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getRenderingMode() === 'template-only',\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,wBAAwB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AAExD,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,cAAc,GAAGN,SAAS,CAC7BO,MAAM,IACPA,MAAM,CAAEH,WAAY,CAAC,CAACI,gBAAgB,CAAC,CAAC,KAAK,eAAe,EAC7D,EACD,CAAC;EAED,OACCC,aAAA,CAACR,wBAAwB;IACxBS,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGL,cAAc,GAAG,sBAAsB,GAAG,cAAgB;IACjEM,KAAK,EAAGV,EAAE,CAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ"}
1
+ {"version":3,"names":["useSelect","PreferenceToggleMenuItem","__","store","editorStore","WelcomeGuideMenuItem","isEditingTemplate","select","getCurrentPostType","createElement","scope","name","label"],"sources":["@wordpress/edit-post/src/plugins/welcome-guide-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isEditingTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,wBAAwB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AAExD,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAGN,SAAS,CAChCO,MAAM,IACPA,MAAM,CAAEH,WAAY,CAAC,CAACI,kBAAkB,CAAC,CAAC,KAAK,aAAa,EAC7D,EACD,CAAC;EAED,OACCC,aAAA,CAACR,wBAAwB;IACxBS,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGL,iBAAiB,GAAG,sBAAsB,GAAG,cAAgB;IACpEM,KAAK,EAAGV,EAAE,CAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ"}
@@ -415,15 +415,6 @@ export function setIsEditingTemplate() {
415
415
  };
416
416
  }
417
417
 
418
- /**
419
- * Switches to the template mode.
420
- */
421
- export const __unstableSwitchToTemplateMode = () => ({
422
- registry
423
- }) => {
424
- registry.dispatch(editorStore).setRenderingMode('template-only');
425
- };
426
-
427
418
  /**
428
419
  * Create a block based template.
429
420
  *
@@ -486,6 +477,9 @@ export const toggleDistractionFree = () => ({
486
477
  registry
487
478
  }) => {
488
479
  const isDistractionFree = registry.select(preferencesStore).get('core', 'distractionFree');
480
+ if (isDistractionFree) {
481
+ registry.dispatch(preferencesStore).set('core', 'fixedToolbar', false);
482
+ }
489
483
  if (!isDistractionFree) {
490
484
  registry.batch(() => {
491
485
  registry.dispatch(preferencesStore).set('core', 'fixedToolbar', true);
@@ -502,7 +496,10 @@ export const toggleDistractionFree = () => ({
502
496
  actions: [{
503
497
  label: __('Undo'),
504
498
  onClick: () => {
505
- registry.dispatch(preferencesStore).toggle('core', 'distractionFree');
499
+ registry.batch(() => {
500
+ registry.dispatch(preferencesStore).set('core', 'fixedToolbar', isDistractionFree ? true : false);
501
+ registry.dispatch(preferencesStore).toggle('core', 'distractionFree');
502
+ });
506
503
  }
507
504
  }]
508
505
  });
@@ -1 +1 @@
1
- {"version":3,"names":["__","apiFetch","store","interfaceStore","preferencesStore","speak","noticesStore","blockEditorStore","editorStore","deprecated","addFilter","getMetaBoxContainer","editPostStore","unlock","openGeneralSidebar","name","dispatch","registry","isDistractionFree","select","get","toggleDistractionFree","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","openModal","since","alternative","closeModal","openPublishSidebar","type","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","set","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","_registry$select$get","existingVariations","updatedVariations","showBlockTypes","blockNames","hideBlockTypes","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","reduce","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","version","hint","setDeviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableSwitchToTemplateMode","setRenderingMode","__unstableCreateTemplate","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","previous","options","then","isAutosave","hasMetaBoxes","batch","createInfoNotice","id","actions","label","onClick"],"sources":["@wordpress/edit-post/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editPostStore.name, name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport const openModal =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).openModal( name )\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').openModal( name )\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).openModal( name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n * @return {Object} Action object.\n */\nexport const closeModal =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).closeModal()\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').closeModal()\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).closeModal();\n\t};\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelEnabled\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelEnabled\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelEnabled( panelName );\n\t};\n\n/**\n * Opens a closed panel and closes an open panel.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n */\nexport const toggleEditorPanelOpened =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelOpened( panelName );\n\t};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport const removeEditorPanel =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).removeEditorPanel\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').removeEditorPanel\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).removeEditorPanel( panelName );\n\t};\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature =\n\t( feature ) =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry.dispatch( preferencesStore ).set( 'core', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to the code editor.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif (\n\t\t\tmode === 'text' &&\n\t\t\tregistry.select( preferencesStore ).get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\n\t\tconst message =\n\t\t\tmode === 'visual'\n\t\t\t\t? __( 'Visual editor selected' )\n\t\t\t\t: __( 'Code editor selected' );\n\t\tspeak( message, 'assertive' );\n\t};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem =\n\t( pluginName ) =>\n\t( { registry } ) => {\n\t\tconst isPinned = registry\n\t\t\t.select( interfaceStore )\n\t\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t[ isPinned ? 'unpinItem' : 'pinItem' ](\n\t\t\t\t'core/edit-post',\n\t\t\t\tpluginName\n\t\t\t);\n\t};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n */\nexport const updatePreferredStyleVariations =\n\t( blockName, blockStyle ) =>\n\t( { registry } ) => {\n\t\tif ( ! blockName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst existingVariations =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};\n\n\t\t// When the blockStyle is omitted, remove the block's preferred variation.\n\t\tif ( ! blockStyle ) {\n\t\t\tconst updatedVariations = {\n\t\t\t\t...existingVariations,\n\t\t\t};\n\n\t\t\tdelete updatedVariations[ blockName ];\n\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations',\n\t\t\t\t\tupdatedVariations\n\t\t\t\t);\n\t\t} else {\n\t\t\t// Else add the variation.\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core/edit-post', 'preferredStyleVariations', {\n\t\t\t\t\t...existingVariations,\n\t\t\t\t\t[ blockName ]: blockStyle,\n\t\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tunlock( registry.dispatch( editorStore ) ).showBlockTypes( blockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tunlock( registry.dispatch( editorStore ) ).hideBlockTypes( blockNames );\n\t};\n\n/**\n * Stores info about which Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport function setAvailableMetaBoxesPerLocation( metaBoxesPerLocation ) {\n\treturn {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t};\n}\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates =\n\t() =>\n\tasync ( { registry, select, dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t\t} );\n\n\t\t// Saves the wp_editor fields.\n\t\tif ( window.tinyMCE ) {\n\t\t\twindow.tinyMCE.triggerSave();\n\t\t}\n\n\t\t// Additional data needed for backward compatibility.\n\t\t// If we do not provide this data, the post will be overridden with the default values.\n\t\tconst post = registry.select( editorStore ).getCurrentPost();\n\t\tconst additionalData = [\n\t\t\tpost.comment_status\n\t\t\t\t? [ 'comment_status', post.comment_status ]\n\t\t\t\t: false,\n\t\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t\t].filter( Boolean );\n\n\t\t// We gather all the metaboxes locations data and the base form data.\n\t\tconst baseFormData = new window.FormData(\n\t\t\tdocument.querySelector( '.metabox-base-form' )\n\t\t);\n\t\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\t\tconst formDataToMerge = [\n\t\t\tbaseFormData,\n\t\t\t...activeMetaBoxLocations.map(\n\t\t\t\t( location ) =>\n\t\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t\t),\n\t\t];\n\n\t\t// Merge all form data objects into a single one.\n\t\tconst formData = formDataToMerge.reduce( ( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t}, new window.FormData() );\n\t\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\t\tformData.append( key, value )\n\t\t);\n\n\t\ttry {\n\t\t\t// Save the metaboxes.\n\t\t\tawait apiFetch( {\n\t\t\t\turl: window._wpMetaBoxUrl,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: formData,\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tdispatch.metaBoxUpdatesSuccess();\n\t\t} catch {\n\t\t\tdispatch.metaBoxUpdatesFailure();\n\t\t}\n\t};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @deprecated\n */\nexport function setIsEditingTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).setIsEditingTemplate\", {\n\t\tsince: '6.5',\n\t\talternative: \"dispatch( 'core/editor').setRenderingMode\",\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Switches to the template mode.\n */\nexport const __unstableSwitchToTemplateMode =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry.dispatch( editorStore ).setRenderingMode( 'template-only' );\n\t};\n\n/**\n * Create a block based template.\n *\n * @deprecated\n */\nexport function __unstableCreateTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).__unstableCreateTemplate\", {\n\t\tsince: '6.5',\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes =\n\t() =>\n\t( { registry, select, dispatch } ) => {\n\t\tconst isEditorReady = registry\n\t\t\t.select( editorStore )\n\t\t\t.__unstableIsEditorReady();\n\n\t\tif ( ! isEditorReady ) {\n\t\t\treturn;\n\t\t}\n\t\t// Only initialize once.\n\t\tif ( metaBoxesInitialized ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\t\tif ( window.postboxes.page !== postType ) {\n\t\t\twindow.postboxes.add_postbox_toggles( postType );\n\t\t}\n\n\t\tmetaBoxesInitialized = true;\n\n\t\t// Save metaboxes on save completion, except for autosaves.\n\t\taddFilter(\n\t\t\t'editor.__unstableSavePost',\n\t\t\t'core/edit-post/save-metaboxes',\n\t\t\t( previous, options ) =>\n\t\t\t\tprevious.then( () => {\n\t\t\t\t\tif ( options.isAutosave ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! select.hasMetaBoxes() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn dispatch.requestMetaBoxUpdates();\n\t\t\t\t} )\n\t\t);\n\n\t\tdispatch( {\n\t\t\ttype: 'META_BOXES_INITIALIZED',\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core', 'fixedToolbar', true );\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core', 'distractionFree', ! isDistractionFree );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-post/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\tregistry\n\t\t\t\t\t\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t\t\t\t\t\t.toggle( 'core', 'distractionFree' );\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;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B,CAAC;IACvDD,QAAQ,CACND,QAAQ,CAAEV,YAAa,CAAC,CACxBsH,gBAAgB,CAChB1G,iBAAiB,GACdlB,EAAE,CAAE,uBAAwB,CAAC,GAC7BA,EAAE,CAAE,sBAAuB,CAAC,EAC/B;MACC6H,EAAE,EAAE,6CAA6C;MACjD/F,IAAI,EAAE,UAAU;MAChBgG,OAAO,EAAE,CACR;QACCC,KAAK,EAAE/H,EAAE,CAAE,MAAO,CAAC;QACnBgI,OAAO,EAAEA,CAAA,KAAM;UACd/G,QAAQ,CACND,QAAQ,CAAEZ,gBAAiB,CAAC,CAC5BmC,MAAM,CAAE,MAAM,EAAE,iBAAkB,CAAC;QACtC;MACD,CAAC;IAEH,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"names":["__","apiFetch","store","interfaceStore","preferencesStore","speak","noticesStore","blockEditorStore","editorStore","deprecated","addFilter","getMetaBoxContainer","editPostStore","unlock","openGeneralSidebar","name","dispatch","registry","isDistractionFree","select","get","toggleDistractionFree","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","openModal","since","alternative","closeModal","openPublishSidebar","type","closePublishSidebar","togglePublishSidebar","toggleEditorPanelEnabled","panelName","toggleEditorPanelOpened","removeEditorPanel","toggleFeature","feature","toggle","switchEditorMode","mode","set","clearSelectedBlock","message","togglePinnedPluginItem","pluginName","isPinned","isItemPinned","updatePreferredStyleVariations","blockName","blockStyle","_registry$select$get","existingVariations","updatedVariations","showBlockTypes","blockNames","hideBlockTypes","setAvailableMetaBoxesPerLocation","metaBoxesPerLocation","requestMetaBoxUpdates","window","tinyMCE","triggerSave","post","getCurrentPost","additionalData","comment_status","ping_status","sticky","author","filter","Boolean","baseFormData","FormData","document","querySelector","activeMetaBoxLocations","getActiveMetaBoxLocations","formDataToMerge","map","location","formData","reduce","memo","currentFormData","key","value","append","forEach","url","_wpMetaBoxUrl","method","body","parse","metaBoxUpdatesSuccess","metaBoxUpdatesFailure","__experimentalSetPreviewDeviceType","deviceType","version","hint","setDeviceType","setIsInserterOpened","setIsListViewOpened","isOpen","setIsEditingTemplate","__unstableCreateTemplate","metaBoxesInitialized","initializeMetaBoxes","isEditorReady","__unstableIsEditorReady","postType","getCurrentPostType","postboxes","page","add_postbox_toggles","previous","options","then","isAutosave","hasMetaBoxes","batch","createInfoNotice","id","actions","label","onClick"],"sources":["@wordpress/edit-post/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport apiFetch from '@wordpress/api-fetch';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { speak } from '@wordpress/a11y';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { getMetaBoxContainer } from '../utils/meta-boxes';\nimport { store as editPostStore } from '.';\nimport { unlock } from '../lock-unlock';\n\n/**\n * Returns an action object used in signalling that the user opened an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editPostStore.name, name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editPostStore.name );\n\n/**\n * Returns an action object used in signalling that the user opened a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n *\n * @param {string} name A string that uniquely identifies the modal.\n *\n * @return {Object} Action object.\n */\nexport const openModal =\n\t( name ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).openModal( name )\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').openModal( name )\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).openModal( name );\n\t};\n\n/**\n * Returns an action object signalling that the user closed a modal.\n *\n * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead.\n *\n * @return {Object} Action object.\n */\nexport const closeModal =\n\t() =>\n\t( { registry } ) => {\n\t\tdeprecated( \"select( 'core/edit-post' ).closeModal()\", {\n\t\t\tsince: '6.3',\n\t\t\talternative: \"select( 'core/interface').closeModal()\",\n\t\t} );\n\t\treturn registry.dispatch( interfaceStore ).closeModal();\n\t};\n\n/**\n * Returns an action object used in signalling that the user opened the publish\n * sidebar.\n *\n * @return {Object} Action object\n */\nexport function openPublishSidebar() {\n\treturn {\n\t\ttype: 'OPEN_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user closed the\n * publish sidebar.\n *\n * @return {Object} Action object.\n */\nexport function closePublishSidebar() {\n\treturn {\n\t\ttype: 'CLOSE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user toggles the publish sidebar.\n *\n * @return {Object} Action object\n */\nexport function togglePublishSidebar() {\n\treturn {\n\t\ttype: 'TOGGLE_PUBLISH_SIDEBAR',\n\t};\n}\n\n/**\n * Returns an action object used to enable or disable a panel in the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to enable or disable.\n *\n * @return {Object} Action object.\n */\nexport const toggleEditorPanelEnabled =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelEnabled\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelEnabled\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelEnabled( panelName );\n\t};\n\n/**\n * Opens a closed panel and closes an open panel.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to open or close.\n */\nexport const toggleEditorPanelOpened =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).toggleEditorPanelOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').toggleEditorPanelOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).toggleEditorPanelOpened( panelName );\n\t};\n\n/**\n * Returns an action object used to remove a panel from the editor.\n *\n * @deprecated\n *\n * @param {string} panelName A string that identifies the panel to remove.\n *\n * @return {Object} Action object.\n */\nexport const removeEditorPanel =\n\t( panelName ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).removeEditorPanel\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').removeEditorPanel\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).removeEditorPanel( panelName );\n\t};\n\n/**\n * Triggers an action used to toggle a feature flag.\n *\n * @param {string} feature Feature name.\n */\nexport const toggleFeature =\n\t( feature ) =>\n\t( { registry } ) =>\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-post', feature );\n\n/**\n * Triggers an action used to switch editor mode.\n *\n * @param {string} mode The editor mode.\n */\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry.dispatch( preferencesStore ).set( 'core', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to the code editor.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif (\n\t\t\tmode === 'text' &&\n\t\t\tregistry.select( preferencesStore ).get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\n\t\tconst message =\n\t\t\tmode === 'visual'\n\t\t\t\t? __( 'Visual editor selected' )\n\t\t\t\t: __( 'Code editor selected' );\n\t\tspeak( message, 'assertive' );\n\t};\n\n/**\n * Triggers an action object used to toggle a plugin name flag.\n *\n * @param {string} pluginName Plugin name.\n */\nexport const togglePinnedPluginItem =\n\t( pluginName ) =>\n\t( { registry } ) => {\n\t\tconst isPinned = registry\n\t\t\t.select( interfaceStore )\n\t\t\t.isItemPinned( 'core/edit-post', pluginName );\n\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t[ isPinned ? 'unpinItem' : 'pinItem' ](\n\t\t\t\t'core/edit-post',\n\t\t\t\tpluginName\n\t\t\t);\n\t};\n\n/**\n * Returns an action object used in signaling that a style should be auto-applied when a block is created.\n *\n * @param {string} blockName Name of the block.\n * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the \"auto apply\" setting of the block is removed.\n */\nexport const updatePreferredStyleVariations =\n\t( blockName, blockStyle ) =>\n\t( { registry } ) => {\n\t\tif ( ! blockName ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst existingVariations =\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-post', 'preferredStyleVariations' ) ?? {};\n\n\t\t// When the blockStyle is omitted, remove the block's preferred variation.\n\t\tif ( ! blockStyle ) {\n\t\t\tconst updatedVariations = {\n\t\t\t\t...existingVariations,\n\t\t\t};\n\n\t\t\tdelete updatedVariations[ blockName ];\n\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations',\n\t\t\t\t\tupdatedVariations\n\t\t\t\t);\n\t\t} else {\n\t\t\t// Else add the variation.\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core/edit-post', 'preferredStyleVariations', {\n\t\t\t\t\t...existingVariations,\n\t\t\t\t\t[ blockName ]: blockStyle,\n\t\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Update the provided block types to be visible.\n *\n * @param {string[]} blockNames Names of block types to show.\n */\nexport const showBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tunlock( registry.dispatch( editorStore ) ).showBlockTypes( blockNames );\n\t};\n\n/**\n * Update the provided block types to be hidden.\n *\n * @param {string[]} blockNames Names of block types to hide.\n */\nexport const hideBlockTypes =\n\t( blockNames ) =>\n\t( { registry } ) => {\n\t\tunlock( registry.dispatch( editorStore ) ).hideBlockTypes( blockNames );\n\t};\n\n/**\n * Stores info about which Meta boxes are available in which location.\n *\n * @param {Object} metaBoxesPerLocation Meta boxes per location.\n */\nexport function setAvailableMetaBoxesPerLocation( metaBoxesPerLocation ) {\n\treturn {\n\t\ttype: 'SET_META_BOXES_PER_LOCATIONS',\n\t\tmetaBoxesPerLocation,\n\t};\n}\n\n/**\n * Update a metabox.\n */\nexport const requestMetaBoxUpdates =\n\t() =>\n\tasync ( { registry, select, dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'REQUEST_META_BOX_UPDATES',\n\t\t} );\n\n\t\t// Saves the wp_editor fields.\n\t\tif ( window.tinyMCE ) {\n\t\t\twindow.tinyMCE.triggerSave();\n\t\t}\n\n\t\t// Additional data needed for backward compatibility.\n\t\t// If we do not provide this data, the post will be overridden with the default values.\n\t\tconst post = registry.select( editorStore ).getCurrentPost();\n\t\tconst additionalData = [\n\t\t\tpost.comment_status\n\t\t\t\t? [ 'comment_status', post.comment_status ]\n\t\t\t\t: false,\n\t\t\tpost.ping_status ? [ 'ping_status', post.ping_status ] : false,\n\t\t\tpost.sticky ? [ 'sticky', post.sticky ] : false,\n\t\t\tpost.author ? [ 'post_author', post.author ] : false,\n\t\t].filter( Boolean );\n\n\t\t// We gather all the metaboxes locations data and the base form data.\n\t\tconst baseFormData = new window.FormData(\n\t\t\tdocument.querySelector( '.metabox-base-form' )\n\t\t);\n\t\tconst activeMetaBoxLocations = select.getActiveMetaBoxLocations();\n\t\tconst formDataToMerge = [\n\t\t\tbaseFormData,\n\t\t\t...activeMetaBoxLocations.map(\n\t\t\t\t( location ) =>\n\t\t\t\t\tnew window.FormData( getMetaBoxContainer( location ) )\n\t\t\t),\n\t\t];\n\n\t\t// Merge all form data objects into a single one.\n\t\tconst formData = formDataToMerge.reduce( ( memo, currentFormData ) => {\n\t\t\tfor ( const [ key, value ] of currentFormData ) {\n\t\t\t\tmemo.append( key, value );\n\t\t\t}\n\t\t\treturn memo;\n\t\t}, new window.FormData() );\n\t\tadditionalData.forEach( ( [ key, value ] ) =>\n\t\t\tformData.append( key, value )\n\t\t);\n\n\t\ttry {\n\t\t\t// Save the metaboxes.\n\t\t\tawait apiFetch( {\n\t\t\t\turl: window._wpMetaBoxUrl,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: formData,\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tdispatch.metaBoxUpdatesSuccess();\n\t\t} catch {\n\t\t\tdispatch.metaBoxUpdatesFailure();\n\t\t}\n\t};\n\n/**\n * Returns an action object used to signal a successful meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesSuccess() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_SUCCESS',\n\t};\n}\n\n/**\n * Returns an action object used to signal a failed meta box update.\n *\n * @return {Object} Action object.\n */\nexport function metaBoxUpdatesFailure() {\n\treturn {\n\t\ttype: 'META_BOX_UPDATES_FAILURE',\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @deprecated\n *\n * @param {string} deviceType\n */\nexport const __experimentalSetPreviewDeviceType =\n\t( deviceType ) =>\n\t( { registry } ) => {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType\",\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\thint: 'registry.dispatch( editorStore ).setDeviceType',\n\t\t\t}\n\t\t);\n\t\tregistry.dispatch( editorStore ).setDeviceType( deviceType );\n\t};\n\n/**\n * Returns an action object used to open/close the inserter.\n *\n * @deprecated\n *\n * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false).\n */\nexport const setIsInserterOpened =\n\t( value ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsInserterOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsInserterOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( value );\n\t};\n\n/**\n * Returns an action object used to open/close the list view.\n *\n * @deprecated\n *\n * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-post' ).setIsListViewOpened\", {\n\t\t\tsince: '6.5',\n\t\t\talternative: \"dispatch( 'core/editor').setIsListViewOpened\",\n\t\t} );\n\t\tregistry.dispatch( editorStore ).setIsListViewOpened( isOpen );\n\t};\n\n/**\n * Returns an action object used to switch to template editing.\n *\n * @deprecated\n */\nexport function setIsEditingTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).setIsEditingTemplate\", {\n\t\tsince: '6.5',\n\t\talternative: \"dispatch( 'core/editor').setRenderingMode\",\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Create a block based template.\n *\n * @deprecated\n */\nexport function __unstableCreateTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-post' ).__unstableCreateTemplate\", {\n\t\tsince: '6.5',\n\t} );\n\treturn { type: 'NOTHING' };\n}\n\nlet metaBoxesInitialized = false;\n\n/**\n * Initializes WordPress `postboxes` script and the logic for saving meta boxes.\n */\nexport const initializeMetaBoxes =\n\t() =>\n\t( { registry, select, dispatch } ) => {\n\t\tconst isEditorReady = registry\n\t\t\t.select( editorStore )\n\t\t\t.__unstableIsEditorReady();\n\n\t\tif ( ! isEditorReady ) {\n\t\t\treturn;\n\t\t}\n\t\t// Only initialize once.\n\t\tif ( metaBoxesInitialized ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postType = registry.select( editorStore ).getCurrentPostType();\n\t\tif ( window.postboxes.page !== postType ) {\n\t\t\twindow.postboxes.add_postbox_toggles( postType );\n\t\t}\n\n\t\tmetaBoxesInitialized = true;\n\n\t\t// Save metaboxes on save completion, except for autosaves.\n\t\taddFilter(\n\t\t\t'editor.__unstableSavePost',\n\t\t\t'core/edit-post/save-metaboxes',\n\t\t\t( previous, options ) =>\n\t\t\t\tprevious.then( () => {\n\t\t\t\t\tif ( options.isAutosave ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( ! select.hasMetaBoxes() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn dispatch.requestMetaBoxUpdates();\n\t\t\t\t} )\n\t\t);\n\n\t\tdispatch( {\n\t\t\ttype: 'META_BOXES_INITIALIZED',\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core', 'fixedToolbar', false );\n\t\t}\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core', 'fixedToolbar', true );\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set( 'core', 'distractionFree', ! isDistractionFree );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-post/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\tregistry.batch( () => {\n\t\t\t\t\t\t\t\t\t\tregistry\n\t\t\t\t\t\t\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t\t\t\t\t\t\t.set(\n\t\t\t\t\t\t\t\t\t\t\t\t'core',\n\t\t\t\t\t\t\t\t\t\t\t\t'fixedToolbar',\n\t\t\t\t\t\t\t\t\t\t\t\tisDistractionFree ? true : false\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\tregistry\n\t\t\t\t\t\t\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t\t\t\t\t\t\t.toggle(\n\t\t\t\t\t\t\t\t\t\t\t\t'core',\n\t\t\t\t\t\t\t\t\t\t\t\t'distractionFree'\n\t\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],\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,SAASC,KAAK,IAAIC,cAAc,QAAQ,sB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