@wordpress/editor 13.29.0 → 13.31.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 (183) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/bindings/index.js +5 -3
  3. package/build/bindings/index.js.map +1 -1
  4. package/build/bindings/post-meta.js +2 -1
  5. package/build/bindings/post-meta.js.map +1 -1
  6. package/build/components/block-removal-warnings/index.js +70 -0
  7. package/build/components/block-removal-warnings/index.js.map +1 -0
  8. package/build/components/commands/index.js +22 -14
  9. package/build/components/commands/index.js.map +1 -1
  10. package/build/components/document-bar/index.js +2 -2
  11. package/build/components/document-bar/index.js.map +1 -1
  12. package/build/components/document-outline/check.js +8 -7
  13. package/build/components/document-outline/check.js.map +1 -1
  14. package/build/components/document-outline/index.js +27 -28
  15. package/build/components/document-outline/index.js.map +1 -1
  16. package/build/components/document-tools/index.js +5 -3
  17. package/build/components/document-tools/index.js.map +1 -1
  18. package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
  19. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  20. package/build/components/entities-saved-states/hooks/use-is-dirty.js +10 -16
  21. package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  22. package/build/components/entities-saved-states/index.js +17 -3
  23. package/build/components/entities-saved-states/index.js.map +1 -1
  24. package/build/components/error-boundary/index.native.js +133 -0
  25. package/build/components/error-boundary/index.native.js.map +1 -0
  26. package/build/components/index.js +9 -8
  27. package/build/components/index.js.map +1 -1
  28. package/build/components/index.native.js +9 -1
  29. package/build/components/index.native.js.map +1 -1
  30. package/build/components/list-view-sidebar/index.js +1 -1
  31. package/build/components/list-view-sidebar/index.js.map +1 -1
  32. package/build/components/plugin-document-setting-panel/index.js +123 -0
  33. package/build/components/plugin-document-setting-panel/index.js.map +1 -0
  34. package/build/components/post-featured-image/index.js +3 -8
  35. package/build/components/post-featured-image/index.js.map +1 -1
  36. package/build/components/post-featured-image/panel.js +7 -3
  37. package/build/components/post-featured-image/panel.js.map +1 -1
  38. package/build/components/post-locked-modal/index.js.map +1 -1
  39. package/build/components/post-preview-button/index.js +2 -1
  40. package/build/components/post-preview-button/index.js.map +1 -1
  41. package/build/components/post-publish-button/index.js +2 -1
  42. package/build/components/post-publish-button/index.js.map +1 -1
  43. package/build/components/post-publish-panel/index.js.map +1 -1
  44. package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  45. package/build/components/post-sync-status/index.js +0 -72
  46. package/build/components/post-sync-status/index.js.map +1 -1
  47. package/build/components/post-taxonomies/flat-term-selector.js +7 -3
  48. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  49. package/build/components/post-taxonomies/hierarchical-term-selector.js +3 -0
  50. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  51. package/build/components/post-title/index.native.js.map +1 -1
  52. package/build/components/post-title/post-title-raw.js.map +1 -1
  53. package/build/components/post-view-link/index.js +2 -1
  54. package/build/components/post-view-link/index.js.map +1 -1
  55. package/build/components/provider/disable-non-page-content-blocks.js +23 -30
  56. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  57. package/build/components/provider/index.js +3 -2
  58. package/build/components/provider/index.js.map +1 -1
  59. package/build/components/provider/use-hide-blocks-from-inserter.js +4 -3
  60. package/build/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
  61. package/build/hooks/index.js +1 -1
  62. package/build/hooks/index.js.map +1 -1
  63. package/build/hooks/{pattern-partial-syncing.js → pattern-overrides.js} +13 -9
  64. package/build/hooks/pattern-overrides.js.map +1 -0
  65. package/build/private-apis.js +0 -2
  66. package/build/private-apis.js.map +1 -1
  67. package/build-module/bindings/index.js +5 -3
  68. package/build-module/bindings/index.js.map +1 -1
  69. package/build-module/bindings/post-meta.js +2 -1
  70. package/build-module/bindings/post-meta.js.map +1 -1
  71. package/build-module/components/block-removal-warnings/index.js +64 -0
  72. package/build-module/components/block-removal-warnings/index.js.map +1 -0
  73. package/build-module/components/commands/index.js +22 -14
  74. package/build-module/components/commands/index.js.map +1 -1
  75. package/build-module/components/document-bar/index.js +2 -2
  76. package/build-module/components/document-bar/index.js.map +1 -1
  77. package/build-module/components/document-outline/check.js +9 -8
  78. package/build-module/components/document-outline/check.js.map +1 -1
  79. package/build-module/components/document-outline/index.js +27 -27
  80. package/build-module/components/document-outline/index.js.map +1 -1
  81. package/build-module/components/document-tools/index.js +5 -3
  82. package/build-module/components/document-tools/index.js.map +1 -1
  83. package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
  84. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  85. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +10 -16
  86. package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
  87. package/build-module/components/entities-saved-states/index.js +18 -4
  88. package/build-module/components/entities-saved-states/index.js.map +1 -1
  89. package/build-module/components/error-boundary/index.native.js +125 -0
  90. package/build-module/components/error-boundary/index.native.js.map +1 -0
  91. package/build-module/components/index.js +2 -1
  92. package/build-module/components/index.js.map +1 -1
  93. package/build-module/components/index.native.js +1 -0
  94. package/build-module/components/index.native.js.map +1 -1
  95. package/build-module/components/list-view-sidebar/index.js +1 -1
  96. package/build-module/components/list-view-sidebar/index.js.map +1 -1
  97. package/build-module/components/plugin-document-setting-panel/index.js +115 -0
  98. package/build-module/components/plugin-document-setting-panel/index.js.map +1 -0
  99. package/build-module/components/post-featured-image/index.js +4 -9
  100. package/build-module/components/post-featured-image/index.js.map +1 -1
  101. package/build-module/components/post-featured-image/panel.js +6 -2
  102. package/build-module/components/post-featured-image/panel.js.map +1 -1
  103. package/build-module/components/post-locked-modal/index.js.map +1 -1
  104. package/build-module/components/post-preview-button/index.js +2 -1
  105. package/build-module/components/post-preview-button/index.js.map +1 -1
  106. package/build-module/components/post-publish-button/index.js +2 -1
  107. package/build-module/components/post-publish-button/index.js.map +1 -1
  108. package/build-module/components/post-publish-panel/index.js.map +1 -1
  109. package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
  110. package/build-module/components/post-sync-status/index.js +2 -73
  111. package/build-module/components/post-sync-status/index.js.map +1 -1
  112. package/build-module/components/post-taxonomies/flat-term-selector.js +7 -3
  113. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  114. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +3 -0
  115. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  116. package/build-module/components/post-title/index.native.js.map +1 -1
  117. package/build-module/components/post-title/post-title-raw.js.map +1 -1
  118. package/build-module/components/post-view-link/index.js +2 -1
  119. package/build-module/components/post-view-link/index.js.map +1 -1
  120. package/build-module/components/provider/disable-non-page-content-blocks.js +24 -31
  121. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  122. package/build-module/components/provider/index.js +3 -2
  123. package/build-module/components/provider/index.js.map +1 -1
  124. package/build-module/components/provider/use-hide-blocks-from-inserter.js +4 -3
  125. package/build-module/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
  126. package/build-module/hooks/index.js +1 -1
  127. package/build-module/hooks/index.js.map +1 -1
  128. package/build-module/hooks/{pattern-partial-syncing.js → pattern-overrides.js} +13 -9
  129. package/build-module/hooks/pattern-overrides.js.map +1 -0
  130. package/build-module/private-apis.js +0 -2
  131. package/build-module/private-apis.js.map +1 -1
  132. package/build-style/style-rtl.css +9 -8
  133. package/build-style/style.css +9 -8
  134. package/package.json +34 -32
  135. package/src/bindings/index.js +6 -3
  136. package/src/bindings/post-meta.js +4 -1
  137. package/src/components/block-removal-warnings/index.js +92 -0
  138. package/src/components/commands/index.js +21 -13
  139. package/src/components/document-bar/index.js +3 -2
  140. package/src/components/document-outline/check.js +8 -10
  141. package/src/components/document-outline/index.js +20 -24
  142. package/src/components/document-outline/test/index.js +26 -7
  143. package/src/components/document-tools/index.js +3 -3
  144. package/src/components/editor-help/intro-to-blocks.native.js +1 -1
  145. package/src/components/entities-saved-states/entity-type-list.js +1 -1
  146. package/src/components/entities-saved-states/hooks/use-is-dirty.js +18 -22
  147. package/src/components/entities-saved-states/index.js +33 -8
  148. package/src/components/entities-saved-states/test/use-is-dirty.js +3 -0
  149. package/src/components/error-boundary/index.native.js +192 -0
  150. package/src/components/error-boundary/style.native.scss +116 -0
  151. package/src/components/index.js +2 -4
  152. package/src/components/index.native.js +1 -0
  153. package/src/components/list-view-sidebar/index.js +1 -1
  154. package/src/components/plugin-document-setting-panel/index.js +121 -0
  155. package/src/components/post-featured-image/index.js +6 -15
  156. package/src/components/post-featured-image/panel.js +9 -3
  157. package/src/components/post-featured-image/style.scss +8 -13
  158. package/src/components/post-locked-modal/index.js +1 -1
  159. package/src/components/post-preview-button/index.js +1 -0
  160. package/src/components/post-publish-button/index.js +1 -0
  161. package/src/components/post-publish-panel/index.js +1 -1
  162. package/src/components/post-publish-panel/maybe-upload-media.js +1 -1
  163. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +3 -3
  164. package/src/components/post-sync-status/index.js +1 -94
  165. package/src/components/post-taxonomies/flat-term-selector.js +13 -8
  166. package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -0
  167. package/src/components/post-title/index.native.js +2 -2
  168. package/src/components/post-title/post-title-raw.js +1 -1
  169. package/src/components/post-view-link/index.js +1 -0
  170. package/src/components/provider/disable-non-page-content-blocks.js +34 -36
  171. package/src/components/provider/index.js +3 -1
  172. package/src/components/provider/test/disable-non-page-content-blocks.js +90 -0
  173. package/src/components/provider/use-hide-blocks-from-inserter.js +5 -3
  174. package/src/hooks/index.js +1 -1
  175. package/src/hooks/{pattern-partial-syncing.js → pattern-overrides.js} +16 -10
  176. package/src/private-apis.js +0 -2
  177. package/build/components/provider/constants.js +0 -8
  178. package/build/components/provider/constants.js.map +0 -1
  179. package/build/hooks/pattern-partial-syncing.js.map +0 -1
  180. package/build-module/components/provider/constants.js +0 -2
  181. package/build-module/components/provider/constants.js.map +0 -1
  182. package/build-module/hooks/pattern-partial-syncing.js.map +0 -1
  183. package/src/components/provider/constants.js +0 -5
