@wordpress/edit-post 7.23.0 → 7.24.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 (81) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/device-preview/index.js +6 -3
  3. package/build/components/device-preview/index.js.map +1 -1
  4. package/build/components/header/writing-menu/index.js +1 -1
  5. package/build/components/header/writing-menu/index.js.map +1 -1
  6. package/build/components/preferences-modal/index.js +1 -1
  7. package/build/components/preferences-modal/index.js.map +1 -1
  8. package/build/components/sidebar/post-pending-status/index.js +9 -2
  9. package/build/components/sidebar/post-pending-status/index.js.map +1 -1
  10. package/build/components/sidebar/post-status/index.js +1 -3
  11. package/build/components/sidebar/post-status/index.js.map +1 -1
  12. package/build/components/sidebar/post-sticky/index.js +9 -2
  13. package/build/components/sidebar/post-sticky/index.js.map +1 -1
  14. package/build/components/sidebar/post-template/index.js +7 -4
  15. package/build/components/sidebar/post-template/index.js.map +1 -1
  16. package/build/components/sidebar/post-visibility/index.js +12 -4
  17. package/build/components/sidebar/post-visibility/index.js.map +1 -1
  18. package/build/components/text-editor/index.js +21 -1
  19. package/build/components/text-editor/index.js.map +1 -1
  20. package/build/components/view-link/index.js +11 -3
  21. package/build/components/view-link/index.js.map +1 -1
  22. package/build/components/visual-editor/index.js +5 -1
  23. package/build/components/visual-editor/index.js.map +1 -1
  24. package/build/store/actions.js +1 -1
  25. package/build/store/actions.js.map +1 -1
  26. package/build-module/components/device-preview/index.js +6 -3
  27. package/build-module/components/device-preview/index.js.map +1 -1
  28. package/build-module/components/header/writing-menu/index.js +1 -1
  29. package/build-module/components/header/writing-menu/index.js.map +1 -1
  30. package/build-module/components/preferences-modal/index.js +1 -1
  31. package/build-module/components/preferences-modal/index.js.map +1 -1
  32. package/build-module/components/sidebar/post-pending-status/index.js +10 -3
  33. package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
  34. package/build-module/components/sidebar/post-status/index.js +2 -4
  35. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  36. package/build-module/components/sidebar/post-sticky/index.js +10 -3
  37. package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
  38. package/build-module/components/sidebar/post-template/index.js +9 -6
  39. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  40. package/build-module/components/sidebar/post-visibility/index.js +14 -6
  41. package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
  42. package/build-module/components/text-editor/index.js +22 -2
  43. package/build-module/components/text-editor/index.js.map +1 -1
  44. package/build-module/components/view-link/index.js +11 -3
  45. package/build-module/components/view-link/index.js.map +1 -1
  46. package/build-module/components/visual-editor/index.js +5 -1
  47. package/build-module/components/visual-editor/index.js.map +1 -1
  48. package/build-module/store/actions.js +1 -1
  49. package/build-module/store/actions.js.map +1 -1
  50. package/build-style/style-rtl.css +7 -62
  51. package/build-style/style.css +7 -62
  52. package/package.json +32 -32
  53. package/src/components/device-preview/index.js +21 -15
  54. package/src/components/header/writing-menu/index.js +1 -1
  55. package/src/components/preferences-modal/index.js +1 -1
  56. package/src/components/sidebar/post-pending-status/index.js +10 -3
  57. package/src/components/sidebar/post-status/index.js +5 -5
  58. package/src/components/sidebar/post-sticky/index.js +10 -3
  59. package/src/components/sidebar/post-template/index.js +10 -6
  60. package/src/components/sidebar/post-template/style.scss +0 -15
  61. package/src/components/sidebar/post-visibility/index.js +12 -5
  62. package/src/components/sidebar/post-visibility/style.scss +0 -11
  63. package/src/components/text-editor/index.js +20 -2
  64. package/src/components/text-editor/style.scss +3 -1
  65. package/src/components/view-link/index.js +21 -10
  66. package/src/components/visual-editor/index.js +7 -0
  67. package/src/store/actions.js +1 -1
  68. package/src/store/test/actions.js +1 -1
  69. package/src/style.scss +0 -2
  70. package/build/components/sidebar/post-author/index.js +0 -22
  71. package/build/components/sidebar/post-author/index.js.map +0 -1
  72. package/build/components/sidebar/post-schedule/index.js +0 -67
  73. package/build/components/sidebar/post-schedule/index.js.map +0 -1
  74. package/build-module/components/sidebar/post-author/index.js +0 -13
  75. package/build-module/components/sidebar/post-author/index.js.map +0 -1
  76. package/build-module/components/sidebar/post-schedule/index.js +0 -60
  77. package/build-module/components/sidebar/post-schedule/index.js.map +0 -1
  78. package/src/components/sidebar/post-author/index.js +0 -20
  79. package/src/components/sidebar/post-author/style.scss +0 -5
  80. package/src/components/sidebar/post-schedule/index.js +0 -67
  81. package/src/components/sidebar/post-schedule/style.scss +0 -36
