@wordpress/editor 14.8.13 → 14.8.15
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/post-taxonomies/flat-term-selector.js +10 -8
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/preferences-modal/index.js +26 -22
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/provider/index.js +9 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/sidebar/post-summary.js +2 -2
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +10 -8
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +26 -22
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/provider/index.js +10 -2
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +2 -2
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/preferences-modal/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/components/post-taxonomies/flat-term-selector.js +8 -8
- package/src/components/preferences-modal/index.js +26 -19
- package/src/components/preferences-modal/test/index.js +1 -1
- package/src/components/provider/index.js +17 -3
- package/src/components/sidebar/post-summary.js +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -57,6 +57,13 @@ const termNamesToIds = ( names, terms ) => {
|
|
|
57
57
|
.filter( ( id ) => id !== undefined );
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
const Wrapper = ( { children, __nextHasNoMarginBottom } ) =>
|
|
61
|
+
__nextHasNoMarginBottom ? (
|
|
62
|
+
<VStack spacing={ 4 }>{ children }</VStack>
|
|
63
|
+
) : (
|
|
64
|
+
<Fragment>{ children }</Fragment>
|
|
65
|
+
);
|
|
66
|
+
|
|
60
67
|
/**
|
|
61
68
|
* Renders a flat term selector component.
|
|
62
69
|
*
|
|
@@ -292,15 +299,8 @@ export function FlatTermSelector( { slug, __nextHasNoMarginBottom } ) {
|
|
|
292
299
|
singularName
|
|
293
300
|
);
|
|
294
301
|
|
|
295
|
-
const Wrapper = ( { children } ) =>
|
|
296
|
-
__nextHasNoMarginBottom ? (
|
|
297
|
-
<VStack spacing={ 4 }>{ children }</VStack>
|
|
298
|
-
) : (
|
|
299
|
-
<Fragment>{ children }</Fragment>
|
|
300
|
-
);
|
|
301
|
-
|
|
302
302
|
return (
|
|
303
|
-
<Wrapper>
|
|
303
|
+
<Wrapper __nextHasNoMarginBottom={ __nextHasNoMarginBottom }>
|
|
304
304
|
<FormTokenField
|
|
305
305
|
__next40pxDefaultSize
|
|
306
306
|
value={ values }
|
|
@@ -36,25 +36,40 @@ const {
|
|
|
36
36
|
} = unlock( preferencesPrivateApis );
|
|
37
37
|
|
|
38
38
|
export default function EditorPreferencesModal( { extraSections = {} } ) {
|
|
39
|
+
const isActive = useSelect( ( select ) => {
|
|
40
|
+
return select( interfaceStore ).isModalActive( 'editor/preferences' );
|
|
41
|
+
}, [] );
|
|
42
|
+
const { closeModal } = useDispatch( interfaceStore );
|
|
43
|
+
|
|
44
|
+
if ( ! isActive ) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Please wrap all contents inside PreferencesModalContents to prevent all
|
|
49
|
+
// hooks from executing when the modal is not open.
|
|
50
|
+
return (
|
|
51
|
+
<PreferencesModal closeModal={ closeModal }>
|
|
52
|
+
<PreferencesModalContents extraSections={ extraSections } />
|
|
53
|
+
</PreferencesModal>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function PreferencesModalContents( { extraSections = {} } ) {
|
|
39
58
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
40
|
-
const
|
|
59
|
+
const showBlockBreadcrumbsOption = useSelect(
|
|
41
60
|
( select ) => {
|
|
42
61
|
const { getEditorSettings } = select( editorStore );
|
|
43
62
|
const { get } = select( preferencesStore );
|
|
44
|
-
const { isModalActive } = select( interfaceStore );
|
|
45
63
|
const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
|
|
46
64
|
const isDistractionFreeEnabled = get( 'core', 'distractionFree' );
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
isActive: isModalActive( 'editor/preferences' ),
|
|
53
|
-
};
|
|
65
|
+
return (
|
|
66
|
+
! isDistractionFreeEnabled &&
|
|
67
|
+
isLargeViewport &&
|
|
68
|
+
isRichEditingEnabled
|
|
69
|
+
);
|
|
54
70
|
},
|
|
55
71
|
[ isLargeViewport ]
|
|
56
72
|
);
|
|
57
|
-
const { closeModal } = useDispatch( interfaceStore );
|
|
58
73
|
const { setIsListViewOpened, setIsInserterOpened } =
|
|
59
74
|
useDispatch( editorStore );
|
|
60
75
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
@@ -330,13 +345,5 @@ export default function EditorPreferencesModal( { extraSections = {} } ) {
|
|
|
330
345
|
]
|
|
331
346
|
);
|
|
332
347
|
|
|
333
|
-
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
return (
|
|
338
|
-
<PreferencesModal closeModal={ closeModal }>
|
|
339
|
-
<PreferencesModalTabs sections={ sections } />
|
|
340
|
-
</PreferencesModal>
|
|
341
|
-
);
|
|
348
|
+
return <PreferencesModalTabs sections={ sections } />;
|
|
342
349
|
}
|
|
@@ -19,7 +19,7 @@ jest.mock( '@wordpress/compose/src/hooks/use-viewport-match', () => jest.fn() );
|
|
|
19
19
|
|
|
20
20
|
describe( 'EditPostPreferencesModal', () => {
|
|
21
21
|
it( 'should not render when the modal is not active', () => {
|
|
22
|
-
useSelect.mockImplementation( () =>
|
|
22
|
+
useSelect.mockImplementation( () => false );
|
|
23
23
|
render( <EditPostPreferencesModal /> );
|
|
24
24
|
expect(
|
|
25
25
|
screen.queryByRole( 'dialog', { name: 'Preferences' } )
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
BlockEditorProvider,
|
|
14
14
|
BlockContextProvider,
|
|
15
15
|
privateApis as blockEditorPrivateApis,
|
|
16
|
+
store as blockEditorStore,
|
|
16
17
|
} from '@wordpress/block-editor';
|
|
17
18
|
import { store as noticesStore } from '@wordpress/notices';
|
|
18
19
|
import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
|
|
@@ -188,6 +189,15 @@ export const ExperimentalEditorProvider = withRegistryProvider(
|
|
|
188
189
|
},
|
|
189
190
|
[ post.type ]
|
|
190
191
|
);
|
|
192
|
+
|
|
193
|
+
const isZoomOut = useSelect( ( select ) => {
|
|
194
|
+
const { __unstableGetEditorMode } = unlock(
|
|
195
|
+
select( blockEditorStore )
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
return __unstableGetEditorMode() === 'zoom-out';
|
|
199
|
+
} );
|
|
200
|
+
|
|
191
201
|
const shouldRenderTemplate = !! template && mode !== 'post-only';
|
|
192
202
|
const rootLevelPost = shouldRenderTemplate ? template : post;
|
|
193
203
|
const defaultBlockContext = useMemo( () => {
|
|
@@ -332,9 +342,13 @@ export const ExperimentalEditorProvider = withRegistryProvider(
|
|
|
332
342
|
{ children }
|
|
333
343
|
{ ! settings.__unstableIsPreviewMode && (
|
|
334
344
|
<>
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
345
|
+
{ ! isZoomOut && (
|
|
346
|
+
<>
|
|
347
|
+
<PatternsMenuItems />
|
|
348
|
+
<TemplatePartMenuItems />
|
|
349
|
+
<ContentOnlySettingsMenu />
|
|
350
|
+
</>
|
|
351
|
+
) }
|
|
338
352
|
{ mode === 'template-locked' && (
|
|
339
353
|
<DisableNonPageContentBlocks />
|
|
340
354
|
) }
|
|
@@ -87,11 +87,11 @@ export default function PostSummary( { onActionPerformed } ) {
|
|
|
87
87
|
<PostsPerPage />
|
|
88
88
|
<SiteDiscussion />
|
|
89
89
|
<PostFormatPanel />
|
|
90
|
+
{ fills }
|
|
90
91
|
</VStack>
|
|
91
92
|
<PostTrash
|
|
92
93
|
onActionPerformed={ onActionPerformed }
|
|
93
94
|
/>
|
|
94
|
-
{ fills }
|
|
95
95
|
</VStack>
|
|
96
96
|
) }
|
|
97
97
|
</VStack>
|