@@ -0,0 +1,116 @@
1
+ .error-boundary__scroll {
2
+ height: 100%;
3
+ width: 100%;
4
+ }
5
+
6
+ .error-boundary__scroll-container {
7
+ flex-grow: 1;
8
+ max-height: 580px;
9
+ align-items: center;
10
+ justify-content: center;
11
+ }
12
+
13
+
14
+ .error-boundary__container {
15
+ width: 100%;
16
+ max-width: 600px;
17
+ justify-content: center;
18
+ align-items: center;
19
+ padding: 0 24px;
20
+ }
21
+
22
+ .error-boundary__icon-container {
23
+ $size: 40px;
24
+
25
+ width: $size;
26
+ height: $size;
27
+ align-items: center;
28
+ justify-content: center;
29
+ margin-bottom: 8px;
30
+ background-color: rgba(60, 60, 67, 0.3);
31
+ border-radius: $size/2;
32
+ }
33
+
34
+ .error-boundary__icon-container--dark {
35
+ background-color: rgba(235, 235, 245, 0.3);
36
+ }
37
+
38
+ .error-boundary__icon {
39
+ width: 24px;
40
+ height: 24px;
41
+ fill: $white;
42
+ }
43
+
44
+ .error-boundary__title {
45
+ font-size: 20px;
46
+ font-weight: 600;
47
+ line-height: 25px;
48
+ color: $black;
49
+ text-align: center;
50
+ margin-bottom: 8px;
51
+ }
52
+
53
+ .error-boundary__title--dark {
54
+ color: $white;
55
+ }
56
+
57
+ .error-boundary__message {
58
+ font-size: 16px;
59
+ font-weight: 400;
60
+ line-height: 21px;
61
+ color: rgba(60, 60, 67, 0.6);
62
+ text-align: center;
63
+ margin-bottom: 16px;
64
+ }
65
+
66
+ .error-boundary__message--dark {
67
+ color: rgba(235, 235, 245, 0.6);
68
+ }
69
+
70
+ .error-boundary__actions-container {
71
+ width: 100%;
72
+ max-width: 400px;
73
+ justify-content: center;
74
+ gap: 12px;
75
+ padding-top: 16px;
76
+ }
77
+
78
+ .copy-button__container {
79
+ border-radius: 5px;
80
+ padding: $grid-unit $grid-unit-20;
81
+ background-color: $light-primary;
82
+ }
83
+
84
+ .copy-button__container--dark {
85
+ background-color: $white;
86
+ }
87
+
88
+ .copy-button__container--secondary {
89
+ border: 1px #c6c6c8;
90
+ background-color: $white;
91
+ }
92
+
93
+ .copy-button__container--secondary-dark {
94
+ border-color: rgba(255, 255, 255, 0.3);
95
+ background-color: $black;
96
+ }
97
+
98
+ .copy-button__text {
99
+ font-size: 17px;
100
+ font-weight: 400;
101
+ line-height: 22px;
102
+ text-align: center;
103
+ color: $white;
104
+ }
105
+
106
+ .copy-button__text--dark {
107
+ color: $background-dark-secondary;
108
+ }
109
+
110
+ .copy-button__text--secondary {
111
+ color: $black;
112
+ }
113
+
114
+ .copy-button__text--secondary-dark {
115
+ color: $white;
116
+ }
@@ -26,6 +26,7 @@ export { default as PageAttributesOrder } from './page-attributes/order';
26
26
  export { default as PageAttributesPanel } from './page-attributes/panel';
