@wordpress/edit-post 7.22.0 → 7.23.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 (52) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/header/document-actions/index.js +3 -7
  3. package/build/components/header/document-actions/index.js.map +1 -1
  4. package/build/components/header/header-toolbar/index.js +3 -8
  5. package/build/components/header/header-toolbar/index.js.map +1 -1
  6. package/build/components/header/index.js +65 -11
  7. package/build/components/header/index.js.map +1 -1
  8. package/build/components/keyboard-shortcuts/index.js +2 -4
  9. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  10. package/build/components/sidebar/post-schedule/index.js +1 -0
  11. package/build/components/sidebar/post-schedule/index.js.map +1 -1
  12. package/build/components/sidebar/post-status/index.js +1 -2
  13. package/build/components/sidebar/post-status/index.js.map +1 -1
  14. package/build/components/start-page-options/index.js +11 -13
  15. package/build/components/start-page-options/index.js.map +1 -1
  16. package/build-module/components/header/document-actions/index.js +3 -7
  17. package/build-module/components/header/document-actions/index.js.map +1 -1
  18. package/build-module/components/header/header-toolbar/index.js +3 -8
  19. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  20. package/build-module/components/header/index.js +66 -12
  21. package/build-module/components/header/index.js.map +1 -1
  22. package/build-module/components/keyboard-shortcuts/index.js +2 -4
  23. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  24. package/build-module/components/sidebar/post-schedule/index.js +1 -0
  25. package/build-module/components/sidebar/post-schedule/index.js.map +1 -1
  26. package/build-module/components/sidebar/post-status/index.js +2 -3
  27. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  28. package/build-module/components/start-page-options/index.js +12 -14
  29. package/build-module/components/start-page-options/index.js.map +1 -1
  30. package/build-style/style-rtl.css +34 -133
  31. package/build-style/style.css +34 -133
  32. package/package.json +32 -32
  33. package/src/components/header/document-actions/index.js +4 -7
  34. package/src/components/header/header-toolbar/index.js +1 -5
  35. package/src/components/header/index.js +104 -17
  36. package/src/components/header/style.scss +31 -2
  37. package/src/components/keyboard-shortcuts/index.js +6 -3
  38. package/src/components/layout/style.scss +0 -11
  39. package/src/components/sidebar/post-schedule/index.js +1 -0
  40. package/src/components/sidebar/post-schedule/style.scss +6 -4
  41. package/src/components/sidebar/post-status/index.js +6 -3
  42. package/src/components/sidebar/post-template/style.scss +2 -3
  43. package/src/components/sidebar/post-visibility/style.scss +2 -3
  44. package/src/components/start-page-options/index.js +8 -15
  45. package/src/components/visual-editor/style.scss +0 -90
  46. package/src/style.scss +0 -1
  47. package/build/components/sidebar/post-url/index.js +0 -62
  48. package/build/components/sidebar/post-url/index.js.map +0 -1
  49. package/build-module/components/sidebar/post-url/index.js +0 -55
  50. package/build-module/components/sidebar/post-url/index.js.map +0 -1
  51. package/src/components/sidebar/post-url/index.js +0 -58
  52. package/src/components/sidebar/post-url/style.scss +0 -26
@@ -20,21 +20,18 @@ import { displayShortcut } from '@wordpress/keycodes';
20
20
  import { store as editPostStore } from '../../../store';
21
21
 
