@wordpress/edit-post 7.9.0 → 7.11.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 (70) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/header/header-toolbar/index.js +10 -15
  3. package/build/components/header/header-toolbar/index.js.map +1 -1
  4. package/build/components/header/index.js +3 -1
  5. package/build/components/header/index.js.map +1 -1
  6. package/build/components/keyboard-shortcuts/index.js +1 -1
  7. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  8. package/build/components/sidebar/plugin-document-setting-panel/index.js +1 -3
  9. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  10. package/build/components/sidebar/plugin-post-status-info/index.js +1 -4
  11. package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  12. package/build/components/sidebar/post-status/index.js +8 -1
  13. package/build/components/sidebar/post-status/index.js.map +1 -1
  14. package/build/components/sidebar/post-trash/index.js +5 -3
  15. package/build/components/sidebar/post-trash/index.js.map +1 -1
  16. package/build/components/sidebar/settings-sidebar/index.js +1 -1
  17. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  18. package/build/components/view-link/index.js +52 -0
  19. package/build/components/view-link/index.js.map +1 -0
  20. package/build/components/visual-editor/header.native.js +10 -3
  21. package/build/components/visual-editor/header.native.js.map +1 -1
  22. package/build/editor.js +9 -1
  23. package/build/editor.js.map +1 -1
  24. package/build/index.js +2 -2
  25. package/build/index.js.map +1 -1
  26. package/build-module/components/header/header-toolbar/index.js +9 -15
  27. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  28. package/build-module/components/header/index.js +2 -1
  29. package/build-module/components/header/index.js.map +1 -1
  30. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  31. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  32. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +1 -1
  33. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  34. package/build-module/components/sidebar/plugin-post-status-info/index.js +1 -1
  35. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  36. package/build-module/components/sidebar/post-status/index.js +8 -2
  37. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  38. package/build-module/components/sidebar/post-trash/index.js +4 -2
  39. package/build-module/components/sidebar/post-trash/index.js.map +1 -1
  40. package/build-module/components/sidebar/settings-sidebar/index.js +1 -1
  41. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  42. package/build-module/components/view-link/index.js +39 -0
  43. package/build-module/components/view-link/index.js.map +1 -0
  44. package/build-module/components/visual-editor/header.native.js +10 -3
  45. package/build-module/components/visual-editor/header.native.js.map +1 -1
  46. package/build-module/editor.js +7 -1
  47. package/build-module/editor.js.map +1 -1
  48. package/build-module/index.js +2 -2
  49. package/build-module/index.js.map +1 -1
  50. package/build-style/classic-rtl.css +1 -1
  51. package/build-style/classic.css +1 -1
  52. package/build-style/style-rtl.css +12 -14
  53. package/build-style/style.css +12 -14
  54. package/package.json +33 -31
  55. package/src/components/header/header-toolbar/index.js +10 -19
  56. package/src/components/header/index.js +2 -0
  57. package/src/components/keyboard-shortcuts/index.js +1 -1
  58. package/src/components/layout/style.scss +0 -1
  59. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +3 -3
  60. package/src/components/sidebar/plugin-document-setting-panel/index.js +1 -1
  61. package/src/components/sidebar/plugin-post-status-info/index.js +1 -1
  62. package/src/components/sidebar/post-status/index.js +14 -2
  63. package/src/components/sidebar/post-trash/index.js +3 -3
  64. package/src/components/sidebar/settings-sidebar/index.js +1 -1
  65. package/src/components/start-page-options/style.scss +1 -1
  66. package/src/components/view-link/index.js +37 -0
  67. package/src/components/visual-editor/header.native.js +12 -4
  68. package/src/components/visual-editor/style.scss +1 -1
  69. package/src/editor.js +5 -0
  70. package/src/index.js +3 -2
@@ -97,7 +97,7 @@
97
97
  --wp-block-synced-color: #7a00df;
98
98
  --wp-block-synced-color--rgb: 122, 0, 223;
99
99
  }
100
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
100
+ @media (min-resolution: 192dpi) {
101
101
  :root {
102
102
  --wp-admin-border-width-focus: 1.5px;
103
103
  }
@@ -859,8 +859,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
859
859
  width: 36px;
860
860
  height: 36px;
861
861
  border-radius: 2px;
862
- -o-object-fit: cover;
863
- object-fit: cover;
862
+ object-fit: cover;
864
863
  margin-top: -1px;
865
864
  }
866
865
 