@@ -2,10 +2,13 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useState, useMemo } from '@wordpress/element';
5
- import { PanelRow, Dropdown, Button } from '@wordpress/components';
5
+ import { Dropdown, Button } from '@wordpress/components';
6
6
  import { __, sprintf } from '@wordpress/i18n';
7
7
  import { useSelect } from '@wordpress/data';
8
- import { store as editorStore } from '@wordpress/editor';
8
+ import {
9
+ store as editorStore,
10
+ privateApis as editorPrivateApis,
11
+ } from '@wordpress/editor';
9
12
  import { store as coreStore } from '@wordpress/core-data';
10
13
 
11
14
  /**
@@ -13,6 +16,9 @@ import { store as coreStore } from '@wordpress/core-data';
13
16
  */
14
17
  import PostTemplateForm from './form';
15
18
  import { store as editPostStore } from '../../../store';
19
+ import { unlock } from '../../../lock-unlock';
20
+
21
+ const { PostPanelRow } = unlock( editorPrivateApis );
16
22
 
17
23
  export default function PostTemplate() {
18
24
  // Use internal state instead of a ref to make sure that the component
@@ -53,11 +59,9 @@ export default function PostTemplate() {
53
59
  }
54
60
 
55
61
  return (
56
- <PanelRow className="edit-post-post-template" ref={ setPopoverAnchor }>
57
- <span>{ __( 'Template' ) }</span>
62
+ <PostPanelRow label={ __( 'Template' ) } ref={ setPopoverAnchor }>
58
63
  <Dropdown
59
64
  popoverProps={ popoverProps }
60
- className="edit-post-post-template__dropdown"
61
65
  contentClassName="edit-post-post-template__dialog"
62
66
  focusOnMount
63
67
  renderToggle={ ( { isOpen, onToggle } ) => (
@@ -70,7 +74,7 @@ export default function PostTemplate() {
70
74
  <PostTemplateForm onClose={ onClose } />
71
75
  ) }
72
76
  />
73
- </PanelRow>
77
+ </PostPanelRow>
74
78
  );
75
79
  }
76
80
 
@@ -1,18 +1,3 @@
1
- .edit-post-post-template {
2
- width: 100%;
3
- justify-content: flex-start;
4
-
5
- span {
6
- display: block;
7
- width: 30%;
8
- margin-right: 8px;
9
- }
10
- }
11
-
12
- .edit-post-post-template__dropdown {
13
- max-width: 55%;
14
- }
15
-
16
1
  .components-button.edit-post-post-template__toggle {
17
2
  display: inline-block;
18
3
  width: 100%;
@@ -2,15 +2,23 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __, sprintf } from '@wordpress/i18n';
5
- import { PanelRow, Dropdown, Button } from '@wordpress/components';
5
+ import { Dropdown, Button } from '@wordpress/components';
6
6
  import {
7
7
  PostVisibility as PostVisibilityForm,
8
8
  PostVisibilityLabel,
9
9
  PostVisibilityCheck,
10
10
  usePostVisibilityLabel,
11
+ privateApis as editorPrivateApis,
11
12
  } from '@wordpress/editor';
12
13
  import { useMemo, useState } from '@wordpress/element';
13
14
 
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { unlock } from '../../../lock-unlock';
19
+
20
+ const { PostPanelRow } = unlock( editorPrivateApis );
21
+
14
22
  export function PostVisibility() {
15
23
  // Use internal state instead of a ref to make sure that the component
16
24
  // re-renders when the popover's anchor updates.
@@ -29,11 +37,10 @@ export function PostVisibility() {
29
37
  return (
30
38
  <PostVisibilityCheck
31
39
  render={ ( { canEdit } ) => (
32
- <PanelRow
40
+ <PostPanelRow
41
+ label={ __( 'Visibility' ) }
33
42
  ref={ setPopoverAnchor }
34
- className="edit-post-post-visibility"
35
43
  >
36
- <span>{ __( 'Visibility' ) }</span>
37
44
  { ! canEdit && (
38
45
  <span>
39
46
  <PostVisibilityLabel />
@@ -55,7 +62,7 @@ export function PostVisibility() {
55
62
  ) }
56
63
  />
57
64
  ) }
58
- </PanelRow>
65
+ </PostPanelRow>
59
66
  ) }
60
67
  />
61
68
  );
@@ -1,14 +1,3 @@
1
- .edit-post-post-visibility {
2
- width: 100%;
3
- justify-content: flex-start;
4
-
5
- span {
6
- display: block;
7
- width: 30%;
8
- margin-right: 8px;
9
- }
10
- }
11
-
12
1
  .edit-post-post-visibility__dialog .editor-post-visibility {
13
2
  // sidebar width - popover padding - form margin
14
3
  min-width: $sidebar-width - $grid-unit-20 - $grid-unit-20;
@@ -3,13 +3,14 @@
3
3
  */
4
4
  import {
5
5
  PostTextEditor,
6
- PostTitle,
6
+ PostTitleRaw,
7
7
  store as editorStore,
8
8
  } from '@wordpress/editor';
9
9
  import { Button } from '@wordpress/components';
10
10
  import { useDispatch, useSelect } from '@wordpress/data';
11
11
  import { __ } from '@wordpress/i18n';
12
12
  import { displayShortcut } from '@wordpress/keycodes';
13
+ import { useEffect, useRef } from '@wordpress/element';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
@@ -22,6 +23,23 @@ export default function TextEditor() {
22
23
  }, [] );
23
24
  const { switchEditorMode } = useDispatch( editPostStore );
24
25
 
26
+ const { isWelcomeGuideVisible } = useSelect( ( select ) => {
27
+ const { isFeatureActive } = select( editPostStore );
28
+
29
+ return {
30
+ isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
31
+ };
32
+ }, [] );
33
+
34
+ const titleRef = useRef();
35
+
36
+ useEffect( () => {
37
+ if ( isWelcomeGuideVisible ) {
38
+ return;
39
+ }
40
+ titleRef?.current?.focus();
41
+ }, [ isWelcomeGuideVisible ] );
42
+
25
43
  return (
26
44
  <div className="edit-post-text-editor">
27
45
  { isRichEditingEnabled && (
@@ -37,7 +55,7 @@ export default function TextEditor() {
37
55
  </div>
38
56
  ) }
39
57
  <div className="edit-post-text-editor__body">
40
- <PostTitle />
58
+ <PostTitleRaw ref={ titleRef } />
41
59
  <PostTextEditor />
42
60
  </div>
43
61
  </div>
@@ -5,7 +5,8 @@
5
5
  flex-grow: 1;
6
6
 
7
7
  // Post title.
8
- .editor-post-title {
8
+ .editor-post-title:not(.is-raw-text),
9
+ .editor-post-title.is-raw-text textarea {
9
10
  max-width: none;
10
11
  line-height: $default-line-height;
11
12
 
@@ -14,6 +15,7 @@
14
15
  font-weight: normal;
15
16
 
16
17
  border: $border-width solid $gray-600;
18
+ border-radius: 0;
17
19
 
18
20
  // Same padding as body.
19
21
  padding: $grid-unit-20;
@@ -8,18 +8,28 @@ import { store as editorStore } from '@wordpress/editor';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
9
  import { useSelect } from '@wordpress/data';
10
10
 
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { store as editPostStore } from '../../store';
15
+
11
16
  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 );
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 );
16
22
 
17
- return {
18
- permalink: select( editorStore ).getPermalink(),
19
- isPublished: select( editorStore ).isCurrentPostPublished(),
20
- label: postType?.labels.view_item,
21
- };
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
+ );
23
33
 
24
34
  // Only render the view button if the post is published and has a permalink.
25
35
  if ( ! isPublished || ! permalink ) {
@@ -32,6 +42,7 @@ export default function ViewLink() {
32
42
  label={ label || __( 'View post' ) }
33
43
  href={ permalink }
34
44
  target="_blank"
45
+ showTooltip={ ! showIconLabels }
35
46
  />
36
47
  );
37
48
  }
@@ -411,6 +411,13 @@ export default function VisualEditor( { styles } ) {
411
411
  : `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
412
412
  }
413
413
  layout={ blockListLayout }
414
+ dropZoneElement={
415
+ // When iframed, pass in the html element of the iframe to
416
+ // ensure the drop zone extends to the edges of the iframe.
417
+ isToBeIframed
418
+ ? ref.current?.parentNode
419
+ : ref.current
420
+ }
414
421
  />
415
422
  </RecursionProvider>
416
423
  </BlockCanvas>
@@ -630,7 +630,7 @@ export const toggleDistractionFree =
630
630
  registry.batch( () => {
631
631
  registry
632
632
  .dispatch( preferencesStore )
633
- .set( 'core/edit-post', 'fixedToolbar', false );
633
+ .set( 'core/edit-post', 'fixedToolbar', true );
634
634
  dispatch.setIsInserterOpened( false );
635
635
  dispatch.setIsListViewOpened( false );
636
636
  dispatch.closeGeneralSidebar();
@@ -375,7 +375,7 @@ describe( 'actions', () => {
375
375
  registry
376
376
  .select( preferencesStore )
377
377
  .get( 'core/edit-post', 'fixedToolbar' )
378
- ).toBe( false );
378
+ ).toBe( true );
379
379
  expect( registry.select( editPostStore ).isListViewOpened() ).toBe(
380
380
  false
381
381
  );
package/src/style.scss CHANGED
@@ -10,9 +10,7 @@
10
10
  @import "./components/secondary-sidebar/style.scss";
11
11
  @import "./components/sidebar/style.scss";
12
12
  @import "./components/sidebar/last-revision/style.scss";
13
- @import "./components/sidebar/post-author/style.scss";
14
13
  @import "./components/sidebar/post-format/style.scss";
15
- @import "./components/sidebar/post-schedule/style.scss";
16
14
  @import "./components/sidebar/post-slug/style.scss";
17
15
  @import "./components/sidebar/post-template/style.scss";
18
16
  @import "./components/sidebar/post-visibility/style.scss";
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PostAuthor = PostAuthor;
7
- exports.default = void 0;
8
- var _react = require("react");
9
- var _components = require("@wordpress/components");
10
- var _editor = require("@wordpress/editor");
11
- /**
12
- * WordPress dependencies
13
- */
14
-
15
- function PostAuthor() {
16
- return (0, _react.createElement)(_editor.PostAuthorCheck, null, (0, _react.createElement)(_components.PanelRow, {
17
- className: "edit-post-post-author"
18
- }, (0, _react.createElement)(_editor.PostAuthor, null)));
19
- }
20
- var _default = PostAuthor;
21
- exports.default = _default;
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_components","require","_editor","PostAuthor","_react","createElement","PostAuthorCheck","PanelRow","className","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/sidebar/post-author/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelRow } from '@wordpress/components';\nimport {\n\tPostAuthor as PostAuthorForm,\n\tPostAuthorCheck,\n} from '@wordpress/editor';\n\nexport function PostAuthor() {\n\treturn (\n\t\t<PostAuthorCheck>\n\t\t\t<PanelRow className=\"edit-post-post-author\">\n\t\t\t\t<PostAuthorForm />\n\t\t\t</PanelRow>\n\t\t</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAOO,SAASE,UAAUA,CAAA,EAAG;EAC5B,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACH,OAAA,CAAAI,eAAe,QACf,IAAAF,MAAA,CAAAC,aAAA,EAACL,WAAA,CAAAO,QAAQ;IAACC,SAAS,EAAC;EAAuB,GAC1C,IAAAJ,MAAA,CAAAC,aAAA,EAACH,OAAA,CAAAC,UAAc,MAAE,CACR,CACM,CAAC;AAEpB;AAAC,IAAAM,QAAA,GAEcN,UAAU;AAAAO,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = PostSchedule;
7
- var _react = require("react");
8
- var _i18n = require("@wordpress/i18n");
9
- var _components = require("@wordpress/components");
10
- var _element = require("@wordpress/element");
11
- var _editor = require("@wordpress/editor");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- function PostSchedule() {
17
- // Use internal state instead of a ref to make sure that the component
18
- // re-renders when the popover's anchor updates.
19
- const [popoverAnchor, setPopoverAnchor] = (0, _element.useState)(null);
20
- // Memoize popoverProps to avoid returning a new object every time.
21
- const popoverProps = (0, _element.useMemo)(() => ({
22
- anchor: popoverAnchor,
23
- placement: 'bottom-end'
24
- }), [popoverAnchor]);
25
- return (0, _react.createElement)(_editor.PostScheduleCheck, null, (0, _react.createElement)(_components.PanelRow, {
26
- className: "edit-post-post-schedule",
27
- ref: setPopoverAnchor
28
- }, (0, _react.createElement)("span", null, (0, _i18n.__)('Publish')), (0, _react.createElement)(_components.Dropdown, {
29
- popoverProps: popoverProps,
30
- className: "edit-post-post-schedule__dropdown",
31
- contentClassName: "edit-post-post-schedule__dialog",
32
- focusOnMount: true,
33
- renderToggle: ({
34
- isOpen,
35
- onToggle
36
- }) => (0, _react.createElement)(PostScheduleToggle, {
37
- isOpen: isOpen,
38
- onClick: onToggle
39
- }),
40
- renderContent: ({
41
- onClose
42
- }) => (0, _react.createElement)(_editor.PostSchedule, {
43
- onClose: onClose
44
- })
45
- })));
46
- }
47
- function PostScheduleToggle({
48
- isOpen,
49
- onClick
50
- }) {
51
- const label = (0, _editor.usePostScheduleLabel)();
52
- const fullLabel = (0, _editor.usePostScheduleLabel)({
53
- full: true
54
- });
55
- return (0, _react.createElement)(_components.Button, {
56
- className: "edit-post-post-schedule__toggle",
57
- variant: "tertiary",
58
- label: fullLabel,
59
- showTooltip: true,
60
- "aria-expanded": isOpen
61
- // translators: %s: Current post date.
62
- ,
63
- "aria-label": (0, _i18n.sprintf)((0, _i18n.__)('Change date: %s'), label),
64
- onClick: onClick
65
- }, label);
66
- }
67
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_i18n","require","_components","_element","_editor","PostSchedule","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","_react","createElement","PostScheduleCheck","PanelRow","className","ref","__","Dropdown","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostScheduleToggle","onClick","renderContent","onClose","label","usePostScheduleLabel","fullLabel","full","Button","variant","showTooltip","sprintf"],"sources":["@wordpress/edit-post/src/components/sidebar/post-schedule/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tPostSchedule as PostScheduleForm,\n\tPostScheduleCheck,\n\tusePostScheduleLabel,\n} from '@wordpress/editor';\n\nexport default function PostSchedule() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostScheduleCheck>\n\t\t\t<PanelRow\n\t\t\t\tclassName=\"edit-post-post-schedule\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t<span>{ __( 'Publish' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"edit-post-post-schedule__dropdown\"\n\t\t\t\t\tcontentClassName=\"edit-post-post-schedule__dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostScheduleToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostScheduleForm onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</PostScheduleCheck>\n\t);\n}\n\nfunction PostScheduleToggle( { isOpen, onClick } ) {\n\tconst label = usePostScheduleLabel();\n\tconst fullLabel = usePostScheduleLabel( { full: true } );\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-schedule__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\tlabel={ fullLabel }\n\t\t\tshowTooltip\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post date.\n\t\t\taria-label={ sprintf( __( 'Change date: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAUe,SAASI,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEC,aAAa,EAAEC,gBAAgB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,IAAK,CAAC;EAC5D;EACA,MAAMC,YAAY,GAAG,IAAAC,gBAAO,EAC3B,OAAQ;IAAEC,MAAM,EAAEL,aAAa;IAAEM,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEN,aAAa,CAChB,CAAC;EAED,OACC,IAAAO,MAAA,CAAAC,aAAA,EAACV,OAAA,CAAAW,iBAAiB,QACjB,IAAAF,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAc,QAAQ;IACRC,SAAS,EAAC,yBAAyB;IACnCC,GAAG,EAAGX;EAAkB,GAExB,IAAAM,MAAA,CAAAC,aAAA,gBAAQ,IAAAK,QAAE,EAAE,SAAU,CAAS,CAAC,EAChC,IAAAN,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAkB,QAAQ;IACRX,YAAY,EAAGA,YAAc;IAC7BQ,SAAS,EAAC,mCAAmC;IAC7CI,gBAAgB,EAAC,iCAAiC;IAClDC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpC,IAAAZ,MAAA,CAAAC,aAAA,EAACY,kBAAkB;MAClBF,MAAM,EAAGA,MAAQ;MACjBG,OAAO,EAAGF;IAAU,CACpB,CACC;IACHG,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5B,IAAAhB,MAAA,CAAAC,aAAA,EAACV,OAAA,CAAAC,YAAgB;MAACwB,OAAO,EAAGA;IAAS,CAAE;EACrC,CACH,CACQ,CACQ,CAAC;AAEtB;AAEA,SAASH,kBAAkBA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EAClD,MAAMG,KAAK,GAAG,IAAAC,4BAAoB,EAAC,CAAC;EACpC,MAAMC,SAAS,GAAG,IAAAD,4BAAoB,EAAE;IAAEE,IAAI,EAAE;EAAK,CAAE,CAAC;EACxD,OACC,IAAApB,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAgC,MAAM;IACNjB,SAAS,EAAC,iCAAiC;IAC3CkB,OAAO,EAAC,UAAU;IAClBL,KAAK,EAAGE,SAAW;IACnBI,WAAW;IACX,iBAAgBZ;IAChB;IAAA;IACA,cAAa,IAAAa,aAAO,EAAE,IAAAlB,QAAE,EAAE,iBAAkB,CAAC,EAAEW,KAAM,CAAG;IACxDH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX"}
@@ -1,13 +0,0 @@
1
- import { createElement } from "react";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { PanelRow } from '@wordpress/components';
6
- import { PostAuthor as PostAuthorForm, PostAuthorCheck } from '@wordpress/editor';
7
- export function PostAuthor() {
8
- return createElement(PostAuthorCheck, null, createElement(PanelRow, {
9
- className: "edit-post-post-author"
10
- }, createElement(PostAuthorForm, null)));
11
- }
12
- export default PostAuthor;
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["PanelRow","PostAuthor","PostAuthorForm","PostAuthorCheck","createElement","className"],"sources":["@wordpress/edit-post/src/components/sidebar/post-author/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelRow } from '@wordpress/components';\nimport {\n\tPostAuthor as PostAuthorForm,\n\tPostAuthorCheck,\n} from '@wordpress/editor';\n\nexport function PostAuthor() {\n\treturn (\n\t\t<PostAuthorCheck>\n\t\t\t<PanelRow className=\"edit-post-post-author\">\n\t\t\t\t<PostAuthorForm />\n\t\t\t</PanelRow>\n\t\t</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SACCC,UAAU,IAAIC,cAAc,EAC5BC,eAAe,QACT,mBAAmB;AAE1B,OAAO,SAASF,UAAUA,CAAA,EAAG;EAC5B,OACCG,aAAA,CAACD,eAAe,QACfC,aAAA,CAACJ,QAAQ;IAACK,SAAS,EAAC;EAAuB,GAC1CD,aAAA,CAACF,cAAc,MAAE,CACR,CACM,CAAC;AAEpB;AAEA,eAAeD,UAAU"}
@@ -1,60 +0,0 @@
1
- import { createElement } from "react";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { __, sprintf } from '@wordpress/i18n';
6
- import { PanelRow, Dropdown, Button } from '@wordpress/components';
7
- import { useState, useMemo } from '@wordpress/element';
8
- import { PostSchedule as PostScheduleForm, PostScheduleCheck, usePostScheduleLabel } from '@wordpress/editor';
9
- export default function PostSchedule() {
10
- // Use internal state instead of a ref to make sure that the component
11
- // re-renders when the popover's anchor updates.
12
- const [popoverAnchor, setPopoverAnchor] = useState(null);
13
- // Memoize popoverProps to avoid returning a new object every time.
14
- const popoverProps = useMemo(() => ({
15
- anchor: popoverAnchor,
16
- placement: 'bottom-end'
17
- }), [popoverAnchor]);
18
- return createElement(PostScheduleCheck, null, createElement(PanelRow, {
19
- className: "edit-post-post-schedule",
20
- ref: setPopoverAnchor
21
- }, createElement("span", null, __('Publish')), createElement(Dropdown, {
22
- popoverProps: popoverProps,
23
- className: "edit-post-post-schedule__dropdown",
24
- contentClassName: "edit-post-post-schedule__dialog",
25
- focusOnMount: true,
26
- renderToggle: ({
27
- isOpen,
28
- onToggle
29
- }) => createElement(PostScheduleToggle, {
30
- isOpen: isOpen,
31
- onClick: onToggle
32
- }),
33
- renderContent: ({
34
- onClose
35
- }) => createElement(PostScheduleForm, {
36
- onClose: onClose
37
- })
38
- })));
39
- }
40
- function PostScheduleToggle({
41
- isOpen,
42
- onClick
43
- }) {
44
- const label = usePostScheduleLabel();
45
- const fullLabel = usePostScheduleLabel({
46
- full: true
47
- });
48
- return createElement(Button, {
49
- className: "edit-post-post-schedule__toggle",
50
- variant: "tertiary",
51
- label: fullLabel,
52
- showTooltip: true,
53
- "aria-expanded": isOpen
54
- // translators: %s: Current post date.
55
- ,
56
- "aria-label": sprintf(__('Change date: %s'), label),
57
- onClick: onClick
58
- }, label);
59
- }
60
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["__","sprintf","PanelRow","Dropdown","Button","useState","useMemo","PostSchedule","PostScheduleForm","PostScheduleCheck","usePostScheduleLabel","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","createElement","className","ref","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostScheduleToggle","onClick","renderContent","onClose","label","fullLabel","full","variant","showTooltip"],"sources":["@wordpress/edit-post/src/components/sidebar/post-schedule/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tPostSchedule as PostScheduleForm,\n\tPostScheduleCheck,\n\tusePostScheduleLabel,\n} from '@wordpress/editor';\n\nexport default function PostSchedule() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\treturn (\n\t\t<PostScheduleCheck>\n\t\t\t<PanelRow\n\t\t\t\tclassName=\"edit-post-post-schedule\"\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t>\n\t\t\t\t<span>{ __( 'Publish' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"edit-post-post-schedule__dropdown\"\n\t\t\t\t\tcontentClassName=\"edit-post-post-schedule__dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostScheduleToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostScheduleForm onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</PostScheduleCheck>\n\t);\n}\n\nfunction PostScheduleToggle( { isOpen, onClick } ) {\n\tconst label = usePostScheduleLabel();\n\tconst fullLabel = usePostScheduleLabel( { full: true } );\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-schedule__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\tlabel={ fullLabel }\n\t\t\tshowTooltip\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post date.\n\t\t\taria-label={ sprintf( __( 'Change date: %s' ), label ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,uBAAuB;AAClE,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SACCC,YAAY,IAAIC,gBAAgB,EAChCC,iBAAiB,EACjBC,oBAAoB,QACd,mBAAmB;AAE1B,eAAe,SAASH,YAAYA,CAAA,EAAG;EACtC;EACA;EACA,MAAM,CAAEI,aAAa,EAAEC,gBAAgB,CAAE,GAAGP,QAAQ,CAAE,IAAK,CAAC;EAC5D;EACA,MAAMQ,YAAY,GAAGP,OAAO,CAC3B,OAAQ;IAAEQ,MAAM,EAAEH,aAAa;IAAEI,SAAS,EAAE;EAAa,CAAC,CAAE,EAC5D,CAAEJ,aAAa,CAChB,CAAC;EAED,OACCK,aAAA,CAACP,iBAAiB,QACjBO,aAAA,CAACd,QAAQ;IACRe,SAAS,EAAC,yBAAyB;IACnCC,GAAG,EAAGN;EAAkB,GAExBI,aAAA,eAAQhB,EAAE,CAAE,SAAU,CAAS,CAAC,EAChCgB,aAAA,CAACb,QAAQ;IACRU,YAAY,EAAGA,YAAc;IAC7BI,SAAS,EAAC,mCAAmC;IAC7CE,gBAAgB,EAAC,iCAAiC;IAClDC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpCP,aAAA,CAACQ,kBAAkB;MAClBF,MAAM,EAAGA,MAAQ;MACjBG,OAAO,EAAGF;IAAU,CACpB,CACC;IACHG,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5BX,aAAA,CAACR,gBAAgB;MAACmB,OAAO,EAAGA;IAAS,CAAE;EACrC,CACH,CACQ,CACQ,CAAC;AAEtB;AAEA,SAASH,kBAAkBA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EAClD,MAAMG,KAAK,GAAGlB,oBAAoB,CAAC,CAAC;EACpC,MAAMmB,SAAS,GAAGnB,oBAAoB,CAAE;IAAEoB,IAAI,EAAE;EAAK,CAAE,CAAC;EACxD,OACCd,aAAA,CAACZ,MAAM;IACNa,SAAS,EAAC,iCAAiC;IAC3Cc,OAAO,EAAC,UAAU;IAClBH,KAAK,EAAGC,SAAW;IACnBG,WAAW;IACX,iBAAgBV;IAChB;IAAA;IACA,cAAarB,OAAO,CAAED,EAAE,CAAE,iBAAkB,CAAC,EAAE4B,KAAM,CAAG;IACxDH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX"}
@@ -1,20 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { PanelRow } from '@wordpress/components';
5
- import {
6
- PostAuthor as PostAuthorForm,
7
- PostAuthorCheck,
8
- } from '@wordpress/editor';
9
-
10
- export function PostAuthor() {
11
- return (
12
- <PostAuthorCheck>
13
- <PanelRow className="edit-post-post-author">
14
- <PostAuthorForm />
15
- </PanelRow>
16
- </PostAuthorCheck>
17
- );
18
- }
19
-
20
- export default PostAuthor;
@@ -1,5 +0,0 @@
1
- .edit-post-post-author {
2
- display: flex;
3
- flex-direction: column;
4
- align-items: stretch;
5
- }
@@ -1,67 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { __, sprintf } from '@wordpress/i18n';
5
- import { PanelRow, Dropdown, Button } from '@wordpress/components';
6
- import { useState, useMemo } from '@wordpress/element';
7
- import {
8
- PostSchedule as PostScheduleForm,
9
- PostScheduleCheck,
10
- usePostScheduleLabel,
11
- } from '@wordpress/editor';
12
-
13
- export default function PostSchedule() {
14
- // Use internal state instead of a ref to make sure that the component
15
- // re-renders when the popover's anchor updates.
16
- const [ popoverAnchor, setPopoverAnchor ] = useState( null );
17
- // Memoize popoverProps to avoid returning a new object every time.
18
- const popoverProps = useMemo(
19
- () => ( { anchor: popoverAnchor, placement: 'bottom-end' } ),
20
- [ popoverAnchor ]
21
- );
22
-
23
- return (
24
- <PostScheduleCheck>
25
- <PanelRow
26
- className="edit-post-post-schedule"
27
- ref={ setPopoverAnchor }
28
- >
29
- <span>{ __( 'Publish' ) }</span>
30
- <Dropdown
31
- popoverProps={ popoverProps }
32
- className="edit-post-post-schedule__dropdown"
33
- contentClassName="edit-post-post-schedule__dialog"
34
- focusOnMount
35
- renderToggle={ ( { isOpen, onToggle } ) => (
36
- <PostScheduleToggle
37
- isOpen={ isOpen }
38
- onClick={ onToggle }
39
- />
40
- ) }
41
- renderContent={ ( { onClose } ) => (
42
- <PostScheduleForm onClose={ onClose } />
43
- ) }
44
- />
45
- </PanelRow>
46
- </PostScheduleCheck>
47
- );
48
- }
49
-
50
- function PostScheduleToggle( { isOpen, onClick } ) {
51
- const label = usePostScheduleLabel();
52
- const fullLabel = usePostScheduleLabel( { full: true } );
53
- return (
54
- <Button
55
- className="edit-post-post-schedule__toggle"
56
- variant="tertiary"
57
- label={ fullLabel }
58
- showTooltip
59
- aria-expanded={ isOpen }
60
- // translators: %s: Current post date.
61
- aria-label={ sprintf( __( 'Change date: %s' ), label ) }
62
- onClick={ onClick }
63
- >
64
- { label }
65
- </Button>
66
- );
67
- }
@@ -1,36 +0,0 @@
1
- .edit-post-post-schedule {
2
- width: 100%;
3
- position: relative;
4
- justify-content: flex-start;
5
- align-items: flex-start;
6
-
7
- span {
8
- display: block;
9
- width: 30%;
10
- margin-right: 8px;
11
- }
12
- }
13
-
14
- .edit-post-post-schedule__dropdown {
15
- width: 70%;
16
- }
17
-
18
- .components-button.edit-post-post-schedule__toggle {
19
- text-align: left;
20
- white-space: normal;
21
- height: auto;
22
-
23
- // This span is added by the Popover in Tooltip when no anchor is
24
- // provided. We set its width to 0 so that it does not cause the button text
25
- // to wrap to a new line when displaying the tooltip. A better fix would be
26
- // to pass anchorRef and avoid the need for a span alltogether, which is
27
- // what this PR allows us to do:
28
- // https://github.com/WordPress/gutenberg/pull/41268.
29
- span {
30
- width: 0;
31
- }
32
- }
33
-
34
- .edit-post-post-schedule__dialog .block-editor-publish-date-time-picker {
35
- margin: $grid-unit-10;
36
- }