22
22
  function DocumentActions() {
23
- const { template, isEditing } = useSelect( ( select ) => {
24
- const { isEditingTemplate, getEditedPostTemplate } =
25
- select( editPostStore );
26
- const _isEditing = isEditingTemplate();
23
+ const { template } = useSelect( ( select ) => {
24
+ const { getEditedPostTemplate } = select( editPostStore );
27
25
 
28
26
  return {
29
- template: _isEditing ? getEditedPostTemplate() : null,
30
- isEditing: _isEditing,
27
+ template: getEditedPostTemplate(),
31
28
  };
32
29
  }, [] );
33
30
  const { clearSelectedBlock } = useDispatch( blockEditorStore );
34
31
  const { setIsEditingTemplate } = useDispatch( editPostStore );
35
32
  const { open: openCommandCenter } = useDispatch( commandsStore );
36
33
 
37
- if ( ! isEditing || ! template ) {
34
+ if ( ! template ) {
38
35
  return null;
39
36
  }
40
37
 
@@ -19,7 +19,6 @@ import { Button, ToolbarItem } from '@wordpress/components';
19
19
  import { listView, plus } from '@wordpress/icons';
20
20
  import { useRef, useCallback } from '@wordpress/element';
21
21
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
22
- import { store as preferencesStore } from '@wordpress/preferences';
23
22
 
24
23
  /**
25
24
  * Internal dependencies
@@ -33,7 +32,7 @@ const preventDefault = ( event ) => {
33
32
  event.preventDefault();
34
33
  };
35
34
 
36
- function HeaderToolbar( { setListViewToggleElement } ) {
35
+ function HeaderToolbar( { hasFixedToolbar, setListViewToggleElement } ) {
37
36
  const inserterButton = useRef();
38
37
  const { setIsInserterOpened, setIsListViewOpened } =
39
38
  useDispatch( editPostStore );
@@ -44,7 +43,6 @@ function HeaderToolbar( { setListViewToggleElement } ) {
44
43
  showIconLabels,
45
44
  isListViewOpen,
46
45
  listViewShortcut,
47
- hasFixedToolbar,
48
46
  } = useSelect( ( select ) => {
49
47
  const { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =
50
48
  select( blockEditorStore );
@@ -52,7 +50,6 @@ function HeaderToolbar( { setListViewToggleElement } ) {
52
50
  const { getEditorMode, isFeatureActive, isListViewOpened } =
53
51
  select( editPostStore );
54
52
  const { getShortcutRepresentation } = select( keyboardShortcutsStore );
55
- const { get: getPreference } = select( preferencesStore );
56
53
 
57
54
  return {
58
55
  // This setting (richEditingEnabled) should not live in the block editor's setting.
@@ -69,7 +66,6 @@ function HeaderToolbar( { setListViewToggleElement } ) {
69
66
  listViewShortcut: getShortcutRepresentation(
70
67
  'core/edit-post/toggle-list-view'
71
68
  ),
72
- hasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),
73
69
  };
74
70
  }, [] );
75
71
 
@@ -1,11 +1,28 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
9
+ import {
10
+ privateApis as blockEditorPrivateApis,
11
+ store as blockEditorStore,
12
+ } from '@wordpress/block-editor';
4
13
  import { PostSavedState, PostPreviewButton } from '@wordpress/editor';
14
+ import { useEffect, useRef, useState } from '@wordpress/element';
5
15
  import { useSelect } from '@wordpress/data';
16
+ import { __ } from '@wordpress/i18n';
17
+ import { next, previous } from '@wordpress/icons';
6
18
  import { PinnedItems } from '@wordpress/interface';
7
19
  import { useViewportMatch } from '@wordpress/compose';
8
- import { __unstableMotion as motion } from '@wordpress/components';
20
+ import {
21
+ Button,
22
+ __unstableMotion as motion,
23
+ Popover,
24
+ } from '@wordpress/components';
25
+ import { store as preferencesStore } from '@wordpress/preferences';
9
26
 
10
27
  /**
11
28
  * Internal dependencies
@@ -19,6 +36,9 @@ import ViewLink from '../view-link';
19
36
  import MainDashboardButton from './main-dashboard-button';
20
37
  import { store as editPostStore } from '../../store';
21
38
  import DocumentActions from './document-actions';
39
+ import { unlock } from '../../lock-unlock';
40
+
41
+ const { BlockContextualToolbar } = unlock( blockEditorPrivateApis );
22
42
 
23
43
  const slideY = {
24
44
  hidden: { y: '-50px' },
@@ -36,18 +56,43 @@ function Header( {
36
56
  setEntitiesSavedStatesCallback,
37
57
  setListViewToggleElement,
38
58
  } ) {
39
- const isLargeViewport = useViewportMatch( 'large' );
40
- const { hasActiveMetaboxes, isPublishSidebarOpened, showIconLabels } =
41
- useSelect(
42
- ( select ) => ( {
43
- hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
44
- isPublishSidebarOpened:
45
- select( editPostStore ).isPublishSidebarOpened(),
46
- showIconLabels:
47
- select( editPostStore ).isFeatureActive( 'showIconLabels' ),
48
- } ),
49
- []
50
- );
59
+ const isWideViewport = useViewportMatch( 'large' );
60
+ const isLargeViewport = useViewportMatch( 'medium' );
61
+ const blockToolbarRef = useRef();
62
+ const {
63
+ blockSelectionStart,
64
+ hasActiveMetaboxes,
65
+ hasFixedToolbar,
66
+ isEditingTemplate,
67
+ isPublishSidebarOpened,
68
+ showIconLabels,
69
+ } = useSelect( ( select ) => {
70
+ const { get: getPreference } = select( preferencesStore );
71
+
72
+ return {
73
+ blockSelectionStart:
74
+ select( blockEditorStore ).getBlockSelectionStart(),
75
+ hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
76
+ isEditingTemplate: select( editPostStore ).isEditingTemplate(),
77
+ isPublishSidebarOpened:
78
+ select( editPostStore ).isPublishSidebarOpened(),
79
+ hasFixedToolbar: getPreference( 'core/edit-post', 'fixedToolbar' ),
80
+ showIconLabels:
81
+ select( editPostStore ).isFeatureActive( 'showIconLabels' ),
82
+ };
83
+ }, [] );
84
+
85
+ const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
86
+ useState( true );
87
+
88
+ const hasBlockSelected = !! blockSelectionStart;
89
+
90
+ useEffect( () => {
91
+ // If we have a new block selection, show the block tools
92
+ if ( blockSelectionStart ) {
93
+ setIsBlockToolsCollapsed( false );
94
+ }
95
+ }, [ blockSelectionStart ] );
51
96
 
52
97
  return (
53
98
  <div className="edit-post-header">
@@ -65,10 +110,52 @@ function Header( {
65
110
  className="edit-post-header__toolbar"
66
111
  >
67
112
  <HeaderToolbar
113
+ hasFixedToolbar={ hasFixedToolbar }
68
114
  setListViewToggleElement={ setListViewToggleElement }
69
115
  />
70
- <div className="edit-post-header__center">
71
- <DocumentActions />
116
+ { hasFixedToolbar && isLargeViewport && (
117
+ <>
118
+ <div
119
+ className={ classnames(
120
+ 'selected-block-tools-wrapper',
121
+ {
122
+ 'is-collapsed': isBlockToolsCollapsed,
123
+ }
124
+ ) }
125
+ >
126
+ <BlockContextualToolbar isFixed />
127
+ </div>
128
+ <Popover.Slot
129
+ ref={ blockToolbarRef }
130
+ name="block-toolbar"
131
+ />
132
+ { isEditingTemplate && hasBlockSelected && (
133
+ <Button
134
+ className="edit-post-header__block-tools-toggle"
135
+ icon={ isBlockToolsCollapsed ? next : previous }
136
+ onClick={ () => {
137
+ setIsBlockToolsCollapsed(
138
+ ( collapsed ) => ! collapsed
139
+ );
140
+ } }
141
+ label={
142
+ isBlockToolsCollapsed
143
+ ? __( 'Show block tools' )
144
+ : __( 'Hide block tools' )
145
+ }
146
+ />
147
+ ) }
148
+ </>
149
+ ) }
150
+ <div
151
+ className={ classnames( 'edit-post-header__center', {
152
+ 'is-collapsed':
153
+ ! isBlockToolsCollapsed &&
154
+ isLargeViewport &&
155
+ isEditingTemplate,
156
+ } ) }
157
+ >
158
+ { isEditingTemplate && <DocumentActions /> }
72
159
  </div>
73
160
  </motion.div>
74
161
  <motion.div
@@ -96,13 +183,13 @@ function Header( {
96
183
  setEntitiesSavedStatesCallback
97
184
  }
98
185
  />
99
- { ( isLargeViewport || ! showIconLabels ) && (
186
+ { ( isWideViewport || ! showIconLabels ) && (
100
187
  <>
101
188
  <PinnedItems.Slot scope="core/edit-post" />
102
189
  <MoreMenu showIconLabels={ showIconLabels } />
103
190
  </>
104
191
  ) }
105
- { showIconLabels && ! isLargeViewport && (
192
+ { showIconLabels && ! isWideViewport && (
106
193
  <MoreMenu showIconLabels={ showIconLabels } />
107
194
  ) }
108
195
  </motion.div>
@@ -6,6 +6,7 @@
6
6
  align-items: center;
7
7
  // The header should never be wider than the viewport, or buttons might be hidden. Especially relevant at high zoom levels. Related to https://core.trac.wordpress.org/ticket/47603#ticket.
8
8
  max-width: 100vw;
9
+ justify-content: space-between;
9
10
 
10
11
  // Make toolbar sticky on larger breakpoints
11
12
  @include break-zoomed-in {
@@ -33,7 +34,15 @@
33
34
 
34
35
  .edit-post-header__toolbar {
35
36
  display: flex;
36
- flex-grow: 1;
37
+ // Allow this area to shrink to fit the toolbar buttons.
38
+ flex-shrink: 8;
39
+ // Take up the space of the toolbar so it can be justified to the left side of the toolbar.
40
+ flex-grow: 3;
41
+ // Hide the overflow so flex will limit its width. Block toolbar will allow scrolling on fixed toolbar.
42
+ overflow: hidden;
43
+ // Leave enough room for the focus ring to show.
44
+ padding: 2px 0;
45
+ align-items: center;
37
46
 
38
47
  .table-of-contents {
39
48
  display: none;
@@ -42,12 +51,32 @@
42
51
  display: block;
43
52
  }
44
53
  }
54
+
55
+ .block-editor-block-contextual-toolbar.is-fixed {
56
+ border: none;
57
+ }
58
+
59
+ .selected-block-tools-wrapper {
60
+ overflow-x: hidden;
61
+
62
+ &.is-collapsed {
63
+ display: none;
64
+ }
65
+ }
66
+ }
67
+
68
+ .edit-post-header__block-tools-toggle {
69
+ margin-left: 2px; // Allow focus ring to be fully visible
45
70
  }
46
71
 
47
72
  .edit-post-header__center {
48
73
  flex-grow: 1;
49
74
  display: flex;
50
75
  justify-content: center;
76
+
77
+ &.is-collapsed {
78
+ display: none;
79
+ }
51
80
  }
52
81
 
53
82
  /**
@@ -57,7 +86,7 @@
57
86
  .edit-post-header__settings {
58
87
  display: inline-flex;
59
88
  align-items: center;
60
- flex-wrap: wrap;
89
+ flex-wrap: nowrap;
61
90
  padding-right: $grid-unit-05;
62
91
 
63
92
  @include break-small () {
@@ -18,7 +18,6 @@ import { createBlock } from '@wordpress/blocks';
18
18
  import { store as editPostStore } from '../../store';
19
19
 
20
20
  function KeyboardShortcuts() {
21
- const { getBlockSelectionStart } = useSelect( blockEditorStore );
22
21
  const { getEditorMode, isEditorSidebarOpened, isListViewOpened } =
23
22
  useSelect( editPostStore );
24
23
  const isModeToggleDisabled = useSelect( ( select ) => {
@@ -38,8 +37,12 @@ function KeyboardShortcuts() {
38
37
  const { registerShortcut } = useDispatch( keyboardShortcutsStore );
39
38
 
40
39
  const { replaceBlocks } = useDispatch( blockEditorStore );
41
- const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
42
- useSelect( blockEditorStore );
40
+ const {
41
+ getBlockName,
42
+ getSelectedBlockClientId,
43
+ getBlockAttributes,
44
+ getBlockSelectionStart,
45
+ } = useSelect( blockEditorStore );
43
46
 
44
47
  const handleTextLevelShortcut = ( event, level ) => {
45
48
  event.preventDefault();
@@ -99,14 +99,3 @@
99
99
  .edit-post-layout .entities-saved-states__panel-header {
100
100
  height: $header-height + $border-width;
101
101
  }
102
-
103
- .edit-post-layout.has-fixed-toolbar {
104
- // making the header be lower than the content
105
- // so the fixed toolbar can be positioned on top of it
106
- // but only on desktop
107
- @include break-medium() {
108
- .interface-interface-skeleton__header:not(:focus-within) {
109
- z-index: 19;
110
- }
111
- }
112
- }
@@ -29,6 +29,7 @@ export default function PostSchedule() {
29
29
  <span>{ __( 'Publish' ) }</span>
30
30
  <Dropdown
31
31
  popoverProps={ popoverProps }
32
+ className="edit-post-post-schedule__dropdown"
32
33
  contentClassName="edit-post-post-schedule__dialog"
33
34
  focusOnMount
34
35
  renderToggle={ ( { isOpen, onToggle } ) => (
@@ -6,13 +6,15 @@
6
6
 
7
7
  span {
8
8
  display: block;
9
- width: 45%;
10
- flex-shrink: 0;
11
- // Match padding on tertiary buttons for alignment.
12
- padding: $grid-unit-15 * 0.5 0;
9
+ width: 30%;
10
+ margin-right: 8px;
13
11
  }
14
12
  }
15
13
 
14
+ .edit-post-post-schedule__dropdown {
15
+ width: 70%;
16
+ }
17
+
16
18
  .components-button.edit-post-post-schedule__toggle {
17
19
  text-align: left;
18
20
  white-space: normal;
@@ -7,7 +7,11 @@ import {
7
7
  PanelBody,
8
8
  } from '@wordpress/components';
9
9
  import { useDispatch, useSelect } from '@wordpress/data';
10
- import { PostSwitchToDraftButton, PostSyncStatus } from '@wordpress/editor';
10
+ import {
11
+ PostSwitchToDraftButton,
12
+ PostSyncStatus,
13
+ PostURLPanel,
14
+ } from '@wordpress/editor';
11
15
 
12
16
  /**
13
17
  * Internal dependencies
@@ -23,7 +27,6 @@ import PostPendingStatus from '../post-pending-status';
23
27
  import PluginPostStatusInfo from '../plugin-post-status-info';
24
28
  import { store as editPostStore } from '../../../store';
25
29
  import PostTemplate from '../post-template';
26
- import PostURL from '../post-url';
27
30
 
28
31
  /**
29
32
  * Module Constants
@@ -60,7 +63,7 @@ export default function PostStatus() {
60
63
  <PostVisibility />
61
64
  <PostSchedule />
62
65
  <PostTemplate />
63
- <PostURL />
66
+ <PostURLPanel />
64
67
  <PostSticky />
65
68
  <PostPendingStatus />
66
69
  <PostFormat />
@@ -4,9 +4,8 @@
4
4
 
5
5
  span {
6
6
  display: block;
7
- width: 45%;
8
- // Match padding on tertiary buttons for alignment.
9
- padding: $grid-unit-15 * 0.5 0;
7
+ width: 30%;
8
+ margin-right: 8px;
10
9
  }
11
10
  }
12
11
 
@@ -4,9 +4,8 @@
4
4
 
5
5
  span {
6
6
  display: block;
7
- width: 45%;
8
- // Match padding on tertiary buttons for alignment.
9
- padding: $grid-unit-15 * 0.5 0;
7
+ width: 30%;
8
+ margin-right: 8px;
10
9
  }
11
10
  }
12
11
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { Modal } from '@wordpress/components';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { useState, useEffect, useMemo } from '@wordpress/element';
6
+ import { useState, useMemo } from '@wordpress/element';
7
7
  import {
8
8
  store as blockEditorStore,
9
9
  __experimentalBlockPatternsList as BlockPatternsList,
@@ -62,19 +62,11 @@ function PatternSelection( { blockPatterns, onChoosePattern } ) {
62
62
  );
63
63
  }
64
64
 
65
- function StartPageOptionsModal() {
66
- const [ modalState, setModalState ] = useState( 'initial' );
65
+ function StartPageOptionsModal( { onClose } ) {
67
66
  const startPatterns = useStartPatterns();
68
67
  const hasStartPattern = startPatterns.length > 0;
69
- const shouldOpenModal = hasStartPattern && modalState === 'initial';
70
68
 
71
- useEffect( () => {
72
- if ( shouldOpenModal ) {
73
- setModalState( 'open' );
74
- }
75
- }, [ shouldOpenModal ] );
76
-
77
- if ( modalState !== 'open' ) {
69
+ if ( ! hasStartPattern ) {
78
70
  return null;
79
71
  }
80
72
 
@@ -83,12 +75,12 @@ function StartPageOptionsModal() {
83
75
  className="edit-post-start-page-options__modal"
84
76
  title={ __( 'Choose a pattern' ) }
85
77
  isFullScreen
86
- onRequestClose={ () => setModalState( 'closed' ) }
78
+ onRequestClose={ onClose }
87
79
  >
88
80
  <div className="edit-post-start-page-options__modal-content">
89
81
  <PatternSelection
90
82
  blockPatterns={ startPatterns }
91
- onChoosePattern={ () => setModalState( 'closed' ) }
83
+ onChoosePattern={ onClose }
92
84
  />
93
85
  </div>
94
86
  </Modal>
@@ -96,6 +88,7 @@ function StartPageOptionsModal() {
96
88
  }
97
89
 
98
90
  export default function StartPageOptions() {
91
+ const [ isClosed, setIsClosed ] = useState( false );
99
92
  const shouldEnableModal = useSelect( ( select ) => {
100
93
  const { isCleanNewPost } = select( editorStore );
101
94
  const { isEditingTemplate, isFeatureActive } = select( editPostStore );
@@ -107,9 +100,9 @@ export default function StartPageOptions() {
107
100
  );
108
101
  }, [] );
109
102
 
110
- if ( ! shouldEnableModal ) {
103
+ if ( ! shouldEnableModal || isClosed ) {
111
104
  return null;
112
105
  }
113
106
 
114
- return <StartPageOptionsModal />;
107
+ return <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;
115
108
  }
@@ -21,7 +21,6 @@
21
21
  font-size: $default-font-size;
22
22
  padding: 6px 12px;
23
23
 
24
- &.is-tertiary,
25
24
  &.has-icon {
26
25
  padding: 6px;
27
26
  }
@@ -67,92 +66,3 @@
67
66
  // See also https://www.w3.org/TR/CSS22/visudet.html#the-height-property
68
67
  flex-grow: 1;
69
68
  }
70
-
71
- // Fixed contextual toolbar
72
- @include editor-left(".edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed");
73
-
74
- .edit-post-visual-editor .block-editor-block-contextual-toolbar.is-fixed {
75
- position: sticky;
76
- top: 0;
77
- z-index: z-index(".block-editor-block-popover");
78
- display: block;
79
- width: 100%;
80
-
81
- // on desktop and tablet viewports the toolbar is fixed
82
- // on top of interface header
83
- $toolbar-margin: $grid-unit-80 * 3 - 2 * $grid-unit + $grid-unit-05;
84
-
85
- @include break-medium() {
86
- // leave room for block inserter, undo and redo, list view
87
- margin-left: $toolbar-margin;
88
- // position on top of interface header
89
- position: fixed;
90
- top: $admin-bar-height;
91
- // Don't fill up when empty
92
- min-height: initial;
93
- // remove the border
94
- border-bottom: none;
95
- // has to be flex for collapse button to fit
96
- display: flex;
97
-
98
- // Mimic the height of the parent, vertically align center, and provide a max-height.
99
- height: $header-height;
100
- align-items: center;
101
-
102
-
103
- // on tablet viewports the toolbar is fixed
104
- // on top of interface header and covers the whole header
105
- // except for the inserter on the left
106
- width: calc(100% - #{$toolbar-margin});
107
-
108
- &.is-collapsed {
109
- width: initial;
110
- }
111
-
112
- &:empty {
113
- width: initial;
114
- }
115
-
116
- .is-fullscreen-mode & {
117
- // leave room for block inserter, undo and redo, list view
118
- // and some margin left
119
- margin-left: $grid-unit-80 * 4 - 2 * $grid-unit;
120
-
121
- top: 0;
122
-
123
- &.is-collapsed {
124
- width: initial;
125
- }
126
-
127
- &:empty {
128
- width: initial;
129
- }
130
- }
131
-
132
- .show-icon-labels & {
133
- width: calc(100% + 40px - #{$toolbar-margin}); //there are no undo, redo and list view buttons
134
- margin-left: $grid-unit-80 + 2 * $grid-unit; // inserter and margin
135
-
136
- .is-fullscreen-mode & {
137
- margin-left: $grid-unit * 18; // site hub, inserter and margin
138
- }
139
- }
140
- }
141
-
142
- // on desktop viewports the toolbar is fixed
143
- // on top of interface header and leaves room
144
- // for the block inserter the publish button
145
- @include break-large() {
146
- width: auto;
147
- .show-icon-labels & {
148
- width: auto; //there are no undo, redo and list view buttons
149
- }
150
-
151
- .is-fullscreen-mode & {
152
- // in full screen mode we need to account for
153
- // the combined with of the tools at the right of the header and the margin left
154
- // of the toolbar which includes four buttons
155
- width: calc(100% - 280px - #{4 * $grid-unit-80});
156
- }
157
- }
158
- }
package/src/style.scss CHANGED
@@ -15,7 +15,6 @@
15
15
  @import "./components/sidebar/post-schedule/style.scss";
16
16
  @import "./components/sidebar/post-slug/style.scss";
17
17
  @import "./components/sidebar/post-template/style.scss";
18
- @import "./components/sidebar/post-url/style.scss";
19
18
  @import "./components/sidebar/post-visibility/style.scss";
20
19
  @import "./components/sidebar/settings-header/style.scss";
21
20
  @import "./components/sidebar/template-summary/style.scss";
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = PostURL;
7
- var _react = require("react");
8
- var _element = require("@wordpress/element");
9
- var _components = require("@wordpress/components");
10
- var _i18n = require("@wordpress/i18n");
11
- var _editor = require("@wordpress/editor");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- function PostURL() {
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.PostURLCheck, null, (0, _react.createElement)(_components.PanelRow, {
26
- className: "edit-post-post-url",
27
- ref: setPopoverAnchor
28
- }, (0, _react.createElement)("span", null, (0, _i18n.__)('URL')), (0, _react.createElement)(_components.Dropdown, {
29
- popoverProps: popoverProps,
30
- className: "edit-post-post-url__dropdown",
31
- contentClassName: "edit-post-post-url__dialog",
32
- focusOnMount: true,
33
- renderToggle: ({
34
- isOpen,
35
- onToggle
36
- }) => (0, _react.createElement)(PostURLToggle, {
37
- isOpen: isOpen,
38
- onClick: onToggle
39
- }),
40
- renderContent: ({
41
- onClose
42
- }) => (0, _react.createElement)(_editor.PostURL, {
43
- onClose: onClose
44
- })
45
- })));
46
- }
47
- function PostURLToggle({
48
- isOpen,
49
- onClick
50
- }) {
51
- const label = (0, _editor.usePostURLLabel)();
52
- return (0, _react.createElement)(_components.Button, {
53
- className: "edit-post-post-url__toggle",
54
- variant: "tertiary",
55
- "aria-expanded": isOpen
56
- // translators: %s: Current post URL.
57
- ,
58
- "aria-label": (0, _i18n.sprintf)((0, _i18n.__)('Change URL: %s'), label),
59
- onClick: onClick
60
- }, label);
61
- }
62
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_element","require","_components","_i18n","_editor","PostURL","popoverAnchor","setPopoverAnchor","useState","popoverProps","useMemo","anchor","placement","_react","createElement","PostURLCheck","PanelRow","className","ref","__","Dropdown","contentClassName","focusOnMount","renderToggle","isOpen","onToggle","PostURLToggle","onClick","renderContent","onClose","label","usePostURLLabel","Button","variant","sprintf"],"sources":["@wordpress/edit-post/src/components/sidebar/post-url/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useState } from '@wordpress/element';\nimport { PanelRow, Dropdown, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tPostURLCheck,\n\tPostURL as PostURLForm,\n\tusePostURLLabel,\n} from '@wordpress/editor';\n\nexport default function PostURL() {\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<PostURLCheck>\n\t\t\t<PanelRow className=\"edit-post-post-url\" ref={ setPopoverAnchor }>\n\t\t\t\t<span>{ __( 'URL' ) }</span>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tclassName=\"edit-post-post-url__dropdown\"\n\t\t\t\t\tcontentClassName=\"edit-post-post-url__dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostURLToggle isOpen={ isOpen } onClick={ onToggle } />\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<PostURLForm onClose={ onClose } />\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PanelRow>\n\t\t</PostURLCheck>\n\t);\n}\n\nfunction PostURLToggle( { isOpen, onClick } ) {\n\tconst label = usePostURLLabel();\n\treturn (\n\t\t<Button\n\t\t\tclassName=\"edit-post-post-url__toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post URL.\n\t\t\taria-label={ sprintf( __( 'Change URL: %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,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAUe,SAASI,OAAOA,CAAA,EAAG;EACjC;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,YAAY,QACZ,IAAAF,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAc,QAAQ;IAACC,SAAS,EAAC,oBAAoB;IAACC,GAAG,EAAGX;EAAkB,GAChE,IAAAM,MAAA,CAAAC,aAAA,gBAAQ,IAAAK,QAAE,EAAE,KAAM,CAAS,CAAC,EAC5B,IAAAN,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAkB,QAAQ;IACRX,YAAY,EAAGA,YAAc;IAC7BQ,SAAS,EAAC,8BAA8B;IACxCI,gBAAgB,EAAC,4BAA4B;IAC7CC,YAAY;IACZC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,KACpC,IAAAZ,MAAA,CAAAC,aAAA,EAACY,aAAa;MAACF,MAAM,EAAGA,MAAQ;MAACG,OAAO,EAAGF;IAAU,CAAE,CACrD;IACHG,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,KAC5B,IAAAhB,MAAA,CAAAC,aAAA,EAACV,OAAA,CAAAC,OAAW;MAACwB,OAAO,EAAGA;IAAS,CAAE;EAChC,CACH,CACQ,CACG,CAAC;AAEjB;AAEA,SAASH,aAAaA,CAAE;EAAEF,MAAM;EAAEG;AAAQ,CAAC,EAAG;EAC7C,MAAMG,KAAK,GAAG,IAAAC,uBAAe,EAAC,CAAC;EAC/B,OACC,IAAAlB,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAA8B,MAAM;IACNf,SAAS,EAAC,4BAA4B;IACtCgB,OAAO,EAAC,UAAU;IAClB,iBAAgBT;IAChB;IAAA;IACA,cAAa,IAAAU,aAAO,EAAE,IAAAf,QAAE,EAAE,gBAAiB,CAAC,EAAEW,KAAM,CAAG;IACvDH,OAAO,EAAGA;EAAS,GAEjBG,KACK,CAAC;AAEX"}