@wordpress/edit-post 8.1.0 → 8.3.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 (46) hide show
  1. package/CHANGELOG.md +15 -11
  2. package/build/components/init-pattern-modal/index.js +1 -1
  3. package/build/components/init-pattern-modal/index.js.map +1 -1
  4. package/build/components/layout/index.js +3 -1
  5. package/build/components/layout/index.js.map +1 -1
  6. package/build/components/preferences-modal/enable-custom-fields.js +1 -1
  7. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
  8. package/build/deprecated.js +29 -0
  9. package/build/deprecated.js.map +1 -1
  10. package/build/editor.native.js +0 -7
  11. package/build/editor.native.js.map +1 -1
  12. package/build/index.js +3 -1
  13. package/build/index.js.map +1 -1
  14. package/build/lock-unlock.js +1 -1
  15. package/build/lock-unlock.js.map +1 -1
  16. package/build/store/actions.js +10 -3
  17. package/build/store/actions.js.map +1 -1
  18. package/build-module/components/init-pattern-modal/index.js +1 -1
  19. package/build-module/components/init-pattern-modal/index.js.map +1 -1
  20. package/build-module/components/layout/index.js +3 -1
  21. package/build-module/components/layout/index.js.map +1 -1
  22. package/build-module/components/preferences-modal/enable-custom-fields.js +1 -1
  23. package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
  24. package/build-module/deprecated.js +29 -0
  25. package/build-module/deprecated.js.map +1 -1
  26. package/build-module/editor.native.js +0 -7
  27. package/build-module/editor.native.js.map +1 -1
  28. package/build-module/index.js +3 -1
  29. package/build-module/index.js.map +1 -1
  30. package/build-module/lock-unlock.js +1 -1
  31. package/build-module/lock-unlock.js.map +1 -1
  32. package/build-module/store/actions.js +10 -3
  33. package/build-module/store/actions.js.map +1 -1
  34. package/build-style/style-rtl.css +7 -3
  35. package/build-style/style.css +7 -3
  36. package/package.json +31 -31
  37. package/src/components/init-pattern-modal/index.js +1 -1
  38. package/src/components/layout/index.js +3 -1
  39. package/src/components/layout/style.scss +1 -1
  40. package/src/components/preferences-modal/enable-custom-fields.js +1 -1
  41. package/src/deprecated.js +32 -0
  42. package/src/editor.native.js +0 -5
  43. package/src/index.js +5 -2
  44. package/src/lock-unlock.js +1 -1
  45. package/src/store/actions.js +15 -5
  46. package/src/style.scss +4 -2
package/src/deprecated.js CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  PluginSidebar as EditorPluginSidebar,
13
13
  PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
14
14
  } from '@wordpress/editor';
15
+ import { getPath } from '@wordpress/url';
15
16
  import deprecated from '@wordpress/deprecated';
16
17
 
17
18
  /**
@@ -20,6 +21,10 @@ import deprecated from '@wordpress/deprecated';
20
21
  import { unlock } from './lock-unlock';
21
22
  const { PluginPostExcerpt } = unlock( editorPrivateApis );
22
23
 
24
+ const isSiteEditor = getPath( window.location.href )?.includes(
25
+ 'site-editor.php'
26
+ );
27
+
23
28
  const deprecateSlot = ( name ) => {
24
29
  deprecated( `wp.editPost.${ name }`, {
25
30
  since: '6.6',
@@ -32,6 +37,9 @@ const deprecateSlot = ( name ) => {
32
37
  * @see PluginBlockSettingsMenuItem in @wordpress/editor package.
33
38
  */
34
39
  export function PluginBlockSettingsMenuItem( props ) {
40
+ if ( isSiteEditor ) {
41
+ return null;
42
+ }
35
43
  deprecateSlot( 'PluginBlockSettingsMenuItem' );
36
44
  return <EditorPluginBlockSettingsMenuItem { ...props } />;
37
45
  }
