@wordpress/edit-post 7.8.0 → 7.10.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 (80) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/header/header-toolbar/index.js +15 -1
  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/header/template-title/delete-template.js +1 -1
  7. package/build/components/header/template-title/delete-template.js.map +1 -1
  8. package/build/components/header/template-title/edit-template-title.js +2 -7
  9. package/build/components/header/template-title/edit-template-title.js.map +1 -1
  10. package/build/components/keyboard-shortcuts/index.js +1 -1
  11. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  12. package/build/components/sidebar/plugin-document-setting-panel/index.js +1 -3
  13. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  14. package/build/components/sidebar/plugin-post-status-info/index.js +1 -4
  15. package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  16. package/build/components/sidebar/post-status/index.js +8 -1
  17. package/build/components/sidebar/post-status/index.js.map +1 -1
  18. package/build/components/sidebar/post-trash/index.js +5 -3
  19. package/build/components/sidebar/post-trash/index.js.map +1 -1
  20. package/build/components/sidebar/settings-sidebar/index.js +1 -1
  21. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  22. package/build/components/start-page-options/index.js +1 -0
  23. package/build/components/start-page-options/index.js.map +1 -1
  24. package/build/components/view-link/index.js +52 -0
  25. package/build/components/view-link/index.js.map +1 -0
  26. package/build/components/visual-editor/header.native.js +10 -3
  27. package/build/components/visual-editor/header.native.js.map +1 -1
  28. package/build/editor.js +11 -1
  29. package/build/editor.js.map +1 -1
  30. package/build-module/components/header/header-toolbar/index.js +15 -2
  31. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  32. package/build-module/components/header/index.js +2 -1
  33. package/build-module/components/header/index.js.map +1 -1
  34. package/build-module/components/header/template-title/delete-template.js +1 -1
  35. package/build-module/components/header/template-title/delete-template.js.map +1 -1
  36. package/build-module/components/header/template-title/edit-template-title.js +2 -7
  37. package/build-module/components/header/template-title/edit-template-title.js.map +1 -1
  38. package/build-module/components/keyboard-shortcuts/index.js +1 -1
  39. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  40. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +1 -1
  41. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  42. package/build-module/components/sidebar/plugin-post-status-info/index.js +1 -1
  43. package/build-module/components/sidebar/plugin-post-status-info/index.js.map +1 -1
  44. package/build-module/components/sidebar/post-status/index.js +8 -2
  45. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  46. package/build-module/components/sidebar/post-trash/index.js +4 -2
  47. package/build-module/components/sidebar/post-trash/index.js.map +1 -1
  48. package/build-module/components/sidebar/settings-sidebar/index.js +1 -1
  49. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  50. package/build-module/components/start-page-options/index.js +1 -0
  51. package/build-module/components/start-page-options/index.js.map +1 -1
  52. package/build-module/components/view-link/index.js +39 -0
  53. package/build-module/components/view-link/index.js.map +1 -0
  54. package/build-module/components/visual-editor/header.native.js +10 -3
  55. package/build-module/components/visual-editor/header.native.js.map +1 -1
  56. package/build-module/editor.js +9 -1
  57. package/build-module/editor.js.map +1 -1
  58. package/build-style/style-rtl.css +75 -19
  59. package/build-style/style.css +75 -19
  60. package/package.json +33 -31
  61. package/src/components/header/header-toolbar/index.js +17 -1
  62. package/src/components/header/index.js +2 -0
  63. package/src/components/header/template-title/delete-template.js +0 -1
  64. package/src/components/header/template-title/edit-template-title.js +4 -7
  65. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +3 -1
  66. package/src/components/keyboard-shortcuts/index.js +1 -1
  67. package/src/components/layout/style.scss +11 -0
  68. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +9 -5
  69. package/src/components/secondary-sidebar/style.scss +20 -5
  70. package/src/components/sidebar/plugin-document-setting-panel/index.js +1 -1
  71. package/src/components/sidebar/plugin-post-status-info/index.js +1 -1
  72. package/src/components/sidebar/post-status/index.js +14 -2
  73. package/src/components/sidebar/post-trash/index.js +3 -3
  74. package/src/components/sidebar/settings-sidebar/index.js +1 -1
  75. package/src/components/start-page-options/index.js +1 -0
  76. package/src/components/start-page-options/style.scss +11 -15
  77. package/src/components/view-link/index.js +37 -0
  78. package/src/components/visual-editor/header.native.js +12 -4
  79. package/src/components/visual-editor/style.scss +2 -1
  80. package/src/editor.js +7 -0
@@ -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' ) }
@@ -113,6 +113,7 @@ export default function StartPageOptions() {
113
113
  <Modal
114
114
  className="edit-post-start-page-options__modal"
115
115
  title={ __( 'Choose a pattern' ) }
116
+ isFullScreen={ true }
116
117
  onRequestClose={ () => {
117
118
  setModalState( START_PAGE_MODAL_STATES.CLOSED );
118
119
  } }
@@ -1,23 +1,19 @@
1
- .edit-post-start-page-options__modal {
2
- // To keep modal dimensions consistent as subsections are navigated, width
3
- // and height are used instead of max-(width/height).
4
- @include break-small() {
5
- width: calc(100% - #{ $grid-unit-20 * 2 });
6
- height: calc(100% - #{ $header-height * 2 });
7
- }
8
- @include break-medium() {
9
- width: $break-medium - $grid-unit-20 * 2;
10
- }
11
- @include break-large() {
12
- height: 70%;
13
- }
14
- }
15
-
16
1
  // 2 column masonry layout.
17
2
  .edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
18
3
  column-count: 2;
19
4
  column-gap: $grid-unit-30;
20
5
 
6
+ // Small top padding required to avoid cutting off the visible outline when hovering items
7
+ padding-top: $border-width-focus-fallback;
8
+
9
+ @include break-medium() {
10
+ column-count: 3;
11
+ }
12
+
13
+ @include break-wide() {
14
+ column-count: 4;
15
+ }
16
+
21
17
  .block-editor-block-patterns-list__list-item {
22
18
  break-inside: avoid-column;
23
19
  margin-bottom: $grid-unit-30;
@@ -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
@@ -2,11 +2,12 @@
2
2
  position: relative;
3
3
  display: flex;
4
4
  flex-flow: column;
5
+ overflow: hidden;
5
6
 
6
7
  // Gray preview overlay (desktop/tablet/mobile) is intentionally not set on an element with scrolling content like
7
8
  // interface-interface-skeleton__content. This causes graphical glitches (flashes of the background color)
8
9
  // when scrolling in Safari due to incorrect ordering of large compositing layers (GPU acceleration).
9
- background-color: $gray-800;
10
+ background-color: $gray-900;
10
11
 
11
12
  // The button element easily inherits styles that are meant for the editor style.
12
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,9 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
185
189
  { ...props }
186
190
  >
187
191
  <ErrorBoundary>
192
+ { window?.__experimentalEnableCommandCenter && (
193
+ <CommandMenu />
194
+ ) }
188
195
  <EditorInitialization postId={ postId } />
189
196
  <Layout styles={ styles } />
190
197
  </ErrorBoundary>