27
27
  export { default as PageAttributesParent } from './page-attributes/parent';
28
28
  export { default as PageTemplate } from './post-template/classic-theme';
29
+ export { default as PluginDocumentSettingPanel } from './plugin-document-setting-panel';
29
30
  export { default as PostTemplatePanel } from './post-template/panel';
30
31
  export { default as PostAuthor } from './post-author';
31
32
  export { default as PostAuthorCheck } from './post-author/check';
@@ -64,10 +65,7 @@ export { default as PostSlugCheck } from './post-slug/check';
64
65
  export { default as PostSticky } from './post-sticky';
65
66
  export { default as PostStickyCheck } from './post-sticky/check';
66
67
  export { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';
67
- export {
68
- default as PostSyncStatus,
69
- PostSyncStatusModal,
70
- } from './post-sync-status';
68
+ export { default as PostSyncStatus } from './post-sync-status';
71
69
  export { default as PostTaxonomies } from './post-taxonomies';
72
70
  export { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';
73
71
  export { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';
@@ -10,5 +10,6 @@ export { default as EditorProvider } from './provider';
10
10
  // Other Components.
11
11
  export { default as EditorHelpTopics } from './editor-help';
12
12
  export { default as OfflineStatus } from './offline-status';
13
+ export { default as ErrorBoundary } from './error-boundary';
13
14
 
14
15
  export * from './deprecated';
@@ -127,7 +127,7 @@ export default function ListViewSidebar() {
127
127
  // render where no tab is selected. This ensures that the
128
128
  // tabpanel height is correct so the relevant scroll container
129
129
  // can be rendered internally.
130
- initialTabId="list-view"
130
+ defaultTabId="list-view"
131
131
  >
132
132
  <div className="edit-post-editor__document-overview-panel__header">
133
133
  <Button
@@ -0,0 +1,121 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createSlotFill, PanelBody } from '@wordpress/components';
5
+ import { usePluginContext } from '@wordpress/plugins';
6
+ import { useDispatch, useSelect } from '@wordpress/data';
7
+ import warning from '@wordpress/warning';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import EnablePluginDocumentSettingPanelOption from '../preferences-modal/enable-plugin-document-setting-panel';
13
+ import { store as editorStore } from '../../store';
14
+
15
+ const { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );
16
+
17
+ /**
18
+ * Renders items below the Status & Availability panel in the Document Sidebar.
19
+ *
20
+ * @param {Object} props Component properties.
21
+ * @param {string} props.name Required. A machine-friendly name for the panel.
22
+ * @param {string} [props.className] An optional class name added to the row.
23
+ * @param {string} [props.title] The title of the panel
24
+ * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
25
+ * @param {Element} props.children Children to be rendered
26
+ *
27
+ * @example
28
+ * ```js
29
+ * // Using ES5 syntax
30
+ * var el = React.createElement;
31
+ * var __ = wp.i18n.__;
32
+ * var registerPlugin = wp.plugins.registerPlugin;
33
+ * var PluginDocumentSettingPanel = wp.editor.PluginDocumentSettingPanel;
34
+ *
35
+ * function MyDocumentSettingPlugin() {
36
+ * return el(
37
+ * PluginDocumentSettingPanel,
38
+ * {
39
+ * className: 'my-document-setting-plugin',
40
+ * title: 'My Panel',
41
+ * name: 'my-panel',
42
+ * },
43
+ * __( 'My Document Setting Panel' )
44
+ * );
45
+ * }
46
+ *
47
+ * registerPlugin( 'my-document-setting-plugin', {
48
+ * render: MyDocumentSettingPlugin
49
+ * } );
50
+ * ```
51
+ *
52
+ * @example
53
+ * ```jsx
54
+ * // Using ESNext syntax
55
+ * import { registerPlugin } from '@wordpress/plugins';
56
+ * import { PluginDocumentSettingPanel } from '@wordpress/editor';
57
+ *
58
+ * const MyDocumentSettingTest = () => (
59
+ * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel">
60
+ * <p>My Document Setting Panel</p>
61
+ * </PluginDocumentSettingPanel>
62
+ * );
63
+ *
64
+ * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
65
+ * ```
66
+ *
67
+ * @return {Component} The component to be rendered.
68
+ */
69
+ const PluginDocumentSettingPanel = ( {
70
+ name,
71
+ className,
72
+ title,
73
+ icon,
74
+ children,
75
+ } ) => {
76
+ const { name: pluginName } = usePluginContext();
77
+ const panelName = `${ pluginName }/${ name }`;
78
+ const { opened, isEnabled } = useSelect(
79
+ ( select ) => {
80
+ const { isEditorPanelOpened, isEditorPanelEnabled } =
81
+ select( editorStore );
82
+
83
+ return {
84
+ opened: isEditorPanelOpened( panelName ),
85
+ isEnabled: isEditorPanelEnabled( panelName ),
86
+ };
87
+ },
88
+ [ panelName ]
89
+ );
90
+ const { toggleEditorPanelOpened } = useDispatch( editorStore );
91
+
92
+ if ( undefined === name ) {
93
+ warning( 'PluginDocumentSettingPanel requires a name property.' );
94
+ }
95
+
96
+ return (
97
+ <>
98
+ <EnablePluginDocumentSettingPanelOption
99
+ label={ title }
100
+ panelName={ panelName }
101
+ />
102
+ <Fill>
103
+ { isEnabled && (
104
+ <PanelBody
105
+ className={ className }
106
+ title={ title }
107
+ icon={ icon }
108
+ opened={ opened }
109
+ onToggle={ () => toggleEditorPanelOpened( panelName ) }
110
+ >
111
+ { children }
112
+ </PanelBody>
113
+ ) }
114
+ </Fill>
115
+ </>
116
+ );
117
+ };
118
+
119
+ PluginDocumentSettingPanel.Slot = Slot;
120
+
121
+ export default PluginDocumentSettingPanel;
@@ -7,7 +7,6 @@ import {
7
7
  DropZone,
8
8
  Button,
9
9
  Spinner,
10
- ResponsiveWrapper,
11
10
  withNotices,
12
11
  withFilters,
13
12
  __experimentalHStack as HStack,
@@ -99,10 +98,7 @@ function PostFeaturedImage( {
99
98
  const toggleRef = useRef();
100
99
  const [ isLoading, setIsLoading ] = useState( false );
101
100
  const { getSettings } = useSelect( blockEditorStore );
102
- const { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(
103
- media,
104
- currentPostId
105
- );
101
+ const { mediaSourceUrl } = getMediaDetails( media, currentPostId );
106
102
 
107
103
  function onDropFiles( filesList ) {
108
104
  getSettings().mediaUpload( {
@@ -183,16 +179,11 @@ function PostFeaturedImage( {
183
179
  }
184
180
  >
185
181
  { !! featuredImageId && media && (
186
- <ResponsiveWrapper
187
- naturalWidth={ mediaWidth }
188
- naturalHeight={ mediaHeight }
189
- isInline
190
- >
191
- <img
192
- src={ mediaSourceUrl }
193
- alt=""
194
- />
195
- </ResponsiveWrapper>
182
+ <img
183
+ className="editor-post-featured-image__preview-image"
184
+ src={ mediaSourceUrl }
185
+ alt=""
186
+ />
196
187
  ) }
197
188
  { isLoading && <Spinner /> }
198
189
  { ! featuredImageId &&
@@ -15,7 +15,7 @@ import PostFeaturedImageCheck from './check';
15
15
 
16
16
  const PANEL_NAME = 'featured-image';
17
17
 
18
- function FeaturedImage() {
18
+ export default function PostFeaturedImagePanel( { withPanelBody = true } ) {
19
19
  const { postType, isEnabled, isOpened } = useSelect( ( select ) => {
20
20
  const {
21
21
  getEditedPostAttribute,
@@ -37,6 +37,14 @@ function FeaturedImage() {
37
37
  return null;
38
38
  }
39
39
 
40
+ if ( ! withPanelBody ) {
41
+ return (
42
+ <PostFeaturedImageCheck>
43
+ <PostFeaturedImage />
44
+ </PostFeaturedImageCheck>
45
+ );
46
+ }
47
+
40
48
  return (
41
49
  <PostFeaturedImageCheck>
42
50
  <PanelBody
@@ -51,5 +59,3 @@ function FeaturedImage() {
51
59
  </PostFeaturedImageCheck>
52
60
  );
53
61
  }
54
-
55
- export default FeaturedImage;
@@ -1,7 +1,6 @@
1
1
  .editor-post-featured-image {
2
2
  padding: 0;
3
3
 
4
-
5
4
  .components-spinner {
6
5
  position: absolute;
7
6
  top: 50%;
@@ -9,17 +8,11 @@
9
8
  margin-top: -9px;
10
9
  margin-left: -9px;
11
10
  }
12
-
13
- // This keeps images at their intrinsic size (eg. a 50px
14
- // image will never be wider than 50px).
15
- .components-responsive-wrapper__content {
16
- max-width: 100%;
17
- width: auto;
18
- }
19
11
  }
20
12
 
21
13
  .editor-post-featured-image__container {
22
14
  position: relative;
15
+ aspect-ratio: 2/1;
23
16
 
24
17
  &:hover,
25
18
  &:focus,
@@ -38,26 +31,28 @@
38
31
  @include reduce-motion("transition");
39
32
  box-shadow: 0 0 0 0 var(--wp-admin-theme-color);
40
33
  overflow: hidden; // Ensure the focus style properly encapsulates the image.
34
+ outline: $border-width solid rgba(0, 0, 0, 0.1);
35
+ outline-offset: -#{$border-width};
41
36
 
42
- // Apply a max-height.
43
37
  display: flex;
44
38
  justify-content: center;
45
- max-height: 150px;
46
39
  }
47
40
 
48
41
  .editor-post-featured-image__preview {
49
42
  height: auto;
50
43
 
51
- .components-responsive-wrapper {
44
+ .editor-post-featured-image__preview-image {
45
+ object-fit: cover;
52
46
  width: 100%;
53
- background: $gray-100;
47
+ object-position: 50% 50%;
48
+ aspect-ratio: 2/1;
54
49
  }
55
50
  }
56
51
 
57
52
  .editor-post-featured-image__toggle {
58
53
  border-radius: $radius-block-ui;
59
54
  background-color: $gray-100;
60
- min-height: 90px;
55
+ height: 100%;
61
56
  line-height: 20px;
62
57
  padding: $grid-unit-10 0;
63
58
  text-align: center;
@@ -168,7 +168,7 @@ export default function PostLockedModal() {
168
168
  ? __( 'Someone else has taken over this post' )
169
169
  : __( 'This post is already being edited' )
170
170
  }
171
- focusOnMount={ true }
171
+ focusOnMount
172
172
  shouldCloseOnClickOutside={ false }
173
173
  shouldCloseOnEsc={ false }
174
174
  isDismissible={ false }
@@ -171,6 +171,7 @@ export default function PostPreviewButton( {
171
171
  disabled={ ! isSaveable }
172
172
  onClick={ openPreviewWindow }
173
173
  role={ role }
174
+ size="compact"
174
175
  >
175
176
  { textContent || (
176
177
  <>
@@ -203,6 +203,7 @@ export class PostPublishButton extends Component {
203
203
  'has-changes-dot': hasNonPostEntityChanges,
204
204
  }
205
205
  ) }
206
+ size="compact"
206
207
  >
207
208
  { componentChildren }
208
209
  </Button>
@@ -110,7 +110,7 @@ export class PostPublishPanel extends Component {
110
110
  </PostPublishPanelPrepublish>
111
111
  ) }
112
112
  { isPostPublish && (
113
- <PostPublishPanelPostpublish focusOnMount={ true }>
113
+ <PostPublishPanelPostpublish focusOnMount>
114
114
  { PostPublishExtension && <PostPublishExtension /> }
115
115
  </PostPublishPanelPostpublish>
116
116
  ) }
@@ -131,7 +131,7 @@ export default function PostFormatPanel() {
131
131
  }
132
132
 
133
133
  return (
134
- <PanelBody initialOpen={ true } title={ panelBodyTitle }>
134
+ <PanelBody initialOpen title={ panelBodyTitle }>
135
135
  <p>
136
136
  { __(
137
137
  'Upload external images to the Media Library. Images from different domains may load slowly, display incorrectly, or be removed unexpectedly.'
@@ -353,7 +353,7 @@ exports[`PostPublishPanel should render the pre-publish panel if post status is
353
353
  >
354
354
  <button
355
355
  aria-disabled="true"
356
- class="components-button editor-post-publish-button editor-post-publish-button__button is-primary"
356
+ class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
357
357
  type="button"
358
358
  >
359
359
  Submit for Review
@@ -476,7 +476,7 @@ exports[`PostPublishPanel should render the pre-publish panel if the post is not
476
476
  >
477
477
  <button
478
478
  aria-disabled="true"
479
- class="components-button editor-post-publish-button editor-post-publish-button__button is-primary"
479
+ class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
480
480
  type="button"
481
481
  >
482
482
  Submit for Review
@@ -643,7 +643,7 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
643
643
  >
644
644
  <button
645
645
  aria-disabled="true"
646
- class="components-button editor-post-publish-button editor-post-publish-button__button is-primary"
646
+ class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
647
647
  type="button"
648
648
  >
649
649
  Submit for Review
@@ -1,26 +1,14 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useSelect, useDispatch } from '@wordpress/data';
4
+ import { useSelect } from '@wordpress/data';
5
5
  import { __, _x } from '@wordpress/i18n';
6
- import {
7
- Modal,
8
- Button,
9
- __experimentalHStack as HStack,
10
- __experimentalVStack as VStack,
11
- ToggleControl,
12
- } from '@wordpress/components';
13
- import { useEffect, useState } from '@wordpress/element';
14
- import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
15
6
 
16
7
  /**
17
8
  * Internal dependencies
18
9
  */
19
10
  import PostPanelRow from '../post-panel-row';
20
11
  import { store as editorStore } from '../../store';
21
- import { unlock } from '../../lock-unlock';
22
-
23
- const { ReusableBlocksRenameHint } = unlock( blockEditorPrivateApis );
24
12
 
25
13
  export default function PostSyncStatus() {
26
14
  const { syncStatus, postType } = useSelect( ( select ) => {
@@ -59,84 +47,3 @@ export default function PostSyncStatus() {
59
47
  </PostPanelRow>
60
48
  );
61
49
  }
62
-
63
- export function PostSyncStatusModal() {
64
- const { editPost } = useDispatch( editorStore );
65
- const [ isModalOpen, setIsModalOpen ] = useState( false );
66
- const [ syncType, setSyncType ] = useState( undefined );
67
-
68
- const { postType, isNewPost } = useSelect( ( select ) => {
69
- const { getEditedPostAttribute, isCleanNewPost } =
70
- select( editorStore );
71
- return {
72
- postType: getEditedPostAttribute( 'type' ),
73
- isNewPost: isCleanNewPost(),
74
- };
75
- }, [] );
76
-
77
- useEffect( () => {
78
- if ( isNewPost && postType === 'wp_block' ) {
79
- setIsModalOpen( true );
80
- }
81
- // We only want the modal to open when the page is first loaded.
82
- // eslint-disable-next-line react-hooks/exhaustive-deps
83
- }, [] );
84
-
85
- const setSyncStatus = () => {
86
- editPost( {
87
- meta: {
88
- wp_pattern_sync_status: syncType,
89
- },
90
- } );
91
- };
92
-
93
- if ( postType !== 'wp_block' || ! isNewPost ) {
94
- return null;
95
- }
96
-
97
- return (
98
- <>
99
- { isModalOpen && (
100
- <Modal
101
- title={ __( 'Set pattern sync status' ) }
102
- onRequestClose={ () => {
103
- setIsModalOpen( false );
104
- } }
105
- overlayClassName="reusable-blocks-menu-items__convert-modal"
106
- >
107
- <form
108
- onSubmit={ ( event ) => {
109
- event.preventDefault();
110
- setIsModalOpen( false );
111
- setSyncStatus();
112
- } }
113
- >
114
- <VStack spacing="5">
115
- <ReusableBlocksRenameHint />
116
- <ToggleControl
117
- label={ _x(
118
- 'Synced',
119
- 'Option that makes an individual pattern synchronized'
120
- ) }
121
- help={ __(
122
- 'Sync this pattern across multiple locations.'
123
- ) }
124
- checked={ ! syncType }
125
- onChange={ () => {
126
- setSyncType(
127
- ! syncType ? 'unsynced' : undefined
128
- );
129
- } }
130
- />
131
- <HStack justify="right">
132
- <Button variant="primary" type="submit">
133
- { __( 'Create' ) }
134
- </Button>
135
- </HStack>
136
- </VStack>
137
- </form>
138
- </Modal>
139
- ) }
140
- </>
141
- );
142
- }
@@ -40,10 +40,13 @@ const isSameTermName = ( termA, termB ) =>
40
40
  unescapeString( termB ).toLowerCase();
41
41
 
42
42
  const termNamesToIds = ( names, terms ) => {
43
- return names.map(
44
- ( termName ) =>
45
- terms.find( ( term ) => isSameTermName( term.name, termName ) ).id
46
- );
43
+ return names
44
+ .map(
45
+ ( termName ) =>
46
+ terms.find( ( term ) => isSameTermName( term.name, termName ) )
47
+ ?.id
48
+ )
49
+ .filter( ( id ) => id !== undefined );
47
50
  };
48
51
 
49
52
  export function FlatTermSelector( { slug } ) {
@@ -193,9 +196,8 @@ export function FlatTermSelector( { slug } ) {
193
196
  setValues( uniqueTerms );
194
197
 
195
198
  if ( newTermNames.length === 0 ) {
196
- return onUpdateTerms(
197
- termNamesToIds( uniqueTerms, availableTerms )
198
- );
199
+ onUpdateTerms( termNamesToIds( uniqueTerms, availableTerms ) );
200
+ return;
199
201
  }
200
202
 
201
203
  if ( ! hasCreateAction ) {
@@ -209,7 +211,7 @@ export function FlatTermSelector( { slug } ) {
209
211
  )
210
212
  .then( ( newTerms ) => {
211
213
  const newAvailableTerms = availableTerms.concat( newTerms );
212
- return onUpdateTerms(
214
+ onUpdateTerms(
213
215
  termNamesToIds( uniqueTerms, newAvailableTerms )
214
216
  );
215
217
  } )
@@ -217,6 +219,9 @@ export function FlatTermSelector( { slug } ) {
217
219
  createErrorNotice( error.message, {
218
220
  type: 'snackbar',
219
221
  } );
222
+ // In case of a failure, try assigning available terms.
223
+ // This will invalidate the optimistic update.
224
+ onUpdateTerms( termNamesToIds( uniqueTerms, availableTerms ) );
220
225
  } );
221
226
  }
222
227
 
@@ -439,6 +439,7 @@ export function HierarchicalTermSelector( { slug } ) {
439
439
  <form onSubmit={ onAddTerm }>
440
440
  <Flex direction="column" gap="4">
441
441
  <TextControl
442
+ __next40pxDefaultSize
442
443
  __nextHasNoMarginBottom
443
444
  className="editor-post-taxonomies__hierarchical-terms-input"
444
445
  label={ newTermLabel }
@@ -448,6 +449,7 @@ export function HierarchicalTermSelector( { slug } ) {
448
449
  />
449
450
  { !! availableTerms.length && (
450
451
  <TreeSelect
452
+ __next40pxDefaultSize
451
453
  __nextHasNoMarginBottom
452
454
  label={ parentSelectLabel }
453
455
  noOptionLabel={ noParentOption }
@@ -458,6 +460,7 @@ export function HierarchicalTermSelector( { slug } ) {
458
460
  ) }
459
461
  <FlexItem>
460
462
  <Button
463
+ __next40pxDefaultSize
461
464
  variant="secondary"
462
465
  type="submit"
463
466
  className="editor-post-taxonomies__hierarchical-terms-submit"
@@ -175,7 +175,7 @@ class PostTitle extends Component {
175
175
  fontSize={ 24 }
176
176
  lineHeight={ 1 }
177
177
  fontWeight={ 'bold' }
178
- deleteEnter={ true }
178
+ deleteEnter
179
179
  onChange={ ( value ) => {
180
180
  this.props.onUpdate( value );
181
181
  } }
@@ -184,7 +184,7 @@ class PostTitle extends Component {
184
184
  value={ title }
185
185
  onSelectionChange={ () => {} }
186
186
  onEnter={ this.props.onEnterPress }
187
- disableEditingMenu={ true }
187
+ disableEditingMenu
188
188
  __unstableIsSelected={ this.props.isSelected }
189
189
  __unstableOnCreateUndoLevel={ () => {} }
190
190
  />