@wordpress/edit-site 5.12.10 → 5.12.12
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.
- package/build/components/global-styles/screen-revisions/index.js +8 -2
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +31 -25
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/layout/index.js +14 -3
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +2 -1
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -1
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-template-parts/index.js +1 -2
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +14 -23
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +2 -7
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +15 -13
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +8 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +2 -0
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +0 -9
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +1 -10
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +16 -7
- package/build/components/site-hub/index.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +78 -20
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +30 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/store/private-actions.js +2 -1
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +9 -3
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +10 -22
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +27 -21
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +7 -5
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/layout/index.js +14 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +3 -2
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -1
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-template-parts/index.js +1 -2
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +15 -24
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +2 -7
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +13 -13
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +7 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +0 -7
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +1 -8
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +16 -7
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +74 -20
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +29 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/store/private-actions.js +2 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +12 -11
- package/build-style/style.css +12 -11
- package/package.json +20 -20
- package/src/components/global-styles/screen-revisions/index.js +76 -58
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +17 -31
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +14 -1
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +63 -48
- package/src/components/keyboard-shortcuts/edit-mode.js +4 -5
- package/src/components/layout/index.js +22 -2
- package/src/components/layout/style.scss +1 -1
- package/src/components/page-patterns/patterns-list.js +5 -2
- package/src/components/page-patterns/style.scss +3 -0
- package/src/components/page-patterns/use-patterns.js +1 -0
- package/src/components/page-template-parts/index.js +0 -1
- package/src/components/resizable-frame/index.js +12 -28
- package/src/components/resizable-frame/style.scss +0 -17
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +1 -4
- package/src/components/sidebar-navigation-screen/index.js +13 -15
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +27 -15
- package/src/components/sidebar-navigation-screen-pages/index.js +9 -4
- package/src/components/sidebar-navigation-screen-patterns/index.js +0 -8
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +1 -9
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -0
- package/src/components/site-hub/index.js +21 -7
- package/src/components/site-hub/style.scss +9 -2
- package/src/hooks/commands/use-common-commands.js +56 -23
- package/src/hooks/commands/use-edit-mode-commands.js +34 -3
- package/src/store/private-actions.js +5 -1
|
@@ -21,34 +21,40 @@ const EMPTY_ARRAY = [];
|
|
|
21
21
|
const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
|
|
22
22
|
export default function useGlobalStylesRevisions() {
|
|
23
23
|
const { user: userConfig } = useContext( GlobalStylesContext );
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
24
|
+
const {
|
|
25
|
+
authors,
|
|
26
|
+
currentUser,
|
|
27
|
+
isDirty,
|
|
28
|
+
revisions,
|
|
29
|
+
isLoadingGlobalStylesRevisions,
|
|
30
|
+
} = useSelect( ( select ) => {
|
|
31
|
+
const {
|
|
32
|
+
__experimentalGetDirtyEntityRecords,
|
|
33
|
+
getCurrentUser,
|
|
34
|
+
getUsers,
|
|
35
|
+
getCurrentThemeGlobalStylesRevisions,
|
|
36
|
+
isResolving,
|
|
37
|
+
} = select( coreStore );
|
|
38
|
+
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
39
|
+
const _currentUser = getCurrentUser();
|
|
40
|
+
const _isDirty = dirtyEntityRecords.length > 0;
|
|
41
|
+
const globalStylesRevisions =
|
|
42
|
+
getCurrentThemeGlobalStylesRevisions() || EMPTY_ARRAY;
|
|
43
|
+
const _authors = getUsers( SITE_EDITOR_AUTHORS_QUERY ) || EMPTY_ARRAY;
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
return {
|
|
46
|
+
authors: _authors,
|
|
47
|
+
currentUser: _currentUser,
|
|
48
|
+
isDirty: _isDirty,
|
|
49
|
+
revisions: globalStylesRevisions,
|
|
50
|
+
isLoadingGlobalStylesRevisions: isResolving(
|
|
51
|
+
'getCurrentThemeGlobalStylesRevisions'
|
|
52
|
+
),
|
|
53
|
+
};
|
|
54
|
+
}, [] );
|
|
49
55
|
return useMemo( () => {
|
|
50
56
|
let _modifiedRevisions = [];
|
|
51
|
-
if ( ! authors.length ||
|
|
57
|
+
if ( ! authors.length || isLoadingGlobalStylesRevisions ) {
|
|
52
58
|
return {
|
|
53
59
|
revisions: _modifiedRevisions,
|
|
54
60
|
hasUnsavedChanges: isDirty,
|
|
@@ -66,30 +72,32 @@ export default function useGlobalStylesRevisions() {
|
|
|
66
72
|
};
|
|
67
73
|
} );
|
|
68
74
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
_modifiedRevisions[ 0 ].
|
|
72
|
-
|
|
75
|
+
if ( _modifiedRevisions.length ) {
|
|
76
|
+
// Flags the most current saved revision.
|
|
77
|
+
if ( _modifiedRevisions[ 0 ].id !== 'unsaved' ) {
|
|
78
|
+
_modifiedRevisions[ 0 ].isLatest = true;
|
|
79
|
+
}
|
|
73
80
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
// Adds an item for unsaved changes.
|
|
82
|
+
if (
|
|
83
|
+
isDirty &&
|
|
84
|
+
userConfig &&
|
|
85
|
+
Object.keys( userConfig ).length > 0 &&
|
|
86
|
+
currentUser
|
|
87
|
+
) {
|
|
88
|
+
const unsavedRevision = {
|
|
89
|
+
id: 'unsaved',
|
|
90
|
+
styles: userConfig?.styles,
|
|
91
|
+
settings: userConfig?.settings,
|
|
92
|
+
author: {
|
|
93
|
+
name: currentUser?.name,
|
|
94
|
+
avatar_urls: currentUser?.avatar_urls,
|
|
95
|
+
},
|
|
96
|
+
modified: new Date(),
|
|
97
|
+
};
|
|
91
98
|
|
|
92
|
-
|
|
99
|
+
_modifiedRevisions.unshift( unsavedRevision );
|
|
100
|
+
}
|
|
93
101
|
}
|
|
94
102
|
|
|
95
103
|
return {
|
|
@@ -97,5 +105,12 @@ export default function useGlobalStylesRevisions() {
|
|
|
97
105
|
hasUnsavedChanges: isDirty,
|
|
98
106
|
isLoading: false,
|
|
99
107
|
};
|
|
100
|
-
}, [
|
|
108
|
+
}, [
|
|
109
|
+
isDirty,
|
|
110
|
+
revisions,
|
|
111
|
+
currentUser,
|
|
112
|
+
authors,
|
|
113
|
+
userConfig,
|
|
114
|
+
isLoadingGlobalStylesRevisions,
|
|
115
|
+
] );
|
|
101
116
|
}
|
|
@@ -33,10 +33,8 @@ function KeyboardShortcutsEditMode() {
|
|
|
33
33
|
);
|
|
34
34
|
const { redo, undo } = useDispatch( coreStore );
|
|
35
35
|
const {
|
|
36
|
-
isFeatureActive,
|
|
37
36
|
setIsListViewOpened,
|
|
38
37
|
switchEditorMode,
|
|
39
|
-
toggleFeature,
|
|
40
38
|
setIsInserterOpened,
|
|
41
39
|
closeGeneralSidebar,
|
|
42
40
|
} = useDispatch( editSiteStore );
|
|
@@ -47,7 +45,8 @@ function KeyboardShortcutsEditMode() {
|
|
|
47
45
|
const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
|
|
48
46
|
useSelect( blockEditorStore );
|
|
49
47
|
|
|
50
|
-
const {
|
|
48
|
+
const { get: getPreference } = useSelect( preferencesStore );
|
|
49
|
+
const { set: setPreference, toggle } = useDispatch( preferencesStore );
|
|
51
50
|
const { createInfoNotice } = useDispatch( noticesStore );
|
|
52
51
|
|
|
53
52
|
const toggleDistractionFree = () => {
|
|
@@ -135,9 +134,9 @@ function KeyboardShortcutsEditMode() {
|
|
|
135
134
|
|
|
136
135
|
useShortcut( 'core/edit-site/toggle-distraction-free', () => {
|
|
137
136
|
toggleDistractionFree();
|
|
138
|
-
|
|
137
|
+
toggle( 'core/edit-site', 'distractionFree' );
|
|
139
138
|
createInfoNotice(
|
|
140
|
-
|
|
139
|
+
getPreference( 'core/edit-site', 'distractionFree' )
|
|
141
140
|
? __( 'Distraction free mode turned on.' )
|
|
142
141
|
: __( 'Distraction free mode turned off.' ),
|
|
143
142
|
{
|
|
@@ -121,6 +121,8 @@ export default function Layout() {
|
|
|
121
121
|
const [ fullResizer ] = useResizeObserver();
|
|
122
122
|
const [ isResizing ] = useState( false );
|
|
123
123
|
const isEditorLoading = useIsSiteEditorLoading();
|
|
124
|
+
const [ isResizableFrameOversized, setIsResizableFrameOversized ] =
|
|
125
|
+
useState( false );
|
|
124
126
|
|
|
125
127
|
// This determines which animation variant should apply to the header.
|
|
126
128
|
// There is also a `isDistractionFreeHovering` state that gets priority
|
|
@@ -218,6 +220,7 @@ export default function Layout() {
|
|
|
218
220
|
edit: { x: 0 },
|
|
219
221
|
} }
|
|
220
222
|
ref={ hubRef }
|
|
223
|
+
isTransparent={ isResizableFrameOversized }
|
|
221
224
|
className="edit-site-layout__hub"
|
|
222
225
|
/>
|
|
223
226
|
|
|
@@ -315,7 +318,13 @@ export default function Layout() {
|
|
|
315
318
|
}
|
|
316
319
|
initial={ false }
|
|
317
320
|
layout="position"
|
|
318
|
-
className=
|
|
321
|
+
className={ classnames(
|
|
322
|
+
'edit-site-layout__canvas',
|
|
323
|
+
{
|
|
324
|
+
'is-right-aligned':
|
|
325
|
+
isResizableFrameOversized,
|
|
326
|
+
}
|
|
327
|
+
) }
|
|
319
328
|
transition={ {
|
|
320
329
|
type: 'tween',
|
|
321
330
|
duration:
|
|
@@ -331,7 +340,18 @@ export default function Layout() {
|
|
|
331
340
|
! isEditorLoading
|
|
332
341
|
}
|
|
333
342
|
isFullWidth={ isEditing }
|
|
334
|
-
|
|
343
|
+
defaultSize={ {
|
|
344
|
+
width:
|
|
345
|
+
canvasSize.width -
|
|
346
|
+
24 /* $canvas-padding */,
|
|
347
|
+
height: canvasSize.height,
|
|
348
|
+
} }
|
|
349
|
+
isOversized={
|
|
350
|
+
isResizableFrameOversized
|
|
351
|
+
}
|
|
352
|
+
setIsOversized={
|
|
353
|
+
setIsResizableFrameOversized
|
|
354
|
+
}
|
|
335
355
|
innerContentStyle={ {
|
|
336
356
|
background:
|
|
337
357
|
gradientValue ??
|
|
@@ -27,7 +27,7 @@ import usePatterns from './use-patterns';
|
|
|
27
27
|
import SidebarButton from '../sidebar-button';
|
|
28
28
|
import useDebouncedInput from '../../utils/use-debounced-input';
|
|
29
29
|
import { unlock } from '../../lock-unlock';
|
|
30
|
-
import { SYNC_TYPES, USER_PATTERN_CATEGORY } from './utils';
|
|
30
|
+
import { SYNC_TYPES, USER_PATTERN_CATEGORY, PATTERNS } from './utils';
|
|
31
31
|
|
|
32
32
|
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
33
33
|
|
|
@@ -58,9 +58,12 @@ export default function PatternsList( { categoryId, type } ) {
|
|
|
58
58
|
const [ syncFilter, setSyncFilter ] = useState( 'all' );
|
|
59
59
|
const deferredSyncedFilter = useDeferredValue( syncFilter );
|
|
60
60
|
|
|
61
|
+
const isUncategorizedThemePatterns =
|
|
62
|
+
type === PATTERNS && categoryId === 'uncategorized';
|
|
63
|
+
|
|
61
64
|
const { patterns, isResolving } = usePatterns(
|
|
62
65
|
type,
|
|
63
|
-
|
|
66
|
+
isUncategorizedThemePatterns ? '' : categoryId,
|
|
64
67
|
{
|
|
65
68
|
search: deferredFilterValue,
|
|
66
69
|
syncStatus:
|
|
@@ -86,6 +86,7 @@ const selectThemePatterns = ( select, { categoryId, search = '' } = {} ) => {
|
|
|
86
86
|
( pattern ) => ! CORE_PATTERN_SOURCES.includes( pattern.source )
|
|
87
87
|
)
|
|
88
88
|
.filter( filterOutDuplicatesByName )
|
|
89
|
+
.filter( ( pattern ) => pattern.inserter !== false )
|
|
89
90
|
.map( ( pattern ) => ( {
|
|
90
91
|
...pattern,
|
|
91
92
|
keywords: pattern.keywords || [],
|
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useState, useRef
|
|
9
|
+
import { useState, useRef } from '@wordpress/element';
|
|
10
10
|
import {
|
|
11
11
|
ResizableBox,
|
|
12
12
|
Tooltip,
|
|
@@ -78,9 +78,12 @@ function calculateNewHeight( width, initialAspectRatio ) {
|
|
|
78
78
|
|
|
79
79
|
function ResizableFrame( {
|
|
80
80
|
isFullWidth,
|
|
81
|
+
isOversized,
|
|
82
|
+
setIsOversized,
|
|
81
83
|
isReady,
|
|
82
84
|
children,
|
|
83
|
-
|
|
85
|
+
/** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */
|
|
86
|
+
defaultSize,
|
|
84
87
|
innerContentStyle,
|
|
85
88
|
} ) {
|
|
86
89
|
const [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );
|
|
@@ -88,29 +91,19 @@ function ResizableFrame( {
|
|
|
88
91
|
const [ startingWidth, setStartingWidth ] = useState();
|
|
89
92
|
const [ isResizing, setIsResizing ] = useState( false );
|
|
90
93
|
const [ shouldShowHandle, setShouldShowHandle ] = useState( false );
|
|
91
|
-
const [ isOversized, setIsOversized ] = useState( false );
|
|
92
94
|
const [ resizeRatio, setResizeRatio ] = useState( 1 );
|
|
93
95
|
const canvasMode = useSelect(
|
|
94
96
|
( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),
|
|
95
97
|
[]
|
|
96
98
|
);
|
|
97
99
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
98
|
-
const initialAspectRatioRef = useRef( null );
|
|
99
|
-
// The width of the resizable frame on initial render.
|
|
100
|
-
const initialComputedWidthRef = useRef( null );
|
|
101
100
|
const FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };
|
|
102
101
|
const frameRef = useRef( null );
|
|
103
102
|
const resizableHandleHelpId = useInstanceId(
|
|
104
103
|
ResizableFrame,
|
|
105
104
|
'edit-site-resizable-frame-handle-help'
|
|
106
105
|
);
|
|
107
|
-
|
|
108
|
-
// Remember frame dimensions on initial render.
|
|
109
|
-
useEffect( () => {
|
|
110
|
-
const { offsetWidth, offsetHeight } = frameRef.current.resizable;
|
|
111
|
-
initialComputedWidthRef.current = offsetWidth;
|
|
112
|
-
initialAspectRatioRef.current = offsetWidth / offsetHeight;
|
|
113
|
-
}, [] );
|
|
106
|
+
const defaultAspectRatio = defaultSize.width / defaultSize.height;
|
|
114
107
|
|
|
115
108
|
const handleResizeStart = ( _event, _direction, ref ) => {
|
|
116
109
|
// Remember the starting width so we don't have to get `ref.offsetWidth` on
|
|
@@ -126,7 +119,7 @@ function ResizableFrame( {
|
|
|
126
119
|
const maxDoubledDelta =
|
|
127
120
|
delta.width < 0 // is shrinking
|
|
128
121
|
? deltaAbs
|
|
129
|
-
: (
|
|
122
|
+
: ( defaultSize.width - startingWidth ) / 2;
|
|
130
123
|
const deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );
|
|
131
124
|
const doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;
|
|
132
125
|
const singleSegment = 1 - doubleSegment;
|
|
@@ -135,17 +128,14 @@ function ResizableFrame( {
|
|
|
135
128
|
|
|
136
129
|
const updatedWidth = startingWidth + delta.width;
|
|
137
130
|
|
|
138
|
-
setIsOversized( updatedWidth >
|
|
131
|
+
setIsOversized( updatedWidth > defaultSize.width );
|
|
139
132
|
|
|
140
133
|
// Width will be controlled by the library (via `resizeRatio`),
|
|
141
134
|
// so we only need to update the height.
|
|
142
135
|
setFrameSize( {
|
|
143
136
|
height: isOversized
|
|
144
137
|
? '100%'
|
|
145
|
-
: calculateNewHeight(
|
|
146
|
-
updatedWidth,
|
|
147
|
-
initialAspectRatioRef.current
|
|
148
|
-
),
|
|
138
|
+
: calculateNewHeight( updatedWidth, defaultAspectRatio ),
|
|
149
139
|
} );
|
|
150
140
|
};
|
|
151
141
|
|
|
@@ -186,15 +176,12 @@ function ResizableFrame( {
|
|
|
186
176
|
FRAME_MIN_WIDTH,
|
|
187
177
|
frameRef.current.resizable.offsetWidth + delta
|
|
188
178
|
),
|
|
189
|
-
|
|
179
|
+
defaultSize.width
|
|
190
180
|
);
|
|
191
181
|
|
|
192
182
|
setFrameSize( {
|
|
193
183
|
width: newWidth,
|
|
194
|
-
height: calculateNewHeight(
|
|
195
|
-
newWidth,
|
|
196
|
-
initialAspectRatioRef.current
|
|
197
|
-
),
|
|
184
|
+
height: calculateNewHeight( newWidth, defaultAspectRatio ),
|
|
198
185
|
} );
|
|
199
186
|
};
|
|
200
187
|
|
|
@@ -291,9 +278,7 @@ function ResizableFrame( {
|
|
|
291
278
|
undefined
|
|
292
279
|
}
|
|
293
280
|
aria-valuemin={ FRAME_MIN_WIDTH }
|
|
294
|
-
aria-valuemax={
|
|
295
|
-
initialComputedWidthRef.current
|
|
296
|
-
}
|
|
281
|
+
aria-valuemax={ defaultSize.width }
|
|
297
282
|
onKeyDown={ handleResizableHandleKeyDown }
|
|
298
283
|
initial="hidden"
|
|
299
284
|
exit="hidden"
|
|
@@ -314,7 +299,6 @@ function ResizableFrame( {
|
|
|
314
299
|
onResizeStop={ handleResizeStop }
|
|
315
300
|
className={ classnames( 'edit-site-resizable-frame__inner', {
|
|
316
301
|
'is-resizing': isResizing,
|
|
317
|
-
[ oversizedClassName ]: isOversized,
|
|
318
302
|
} ) }
|
|
319
303
|
>
|
|
320
304
|
<motion.div
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
.edit-site-resizable-frame__inner {
|
|
2
2
|
position: relative;
|
|
3
3
|
|
|
4
|
-
&.edit-site-layout__resizable-frame-oversized {
|
|
5
|
-
@at-root {
|
|
6
|
-
body:has(&) {
|
|
7
|
-
.edit-site-site-hub {
|
|
8
|
-
.edit-site-site-hub__site-title,
|
|
9
|
-
.edit-site-site-hub_toggle-command-center {
|
|
10
|
-
opacity: 0 !important;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.edit-site-site-hub__view-mode-toggle-container {
|
|
14
|
-
background-color: transparent;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
4
|
&.is-resizing {
|
|
22
5
|
@at-root {
|
|
23
6
|
body:has(&) {
|
|
@@ -212,11 +212,8 @@ export default function PageStatus( {
|
|
|
212
212
|
} )
|
|
213
213
|
}
|
|
214
214
|
value={ password }
|
|
215
|
-
/* eslint-disable jsx-a11y/no-autofocus */
|
|
216
|
-
autoFocus={ ! password }
|
|
217
|
-
/* eslint-enable jsx-a11y/no-autofocus */
|
|
218
215
|
placeholder={ __(
|
|
219
|
-
'
|
|
216
|
+
'Use a secure password'
|
|
220
217
|
) }
|
|
221
218
|
type="text"
|
|
222
219
|
/>
|
|
@@ -11,6 +11,7 @@ import { isRTL, __, sprintf } from '@wordpress/i18n';
|
|
|
11
11
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { useSelect } from '@wordpress/data';
|
|
14
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Internal dependencies
|
|
@@ -23,6 +24,8 @@ import {
|
|
|
23
24
|
currentlyPreviewingTheme,
|
|
24
25
|
} from '../../utils/is-previewing-theme';
|
|
25
26
|
|
|
27
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
28
|
+
|
|
26
29
|
export default function SidebarNavigationScreen( {
|
|
27
30
|
isRoot,
|
|
28
31
|
title,
|
|
@@ -31,7 +34,7 @@ export default function SidebarNavigationScreen( {
|
|
|
31
34
|
content,
|
|
32
35
|
footer,
|
|
33
36
|
description,
|
|
34
|
-
backPath,
|
|
37
|
+
backPath: backPathProp,
|
|
35
38
|
} ) {
|
|
36
39
|
const { dashboardLink } = useSelect( ( select ) => {
|
|
37
40
|
const { getSettings } = unlock( select( editSiteStore ) );
|
|
@@ -40,6 +43,7 @@ export default function SidebarNavigationScreen( {
|
|
|
40
43
|
};
|
|
41
44
|
}, [] );
|
|
42
45
|
const { getTheme } = useSelect( coreStore );
|
|
46
|
+
const location = useLocation();
|
|
43
47
|
const navigator = useNavigator();
|
|
44
48
|
const theme = getTheme( currentlyPreviewingTheme() );
|
|
45
49
|
const icon = isRTL() ? chevronRight : chevronLeft;
|
|
@@ -56,13 +60,17 @@ export default function SidebarNavigationScreen( {
|
|
|
56
60
|
alignment="flex-start"
|
|
57
61
|
className="edit-site-sidebar-navigation-screen__title-icon"
|
|
58
62
|
>
|
|
59
|
-
{ ! isRoot &&
|
|
63
|
+
{ ! isRoot && (
|
|
60
64
|
<SidebarButton
|
|
61
65
|
onClick={ () => {
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
const backPath =
|
|
67
|
+
backPathProp ?? location.state?.backPath;
|
|
68
|
+
if ( backPath ) {
|
|
69
|
+
navigator.goTo( backPath, {
|
|
70
|
+
isBack: true,
|
|
71
|
+
} );
|
|
64
72
|
} else {
|
|
65
|
-
navigator.
|
|
73
|
+
navigator.goToParent();
|
|
66
74
|
}
|
|
67
75
|
} }
|
|
68
76
|
icon={ icon }
|
|
@@ -70,16 +78,6 @@ export default function SidebarNavigationScreen( {
|
|
|
70
78
|
showTooltip={ false }
|
|
71
79
|
/>
|
|
72
80
|
) }
|
|
73
|
-
{ ! isRoot && backPath && (
|
|
74
|
-
<SidebarButton
|
|
75
|
-
onClick={ () =>
|
|
76
|
-
navigator.goTo( backPath, { isBack: true } )
|
|
77
|
-
}
|
|
78
|
-
icon={ icon }
|
|
79
|
-
label={ __( 'Back' ) }
|
|
80
|
-
showTooltip={ false }
|
|
81
|
-
/>
|
|
82
|
-
) }
|
|
83
81
|
{ isRoot && (
|
|
84
82
|
<SidebarButton
|
|
85
83
|
icon={ icon }
|
|
@@ -23,10 +23,12 @@ import {
|
|
|
23
23
|
currentlyPreviewingTheme,
|
|
24
24
|
} from '../../utils/is-previewing-theme';
|
|
25
25
|
import { unlock } from '../../lock-unlock';
|
|
26
|
+
import { getPathFromURL } from '../sync-state-with-url/use-sync-path-with-url';
|
|
26
27
|
|
|
27
|
-
const { useHistory } = unlock( routerPrivateApis );
|
|
28
|
+
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
28
29
|
|
|
29
30
|
export default function LeafMoreMenu( props ) {
|
|
31
|
+
const location = useLocation();
|
|
30
32
|
const history = useHistory();
|
|
31
33
|
const { block } = props;
|
|
32
34
|
const { clientId } = block;
|
|
@@ -63,22 +65,32 @@ export default function LeafMoreMenu( props ) {
|
|
|
63
65
|
attributes.type &&
|
|
64
66
|
history
|
|
65
67
|
) {
|
|
66
|
-
history.push(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
history.push(
|
|
69
|
+
{
|
|
70
|
+
postType: attributes.type,
|
|
71
|
+
postId: attributes.id,
|
|
72
|
+
...( isPreviewingTheme() && {
|
|
73
|
+
wp_theme_preview: currentlyPreviewingTheme(),
|
|
74
|
+
} ),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
backPath: getPathFromURL( location.params ),
|
|
78
|
+
}
|
|
79
|
+
);
|
|
73
80
|
}
|
|
74
81
|
if ( name === 'core/page-list-item' && attributes.id && history ) {
|
|
75
|
-
history.push(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
history.push(
|
|
83
|
+
{
|
|
84
|
+
postType: 'page',
|
|
85
|
+
postId: attributes.id,
|
|
86
|
+
...( isPreviewingTheme() && {
|
|
87
|
+
wp_theme_preview: currentlyPreviewingTheme(),
|
|
88
|
+
} ),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
backPath: getPathFromURL( location.params ),
|
|
92
|
+
}
|
|
93
|
+
);
|
|
82
94
|
}
|
|
83
95
|
},
|
|
84
96
|
[ history ]
|
|
@@ -28,10 +28,15 @@ import { unlock } from '../../lock-unlock';
|
|
|
28
28
|
const { useHistory } = unlock( routerPrivateApis );
|
|
29
29
|
|
|
30
30
|
const PageItem = ( { postType = 'page', postId, ...props } ) => {
|
|
31
|
-
const linkInfo = useLink(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const linkInfo = useLink(
|
|
32
|
+
{
|
|
33
|
+
postType,
|
|
34
|
+
postId,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
backPath: '/page',
|
|
38
|
+
}
|
|
39
|
+
);
|
|
35
40
|
return <SidebarNavigationItem { ...linkInfo } { ...props } />;
|
|
36
41
|
};
|
|
37
42
|
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
__experimentalHeading as Heading,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
13
|
-
import { useSelect } from '@wordpress/data';
|
|
14
13
|
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
15
14
|
import { __ } from '@wordpress/i18n';
|
|
16
15
|
import { getQueryArgs } from '@wordpress/url';
|
|
@@ -24,7 +23,6 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
|
24
23
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
25
24
|
import CategoryItem from './category-item';
|
|
26
25
|
import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';
|
|
27
|
-
import { store as editSiteStore } from '../../store';
|
|
28
26
|
import { useLink } from '../routes/link';
|
|
29
27
|
import usePatternCategories from './use-pattern-categories';
|
|
30
28
|
import useMyPatterns from './use-my-patterns';
|
|
@@ -106,11 +104,6 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
106
104
|
const { patternCategories, hasPatterns } = usePatternCategories();
|
|
107
105
|
const { myPatterns } = useMyPatterns();
|
|
108
106
|
|
|
109
|
-
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
110
|
-
const settings = select( editSiteStore ).getSettings();
|
|
111
|
-
return !! settings.supportsTemplatePartsMode;
|
|
112
|
-
}, [] );
|
|
113
|
-
|
|
114
107
|
const templatePartsLink = useLink( { path: '/wp_template_part/all' } );
|
|
115
108
|
const footer = ! isMobileViewport ? (
|
|
116
109
|
<ItemGroup>
|
|
@@ -129,7 +122,6 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
129
122
|
|
|
130
123
|
return (
|
|
131
124
|
<SidebarNavigationScreen
|
|
132
|
-
isRoot={ isTemplatePartsMode }
|
|
133
125
|
title={ __( 'Patterns' ) }
|
|
134
126
|
description={ __(
|
|
135
127
|
'Manage what patterns are available when editing the site.'
|
|
@@ -36,7 +36,8 @@ export default function useThemePatterns() {
|
|
|
36
36
|
( pattern ) =>
|
|
37
37
|
! CORE_PATTERN_SOURCES.includes( pattern.source )
|
|
38
38
|
)
|
|
39
|
-
.filter( filterOutDuplicatesByName )
|
|
39
|
+
.filter( filterOutDuplicatesByName )
|
|
40
|
+
.filter( ( pattern ) => pattern.inserter !== false ),
|
|
40
41
|
[ blockPatterns, restBlockPatterns ]
|
|
41
42
|
);
|
|
42
43
|
|