@@ -40,6 +48,9 @@ export function PluginBlockSettingsMenuItem( props ) {
40
48
  * @see PluginDocumentSettingPanel in @wordpress/editor package.
41
49
  */
42
50
  export function PluginDocumentSettingPanel( props ) {
51
+ if ( isSiteEditor ) {
52
+ return null;
53
+ }
43
54
  deprecateSlot( 'PluginDocumentSettingPanel' );
44
55
  return <EditorPluginDocumentSettingPanel { ...props } />;
45
56
  }
@@ -48,6 +59,9 @@ export function PluginDocumentSettingPanel( props ) {
48
59
  * @see PluginMoreMenuItem in @wordpress/editor package.
49
60
  */
50
61
  export function PluginMoreMenuItem( props ) {
62
+ if ( isSiteEditor ) {
63
+ return null;
64
+ }
51
65
  deprecateSlot( 'PluginMoreMenuItem' );
52
66
  return <EditorPluginMoreMenuItem { ...props } />;
53
67
  }
@@ -56,6 +70,9 @@ export function PluginMoreMenuItem( props ) {
56
70
  * @see PluginPrePublishPanel in @wordpress/editor package.
57
71
  */
58
72
  export function PluginPrePublishPanel( props ) {
73
+ if ( isSiteEditor ) {
74
+ return null;
75
+ }
59
76
  deprecateSlot( 'PluginPrePublishPanel' );
60
77
  return <EditorPluginPrePublishPanel { ...props } />;
61
78
  }
@@ -64,6 +81,9 @@ export function PluginPrePublishPanel( props ) {
64
81
  * @see PluginPostPublishPanel in @wordpress/editor package.
65
82
  */
66
83
  export function PluginPostPublishPanel( props ) {
84
+ if ( isSiteEditor ) {
85
+ return null;
86
+ }
67
87
  deprecateSlot( 'PluginPostPublishPanel' );
68
88
  return <EditorPluginPostPublishPanel { ...props } />;
69
89
  }
@@ -72,6 +92,9 @@ export function PluginPostPublishPanel( props ) {
72
92
  * @see PluginPostStatusInfo in @wordpress/editor package.
73
93
  */
74
94
  export function PluginPostStatusInfo( props ) {
95
+ if ( isSiteEditor ) {
96
+ return null;
97
+ }
75
98
  deprecateSlot( 'PluginPostStatusInfo' );
76
99
  return <EditorPluginPostStatusInfo { ...props } />;
77
100
  }
@@ -80,6 +103,9 @@ export function PluginPostStatusInfo( props ) {
80
103
  * @see PluginSidebar in @wordpress/editor package.
81
104
  */
82
105
  export function PluginSidebar( props ) {
106
+ if ( isSiteEditor ) {
107
+ return null;
108
+ }
83
109
  deprecateSlot( 'PluginSidebar' );
84
110
  return <EditorPluginSidebar { ...props } />;
85
111
  }
@@ -88,6 +114,9 @@ export function PluginSidebar( props ) {
88
114
  * @see PluginSidebarMoreMenuItem in @wordpress/editor package.
89
115
  */
90
116
  export function PluginSidebarMoreMenuItem( props ) {
117
+ if ( isSiteEditor ) {
118
+ return null;
119
+ }
91
120
  deprecateSlot( 'PluginSidebarMoreMenuItem' );
92
121
  return <EditorPluginSidebarMoreMenuItem { ...props } />;
93
122
  }
@@ -96,6 +125,9 @@ export function PluginSidebarMoreMenuItem( props ) {
96
125
  * @see PluginPostExcerpt in @wordpress/editor package.
97
126
  */
98
127
  export function __experimentalPluginPostExcerpt() {
128
+ if ( isSiteEditor ) {
129
+ return null;
130
+ }
99
131
  deprecated( 'wp.editPost.__experimentalPluginPostExcerpt', {
100
132
  since: '6.6',
101
133
  hint: 'Core and custom panels can be access programmatically using their panel name.',
@@ -33,11 +33,6 @@ class Editor extends Component {
33
33
  constructor( props ) {
34
34
  super( ...arguments );
35
35
 
36
- // need to set this globally to avoid race with deprecations
37
- // defaulting to true to avoid issues with a not-yet-cached value
38
- const { galleryWithImageBlocks = true } = props;
39
- window.wp.galleryBlockV2Enabled = galleryWithImageBlocks;
40
-
41
36
  if ( props.initialHtmlModeEnabled && props.mode === 'visual' ) {
42
37
  // Enable html mode if the initial mode the parent wants it but we're not already in it.
43
38
  this.props.switchEditorMode( 'text' );
package/src/index.js CHANGED
@@ -25,8 +25,10 @@ import {
25
25
  import Layout from './components/layout';
26
26
  import { unlock } from './lock-unlock';
27
27
 
28
- const { BackButton: __experimentalMainDashboardButton } =
29
- unlock( editorPrivateApis );
28
+ const {
29
+ BackButton: __experimentalMainDashboardButton,
30
+ registerDefaultActions,
31
+ } = unlock( editorPrivateApis );
30
32
 
31
33
  /**
32
34
  * Initializes and returns an instance of Editor.
@@ -91,6 +93,7 @@ export function initializeEditor(
91
93
  enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks,
92
94
  } );
93
95
  }
96
+ registerDefaultActions();
94
97
 
95
98
  // Show a console log warning if the browser is not in Standards rendering mode.
96
99
  const documentMode =
@@ -5,6 +5,6 @@ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/pri
5
5
 
6
6
  export const { lock, unlock } =
7
7
  __dangerousOptInToUnstableAPIsOnlyForCoreModules(
8
- 'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',
8
+ 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
9
9
  '@wordpress/edit-post'
10
10
  );
@@ -9,6 +9,7 @@ import {
9
9
  } from '@wordpress/editor';
10
10
  import deprecated from '@wordpress/deprecated';
11
11
  import { addFilter } from '@wordpress/hooks';
12
+ import { store as coreStore } from '@wordpress/core-data';
12
13
 
13
14
  /**
14
15
  * Internal dependencies
@@ -289,9 +290,21 @@ export const requestMetaBoxUpdates =
289
290
  window.tinyMCE.triggerSave();
290
291
  }
291
292
 
293
+ // We gather the base form data.
294
+ const baseFormData = new window.FormData(
295
+ document.querySelector( '.metabox-base-form' )
296
+ );
297
+
298
+ const postId = baseFormData.get( 'post_ID' );
299
+ const postType = baseFormData.get( 'post_type' );
300
+
292
301
  // Additional data needed for backward compatibility.
293
302
  // If we do not provide this data, the post will be overridden with the default values.
294
- const post = registry.select( editorStore ).getCurrentPost();
303
+ // We cannot rely on getCurrentPost because right now on the editor we may be editing a pattern or a template.
304
+ // We need to retrieve the post that the base form data is referring to.
305
+ const post = registry
306
+ .select( coreStore )
307
+ .getEditedEntityRecord( 'postType', postType, postId );
295
308
  const additionalData = [
296
309
  post.comment_status
297
310
  ? [ 'comment_status', post.comment_status ]
@@ -301,10 +314,7 @@ export const requestMetaBoxUpdates =
301
314
  post.author ? [ 'post_author', post.author ] : false,
302
315
  ].filter( Boolean );
303
316
 
304
- // We gather all the metaboxes locations data and the base form data.
305
- const baseFormData = new window.FormData(
306
- document.querySelector( '.metabox-base-form' )
307
- );
317
+ // We gather all the metaboxes locations.
308
318
  const activeMetaBoxLocations = select.getActiveMetaBoxLocations();
309
319
  const formDataToMerge = [
310
320
  baseFormData,
package/src/style.scss CHANGED
@@ -31,11 +31,13 @@ body.js.block-editor-page {
31
31
  }
32
32
  }
33
33
 
34
- // Target the editor UI excluding the visual editor contents, metaboxes and custom fields areas.
34
+ // Target the editor UI excluding the non-iframed visual editor contents, metaboxes
35
+ // and custom fields areas.
35
36
  .editor-header,
36
37
  .editor-text-editor,
37
38
  .editor-sidebar,
38
- .editor-post-publish-panel {
39
+ .editor-post-publish-panel,
40
+ .edit-post-visual-editor.is-iframed {
39
41
  @include reset;
40
42
  }
41
43