@wordpress/block-editor 14.7.0 → 14.8.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.
- package/CHANGELOG.md +2 -0
- package/build/components/block-controls/slot.js +6 -3
- package/build/components/block-controls/slot.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -1
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-manager/category.js +79 -0
- package/build/components/block-manager/category.js.map +1 -0
- package/build/components/block-manager/checklist.js +40 -0
- package/build/components/block-manager/checklist.js.map +1 -0
- package/build/components/block-manager/index.js +108 -0
- package/build/components/block-manager/index.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +16 -4
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/switch-section-style.js +105 -0
- package/build/components/block-toolbar/switch-section-style.js.map +1 -0
- package/build/components/collab/block-comment-icon-slot.js +2 -6
- package/build/components/collab/block-comment-icon-slot.js.map +1 -1
- package/build/components/collab/block-comment-icon-toolbar-slot.js +2 -6
- package/build/components/collab/block-comment-icon-toolbar-slot.js.map +1 -1
- package/build/components/color-palette/with-color-context.js +4 -2
- package/build/components/color-palette/with-color-context.js.map +1 -1
- package/build/components/font-family/index.js +14 -13
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/iframe/index.js +13 -100
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-scale-canvas.js +377 -0
- package/build/components/iframe/use-scale-canvas.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +22 -3
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -5
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +7 -8
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter-draggable-blocks/index.js +2 -1
- package/build/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build/components/inspector-controls/slot.js +7 -4
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -4
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/media-placeholder/index.js +29 -21
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/hooks/border.js +3 -3
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/style.js +6 -6
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +1 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +1 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +11 -9
- package/build/layouts/flex.js.map +1 -1
- package/build/private-apis.js +4 -4
- package/build/private-apis.js.map +1 -1
- package/build/store/private-selectors.js +1 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +3 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-controls/slot.js +6 -3
- package/build-module/components/block-controls/slot.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -1
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-manager/category.js +71 -0
- package/build-module/components/block-manager/category.js.map +1 -0
- package/build-module/components/block-manager/checklist.js +32 -0
- package/build-module/components/block-manager/checklist.js.map +1 -0
- package/build-module/components/block-manager/index.js +102 -0
- package/build-module/components/block-manager/index.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu/index.js +2 -2
- package/build-module/components/block-settings-menu/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +16 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/switch-section-style.js +97 -0
- package/build-module/components/block-toolbar/switch-section-style.js.map +1 -0
- package/build-module/components/collab/block-comment-icon-slot.js +2 -6
- package/build-module/components/collab/block-comment-icon-slot.js.map +1 -1
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js +2 -6
- package/build-module/components/collab/block-comment-icon-toolbar-slot.js.map +1 -1
- package/build-module/components/color-palette/with-color-context.js +4 -2
- package/build-module/components/color-palette/with-color-context.js.map +1 -1
- package/build-module/components/font-family/index.js +15 -14
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/iframe/index.js +15 -102
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-scale-canvas.js +371 -0
- package/build-module/components/iframe/use-scale-canvas.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +22 -3
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -5
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +8 -9
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter-draggable-blocks/index.js +2 -1
- package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +7 -4
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -4
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +29 -21
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/hooks/border.js +3 -3
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +2 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/style.js +6 -6
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +1 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +1 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +11 -9
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/private-apis.js +6 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +3 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/content-rtl.css +27 -28
- package/build-style/content.css +27 -28
- package/build-style/style-rtl.css +108 -0
- package/build-style/style.css +108 -0
- package/package.json +2 -2
- package/src/components/block-canvas/style.scss +2 -1
- package/src/components/block-controls/slot.js +5 -3
- package/src/components/block-inspector/index.js +0 -2
- package/src/components/block-lock/modal.js +1 -1
- package/src/components/block-manager/category.js +102 -0
- package/src/components/block-manager/checklist.js +34 -0
- package/src/components/block-manager/index.js +127 -0
- package/src/components/block-manager/style.scss +82 -0
- package/src/components/block-mover/README.md +15 -8
- package/src/components/block-mover/stories/index.story.js +73 -71
- package/src/components/block-mover/style.scss +3 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/src/components/block-settings-menu/index.js +2 -2
- package/src/components/block-toolbar/index.js +14 -0
- package/src/components/block-toolbar/switch-section-style.js +115 -0
- package/src/components/block-tools/style.scss +39 -0
- package/src/components/collab/block-comment-icon-slot.js +2 -6
- package/src/components/collab/block-comment-icon-toolbar-slot.js +3 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +2 -2
- package/src/components/color-palette/with-color-context.js +25 -7
- package/src/components/font-family/index.js +13 -13
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +1 -1
- package/src/components/iframe/content.scss +49 -43
- package/src/components/iframe/index.js +14 -171
- package/src/components/iframe/use-scale-canvas.js +468 -0
- package/src/components/image-editor/use-save-image.js +27 -2
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +7 -16
- package/src/components/inserter/category-tabs/index.js +8 -9
- package/src/components/inserter-draggable-blocks/index.js +10 -1
- package/src/components/inspector-controls/README.md +2 -0
- package/src/components/inspector-controls/slot.js +6 -4
- package/src/components/inspector-controls-tabs/position-controls-panel.js +1 -3
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +10 -10
- package/src/components/media-placeholder/index.js +37 -33
- package/src/components/provider/test/use-block-sync.js +3 -1
- package/src/components/rich-text/content.scss +15 -10
- package/src/hooks/border.js +3 -9
- package/src/hooks/color.js +1 -1
- package/src/hooks/dimensions.js +2 -2
- package/src/hooks/style.js +6 -12
- package/src/hooks/supports.js +1 -1
- package/src/hooks/test/style.js +1 -2
- package/src/hooks/typography.js +1 -1
- package/src/hooks/utils.js +1 -1
- package/src/layouts/flex.js +26 -18
- package/src/private-apis.js +6 -6
- package/src/store/private-selectors.js +1 -1
- package/src/store/selectors.js +3 -0
- package/src/store/test/selectors.js +87 -58
- package/src/style.scss +1 -0
- package/build/components/block-info-slot-fill/index.js +0 -39
- package/build/components/block-info-slot-fill/index.js.map +0 -1
- package/build-module/components/block-info-slot-fill/index.js +0 -32
- package/build-module/components/block-info-slot-fill/index.js.map +0 -1
- package/src/components/block-info-slot-fill/index.js +0 -27
|
@@ -53,9 +53,7 @@ const PositionControlsPanel = () => {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
const PositionControls = () => {
|
|
56
|
-
const fills = useSlotFills(
|
|
57
|
-
InspectorControlsGroups.position.Slot.__unstableName
|
|
58
|
-
);
|
|
56
|
+
const fills = useSlotFills( InspectorControlsGroups.position.name );
|
|
59
57
|
const hasFills = Boolean( fills && fills.length );
|
|
60
58
|
|
|
61
59
|
if ( ! hasFills ) {
|
|
@@ -46,18 +46,18 @@ export default function useInspectorControlsTabs( blockName ) {
|
|
|
46
46
|
|
|
47
47
|
// List View Tab: If there are any fills for the list group add that tab.
|
|
48
48
|
const listViewDisabled = useIsListViewTabDisabled( blockName );
|
|
49
|
-
const listFills = useSlotFills( listGroup.
|
|
49
|
+
const listFills = useSlotFills( listGroup.name );
|
|
50
50
|
const hasListFills = ! listViewDisabled && !! listFills && listFills.length;
|
|
51
51
|
|
|
52
52
|
// Styles Tab: Add this tab if there are any fills for block supports
|
|
53
53
|
// e.g. border, color, spacing, typography, etc.
|
|
54
54
|
const styleFills = [
|
|
55
|
-
...( useSlotFills( borderGroup.
|
|
56
|
-
...( useSlotFills( colorGroup.
|
|
57
|
-
...( useSlotFills( dimensionsGroup.
|
|
58
|
-
...( useSlotFills( stylesGroup.
|
|
59
|
-
...( useSlotFills( typographyGroup.
|
|
60
|
-
...( useSlotFills( effectsGroup.
|
|
55
|
+
...( useSlotFills( borderGroup.name ) || [] ),
|
|
56
|
+
...( useSlotFills( colorGroup.name ) || [] ),
|
|
57
|
+
...( useSlotFills( dimensionsGroup.name ) || [] ),
|
|
58
|
+
...( useSlotFills( stylesGroup.name ) || [] ),
|
|
59
|
+
...( useSlotFills( typographyGroup.name ) || [] ),
|
|
60
|
+
...( useSlotFills( effectsGroup.name ) || [] ),
|
|
61
61
|
];
|
|
62
62
|
const hasStyleFills = styleFills.length;
|
|
63
63
|
|
|
@@ -67,12 +67,12 @@ export default function useInspectorControlsTabs( blockName ) {
|
|
|
67
67
|
// the advanced controls slot as well to ensure they are rendered.
|
|
68
68
|
const advancedFills = [
|
|
69
69
|
...( useSlotFills( InspectorAdvancedControls.slotName ) || [] ),
|
|
70
|
-
...( useSlotFills( bindingsGroup.
|
|
70
|
+
...( useSlotFills( bindingsGroup.name ) || [] ),
|
|
71
71
|
];
|
|
72
72
|
|
|
73
73
|
const settingsFills = [
|
|
74
|
-
...( useSlotFills( defaultGroup.
|
|
75
|
-
...( useSlotFills( positionGroup.
|
|
74
|
+
...( useSlotFills( defaultGroup.name ) || [] ),
|
|
75
|
+
...( useSlotFills( positionGroup.name ) || [] ),
|
|
76
76
|
...( hasListFills && hasStyleFills > 1 ? advancedFills : [] ),
|
|
77
77
|
];
|
|
78
78
|
|
|
@@ -239,7 +239,7 @@ export function MediaPlaceholder( {
|
|
|
239
239
|
( block.name === 'core/image' ||
|
|
240
240
|
block.name === 'core/audio' ||
|
|
241
241
|
block.name === 'core/video' ) &&
|
|
242
|
-
block.attributes.url
|
|
242
|
+
( block.attributes.url || block.attributes.src )
|
|
243
243
|
? [ block ]
|
|
244
244
|
: recursivelyFindMediaFromBlocks( block.innerBlocks )
|
|
245
245
|
);
|
|
@@ -252,33 +252,37 @@ export function MediaPlaceholder( {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
const uploadedMediaList = await Promise.all(
|
|
255
|
-
mediaBlocks.map( ( block ) =>
|
|
256
|
-
block.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
255
|
+
mediaBlocks.map( ( block ) => {
|
|
256
|
+
const blockType = block.name.split( '/' )[ 1 ];
|
|
257
|
+
if ( block.attributes.id ) {
|
|
258
|
+
block.attributes.type = blockType;
|
|
259
|
+
return block.attributes;
|
|
260
|
+
}
|
|
261
|
+
return new Promise( ( resolve, reject ) => {
|
|
262
|
+
window
|
|
263
|
+
.fetch( block.attributes.url )
|
|
264
|
+
.then( ( response ) => response.blob() )
|
|
265
|
+
.then( ( blob ) =>
|
|
266
|
+
mediaUpload( {
|
|
267
|
+
filesList: [ blob ],
|
|
268
|
+
additionalData: {
|
|
269
|
+
title: block.attributes.title,
|
|
270
|
+
alt_text: block.attributes.alt,
|
|
271
|
+
caption: block.attributes.caption,
|
|
272
|
+
type: blockType,
|
|
273
|
+
},
|
|
274
|
+
onFileChange: ( [ media ] ) => {
|
|
275
|
+
if ( media.id ) {
|
|
276
|
+
resolve( media );
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
allowedTypes,
|
|
280
|
+
onError: reject,
|
|
281
|
+
} )
|
|
282
|
+
)
|
|
283
|
+
.catch( () => resolve( block.attributes.url ) );
|
|
284
|
+
} );
|
|
285
|
+
} )
|
|
282
286
|
).catch( ( err ) => onError( err ) );
|
|
283
287
|
|
|
284
288
|
if ( multiple ) {
|
|
@@ -288,8 +292,10 @@ export function MediaPlaceholder( {
|
|
|
288
292
|
}
|
|
289
293
|
}
|
|
290
294
|
|
|
291
|
-
async function
|
|
292
|
-
const blocks = pasteHandler( {
|
|
295
|
+
async function onDrop( event ) {
|
|
296
|
+
const blocks = pasteHandler( {
|
|
297
|
+
HTML: event.dataTransfer?.getData( 'default' ),
|
|
298
|
+
} );
|
|
293
299
|
return await handleBlocksDrop( blocks );
|
|
294
300
|
}
|
|
295
301
|
|
|
@@ -379,9 +385,7 @@ export function MediaPlaceholder( {
|
|
|
379
385
|
return null;
|
|
380
386
|
}
|
|
381
387
|
|
|
382
|
-
return
|
|
383
|
-
<DropZone onFilesDrop={ onFilesUpload } onHTMLDrop={ onHTMLDrop } />
|
|
384
|
-
);
|
|
388
|
+
return <DropZone onFilesDrop={ onFilesUpload } onDrop={ onDrop } />;
|
|
385
389
|
};
|
|
386
390
|
|
|
387
391
|
const renderCancelLink = () => {
|
|
@@ -22,7 +22,9 @@ jest.mock( '../../../store/actions', () => {
|
|
|
22
22
|
...actions,
|
|
23
23
|
resetBlocks: jest.fn( actions.resetBlocks ),
|
|
24
24
|
replaceInnerBlocks: jest.fn( actions.replaceInnerBlocks ),
|
|
25
|
-
setHasControlledInnerBlocks: jest.fn(
|
|
25
|
+
setHasControlledInnerBlocks: jest.fn(
|
|
26
|
+
actions.setHasControlledInnerBlocks
|
|
27
|
+
),
|
|
26
28
|
};
|
|
27
29
|
} );
|
|
28
30
|
|
|
@@ -13,16 +13,6 @@
|
|
|
13
13
|
&:focus {
|
|
14
14
|
// Removes outline added by the browser.
|
|
15
15
|
outline: none;
|
|
16
|
-
|
|
17
|
-
[data-rich-text-format-boundary] {
|
|
18
|
-
border-radius: $radius-small;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.block-editor-rich-text__editable {
|
|
24
|
-
> p:first-child {
|
|
25
|
-
margin-top: 0;
|
|
26
16
|
}
|
|
27
17
|
}
|
|
28
18
|
|
|
@@ -40,3 +30,18 @@ figcaption.block-editor-rich-text__editable [data-rich-text-placeholder]::before
|
|
|
40
30
|
background: rgb(255, 255, 0);
|
|
41
31
|
}
|
|
42
32
|
}
|
|
33
|
+
|
|
34
|
+
[data-rich-text-comment],
|
|
35
|
+
[data-rich-text-format-boundary] {
|
|
36
|
+
border-radius: $radius-small;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[data-rich-text-comment] {
|
|
40
|
+
background-color: currentColor;
|
|
41
|
+
|
|
42
|
+
span {
|
|
43
|
+
filter: invert(100%);
|
|
44
|
+
color: currentColor;
|
|
45
|
+
padding: 0 2px;
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/hooks/border.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import { store as blockEditorStore } from '../store';
|
|
32
32
|
import { __ } from '@wordpress/i18n';
|
|
33
33
|
|
|
34
|
-
export const BORDER_SUPPORT_KEY = '
|
|
34
|
+
export const BORDER_SUPPORT_KEY = 'border';
|
|
35
35
|
export const SHADOW_SUPPORT_KEY = 'shadow';
|
|
36
36
|
|
|
37
37
|
const getColorByProperty = ( colors, property, value ) => {
|
|
@@ -161,14 +161,8 @@ export function BorderPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
const defaultControls = {
|
|
164
|
-
...getBlockSupport( name, [
|
|
165
|
-
|
|
166
|
-
'__experimentalDefaultControls',
|
|
167
|
-
] ),
|
|
168
|
-
...getBlockSupport( name, [
|
|
169
|
-
SHADOW_SUPPORT_KEY,
|
|
170
|
-
'__experimentalDefaultControls',
|
|
171
|
-
] ),
|
|
164
|
+
...getBlockSupport( name, [ BORDER_SUPPORT_KEY, 'defaultControls' ] ),
|
|
165
|
+
...getBlockSupport( name, [ SHADOW_SUPPORT_KEY, 'defaultControls' ] ),
|
|
172
166
|
};
|
|
173
167
|
|
|
174
168
|
return (
|
package/src/hooks/color.js
CHANGED
|
@@ -290,7 +290,7 @@ export function ColorEdit( { clientId, name, setAttributes, settings } ) {
|
|
|
290
290
|
|
|
291
291
|
const defaultControls = getBlockSupport( name, [
|
|
292
292
|
COLOR_SUPPORT_KEY,
|
|
293
|
-
'
|
|
293
|
+
'defaultControls',
|
|
294
294
|
] );
|
|
295
295
|
|
|
296
296
|
const enableContrastChecking =
|
package/src/hooks/dimensions.js
CHANGED
|
@@ -88,11 +88,11 @@ export function DimensionsPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
88
88
|
|
|
89
89
|
const defaultDimensionsControls = getBlockSupport( name, [
|
|
90
90
|
DIMENSIONS_SUPPORT_KEY,
|
|
91
|
-
'
|
|
91
|
+
'defaultControls',
|
|
92
92
|
] );
|
|
93
93
|
const defaultSpacingControls = getBlockSupport( name, [
|
|
94
94
|
SPACING_SUPPORT_KEY,
|
|
95
|
-
'
|
|
95
|
+
'defaultControls',
|
|
96
96
|
] );
|
|
97
97
|
const defaultControls = {
|
|
98
98
|
...defaultDimensionsControls,
|
package/src/hooks/style.js
CHANGED
|
@@ -98,22 +98,16 @@ function addAttribute( settings ) {
|
|
|
98
98
|
* @type {Record<string, string[]>}
|
|
99
99
|
*/
|
|
100
100
|
const skipSerializationPathsEdit = {
|
|
101
|
-
[ `${ BORDER_SUPPORT_KEY }.
|
|
102
|
-
[ `${ COLOR_SUPPORT_KEY }.
|
|
103
|
-
|
|
104
|
-
],
|
|
105
|
-
[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
|
|
101
|
+
[ `${ BORDER_SUPPORT_KEY }.skipSerialization` ]: [ 'border' ],
|
|
102
|
+
[ `${ COLOR_SUPPORT_KEY }.skipSerialization` ]: [ COLOR_SUPPORT_KEY ],
|
|
103
|
+
[ `${ TYPOGRAPHY_SUPPORT_KEY }.skipSerialization` ]: [
|
|
106
104
|
TYPOGRAPHY_SUPPORT_KEY,
|
|
107
105
|
],
|
|
108
|
-
[ `${ DIMENSIONS_SUPPORT_KEY }.
|
|
106
|
+
[ `${ DIMENSIONS_SUPPORT_KEY }.skipSerialization` ]: [
|
|
109
107
|
DIMENSIONS_SUPPORT_KEY,
|
|
110
108
|
],
|
|
111
|
-
[ `${ SPACING_SUPPORT_KEY }.
|
|
112
|
-
|
|
113
|
-
],
|
|
114
|
-
[ `${ SHADOW_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [
|
|
115
|
-
SHADOW_SUPPORT_KEY,
|
|
116
|
-
],
|
|
109
|
+
[ `${ SPACING_SUPPORT_KEY }.skipSerialization` ]: [ SPACING_SUPPORT_KEY ],
|
|
110
|
+
[ `${ SHADOW_SUPPORT_KEY }.skipSerialization` ]: [ SHADOW_SUPPORT_KEY ],
|
|
117
111
|
};
|
|
118
112
|
|
|
119
113
|
/**
|
package/src/hooks/supports.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Platform } from '@wordpress/element';
|
|
|
6
6
|
|
|
7
7
|
const ALIGN_SUPPORT_KEY = 'align';
|
|
8
8
|
const ALIGN_WIDE_SUPPORT_KEY = 'alignWide';
|
|
9
|
-
const BORDER_SUPPORT_KEY = '
|
|
9
|
+
const BORDER_SUPPORT_KEY = 'border';
|
|
10
10
|
const COLOR_SUPPORT_KEY = 'color';
|
|
11
11
|
const CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';
|
|
12
12
|
const FONT_FAMILY_SUPPORT_KEY = 'typography.fontFamily';
|
package/src/hooks/test/style.js
CHANGED
|
@@ -133,8 +133,7 @@ describe( 'addSaveProps', () => {
|
|
|
133
133
|
const applySkipSerialization = ( features ) => {
|
|
134
134
|
const updatedSettings = { ...blockSettings };
|
|
135
135
|
Object.keys( features ).forEach( ( key ) => {
|
|
136
|
-
updatedSettings.supports[ key ].
|
|
137
|
-
features[ key ];
|
|
136
|
+
updatedSettings.supports[ key ].skipSerialization = features[ key ];
|
|
138
137
|
} );
|
|
139
138
|
return updatedSettings;
|
|
140
139
|
};
|
package/src/hooks/typography.js
CHANGED
package/src/hooks/utils.js
CHANGED
|
@@ -124,7 +124,7 @@ export function shouldSkipSerialization(
|
|
|
124
124
|
feature
|
|
125
125
|
) {
|
|
126
126
|
const support = getBlockSupport( blockNameOrType, featureSet );
|
|
127
|
-
const skipSerialization = support?.
|
|
127
|
+
const skipSerialization = support?.skipSerialization;
|
|
128
128
|
|
|
129
129
|
if ( Array.isArray( skipSerialization ) ) {
|
|
130
130
|
return skipSerialization.includes( feature );
|
package/src/layouts/flex.js
CHANGED
|
@@ -66,24 +66,27 @@ export default {
|
|
|
66
66
|
onChange,
|
|
67
67
|
layoutBlockSupport = {},
|
|
68
68
|
} ) {
|
|
69
|
-
const { allowOrientation = true } =
|
|
69
|
+
const { allowOrientation = true, allowJustification = true } =
|
|
70
|
+
layoutBlockSupport;
|
|
70
71
|
return (
|
|
71
72
|
<>
|
|
72
73
|
<Flex>
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
{ allowJustification && (
|
|
75
|
+
<FlexItem>
|
|
76
|
+
<FlexLayoutJustifyContentControl
|
|
77
|
+
layout={ layout }
|
|
78
|
+
onChange={ onChange }
|
|
79
|
+
/>
|
|
80
|
+
</FlexItem>
|
|
81
|
+
) }
|
|
82
|
+
{ allowOrientation && (
|
|
83
|
+
<FlexItem>
|
|
81
84
|
<OrientationControl
|
|
82
85
|
layout={ layout }
|
|
83
86
|
onChange={ onChange }
|
|
84
87
|
/>
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
</FlexItem>
|
|
89
|
+
) }
|
|
87
90
|
</Flex>
|
|
88
91
|
<FlexWrapControl layout={ layout } onChange={ onChange } />
|
|
89
92
|
</>
|
|
@@ -94,17 +97,22 @@ export default {
|
|
|
94
97
|
onChange,
|
|
95
98
|
layoutBlockSupport,
|
|
96
99
|
} ) {
|
|
97
|
-
|
|
100
|
+
const { allowVerticalAlignment = true, allowJustification = true } =
|
|
101
|
+
layoutBlockSupport;
|
|
102
|
+
|
|
103
|
+
if ( ! allowJustification && ! allowVerticalAlignment ) {
|
|
98
104
|
return null;
|
|
99
105
|
}
|
|
100
|
-
|
|
106
|
+
|
|
101
107
|
return (
|
|
102
108
|
<BlockControls group="block" __experimentalShareWithChildBlocks>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
{ allowJustification && (
|
|
110
|
+
<FlexLayoutJustifyContentControl
|
|
111
|
+
layout={ layout }
|
|
112
|
+
onChange={ onChange }
|
|
113
|
+
isToolbar
|
|
114
|
+
/>
|
|
115
|
+
) }
|
|
108
116
|
{ allowVerticalAlignment && (
|
|
109
117
|
<FlexLayoutVerticalAlignmentControl
|
|
110
118
|
layout={ layout }
|
package/src/private-apis.js
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
normalizeString,
|
|
14
14
|
} from './components/inserter/search-items';
|
|
15
15
|
import { PrivateListView } from './components/list-view';
|
|
16
|
-
import BlockInfo from './components/block-info-slot-fill';
|
|
17
16
|
import { useHasBlockToolbar } from './components/block-toolbar/use-has-block-toolbar';
|
|
18
17
|
import { cleanEmptyObject } from './hooks/utils';
|
|
19
18
|
import BlockQuickNavigation from './components/block-quick-navigation';
|
|
20
19
|
import { LayoutStyle } from './components/block-list/layout';
|
|
20
|
+
import BlockManager from './components/block-manager';
|
|
21
21
|
import { BlockRemovalWarningModal } from './components/block-removal-warning-modal';
|
|
22
22
|
import {
|
|
23
23
|
setBackgroundStyleDefaults,
|
|
@@ -48,8 +48,8 @@ import { PrivatePublishDateTimePicker } from './components/publish-date-time-pic
|
|
|
48
48
|
import useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';
|
|
49
49
|
import useBlockDisplayTitle from './components/block-title/use-block-display-title';
|
|
50
50
|
import TabbedSidebar from './components/tabbed-sidebar';
|
|
51
|
-
import
|
|
52
|
-
import
|
|
51
|
+
import CommentIconSlotFill from './components/collab/block-comment-icon-slot';
|
|
52
|
+
import CommentIconToolbarSlotFill from './components/collab/block-comment-icon-toolbar-slot';
|
|
53
53
|
/**
|
|
54
54
|
* Private @wordpress/block-editor APIs.
|
|
55
55
|
*/
|
|
@@ -66,11 +66,11 @@ lock( privateApis, {
|
|
|
66
66
|
normalizeString,
|
|
67
67
|
PrivateListView,
|
|
68
68
|
ResizableBoxPopover,
|
|
69
|
-
BlockInfo,
|
|
70
69
|
useHasBlockToolbar,
|
|
71
70
|
cleanEmptyObject,
|
|
72
71
|
BlockQuickNavigation,
|
|
73
72
|
LayoutStyle,
|
|
73
|
+
BlockManager,
|
|
74
74
|
BlockRemovalWarningModal,
|
|
75
75
|
useLayoutClasses,
|
|
76
76
|
useLayoutStyles,
|
|
@@ -95,6 +95,6 @@ lock( privateApis, {
|
|
|
95
95
|
__unstableBlockStyleVariationOverridesWithConfig,
|
|
96
96
|
setBackgroundStyleDefaults,
|
|
97
97
|
sectionRootClientIdKey,
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
CommentIconSlotFill,
|
|
99
|
+
CommentIconToolbarSlotFill,
|
|
100
100
|
} );
|
|
@@ -330,7 +330,7 @@ function mapUserPattern(
|
|
|
330
330
|
id: userPattern.id,
|
|
331
331
|
type: INSERTER_PATTERN_TYPES.user,
|
|
332
332
|
title: userPattern.title.raw,
|
|
333
|
-
categories: userPattern.wp_pattern_category
|
|
333
|
+
categories: userPattern.wp_pattern_category?.map( ( catId ) => {
|
|
334
334
|
const category = __experimentalUserPatternCategories.find(
|
|
335
335
|
( { id } ) => id === catId
|
|
336
336
|
);
|
package/src/store/selectors.js
CHANGED
|
@@ -2774,6 +2774,9 @@ export function isNavigationMode( state ) {
|
|
|
2774
2774
|
*/
|
|
2775
2775
|
export const __unstableGetEditorMode = createRegistrySelector(
|
|
2776
2776
|
( select ) => ( state ) => {
|
|
2777
|
+
if ( ! window?.__experimentalEditorWriteMode ) {
|
|
2778
|
+
return 'edit';
|
|
2779
|
+
}
|
|
2777
2780
|
return (
|
|
2778
2781
|
state.settings.editorTool ??
|
|
2779
2782
|
select( preferencesStore ).get( 'core', 'editorTool' )
|
|
@@ -4615,68 +4615,97 @@ describe( 'getBlockEditingMode', () => {
|
|
|
4615
4615
|
).toBe( 'contentOnly' );
|
|
4616
4616
|
} );
|
|
4617
4617
|
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4618
|
+
describe( 'navigation mode', () => {
|
|
4619
|
+
const writeModeExperiment = window.__experimentalEditorWriteMode;
|
|
4620
|
+
beforeAll( () => {
|
|
4621
|
+
window.__experimentalEditorWriteMode = true;
|
|
4622
|
+
} );
|
|
4623
|
+
afterAll( () => {
|
|
4624
|
+
window.__experimentalEditorWriteMode = writeModeExperiment;
|
|
4625
|
+
} );
|
|
4626
|
+
it( 'in navigation mode, the root section container is default', () => {
|
|
4627
|
+
dispatch( preferencesStore ).set(
|
|
4628
|
+
'core',
|
|
4629
|
+
'editorTool',
|
|
4630
|
+
'navigation'
|
|
4631
|
+
);
|
|
4632
|
+
expect(
|
|
4633
|
+
getBlockEditingMode(
|
|
4634
|
+
navigationModeStateWithRootSection,
|
|
4635
|
+
'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337'
|
|
4636
|
+
)
|
|
4637
|
+
).toBe( 'default' );
|
|
4638
|
+
} );
|
|
4627
4639
|
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4640
|
+
it( 'in navigation mode, anything outside the section container is disabled', () => {
|
|
4641
|
+
dispatch( preferencesStore ).set(
|
|
4642
|
+
'core',
|
|
4643
|
+
'editorTool',
|
|
4644
|
+
'navigation'
|
|
4645
|
+
);
|
|
4646
|
+
expect(
|
|
4647
|
+
getBlockEditingMode(
|
|
4648
|
+
navigationModeStateWithRootSection,
|
|
4649
|
+
'6cf70164-9097-4460-bcbf-200560546988'
|
|
4650
|
+
)
|
|
4651
|
+
).toBe( 'disabled' );
|
|
4652
|
+
} );
|
|
4637
4653
|
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4654
|
+
it( 'in navigation mode, sections are contentOnly', () => {
|
|
4655
|
+
dispatch( preferencesStore ).set(
|
|
4656
|
+
'core',
|
|
4657
|
+
'editorTool',
|
|
4658
|
+
'navigation'
|
|
4659
|
+
);
|
|
4660
|
+
expect(
|
|
4661
|
+
getBlockEditingMode(
|
|
4662
|
+
navigationModeStateWithRootSection,
|
|
4663
|
+
'b26fc763-417d-4f01-b81c-2ec61e14a972'
|
|
4664
|
+
)
|
|
4665
|
+
).toBe( 'contentOnly' );
|
|
4666
|
+
expect(
|
|
4667
|
+
getBlockEditingMode(
|
|
4668
|
+
navigationModeStateWithRootSection,
|
|
4669
|
+
'9b9c5c3f-2e46-4f02-9e14-9fe9515b958f'
|
|
4670
|
+
)
|
|
4671
|
+
).toBe( 'contentOnly' );
|
|
4672
|
+
} );
|
|
4653
4673
|
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4674
|
+
it( 'in navigation mode, blocks with content attributes within sections are contentOnly', () => {
|
|
4675
|
+
dispatch( preferencesStore ).set(
|
|
4676
|
+
'core',
|
|
4677
|
+
'editorTool',
|
|
4678
|
+
'navigation'
|
|
4679
|
+
);
|
|
4680
|
+
hasContentRoleAttribute.mockReturnValueOnce( true );
|
|
4681
|
+
expect(
|
|
4682
|
+
getBlockEditingMode(
|
|
4683
|
+
navigationModeStateWithRootSection,
|
|
4684
|
+
'b3247f75-fd94-4fef-97f9-5bfd162cc416'
|
|
4685
|
+
)
|
|
4686
|
+
).toBe( 'contentOnly' );
|
|
4663
4687
|
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4688
|
+
hasContentRoleAttribute.mockReturnValueOnce( true );
|
|
4689
|
+
expect(
|
|
4690
|
+
getBlockEditingMode(
|
|
4691
|
+
navigationModeStateWithRootSection,
|
|
4692
|
+
'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c'
|
|
4693
|
+
)
|
|
4694
|
+
).toBe( 'contentOnly' );
|
|
4695
|
+
} );
|
|
4672
4696
|
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4697
|
+
it( 'in navigation mode, blocks without content attributes within sections are disabled', () => {
|
|
4698
|
+
dispatch( preferencesStore ).set(
|
|
4699
|
+
'core',
|
|
4700
|
+
'editorTool',
|
|
4701
|
+
'navigation'
|
|
4702
|
+
);
|
|
4703
|
+
expect(
|
|
4704
|
+
getBlockEditingMode(
|
|
4705
|
+
navigationModeStateWithRootSection,
|
|
4706
|
+
'9b9c5c3f-2e46-4f02-9e14-9fed515b958s'
|
|
4707
|
+
)
|
|
4708
|
+
).toBe( 'disabled' );
|
|
4709
|
+
} );
|
|
4681
4710
|
} );
|
|
4682
4711
|
} );
|
package/src/style.scss
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
@import "./components/block-card/style.scss";
|
|
11
11
|
@import "./components/block-compare/style.scss";
|
|
12
12
|
@import "./components/block-draggable/style.scss";
|
|
13
|
+
@import "./components/block-manager/style.scss";
|
|
13
14
|
@import "./components/block-mover/style.scss";
|
|
14
15
|
@import "./components/block-navigation/style.scss";
|
|
15
16
|
@import "./components/block-patterns-list/style.scss";
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _components = require("@wordpress/components");
|
|
8
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
9
|
-
var _context = require("../block-edit/context");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
createPrivateSlotFill
|
|
21
|
-
} = (0, _lockUnlock.unlock)(_components.privateApis);
|
|
22
|
-
const {
|
|
23
|
-
Fill,
|
|
24
|
-
Slot
|
|
25
|
-
} = createPrivateSlotFill('BlockInformation');
|
|
26
|
-
const BlockInfo = props => {
|
|
27
|
-
const context = (0, _context.useBlockEditContext)();
|
|
28
|
-
if (!context[_context.mayDisplayControlsKey]) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Fill, {
|
|
32
|
-
...props
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
BlockInfo.Slot = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(Slot, {
|
|
36
|
-
...props
|
|
37
|
-
});
|
|
38
|
-
var _default = exports.default = BlockInfo;
|
|
39
|
-
//# sourceMappingURL=index.js.map
|