@@ -1860,7 +1859,7 @@ h2.edit-post-template-summary__title {
1860
1859
  display: flex;
1861
1860
  flex-flow: column;
1862
1861
  overflow: hidden;
1863
- background-color: #2f2f2f;
1862
+ background-color: #1e1e1e;
1864
1863
  flex: 1 0 auto;
1865
1864
  }
1866
1865
  .edit-post-visual-editor .components-button {
@@ -1913,8 +1912,7 @@ h2.edit-post-template-summary__title {
1913
1912
  .edit-template-welcome-guide__image > img {
1914
1913
  display: block;
1915
1914
  max-width: 100%;
1916
- -o-object-fit: cover;
1917
- object-fit: cover;
1915
+ object-fit: cover;
1918
1916
  }
1919
1917
  .edit-post-welcome-guide__heading,
1920
1918
  .edit-template-welcome-guide__heading {
@@ -2086,7 +2084,7 @@ body.admin-color-light {
2086
2084
  --wp-admin-theme-color-darker-20--rgb: 0, 97, 135;
2087
2085
  --wp-admin-border-width-focus: 2px;
2088
2086
  }
2089
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
2087
+ @media (min-resolution: 192dpi) {
2090
2088
  body.admin-color-light {
2091
2089
  --wp-admin-border-width-focus: 1.5px;
2092
2090
  }
@@ -2101,7 +2099,7 @@ body.admin-color-modern {
2101
2099
  --wp-admin-theme-color-darker-20--rgb: 24, 58, 214;
2102
2100
  --wp-admin-border-width-focus: 2px;
2103
2101
  }
2104
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
2102
+ @media (min-resolution: 192dpi) {
2105
2103
  body.admin-color-modern {
2106
2104
  --wp-admin-border-width-focus: 1.5px;
2107
2105
  }
@@ -2116,7 +2114,7 @@ body.admin-color-blue {
2116
2114
  --wp-admin-theme-color-darker-20--rgb: 6, 64, 84;
2117
2115
  --wp-admin-border-width-focus: 2px;
2118
2116
  }
2119
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
2117
+ @media (min-resolution: 192dpi) {
2120
2118
  body.admin-color-blue {
2121
2119
  --wp-admin-border-width-focus: 1.5px;
2122
2120
  }
@@ -2131,7 +2129,7 @@ body.admin-color-coffee {
2131
2129
  --wp-admin-theme-color-darker-20--rgb: 43, 39, 36;
2132
2130
  --wp-admin-border-width-focus: 2px;
2133
2131
  }
2134
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
2132
+ @media (min-resolution: 192dpi) {
2135
2133
  body.admin-color-coffee {
2136
2134
  --wp-admin-border-width-focus: 1.5px;
2137
2135
  }
@@ -2146,7 +2144,7 @@ body.admin-color-ectoplasm {
2146
2144
  --wp-admin-theme-color-darker-20--rgb: 58, 44, 77;
2147
2145
  --wp-admin-border-width-focus: 2px;
2148
2146
  }
2149
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
2147
+ @media (min-resolution: 192dpi) {
2150
2148
  body.admin-color-ectoplasm {
2151
2149
  --wp-admin-border-width-focus: 1.5px;
2152
2150
  }
@@ -2161,7 +2159,7 @@ body.admin-color-midnight {
2161
2159
  --wp-admin-theme-color-darker-20--rgb: 208, 44, 33;
2162
2160
  --wp-admin-border-width-focus: 2px;
2163
2161
  }
2164
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
2162
+ @media (min-resolution: 192dpi) {
2165
2163
  body.admin-color-midnight {
2166
2164
  --wp-admin-border-width-focus: 1.5px;
2167
2165
  }
@@ -2176,7 +2174,7 @@ body.admin-color-ocean {
2176
2174
  --wp-admin-theme-color-darker-20--rgb: 76, 96, 102;
2177
2175
  --wp-admin-border-width-focus: 2px;
2178
2176
  }
2179
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
2177
+ @media (min-resolution: 192dpi) {
2180
2178
  body.admin-color-ocean {
2181
2179
  --wp-admin-border-width-focus: 1.5px;
2182
2180
  }
@@ -2191,7 +2189,7 @@ body.admin-color-sunrise {
2191
2189
  --wp-admin-theme-color-darker-20--rgb: 195, 105, 34;
2192
2190
  --wp-admin-border-width-focus: 2px;
2193
2191
  }
2194
- @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
2192
+ @media (min-resolution: 192dpi) {
2195
2193
  body.admin-color-sunrise {
2196
2194
  --wp-admin-border-width-focus: 1.5px;
2197
2195
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "7.9.0",
3
+ "version": "7.11.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,36 +27,38 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.32.0",
31
- "@wordpress/api-fetch": "^6.29.0",
32
- "@wordpress/block-editor": "^12.0.0",
33
- "@wordpress/block-library": "^8.9.0",
34
- "@wordpress/blocks": "^12.9.0",
35
- "@wordpress/components": "^23.9.0",
36
- "@wordpress/compose": "^6.9.0",
37
- "@wordpress/core-data": "^6.9.0",
38
- "@wordpress/data": "^9.2.0",
39
- "@wordpress/deprecated": "^3.32.0",
40
- "@wordpress/dom": "^3.32.0",
41
- "@wordpress/editor": "^13.9.0",
42
- "@wordpress/element": "^5.9.0",
43
- "@wordpress/hooks": "^3.32.0",
44
- "@wordpress/i18n": "^4.32.0",
45
- "@wordpress/icons": "^9.23.0",
46
- "@wordpress/interface": "^5.9.0",
47
- "@wordpress/keyboard-shortcuts": "^4.9.0",
48
- "@wordpress/keycodes": "^3.32.0",
49
- "@wordpress/media-utils": "^4.23.0",
50
- "@wordpress/notices": "^4.0.0",
51
- "@wordpress/plugins": "^6.0.0",
52
- "@wordpress/preferences": "^3.9.0",
53
- "@wordpress/private-apis": "^0.14.0",
54
- "@wordpress/url": "^3.33.0",
55
- "@wordpress/viewport": "^5.9.0",
56
- "@wordpress/warning": "^2.32.0",
57
- "@wordpress/widgets": "^3.9.0",
30
+ "@wordpress/a11y": "^3.34.0",
31
+ "@wordpress/api-fetch": "^6.31.0",
32
+ "@wordpress/block-editor": "^12.2.0",
33
+ "@wordpress/block-library": "^8.11.0",
34
+ "@wordpress/blocks": "^12.11.0",
35
+ "@wordpress/commands": "^0.5.0",
36
+ "@wordpress/components": "^25.0.0",
37
+ "@wordpress/compose": "^6.11.0",
38
+ "@wordpress/core-commands": "^0.3.0",
39
+ "@wordpress/core-data": "^6.11.0",
40
+ "@wordpress/data": "^9.4.0",
41
+ "@wordpress/deprecated": "^3.34.0",
42
+ "@wordpress/dom": "^3.34.0",
43
+ "@wordpress/editor": "^13.11.0",
44
+ "@wordpress/element": "^5.11.0",
45
+ "@wordpress/hooks": "^3.34.0",
46
+ "@wordpress/i18n": "^4.34.0",
47
+ "@wordpress/icons": "^9.25.0",
48
+ "@wordpress/interface": "^5.11.0",
49
+ "@wordpress/keyboard-shortcuts": "^4.11.0",
50
+ "@wordpress/keycodes": "^3.34.0",
51
+ "@wordpress/media-utils": "^4.25.0",
52
+ "@wordpress/notices": "^4.2.0",
53
+ "@wordpress/plugins": "^6.2.0",
54
+ "@wordpress/preferences": "^3.11.0",
55
+ "@wordpress/private-apis": "^0.16.0",
56
+ "@wordpress/url": "^3.35.0",
57
+ "@wordpress/viewport": "^5.11.0",
58
+ "@wordpress/warning": "^2.34.0",
59
+ "@wordpress/widgets": "^3.11.0",
58
60
  "classnames": "^2.3.1",
59
- "memize": "^1.1.0",
61
+ "memize": "^2.1.0",
60
62
  "rememo": "^4.0.2"
61
63
  },
62
64
  "peerDependencies": {
@@ -66,5 +68,5 @@
66
68
  "publishConfig": {
67
69
  "access": "public"
68
70
  },
69
- "gitHead": "6df0c62d43b8901414ccd22ffbe56eaa99d012a6"
71
+ "gitHead": "c7c79cb11b677adcbf06cf5f8cfb6c5ec1699f19"
70
72
  }
@@ -26,6 +26,8 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
26
26
  import { store as editPostStore } from '../../../store';
27
27
  import { unlock } from '../../../private-apis';
28
28
 
29
+ const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );
30
+
29
31
  const preventDefault = ( event ) => {
30
32
  event.preventDefault();
31
33
  };
@@ -41,27 +43,15 @@ function HeaderToolbar() {
41
43
  showIconLabels,
42
44
  isListViewOpen,
43
45
  listViewShortcut,
44
- selectedBlockId,
45
- hasFixedToolbar,
46
46
  } = useSelect( ( select ) => {
47
- const {
48
- hasInserterItems,
49
- getBlockRootClientId,
50
- getBlockSelectionEnd,
51
- getSelectedBlockClientId,
52
- getFirstMultiSelectedBlockClientId,
53
- getSettings,
54
- } = select( blockEditorStore );
47
+ const { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =
48
+ select( blockEditorStore );
55
49
  const { getEditorSettings } = select( editorStore );
56
50
  const { getEditorMode, isFeatureActive, isListViewOpened } =
57
51
  select( editPostStore );
58
52
  const { getShortcutRepresentation } = select( keyboardShortcutsStore );
59
53
 
60
54
  return {
61
- hasFixedToolbar: getSettings().hasFixedToolbar,
62
- selectedBlockId:
63
- getSelectedBlockClientId() ||
64
- getFirstMultiSelectedBlockClientId(),
65
55
  // This setting (richEditingEnabled) should not live in the block editor's setting.
66
56
  isInserterEnabled:
67
57
  getEditorMode() === 'visual' &&
@@ -79,18 +69,19 @@ function HeaderToolbar() {
79
69
  };
80
70
  }, [] );
81
71
 
82
- const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );
83
-
84
72
  const isLargeViewport = useViewportMatch( 'medium' );
85
73
  const isWideViewport = useViewportMatch( 'wide' );
86
- const { shouldShowContextualToolbar, canFocusHiddenToolbar } =
87
- useShouldContextualToolbarShow( selectedBlockId );
74
+ const {
75
+ shouldShowContextualToolbar,
76
+ canFocusHiddenToolbar,
77
+ fixedToolbarCanBeFocused,
78
+ } = useShouldContextualToolbarShow();
88
79
  // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
89
80
  // There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
90
81
  const blockToolbarCanBeFocused =
91
82
  shouldShowContextualToolbar ||
92
83
  canFocusHiddenToolbar ||
93
- ( ( hasFixedToolbar || ! isLargeViewport ) && selectedBlockId );
84
+ fixedToolbarCanBeFocused;
94
85
  /* translators: accessibility text for the editor toolbar */
95
86
  const toolbarAriaLabel = __( 'Document tools' );
96
87
 
@@ -15,6 +15,7 @@ import HeaderToolbar from './header-toolbar';
15
15
  import MoreMenu from './more-menu';
16
16
  import PostPublishButtonOrToggle from './post-publish-button-or-toggle';
17
17
  import { default as DevicePreview } from '../device-preview';
18
+ import ViewLink from '../view-link';
18
19
  import MainDashboardButton from './main-dashboard-button';
19
20
  import { store as editPostStore } from '../../store';
20
21
  import TemplateTitle from './template-title';
@@ -88,6 +89,7 @@ function Header( { setEntitiesSavedStatesCallback } ) {
88
89
  showIconLabels={ showIconLabels }
89
90
  />
90
91
  ) }
92
+ <ViewLink />
91
93
  <DevicePreview />
92
94
  <PostPreviewButton
93
95
  forceIsAutosaveable={ hasActiveMetaboxes }
@@ -130,7 +130,7 @@ function KeyboardShortcuts() {
130
130
  registerShortcut( {
131
131
  name: 'core/edit-post/toggle-sidebar',
132
132
  category: 'global',
133
- description: __( 'Show or hide the settings sidebar.' ),
133
+ description: __( 'Show or hide the Settings sidebar.' ),
134
134
  keyCombination: {
135
135
  modifier: 'primaryShift',
136
136
  character: ',',
@@ -109,5 +109,4 @@
109
109
  z-index: 19;
110
110
  }
111
111
  }
112
-
113
112
  }
@@ -608,13 +608,13 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
608
608
  }
609
609
 
610
610
  .emotion-13:hover {
611
- color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
611
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
612
612
  }
613
613
 
614
614
  .emotion-13:focus {
615
615
  background-color: transparent;
616
- color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
617
- border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
616
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
617
+ border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
618
618
  outline: 3px solid transparent;
619
619
  }
620
620
 
@@ -17,7 +17,7 @@ import warning from '@wordpress/warning';
17
17
  import { EnablePluginDocumentSettingPanelOption } from '../../preferences-modal/options';
18
18
  import { store as editPostStore } from '../../../store';
19
19
 
20
- export const { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );
20
+ const { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );
21
21
 
22
22
  const PluginDocumentSettingFill = ( {
23
23
  isEnabled,
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { createSlotFill, PanelRow } from '@wordpress/components';
9
9
 
10
- export const { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );
10
+ const { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );
11
11
 
12
12
  /**
13
13
  * Renders a row in the Summary panel of the Document sidebar.
@@ -2,9 +2,13 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { PanelBody } from '@wordpress/components';
5
+ import {
6
+ __experimentalHStack as HStack,
7
+ PanelBody,
8
+ } from '@wordpress/components';
6
9
  import { withSelect, withDispatch } from '@wordpress/data';
7
10
  import { compose, ifCondition } from '@wordpress/compose';
11
+ import { PostSwitchToDraftButton } from '@wordpress/editor';
8
12
 
9
13
  /**
10
14
  * Internal dependencies
@@ -48,7 +52,15 @@ function PostStatus( { isOpened, onTogglePanel } ) {
48
52
  <PostSlug />
49
53
  <PostAuthor />
50
54
  { fills }
51
- <PostTrash />
55
+ <HStack
56
+ style={ {
57
+ marginTop: '16px',
58
+ } }
59
+ spacing={ 4 }
60
+ >
61
+ <PostSwitchToDraftButton />
62
+ <PostTrash />
63
+ </HStack>
52
64
  </>
53
65
  ) }
54
66
  </PluginPostStatusInfo.Slot>
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { PanelRow } from '@wordpress/components';
5
4
  import { PostTrash as PostTrashLink, PostTrashCheck } from '@wordpress/editor';
5
+ import { FlexItem } from '@wordpress/components';
6
6
 
7
7
  export default function PostTrash() {
8
8
  return (
9
9
  <PostTrashCheck>
10
- <PanelRow>
10
+ <FlexItem isBlock>
11
11
  <PostTrashLink />
12
- </PanelRow>
12
+ </FlexItem>
13
13
  </PostTrashCheck>
14
14
  );
15
15
  }
@@ -73,7 +73,7 @@ const SettingsSidebar = () => {
73
73
  <PluginSidebarEditPost
74
74
  identifier={ sidebarName }
75
75
  header={ <SettingsHeader sidebarName={ sidebarName } /> }
76
- closeLabel={ __( 'Close settings' ) }
76
+ closeLabel={ __( 'Close Settings' ) }
77
77
  headerClassName="edit-post-sidebar__panel-tabs"
78
78
  /* translators: button label text should, if possible, be under 16 characters. */
79
79
  title={ __( 'Settings' ) }
@@ -4,7 +4,7 @@
4
4
  column-gap: $grid-unit-30;
5
5
 
6
6
  // Small top padding required to avoid cutting off the visible outline when hovering items
7
- padding-top: $border-width-focus;
7
+ padding-top: $border-width-focus-fallback;
8
8
 
9
9
  @include break-medium() {
10
10
  column-count: 3;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { Button } from '@wordpress/components';
6
+ import { external } from '@wordpress/icons';
7
+ import { store as editorStore } from '@wordpress/editor';
8
+ import { store as coreStore } from '@wordpress/core-data';
9
+ import { useSelect } from '@wordpress/data';
10
+
11
+ export default function ViewLink() {
12
+ const { permalink, isPublished, label } = useSelect( ( select ) => {
13
+ // Grab post type to retrieve the view_item label.
14
+ const postTypeSlug = select( editorStore ).getCurrentPostType();
15
+ const postType = select( coreStore ).getPostType( postTypeSlug );
16
+
17
+ return {
18
+ permalink: select( editorStore ).getPermalink(),
19
+ isPublished: select( editorStore ).isCurrentPostPublished(),
20
+ label: postType?.labels.view_item,
21
+ };
22
+ }, [] );
23
+
24
+ // Only render the view button if the post is published and has a permalink.
25
+ if ( ! isPublished || ! permalink ) {
26
+ return null;
27
+ }
28
+
29
+ return (
30
+ <Button
31
+ icon={ external }
32
+ label={ label || __( 'View post' ) }
33
+ href={ permalink }
34
+ target="_blank"
35
+ />
36
+ );
37
+ }
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { View } from 'react-native';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -6,8 +11,10 @@ import { __ } from '@wordpress/i18n';
6
11
  import { withDispatch, withSelect } from '@wordpress/data';
7
12
  import { compose, withPreferredColorScheme } from '@wordpress/compose';
8
13
  import { PostTitle } from '@wordpress/editor';
9
- import { ReadableContentView } from '@wordpress/components';
10
- import { store as blockEditorStore } from '@wordpress/block-editor';
14
+ import {
15
+ store as blockEditorStore,
16
+ useEditorWrapperStyles,
17
+ } from '@wordpress/block-editor';
11
18
 
12
19
  /**
13
20
  * Internal dependencies
@@ -21,12 +28,13 @@ const Header = memo(
21
28
  title,
22
29
  getStylesFromColorScheme,
23
30
  } ) {
31
+ const [ wrapperStyles ] = useEditorWrapperStyles();
24
32
  const blockHolderFocusedStyle = getStylesFromColorScheme(
25
33
  styles.blockHolderFocused,
26
34
  styles.blockHolderFocusedDark
27
35
  );
28
36
  return (
29
- <ReadableContentView>
37
+ <View style={ wrapperStyles }>
30
38
  <PostTitle
31
39
  innerRef={ setTitleRef }
32
40
  title={ title }
@@ -36,7 +44,7 @@ const Header = memo(
36
44
  focusedBorderColor={ blockHolderFocusedStyle.borderColor }
37
45
  accessibilityLabel="post-title"
38
46
  />
39
- </ReadableContentView>
47
+ </View>
40
48
  );
41
49
  },
42
50
  ( prevProps, nextProps ) => prevProps.title === nextProps.title
@@ -7,7 +7,7 @@
7
7
  // Gray preview overlay (desktop/tablet/mobile) is intentionally not set on an element with scrolling content like
8
8
  // interface-interface-skeleton__content. This causes graphical glitches (flashes of the background color)
9
9
  // when scrolling in Safari due to incorrect ordering of large compositing layers (GPU acceleration).
10
- background-color: $gray-800;
10
+ background-color: $gray-900;
11
11
 
12
12
  // The button element easily inherits styles that are meant for the editor style.
13
13
  // These rules enhance the specificity to reduce that inheritance.
package/src/editor.js CHANGED
@@ -14,6 +14,8 @@ import { SlotFillProvider } from '@wordpress/components';
14
14
  import { store as coreStore } from '@wordpress/core-data';
15
15
  import { ShortcutProvider } from '@wordpress/keyboard-shortcuts';
16
16
  import { store as preferencesStore } from '@wordpress/preferences';
17
+ import { CommandMenu } from '@wordpress/commands';
18
+ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
17
19
 
18
20
  /**
19
21
  * Internal dependencies
@@ -24,8 +26,10 @@ import { store as editPostStore } from './store';
24
26
  import { unlock } from './private-apis';
25
27
 
26
28
  const { ExperimentalEditorProvider } = unlock( editorPrivateApis );
29
+ const { useCommands } = unlock( coreCommandsPrivateApis );
27
30
 
28
31
  function Editor( { postId, postType, settings, initialEdits, ...props } ) {
32
+ useCommands();
29
33
  const {
30
34
  hasFixedToolbar,
31
35
  focusMode,
@@ -185,6 +189,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
185
189
  { ...props }
186
190
  >
187
191
  <ErrorBoundary>
192
+ <CommandMenu />
188
193
  <EditorInitialization postId={ postId } />
189
194
  <Layout styles={ styles } />
190
195
  </ErrorBoundary>
package/src/index.js CHANGED
@@ -79,7 +79,7 @@ export function initializeEditor(
79
79
  }
80
80
 
81
81
  /*
82
- * Prevent adding template part in the post editor.
82
+ * Prevent adding template part and post content block in the post editor.
83
83
  * Only add the filter when the post editor is initialized, not imported.
84
84
  * Also only add the filter(s) after registerCoreBlocks()
85
85
  * so that common filters in the block library are not overwritten.
@@ -90,7 +90,8 @@ export function initializeEditor(
90
90
  ( canInsert, blockType ) => {
91
91
  if (
92
92
  ! select( editPostStore ).isEditingTemplate() &&
93
- blockType.name === 'core/template-part'
93
+ ( blockType.name === 'core/template-part' ||
94
+ blockType.name === 'core/post-content' )
94
95
  ) {
95
96
  return false;
96
97
  }