@wordpress/edit-site 6.0.4 → 6.2.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 (135) hide show
  1. package/CHANGELOG.md +10 -6
  2. package/build/components/add-new-page/index.js +2 -0
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +1 -0
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/app/index.js +17 -1
  7. package/build/components/app/index.js.map +1 -1
  8. package/build/components/editor/index.js +12 -13
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/editor-canvas-container/index.js +18 -7
  11. package/build/components/editor-canvas-container/index.js.map +1 -1
  12. package/build/components/global-styles/font-families.js +17 -17
  13. package/build/components/global-styles/font-families.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/context.js +2 -2
  15. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  16. package/build/components/global-styles/variations/variation.js +25 -19
  17. package/build/components/global-styles/variations/variation.js.map +1 -1
  18. package/build/components/global-styles/variations/variations-color.js +1 -0
  19. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  20. package/build/components/global-styles/variations/variations-typography.js +1 -0
  21. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  22. package/build/components/layout/index.js +8 -37
  23. package/build/components/layout/index.js.map +1 -1
  24. package/build/components/page/header.js +1 -0
  25. package/build/components/page/header.js.map +1 -1
  26. package/build/components/page-patterns/header.js +2 -1
  27. package/build/components/page-patterns/header.js.map +1 -1
  28. package/build/components/page-patterns/rename-category-menu-item.js +3 -1
  29. package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
  30. package/build/components/posts-app/index.js +50 -0
  31. package/build/components/posts-app/index.js.map +1 -0
  32. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
  33. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  34. package/build/hooks/commands/use-set-command-context.js +64 -0
  35. package/build/hooks/commands/use-set-command-context.js.map +1 -0
  36. package/build/index.js +15 -2
  37. package/build/index.js.map +1 -1
  38. package/build/posts.js +34 -0
  39. package/build/posts.js.map +1 -0
  40. package/build-module/components/add-new-page/index.js +2 -0
  41. package/build-module/components/add-new-page/index.js.map +1 -1
  42. package/build-module/components/add-new-pattern/index.js +1 -0
  43. package/build-module/components/add-new-pattern/index.js.map +1 -1
  44. package/build-module/components/app/index.js +17 -1
  45. package/build-module/components/app/index.js.map +1 -1
  46. package/build-module/components/editor/index.js +13 -14
  47. package/build-module/components/editor/index.js.map +1 -1
  48. package/build-module/components/editor-canvas-container/index.js +19 -8
  49. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  50. package/build-module/components/global-styles/font-families.js +18 -18
  51. package/build-module/components/global-styles/font-families.js.map +1 -1
  52. package/build-module/components/global-styles/font-library-modal/context.js +2 -2
  53. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  54. package/build-module/components/global-styles/variations/variation.js +25 -19
  55. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  56. package/build-module/components/global-styles/variations/variations-color.js +1 -0
  57. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  58. package/build-module/components/global-styles/variations/variations-typography.js +1 -0
  59. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  60. package/build-module/components/layout/index.js +10 -39
  61. package/build-module/components/layout/index.js.map +1 -1
  62. package/build-module/components/page/header.js +1 -0
  63. package/build-module/components/page/header.js.map +1 -1
  64. package/build-module/components/page-patterns/header.js +2 -1
  65. package/build-module/components/page-patterns/header.js.map +1 -1
  66. package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
  67. package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
  68. package/build-module/components/posts-app/index.js +43 -0
  69. package/build-module/components/posts-app/index.js.map +1 -0
  70. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
  71. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  72. package/build-module/hooks/commands/use-set-command-context.js +57 -0
  73. package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
  74. package/build-module/index.js +8 -2
  75. package/build-module/index.js.map +1 -1
  76. package/build-module/posts.js +27 -0
  77. package/build-module/posts.js.map +1 -0
  78. package/build-style/posts-rtl.css +1707 -0
  79. package/build-style/posts.css +1707 -0
  80. package/build-style/style-rtl.css +18 -20
  81. package/build-style/style.css +18 -20
  82. package/lib/inflate.js +3188 -3937
  83. package/lib/lib-font.browser.js +32 -2
  84. package/lib/unbrotli.js +1818 -2458
  85. package/package.json +41 -41
  86. package/src/components/add-new-page/index.js +6 -1
  87. package/src/components/add-new-pattern/index.js +1 -0
  88. package/src/components/app/index.js +17 -1
  89. package/src/components/editor/index.js +13 -22
  90. package/src/components/editor-canvas-container/index.js +20 -8
  91. package/src/components/global-styles/font-families.js +28 -19
  92. package/src/components/global-styles/font-library-modal/context.js +2 -2
  93. package/src/components/global-styles/style.scss +3 -8
  94. package/src/components/global-styles/variations/variation.js +37 -22
  95. package/src/components/global-styles/variations/variations-color.js +1 -0
  96. package/src/components/global-styles/variations/variations-typography.js +1 -0
  97. package/src/components/global-styles-sidebar/style.scss +0 -1
  98. package/src/components/layout/index.js +24 -70
  99. package/src/components/page/header.js +1 -0
  100. package/src/components/page/style.scss +6 -0
  101. package/src/components/page-patterns/header.js +8 -2
  102. package/src/components/page-patterns/rename-category-menu-item.js +2 -0
  103. package/src/components/page-patterns/style.scss +6 -0
  104. package/src/components/posts-app/index.js +39 -0
  105. package/src/components/sidebar/style.scss +4 -4
  106. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +6 -1
  107. package/src/hooks/commands/use-set-command-context.js +49 -0
  108. package/src/index.js +10 -2
  109. package/src/posts.js +29 -0
  110. package/src/posts.scss +46 -0
  111. package/build/components/block-editor/block-inspector-button.js +0 -57
  112. package/build/components/block-editor/block-inspector-button.js.map +0 -1
  113. package/build/components/block-editor/inserter-media-categories.js +0 -183
  114. package/build/components/block-editor/inserter-media-categories.js.map +0 -1
  115. package/build/components/template-part-converter/convert-to-regular.js +0 -38
  116. package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
  117. package/build/components/template-part-converter/convert-to-template-part.js +0 -84
  118. package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
  119. package/build/components/template-part-converter/index.js +0 -67
  120. package/build/components/template-part-converter/index.js.map +0 -1
  121. package/build-module/components/block-editor/block-inspector-button.js +0 -50
  122. package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
  123. package/build-module/components/block-editor/inserter-media-categories.js +0 -177
  124. package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
  125. package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
  126. package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
  127. package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
  128. package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
  129. package/build-module/components/template-part-converter/index.js +0 -59
  130. package/build-module/components/template-part-converter/index.js.map +0 -1
  131. package/src/components/block-editor/block-inspector-button.js +0 -60
  132. package/src/components/block-editor/inserter-media-categories.js +0 -225
  133. package/src/components/template-part-converter/convert-to-regular.js +0 -32
  134. package/src/components/template-part-converter/convert-to-template-part.js +0 -78
  135. package/src/components/template-part-converter/index.js +0 -59
