@wordpress/edit-post 7.25.0 → 7.26.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 (199) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/browser-url/index.js +3 -2
  4. package/build/components/browser-url/index.js.map +1 -1
  5. package/build/components/header/index.js +25 -25
  6. package/build/components/header/index.js.map +1 -1
  7. package/build/components/header/writing-menu/index.js +11 -8
  8. package/build/components/header/writing-menu/index.js.map +1 -1
  9. package/build/components/keyboard-shortcuts/index.js +1 -20
  10. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  11. package/build/components/layout/index.js +33 -26
  12. package/build/components/layout/index.js.map +1 -1
  13. package/build/components/layout/index.native.js +3 -1
  14. package/build/components/layout/index.native.js.map +1 -1
  15. package/build/components/meta-boxes/meta-box-visibility.js +2 -6
  16. package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
  17. package/build/components/preferences-modal/index.js +25 -8
  18. package/build/components/preferences-modal/index.js.map +1 -1
  19. package/build/components/preferences-modal/options/enable-feature.js +23 -23
  20. package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
  21. package/build/components/preferences-modal/options/enable-panel.js +3 -6
  22. package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
  23. package/build/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  24. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  25. package/build/components/sidebar/plugin-sidebar/index.js +2 -10
  26. package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
  27. package/build/components/sidebar/post-status/index.js +2 -3
  28. package/build/components/sidebar/post-status/index.js.map +1 -1
  29. package/build/components/sidebar/settings-sidebar/index.js +1 -7
  30. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  31. package/build/editor.js +19 -28
  32. package/build/editor.js.map +1 -1
  33. package/build/editor.native.js +3 -10
  34. package/build/editor.native.js.map +1 -1
  35. package/build/hooks/commands/use-common-commands.js +16 -12
  36. package/build/hooks/commands/use-common-commands.js.map +1 -1
  37. package/build/hooks/use-post-history.js +79 -0
  38. package/build/hooks/use-post-history.js.map +1 -0
  39. package/build/index.js +19 -16
  40. package/build/index.js.map +1 -1
  41. package/build/index.native.js +7 -1
  42. package/build/index.native.js.map +1 -1
  43. package/build/store/actions.js +59 -73
  44. package/build/store/actions.js.map +1 -1
  45. package/build/store/reducer.js +1 -62
  46. package/build/store/reducer.js.map +1 -1
  47. package/build/store/selectors.js +66 -38
  48. package/build/store/selectors.js.map +1 -1
  49. package/build-module/components/browser-url/index.js +3 -2
  50. package/build-module/components/browser-url/index.js.map +1 -1
  51. package/build-module/components/header/index.js +25 -25
  52. package/build-module/components/header/index.js.map +1 -1
  53. package/build-module/components/header/writing-menu/index.js +11 -8
  54. package/build-module/components/header/writing-menu/index.js.map +1 -1
  55. package/build-module/components/keyboard-shortcuts/index.js +1 -20
  56. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  57. package/build-module/components/layout/index.js +33 -25
  58. package/build-module/components/layout/index.js.map +1 -1
  59. package/build-module/components/layout/index.native.js +4 -2
  60. package/build-module/components/layout/index.native.js.map +1 -1
  61. package/build-module/components/meta-boxes/meta-box-visibility.js +2 -6
  62. package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
  63. package/build-module/components/preferences-modal/index.js +25 -8
  64. package/build-module/components/preferences-modal/index.js.map +1 -1
  65. package/build-module/components/preferences-modal/options/enable-feature.js +22 -23
  66. package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
  67. package/build-module/components/preferences-modal/options/enable-panel.js +3 -7
  68. package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
  69. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  70. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  71. package/build-module/components/sidebar/plugin-sidebar/index.js +2 -10
  72. package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
  73. package/build-module/components/sidebar/post-status/index.js +3 -4
  74. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  75. package/build-module/components/sidebar/settings-sidebar/index.js +2 -8
  76. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  77. package/build-module/editor.js +19 -28
  78. package/build-module/editor.js.map +1 -1
  79. package/build-module/editor.native.js +3 -10
  80. package/build-module/editor.native.js.map +1 -1
  81. package/build-module/hooks/commands/use-common-commands.js +16 -12
  82. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  83. package/build-module/hooks/use-post-history.js +73 -0
  84. package/build-module/hooks/use-post-history.js.map +1 -0
  85. package/build-module/index.js +17 -11
  86. package/build-module/index.js.map +1 -1
  87. package/build-module/index.native.js +7 -1
  88. package/build-module/index.native.js.map +1 -1
  89. package/build-module/store/actions.js +55 -69
  90. package/build-module/store/actions.js.map +1 -1
  91. package/build-module/store/reducer.js +1 -60
  92. package/build-module/store/reducer.js.map +1 -1
  93. package/build-module/store/selectors.js +58 -29
  94. package/build-module/store/selectors.js.map +1 -1
  95. package/build-style/style-rtl.css +13 -284
  96. package/build-style/style.css +13 -284
  97. package/package.json +32 -32
  98. package/src/components/browser-url/index.js +4 -2
  99. package/src/components/header/index.js +24 -40
  100. package/src/components/header/style.scss +3 -3
  101. package/src/components/header/writing-menu/index.js +10 -8
  102. package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -15
  103. package/src/components/keyboard-shortcuts/index.js +1 -23
  104. package/src/components/layout/index.js +18 -27
  105. package/src/components/layout/index.native.js +9 -1
  106. package/src/components/meta-boxes/meta-box-visibility.js +2 -8
  107. package/src/components/preferences-modal/index.js +27 -9
  108. package/src/components/preferences-modal/options/enable-feature.js +26 -21
  109. package/src/components/preferences-modal/options/enable-panel.js +3 -7
  110. package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +187 -175
  111. package/src/components/sidebar/plugin-document-setting-panel/index.js +3 -3
  112. package/src/components/sidebar/plugin-sidebar/index.js +1 -9
  113. package/src/components/sidebar/post-status/index.js +3 -3
  114. package/src/components/sidebar/settings-sidebar/index.js +15 -13
  115. package/src/components/text-editor/style.scss +0 -6
  116. package/src/editor.js +34 -33
  117. package/src/editor.native.js +2 -17
  118. package/src/hooks/commands/use-common-commands.js +14 -16
  119. package/src/hooks/use-post-history.js +73 -0
  120. package/src/index.js +22 -12
  121. package/src/index.native.js +8 -1
  122. package/src/store/actions.js +48 -85
  123. package/src/store/reducer.js +0 -60
  124. package/src/store/selectors.js +74 -46
  125. package/src/store/test/actions.js +10 -103
  126. package/src/store/test/reducer.js +1 -108
  127. package/src/store/test/selectors.js +0 -50
  128. package/src/style.scss +1 -5
  129. package/src/test/editor.native.js +17 -0
  130. package/build/components/header/header-toolbar/index.js +0 -160
  131. package/build/components/header/header-toolbar/index.js.map +0 -1
  132. package/build/components/secondary-sidebar/inserter-sidebar.js +0 -73
  133. package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
  134. package/build/components/secondary-sidebar/list-view-outline.js +0 -112
  135. package/build/components/secondary-sidebar/list-view-outline.js.map +0 -1
  136. package/build/components/secondary-sidebar/list-view-sidebar.js +0 -148
  137. package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
  138. package/build/components/sidebar/discussion-panel/index.js +0 -59
  139. package/build/components/sidebar/discussion-panel/index.js.map +0 -1
  140. package/build/components/sidebar/featured-image/index.js +0 -70
  141. package/build/components/sidebar/featured-image/index.js.map +0 -1
  142. package/build/components/sidebar/last-revision/index.js +0 -21
  143. package/build/components/sidebar/last-revision/index.js.map +0 -1
  144. package/build/components/sidebar/page-attributes/index.js +0 -65
  145. package/build/components/sidebar/page-attributes/index.js.map +0 -1
  146. package/build/components/sidebar/plugin-post-excerpt/index.js +0 -72
  147. package/build/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
  148. package/build/components/sidebar/post-excerpt/index.js +0 -54
  149. package/build/components/sidebar/post-excerpt/index.js.map +0 -1
  150. package/build/components/sidebar/post-taxonomies/index.js +0 -30
  151. package/build/components/sidebar/post-taxonomies/index.js.map +0 -1
  152. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -56
  153. package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
  154. package/build/components/view-link/index.js +0 -53
  155. package/build/components/view-link/index.js.map +0 -1
  156. package/build-module/components/header/header-toolbar/index.js +0 -152
  157. package/build-module/components/header/header-toolbar/index.js.map +0 -1
  158. package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -66
  159. package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
  160. package/build-module/components/secondary-sidebar/list-view-outline.js +0 -105
  161. package/build-module/components/secondary-sidebar/list-view-outline.js.map +0 -1
  162. package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -140
  163. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
  164. package/build-module/components/sidebar/discussion-panel/index.js +0 -52
  165. package/build-module/components/sidebar/discussion-panel/index.js.map +0 -1
  166. package/build-module/components/sidebar/featured-image/index.js +0 -63
  167. package/build-module/components/sidebar/featured-image/index.js.map +0 -1
  168. package/build-module/components/sidebar/last-revision/index.js +0 -13
  169. package/build-module/components/sidebar/last-revision/index.js.map +0 -1
  170. package/build-module/components/sidebar/page-attributes/index.js +0 -57
  171. package/build-module/components/sidebar/page-attributes/index.js.map +0 -1
  172. package/build-module/components/sidebar/plugin-post-excerpt/index.js +0 -64
  173. package/build-module/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
  174. package/build-module/components/sidebar/post-excerpt/index.js +0 -47
  175. package/build-module/components/sidebar/post-excerpt/index.js.map +0 -1
  176. package/build-module/components/sidebar/post-taxonomies/index.js +0 -21
  177. package/build-module/components/sidebar/post-taxonomies/index.js.map +0 -1
  178. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
  179. package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
  180. package/build-module/components/view-link/index.js +0 -46
  181. package/build-module/components/view-link/index.js.map +0 -1
  182. package/src/components/header/header-toolbar/index.js +0 -186
  183. package/src/components/header/header-toolbar/style.scss +0 -116
  184. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +0 -929
  185. package/src/components/secondary-sidebar/inserter-sidebar.js +0 -71
  186. package/src/components/secondary-sidebar/list-view-outline.js +0 -98
  187. package/src/components/secondary-sidebar/list-view-sidebar.js +0 -170
  188. package/src/components/secondary-sidebar/style.scss +0 -120
  189. package/src/components/sidebar/discussion-panel/index.js +0 -62
  190. package/src/components/sidebar/featured-image/index.js +0 -67
  191. package/src/components/sidebar/last-revision/index.js +0 -17
  192. package/src/components/sidebar/last-revision/style.scss +0 -10
  193. package/src/components/sidebar/page-attributes/index.js +0 -65
  194. package/src/components/sidebar/plugin-post-excerpt/index.js +0 -61
  195. package/src/components/sidebar/plugin-post-excerpt/test/index.js +0 -36
  196. package/src/components/sidebar/post-excerpt/index.js +0 -59
  197. package/src/components/sidebar/post-taxonomies/index.js +0 -30
  198. package/src/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
  199. package/src/components/view-link/index.js +0 -48
@@ -1,61 +0,0 @@
1
- /**
2
- * Defines as extensibility slot for the Excerpt panel.
3
- */
4
-
5
- /**
6
- * WordPress dependencies
7
- */
8
- import { createSlotFill, PanelRow } from '@wordpress/components';
9
-
10
- const { Fill, Slot } = createSlotFill( 'PluginPostExcerpt' );
11
-
12
- /**
13
- * Renders a post excerpt panel in the post sidebar.
14
- *
15
- * @param {Object} props Component properties.
16
- * @param {string} [props.className] An optional class name added to the row.
17
- * @param {Element} props.children Children to be rendered.
18
- *
19
- * @example
20
- * ```js
21
- * // Using ES5 syntax
22
- * var __ = wp.i18n.__;
23
- * var PluginPostExcerpt = wp.editPost.PluginPostExcerpt;
24
- *
25
- * function MyPluginPostExcerpt() {
26
- * return React.createElement(
27
- * PluginPostExcerpt,
28
- * {
29
- * className: 'my-plugin-post-excerpt',
30
- * },
31
- * __( 'Post excerpt custom content' )
32
- * )
33
- * }
34
- * ```
35
- *
36
- * @example
37
- * ```jsx
38
- * // Using ESNext syntax
39
- * import { __ } from '@wordpress/i18n';
40
- * import { PluginPostExcerpt } from '@wordpress/edit-post';
41
- *
42
- * const MyPluginPostExcerpt = () => (
43
- * <PluginPostExcerpt className="my-plugin-post-excerpt">
44
- * { __( 'Post excerpt custom content' ) }
45
- * </PluginPostExcerpt>
46
- * );
47
- * ```
48
- *
49
- * @return {Component} The component to be rendered.
50
- */
51
- const PluginPostExcerpt = ( { children, className } ) => {
52
- return (
53
- <Fill>
54
- <PanelRow className={ className }>{ children }</PanelRow>
55
- </Fill>
56
- );
57
- };
58
-
59
- PluginPostExcerpt.Slot = Slot;
60
-
61
- export default PluginPostExcerpt;
@@ -1,36 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { render, screen } from '@testing-library/react';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { SlotFillProvider } from '@wordpress/components';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import PluginPostExcerptPanel from '../';
15
-
16
- describe( 'PluginPostExcerptPanel', () => {
17
- test( 'renders fill properly', () => {
18
- render(
19
- <SlotFillProvider>
20
- <PluginPostExcerptPanel className="my-plugin-post-excerpt-custom-content">
21
- Post Excerpt - Custom content
22
- </PluginPostExcerptPanel>
23
- <div role="tabpanel">
24
- <PluginPostExcerptPanel.Slot />
25
- </div>
26
- </SlotFillProvider>
27
- );
28
-
29
- expect( screen.getByRole( 'tabpanel' ) ).toHaveTextContent(
30
- 'Post Excerpt - Custom content'
31
- );
32
- expect(
33
- screen.getByText( 'Post Excerpt - Custom content' )
34
- ).toHaveClass( 'my-plugin-post-excerpt-custom-content' );
35
- } );
36
- } );
@@ -1,59 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { PanelBody } from '@wordpress/components';
6
- import {
7
- PostExcerpt as PostExcerptForm,
8
- PostExcerptCheck,
9
- } from '@wordpress/editor';
10
- import { useDispatch, useSelect } from '@wordpress/data';
11
-
12
- /**
13
- * Internal dependencies
14
- */
15
- import { store as editPostStore } from '../../../store';
16
- import PluginPostExcerpt from '../plugin-post-excerpt';
17
-
18
- /**
19
- * Module Constants
20
- */
21
- const PANEL_NAME = 'post-excerpt';
22
-
23
- export default function PostExcerpt() {
24
- const { isOpened, isEnabled } = useSelect( ( select ) => {
25
- const { isEditorPanelOpened, isEditorPanelEnabled } =
26
- select( editPostStore );
27
-
28
- return {
29
- isOpened: isEditorPanelOpened( PANEL_NAME ),
30
- isEnabled: isEditorPanelEnabled( PANEL_NAME ),
31
- };
32
- }, [] );
33
-
34
- const { toggleEditorPanelOpened } = useDispatch( editPostStore );
35
- const toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );
36
-
37
- if ( ! isEnabled ) {
38
- return null;
39
- }
40
-
41
- return (
42
- <PostExcerptCheck>
43
- <PanelBody
44
- title={ __( 'Excerpt' ) }
45
- opened={ isOpened }
46
- onToggle={ toggleExcerptPanel }
47
- >
48
- <PluginPostExcerpt.Slot>
49
- { ( fills ) => (
50
- <>
51
- <PostExcerptForm />
52
- { fills }
53
- </>
54
- ) }
55
- </PluginPostExcerpt.Slot>
56
- </PanelBody>
57
- </PostExcerptCheck>
58
- );
59
- }
@@ -1,30 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- PostTaxonomies as PostTaxonomiesForm,
6
- PostTaxonomiesCheck,
7
- } from '@wordpress/editor';
8
-
9
- /**
10
- * Internal dependencies
11
- */
12
- import TaxonomyPanel from './taxonomy-panel';
13
-
14
- function PostTaxonomies() {
15
- return (
16
- <PostTaxonomiesCheck>
17
- <PostTaxonomiesForm
18
- taxonomyWrapper={ ( content, taxonomy ) => {
19
- return (
20
- <TaxonomyPanel taxonomy={ taxonomy }>
21
- { content }
22
- </TaxonomyPanel>
23
- );
24
- } }
25
- />
26
- </PostTaxonomiesCheck>
27
- );
28
- }
29
-
30
- export default PostTaxonomies;
@@ -1,48 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { PanelBody } from '@wordpress/components';
5
- import { useSelect, useDispatch } from '@wordpress/data';
6
-
7
- /**
8
- * Internal dependencies
9
- */
10
- import { store as editPostStore } from '../../../store';
11
-
12
- function TaxonomyPanel( { taxonomy, children } ) {
13
- const slug = taxonomy?.slug;
14
- const panelName = slug ? `taxonomy-panel-${ slug }` : '';
15
- const { isEnabled, isOpened } = useSelect(
16
- ( select ) => {
17
- const { isEditorPanelEnabled, isEditorPanelOpened } =
18
- select( editPostStore );
19
- return {
20
- isEnabled: slug ? isEditorPanelEnabled( panelName ) : false,
21
- isOpened: slug ? isEditorPanelOpened( panelName ) : false,
22
- };
23
- },
24
- [ panelName, slug ]
25
- );
26
- const { toggleEditorPanelOpened } = useDispatch( editPostStore );
27
-
28
- if ( ! isEnabled ) {
29
- return null;
30
- }
31
-
32
- const taxonomyMenuName = taxonomy?.labels?.menu_name;
33
- if ( ! taxonomyMenuName ) {
34
- return null;
35
- }
36
-
37
- return (
38
- <PanelBody
39
- title={ taxonomyMenuName }
40
- opened={ isOpened }
41
- onToggle={ () => toggleEditorPanelOpened( panelName ) }
42
- >
43
- { children }
44
- </PanelBody>
45
- );
46
- }
47
-
48
- export default TaxonomyPanel;
@@ -1,48 +0,0 @@
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
- /**
12
- * Internal dependencies
13
- */
14
- import { store as editPostStore } from '../../store';
15
-
16
- export default function ViewLink() {
17
- const { permalink, isPublished, label, showIconLabels } = useSelect(
18
- ( select ) => {
19
- // Grab post type to retrieve the view_item label.
20
- const postTypeSlug = select( editorStore ).getCurrentPostType();
21
- const postType = select( coreStore ).getPostType( postTypeSlug );
22
-
23
- return {
24
- permalink: select( editorStore ).getPermalink(),
25
- isPublished: select( editorStore ).isCurrentPostPublished(),
26
- label: postType?.labels.view_item,
27
- showIconLabels:
28
- select( editPostStore ).isFeatureActive( 'showIconLabels' ),
29
- };
30
- },
31
- []
32
- );
33
-
34
- // Only render the view button if the post is published and has a permalink.
35
- if ( ! isPublished || ! permalink ) {
36
- return null;
37
- }
38
-
39
- return (
40
- <Button
41
- icon={ external }
42
- label={ label || __( 'View post' ) }
43
- href={ permalink }
44
- target="_blank"
45
- showTooltip={ ! showIconLabels }
46
- />
47
- );
48
- }