@@ -21,91 +21,60 @@ import {
21
21
  import { __ } from '@wordpress/i18n';
22
22
  import { useState, useRef, useEffect } from '@wordpress/element';
23
23
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
24
- import {
25
- CommandMenu,
26
- privateApis as commandsPrivateApis,
27
- } from '@wordpress/commands';
28
- import { store as preferencesStore } from '@wordpress/preferences';
29
- import {
30
- privateApis as blockEditorPrivateApis,
31
- store as blockEditorStore,
32
- } from '@wordpress/block-editor';
33
- import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
24
+ import { CommandMenu } from '@wordpress/commands';
25
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
34
26
  import {
35
27
  EditorSnackbars,
36
28
  privateApis as editorPrivateApis,
37
29
  } from '@wordpress/editor';
30
+ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
38
31
 
39
32
  /**
40
33
  * Internal dependencies
41
34
  */
42
35
  import ErrorBoundary from '../error-boundary';
43
36
  import { store as editSiteStore } from '../../store';
44
- import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
45
37
  import SiteHub from '../site-hub';
46
38
  import ResizableFrame from '../resizable-frame';
47
- import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
48
39
  import { unlock } from '../../lock-unlock';
49
40
  import SavePanel from '../save-panel';
50
41
  import KeyboardShortcutsRegister from '../keyboard-shortcuts/register';
51
42
  import KeyboardShortcutsGlobal from '../keyboard-shortcuts/global';
52
- import { useCommonCommands } from '../../hooks/commands/use-common-commands';
53
- import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
54
43
  import { useIsSiteEditorLoading } from './hooks';
55
- import useLayoutAreas from './router';
56
44
  import useMovingAnimation from './animation';
57
45
  import SidebarContent from '../sidebar';
58
46
  import SaveHub from '../save-hub';
47
+ import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
59
48
 
60
49
  const { useCommands } = unlock( coreCommandsPrivateApis );
61
- const { useCommandContext } = unlock( commandsPrivateApis );
62
50
  const { useGlobalStyle } = unlock( blockEditorPrivateApis );
63
51
  const { NavigableRegion } = unlock( editorPrivateApis );
64
52
 
65
53
  const ANIMATION_DURATION = 0.3;
66
54
 
67
- export default function Layout() {
68
- // This ensures the edited entity id and type are initialized properly.
69
- useInitEditedEntityFromURL();
55
+ export default function Layout( { route } ) {
70
56
  useSyncCanvasModeWithURL();
71
57
  useCommands();
72
- useEditModeCommands();
73
- useCommonCommands();
74
-
75
58
  const isMobileViewport = useViewportMatch( 'medium', '<' );
76
59
  const toggleRef = useRef();
77
- const {
78
- isDistractionFree,
79
- hasFixedToolbar,
80
- hasBlockSelected,
81
- canvasMode,
82
- previousShortcut,
83
- nextShortcut,
84
- } = useSelect( ( select ) => {
85
- const { getAllShortcutKeyCombinations } = select(
86
- keyboardShortcutsStore
87
- );
88
- const { getCanvasMode } = unlock( select( editSiteStore ) );
89
- return {
90
- canvasMode: getCanvasMode(),
91
- previousShortcut: getAllShortcutKeyCombinations(
92
- 'core/editor/previous-region'
93
- ),
94
- nextShortcut: getAllShortcutKeyCombinations(
95
- 'core/editor/next-region'
96
- ),
97
- hasFixedToolbar: select( preferencesStore ).get(
98
- 'core',
99
- 'fixedToolbar'
100
- ),
101
- isDistractionFree: select( preferencesStore ).get(
102
- 'core',
103
- 'distractionFree'
104
- ),
105
- hasBlockSelected:
106
- select( blockEditorStore ).getBlockSelectionStart(),
107
- };
108
- }, [] );
60
+ const { canvasMode, previousShortcut, nextShortcut } = useSelect(
61
+ ( select ) => {
62
+ const { getAllShortcutKeyCombinations } = select(
63
+ keyboardShortcutsStore
64
+ );
65
+ const { getCanvasMode } = unlock( select( editSiteStore ) );
66
+ return {
67
+ canvasMode: getCanvasMode(),
68
+ previousShortcut: getAllShortcutKeyCombinations(
69
+ 'core/editor/previous-region'
70
+ ),
71
+ nextShortcut: getAllShortcutKeyCombinations(
72
+ 'core/editor/next-region'
73
+ ),
74
+ };
75
+ },
76
+ []
77
+ );
109
78
  const navigateRegionsProps = useNavigateRegions( {
110
79
  previous: previousShortcut,
111
80
  next: nextShortcut,
@@ -116,22 +85,11 @@ export default function Layout() {
116
85
  const isEditorLoading = useIsSiteEditorLoading();
117
86
  const [ isResizableFrameOversized, setIsResizableFrameOversized ] =
118
87
  useState( false );
119
- const { key: routeKey, areas, widths } = useLayoutAreas();
88
+ const { key: routeKey, areas, widths } = route;
120
89
  const animationRef = useMovingAnimation( {
121
90
  triggerAnimationOnChange: canvasMode + '__' + routeKey,
122
91
  } );
123
92
 
124
- // Sets the right context for the command palette
125
- let commandContext = 'site-editor';
126
-
127
- if ( canvasMode === 'edit' ) {
128
- commandContext = 'entity-edit';
129
- }
130
- if ( hasBlockSelected ) {
131
- commandContext = 'block-selection-edit';
132
- }
133
- useCommandContext( commandContext );
134
-
135
93
  const [ backgroundColor ] = useGlobalStyle( 'color.background' );
136
94
  const [ gradientValue ] = useGlobalStyle( 'color.gradient' );
137
95
  const previousCanvaMode = usePrevious( canvasMode );
@@ -163,11 +121,7 @@ export default function Layout() {
163
121
  'edit-site-layout',
164
122
  navigateRegionsProps.className,
165
123
  {
166
- 'is-distraction-free':
167
- isDistractionFree && canvasMode === 'edit',
168
124
  'is-full-canvas': canvasMode === 'edit',
169
- 'has-fixed-toolbar': hasFixedToolbar,
170
- 'is-block-toolbar-visible': hasBlockSelected,
171
125
  }
172
126
  ) }
173
127
  >
@@ -22,6 +22,7 @@ export default function Header( { title, subTitle, actions } ) {
22
22
  level={ 3 }
23
23
  weight={ 500 }
24
24
  className="edit-site-page-header__title"
25
+ truncate
25
26
  >
26
27
  { title }
27
28
  </Heading>
@@ -24,6 +24,12 @@
24
24
 
25
25
  .edit-site-page-header__page-title {
26
26
  min-height: $grid-unit-50;
27
+
28
+ .components-heading {
29
+ flex-grow: 1;
30
+ flex-basis: 0;
31
+ white-space: nowrap;
32
+ }
27
33
  }
28
34
 
29
35
  .edit-site-page-header__sub-title {
@@ -58,12 +58,18 @@ export default function PatternsHeader( {
58
58
  }
59
59
 
60
60
  return (
61
- <VStack className="edit-site-patterns__section-header" spacing={ 0 }>
61
+ <VStack className="edit-site-patterns__section-header" spacing={ 1 }>
62
62
  <HStack
63
63
  justify="space-between"
64
64
  className="edit-site-patterns__title"
65
65
  >
66
- <Heading as="h2" level={ 3 } id={ titleId } weight={ 500 }>
66
+ <Heading
67
+ as="h2"
68
+ level={ 3 }
69
+ id={ titleId }
70
+ weight={ 500 }
71
+ truncate
72
+ >
67
73
  { title }
68
74
  </Heading>
69
75
  <HStack expanded={ false }>
@@ -57,6 +57,8 @@ function RenameModal( { category, onClose } ) {
57
57
  existingCategories={ existingCategories }
58
58
  onClose={ onClose }
59
59
  overlayClassName="edit-site-list__rename-modal"
60
+ focusOnMount="firstContentElement"
61
+ size="small"
60
62
  />
61
63
  );
62
64
  }
@@ -98,6 +98,12 @@
98
98
 
99
99
  .edit-site-patterns__title {
100
100
  min-height: $grid-unit-50;
101
+
102
+ .components-heading {
103
+ flex-grow: 1;
104
+ flex-basis: 0;
105
+ white-space: nowrap;
106
+ }
101
107
  }
102
108
 
103
109
  .edit-site-patterns__sub-title {
@@ -0,0 +1,39 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ UnsavedChangesWarning,
6
+ privateApis as editorPrivateApis,
7
+ } from '@wordpress/editor';
8
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import Layout from '../layout';
14
+ import Page from '../page';
15
+ import { unlock } from '../../lock-unlock';
16
+
17
+ const { RouterProvider } = unlock( routerPrivateApis );
18
+ const { GlobalStylesProvider } = unlock( editorPrivateApis );
19
+
20
+ const defaultRoute = {
21
+ key: 'index',
22
+ areas: {
23
+ sidebar: 'Empty Sidebar',
24
+ content: <Page>Welcome to Posts</Page>,
25
+ preview: undefined,
26
+ mobile: <Page>Welcome to Posts</Page>,
27
+ },
28
+ };
29
+
30
+ export default function PostsApp() {
31
+ return (
32
+ <GlobalStylesProvider>
33
+ <UnsavedChangesWarning />
34
+ <RouterProvider>
35
+ <Layout route={ defaultRoute } />
36
+ </RouterProvider>
37
+ </GlobalStylesProvider>
38
+ );
39
+ }
@@ -3,7 +3,7 @@
3
3
  overflow-y: auto;
4
4
  }
5
5
 
6
- @keyframes slide-from-right {
6
+ @keyframes local--slide-from-right {
7
7
  from {
8
8
  transform: translateX(50px);
9
9
  opacity: 0;
@@ -14,7 +14,7 @@
14
14
  }
15
15
  }
16
16
 
17
- @keyframes slide-from-left {
17
+ @keyframes local--slide-from-left {
18
18
  from {
19
19
  transform: translateX(-50px);
20
20
  opacity: 0;
@@ -47,11 +47,11 @@
47
47
  }
48
48
 
49
49
  &.slide-from-left {
50
- animation-name: slide-from-left;
50
+ animation-name: local--slide-from-left;
51
51
  }
52
52
 
53
53
  &.slide-from-right {
54
- animation-name: slide-from-right;
54
+ animation-name: local--slide-from-right;
55
55
  }
56
56
 
57
57
  }
@@ -22,7 +22,12 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
22
22
  titleHasChanged && notEmptyString( editedMenuTitle );
23
23
 
24
24
  return (
25
- <Modal title={ __( 'Rename' ) } onRequestClose={ onClose }>
25
+ <Modal
26
+ title={ __( 'Rename' ) }
27
+ onRequestClose={ onClose }
28
+ focusOnMount="firstContentElement"
29
+ size="small"
30
+ >
26
31
  <form className="sidebar-navigation__rename-modal-form">
27
32
  <VStack spacing="3">
28
33
  <TextControl
@@ -0,0 +1,49 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { privateApis as commandsPrivateApis } from '@wordpress/commands';
6
+ import { store as blockEditorStore } from '@wordpress/block-editor';
7
+
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ import { store as editSiteStore } from '../../store';
12
+ import { unlock } from '../../lock-unlock';
13
+ import { useHasEditorCanvasContainer } from '../../components/editor-canvas-container';
14
+
15
+ const { useCommandContext } = unlock( commandsPrivateApis );
16
+
17
+ /**
18
+ * React hook used to set the correct command context based on the current state.
19
+ */
20
+ export default function useSetCommandContext() {
21
+ const { hasBlockSelected, canvasMode } = useSelect( ( select ) => {
22
+ const { getCanvasMode } = unlock( select( editSiteStore ) );
23
+ const { getBlockSelectionStart } = select( blockEditorStore );
24
+ return {
25
+ canvasMode: getCanvasMode(),
26
+ hasBlockSelected: getBlockSelectionStart(),
27
+ };
28
+ }, [] );
29
+
30
+ const hasEditorCanvasContainer = useHasEditorCanvasContainer();
31
+
32
+ // Sets the right context for the command palette
33
+ let commandContext = 'site-editor';
34
+ if ( canvasMode === 'edit' ) {
35
+ commandContext = 'entity-edit';
36
+ }
37
+ if ( hasBlockSelected ) {
38
+ commandContext = 'block-selection-edit';
39
+ }
40
+ if ( hasEditorCanvasContainer ) {
41
+ /*
42
+ * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context
43
+ * to remove the suggested commands that may not make sense with Style Book or Style Revisions open.
44
+ * See https://github.com/WordPress/gutenberg/issues/62216.
45
+ */
46
+ commandContext = '';
47
+ }
48
+ useCommandContext( commandContext );
49
+ }
package/src/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  } from '@wordpress/block-library';
10
10
  import { dispatch } from '@wordpress/data';
11
11
  import deprecated from '@wordpress/deprecated';
12
- import { createRoot } from '@wordpress/element';
12
+ import { createRoot, StrictMode } from '@wordpress/element';
13
13
  import { store as editorStore } from '@wordpress/editor';
14
14
  import { store as preferencesStore } from '@wordpress/preferences';
15
15
  import {
@@ -85,7 +85,11 @@ export function initializeEditor( id, settings ) {
85
85
  window.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );
86
86
  window.addEventListener( 'drop', ( e ) => e.preventDefault(), false );
87
87
 
88
- root.render( <App /> );
88
+ root.render(
89
+ <StrictMode>
90
+ <App />
91
+ </StrictMode>
92
+ );
89
93
 
90
94
  return root;
91
95
  }
@@ -100,3 +104,7 @@ export function reinitializeEditor() {
100
104
  export { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';
101
105
  export { store } from './store';
102
106
  export * from './deprecated';
107
+
108
+ // Temporary: While the posts dashboard is being iterated on
109
+ // it's being built in the same package as the site editor.
110
+ export { initializePostsDashboard } from './posts';
package/src/posts.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createRoot, StrictMode } from '@wordpress/element';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import PostsApp from './components/posts-app';
10
+
11
+ /**
12
+ * Initializes the "Posts Dashboard"
13
+ * @param {string} id DOM element id.
14
+ */
15
+ export function initializePostsDashboard( id ) {
16
+ if ( ! globalThis.IS_GUTENBERG_PLUGIN ) {
17
+ return;
18
+ }
19
+ const target = document.getElementById( id );
20
+ const root = createRoot( target );
21
+
22
+ root.render(
23
+ <StrictMode>
24
+ <PostsApp />
25
+ </StrictMode>
26
+ );
27
+
28
+ return root;
29
+ }
package/src/posts.scss ADDED
@@ -0,0 +1,46 @@
1
+ @import "../../dataviews/src/style.scss";
2
+ @import "./components/layout/style.scss";
3
+ @import "./components/page/style.scss";
4
+ @import "./components/save-hub/style.scss";
5
+ @import "./components/save-panel/style.scss";
6
+ @import "./components/sidebar/style.scss";
7
+ @import "./components/site-hub/style.scss";
8
+ @import "./components/site-icon/style.scss";
9
+ @import "./components/editor-canvas-container/style.scss";
10
+ @import "./components/resizable-frame/style.scss";
11
+
12
+ @include wordpress-admin-schemes();
13
+
14
+ #wpadminbar,
15
+ #adminmenumain {
16
+ display: none;
17
+ }
18
+ #wpcontent {
19
+ margin-left: 0;
20
+ }
21
+ body.js #wpbody {
22
+ padding-top: 0;
23
+ }
24
+ body {
25
+ @include wp-admin-reset("#gutenberg-posts-dashboard");
26
+ }
27
+ #gutenberg-posts-dashboard {
28
+ @include reset;
29
+ height: 100vh;
30
+
31
+ // On mobile the main content area has to scroll, otherwise you can invoke
32
+ // the over-scroll bounce on the non-scrolling container, for a bad experience.
33
+ @include break-small {
34
+ bottom: 0;
35
+ left: 0;
36
+ min-height: 100vh;
37
+ position: fixed;
38
+ right: 0;
39
+ top: 0;
40
+ }
41
+
42
+ .no-js & {
43
+ min-height: 0;
44
+ position: static;
45
+ }
46
+ }
@@ -1,57 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = BlockInspectorButton;
7
- var _i18n = require("@wordpress/i18n");
8
- var _a11y = require("@wordpress/a11y");
9
- var _components = require("@wordpress/components");
10
- var _data = require("@wordpress/data");
11
- var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
12
- var _editor = require("@wordpress/editor");
13
- var _lockUnlock = require("../../lock-unlock");
14
- var _jsxRuntime = require("react/jsx-runtime");
15
- /**
16
- * WordPress dependencies
17
- */
18
-
19
- /**
20
- * Internal dependencies
21
- */
22
-
23
- const {
24
- interfaceStore
25
- } = (0, _lockUnlock.unlock)(_editor.privateApis);
26
- function BlockInspectorButton({
27
- onClick = () => {}
28
- }) {
29
- const {
30
- shortcut,
31
- isBlockInspectorOpen
32
- } = (0, _data.useSelect)(select => ({
33
- shortcut: select(_keyboardShortcuts.store).getShortcutRepresentation('core/editor/toggle-sidebar'),
34
- isBlockInspectorOpen: select(interfaceStore).getActiveComplementaryArea('core') === 'edit-post/block'
35
- }), []);
36
- const {
37
- enableComplementaryArea,
38
- disableComplementaryArea
39
- } = (0, _data.useDispatch)(interfaceStore);
40
- const label = isBlockInspectorOpen ? (0, _i18n.__)('Hide more settings') : (0, _i18n.__)('Show more settings');
41
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
42
- onClick: () => {
43
- if (isBlockInspectorOpen) {
44
- disableComplementaryArea('core');
45
- (0, _a11y.speak)((0, _i18n.__)('Block settings closed'));
46
- } else {
47
- enableComplementaryArea('core', 'edit-post/block');
48
- (0, _a11y.speak)((0, _i18n.__)('Additional settings are now available in the Editor block settings sidebar'));
49
- }
50
- // Close dropdown menu.
51
- onClick();
52
- },
53
- shortcut: shortcut,
54
- children: label
55
- });
56
- }
57
- //# sourceMappingURL=block-inspector-button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_i18n","require","_a11y","_components","_data","_keyboardShortcuts","_editor","_lockUnlock","_jsxRuntime","interfaceStore","unlock","editorPrivateApis","BlockInspectorButton","onClick","shortcut","isBlockInspectorOpen","useSelect","select","keyboardShortcutsStore","getShortcutRepresentation","getActiveComplementaryArea","enableComplementaryArea","disableComplementaryArea","useDispatch","label","__","jsx","MenuItem","speak","children"],"sources":["@wordpress/edit-site/src/components/block-editor/block-inspector-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\nexport default function BlockInspectorButton( { onClick = () => {} } ) {\n\tconst { shortcut, isBlockInspectorOpen } = useSelect(\n\t\t( select ) => ( {\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' ),\n\t\t\tisBlockInspectorOpen:\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\t'core'\n\t\t\t\t) === 'edit-post/block',\n\t\t} ),\n\t\t[]\n\t);\n\tconst { enableComplementaryArea, disableComplementaryArea } =\n\t\tuseDispatch( interfaceStore );\n\n\tconst label = isBlockInspectorOpen\n\t\t? __( 'Hide more settings' )\n\t\t: __( 'Show more settings' );\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tif ( isBlockInspectorOpen ) {\n\t\t\t\t\tdisableComplementaryArea( 'core' );\n\t\t\t\t\tspeak( __( 'Block settings closed' ) );\n\t\t\t\t} else {\n\t\t\t\t\tenableComplementaryArea( 'core', 'edit-post/block' );\n\t\t\t\t\tspeak(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Additional settings are now available in the Editor block settings sidebar'\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// Close dropdown menu.\n\t\t\t\tonClick();\n\t\t\t} }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAb3C;AACA;AACA;;AAQA;AACA;AACA;;AAGA,MAAM;EAAEQ;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEvC,SAASC,oBAAoBA,CAAE;EAAEC,OAAO,GAAGA,CAAA,KAAM,CAAC;AAAE,CAAC,EAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC;EAAqB,CAAC,GAAG,IAAAC,eAAS,EACjDC,MAAM,KAAQ;IACfH,QAAQ,EAAEG,MAAM,CACfC,wBACD,CAAC,CAACC,yBAAyB,CAAE,4BAA6B,CAAC;IAC3DJ,oBAAoB,EACnBE,MAAM,CAAER,cAAe,CAAC,CAACW,0BAA0B,CAClD,MACD,CAAC,KAAK;EACR,CAAC,CAAE,EACH,EACD,CAAC;EACD,MAAM;IAAEC,uBAAuB;IAAEC;EAAyB,CAAC,GAC1D,IAAAC,iBAAW,EAAEd,cAAe,CAAC;EAE9B,MAAMe,KAAK,GAAGT,oBAAoB,GAC/B,IAAAU,QAAE,EAAE,oBAAqB,CAAC,GAC1B,IAAAA,QAAE,EAAE,oBAAqB,CAAC;EAE7B,oBACC,IAAAjB,WAAA,CAAAkB,GAAA,EAACvB,WAAA,CAAAwB,QAAQ;IACRd,OAAO,EAAGA,CAAA,KAAM;MACf,IAAKE,oBAAoB,EAAG;QAC3BO,wBAAwB,CAAE,MAAO,CAAC;QAClC,IAAAM,WAAK,EAAE,IAAAH,QAAE,EAAE,uBAAwB,CAAE,CAAC;MACvC,CAAC,MAAM;QACNJ,uBAAuB,CAAE,MAAM,EAAE,iBAAkB,CAAC;QACpD,IAAAO,WAAK,EACJ,IAAAH,QAAE,EACD,4EACD,CACD,CAAC;MACF;MACA;MACAZ,OAAO,CAAC,CAAC;IACV,CAAG;IACHC,QAAQ,EAAGA,QAAU;IAAAe,QAAA,EAEnBL;EAAK,CACE,CAAC;AAEb","ignoreList":[]}