@wordpress/block-library 7.3.0 → 7.4.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/archives/edit.js +1 -1
- package/build/archives/edit.js.map +1 -1
- package/build/audio/edit.js +2 -2
- package/build/audio/edit.js.map +1 -1
- package/build/audio/edit.native.js +1 -1
- package/build/audio/edit.native.js.map +1 -1
- package/build/categories/edit.js +8 -3
- package/build/categories/edit.js.map +1 -1
- package/build/categories/index.js +4 -0
- package/build/categories/index.js.map +1 -1
- package/build/column/index.js +10 -0
- package/build/column/index.js.map +1 -1
- package/build/comment-template/edit.js +3 -1
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +14 -4
- package/build/comment-template/hooks.js.map +1 -1
- package/build/comments-pagination/edit.js +18 -1
- package/build/comments-pagination/edit.js.map +1 -1
- package/build/comments-query-loop/edit.js +1 -1
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-title/edit.js +149 -0
- package/build/comments-title/edit.js.map +1 -0
- package/build/comments-title/index.js +101 -0
- package/build/comments-title/index.js.map +1 -0
- package/build/cover/transforms.js +33 -32
- package/build/cover/transforms.js.map +1 -1
- package/build/embed/edit.js +12 -18
- package/build/embed/edit.js.map +1 -1
- package/build/embed/edit.native.js +1 -7
- package/build/embed/edit.native.js.map +1 -1
- package/build/embed/util.js +29 -4
- package/build/embed/util.js.map +1 -1
- package/build/file/inspector.js +2 -4
- package/build/file/inspector.js.map +1 -1
- package/build/gallery/edit.js +1 -1
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/v1/edit.js +1 -1
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/html/edit.js +2 -2
- package/build/html/edit.js.map +1 -1
- package/build/image/edit.js +4 -6
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +1 -1
- package/build/image/image.js.map +1 -1
- package/build/index.js +5 -3
- package/build/index.js.map +1 -1
- package/build/index.native.js +14 -3
- package/build/index.native.js.map +1 -1
- package/build/latest-comments/edit.js +1 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/list/index.js +13 -2
- package/build/list/index.js.map +1 -1
- package/build/loginout/edit.js +1 -1
- package/build/loginout/edit.js.map +1 -1
- package/build/media-text/edit.js +1 -2
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/edit.native.js +1 -1
- package/build/media-text/edit.native.js.map +1 -1
- package/build/navigation/edit/index.js +17 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +7 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation/index.js +1 -1
- package/build/navigation/view-modal.js +37 -0
- package/build/navigation/view-modal.js.map +1 -0
- package/build/navigation/view.js +1 -34
- package/build/navigation/view.js.map +1 -1
- package/build/paragraph/edit.native.js +6 -2
- package/build/paragraph/edit.native.js.map +1 -1
- package/build/post-author/edit.js +1 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comments/index.js +4 -3
- package/build/post-comments/index.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +19 -7
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/query/edit/index.js +84 -22
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/query-placeholder.js +7 -14
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +6 -1
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/quote/index.js +19 -2
- package/build/quote/index.js.map +1 -1
- package/build/quote/v2/edit.js +11 -3
- package/build/quote/v2/edit.js.map +1 -1
- package/build/rss/edit.js +1 -1
- package/build/rss/edit.js.map +1 -1
- package/build/search/edit.js +11 -9
- package/build/search/edit.js.map +1 -1
- package/build/spacer/constants.js +9 -0
- package/build/spacer/constants.js.map +1 -0
- package/build/spacer/controls.js +3 -3
- package/build/spacer/controls.js.map +1 -1
- package/build/spacer/controls.native.js +2 -2
- package/build/spacer/controls.native.js.map +1 -1
- package/build/spacer/edit.js +5 -6
- package/build/spacer/edit.js.map +1 -1
- package/build/table/edit.js +8 -2
- package/build/table/edit.js.map +1 -1
- package/build/tag-cloud/edit.js +1 -1
- package/build/tag-cloud/edit.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/edit.native.js +1 -1
- package/build/video/edit.native.js.map +1 -1
- package/build-module/archives/edit.js +1 -1
- package/build-module/archives/edit.js.map +1 -1
- package/build-module/audio/edit.js +2 -2
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/audio/edit.native.js +1 -1
- package/build-module/audio/edit.native.js.map +1 -1
- package/build-module/categories/edit.js +8 -3
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/categories/index.js +4 -0
- package/build-module/categories/index.js.map +1 -1
- package/build-module/column/index.js +10 -0
- package/build-module/column/index.js.map +1 -1
- package/build-module/comment-template/edit.js +3 -1
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +14 -4
- package/build-module/comment-template/hooks.js.map +1 -1
- package/build-module/comments-pagination/edit.js +19 -2
- package/build-module/comments-pagination/edit.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +1 -1
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-title/edit.js +133 -0
- package/build-module/comments-title/edit.js.map +1 -0
- package/build-module/comments-title/index.js +88 -0
- package/build-module/comments-title/index.js.map +1 -0
- package/build-module/cover/transforms.js +33 -32
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/embed/edit.js +13 -19
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/embed/edit.native.js +2 -8
- package/build-module/embed/edit.native.js.map +1 -1
- package/build-module/embed/util.js +25 -3
- package/build-module/embed/util.js.map +1 -1
- package/build-module/file/inspector.js +2 -4
- package/build-module/file/inspector.js.map +1 -1
- package/build-module/gallery/edit.js +1 -1
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/v1/edit.js +1 -1
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/html/edit.js +2 -2
- package/build-module/html/edit.js.map +1 -1
- package/build-module/image/edit.js +4 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +1 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/index.js +4 -3
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +14 -3
- package/build-module/index.native.js.map +1 -1
- package/build-module/latest-comments/edit.js +1 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/list/index.js +9 -3
- package/build-module/list/index.js.map +1 -1
- package/build-module/loginout/edit.js +1 -1
- package/build-module/loginout/edit.js.map +1 -1
- package/build-module/media-text/edit.js +1 -2
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/edit.native.js +1 -1
- package/build-module/media-text/edit.native.js.map +1 -1
- package/build-module/navigation/edit/index.js +17 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +6 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +1 -1
- package/build-module/navigation/view-modal.js +32 -0
- package/build-module/navigation/view-modal.js.map +1 -0
- package/build-module/navigation/view.js +1 -30
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/paragraph/edit.native.js +6 -2
- package/build-module/paragraph/edit.native.js.map +1 -1
- package/build-module/post-author/edit.js +1 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comments/index.js +4 -3
- package/build-module/post-comments/index.js.map +1 -1
- package/build-module/post-excerpt/edit.js +1 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +19 -7
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/query/edit/index.js +87 -26
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +8 -15
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +6 -1
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/quote/index.js +10 -4
- package/build-module/quote/index.js.map +1 -1
- package/build-module/quote/v2/edit.js +10 -3
- package/build-module/quote/v2/edit.js.map +1 -1
- package/build-module/rss/edit.js +1 -1
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/search/edit.js +11 -9
- package/build-module/search/edit.js.map +1 -1
- package/build-module/spacer/constants.js +2 -0
- package/build-module/spacer/constants.js.map +1 -0
- package/build-module/spacer/controls.js +2 -2
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/spacer/controls.native.js +1 -1
- package/build-module/spacer/controls.native.js.map +1 -1
- package/build-module/spacer/edit.js +1 -1
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table/edit.js +9 -3
- package/build-module/table/edit.js.map +1 -1
- package/build-module/tag-cloud/edit.js +1 -1
- package/build-module/tag-cloud/edit.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/edit.native.js +1 -1
- package/build-module/video/edit.native.js.map +1 -1
- package/build-style/comments-title/editor-rtl.css +79 -0
- package/build-style/comments-title/editor.css +79 -0
- package/build-style/common-rtl.css +32 -0
- package/build-style/common.css +32 -0
- package/build-style/editor-rtl.css +51 -0
- package/build-style/editor.css +51 -0
- package/build-style/post-comments-form/style-rtl.css +9 -0
- package/build-style/post-comments-form/style.css +9 -0
- package/build-style/query/editor-rtl.css +39 -0
- package/build-style/query/editor.css +39 -0
- package/build-style/style-rtl.css +79 -0
- package/build-style/style.css +79 -0
- package/build-style/table/editor-rtl.css +8 -0
- package/build-style/table/editor.css +8 -0
- package/build-style/table/style-rtl.css +38 -0
- package/build-style/table/style.css +38 -0
- package/package.json +28 -28
- package/src/archives/edit.js +1 -1
- package/src/audio/edit.js +2 -2
- package/src/audio/edit.native.js +1 -1
- package/src/categories/block.json +4 -0
- package/src/categories/edit.js +8 -2
- package/src/categories/index.php +1 -0
- package/src/column/block.json +10 -0
- package/src/comment-template/edit.js +5 -2
- package/src/comment-template/hooks.js +15 -2
- package/src/comment-template/index.php +23 -2
- package/src/comments-pagination/edit.js +23 -0
- package/src/comments-query-loop/edit.js +1 -0
- package/src/comments-title/block.json +70 -0
- package/src/comments-title/edit.js +197 -0
- package/src/comments-title/editor.scss +4 -0
- package/src/comments-title/index.js +18 -0
- package/src/comments-title/index.php +68 -0
- package/src/common.scss +24 -1
- package/src/cover/transforms.js +51 -28
- package/src/editor.scss +1 -0
- package/src/embed/edit.js +19 -24
- package/src/embed/edit.native.js +9 -14
- package/src/embed/util.js +34 -2
- package/src/file/inspector.js +1 -3
- package/src/gallery/edit.js +1 -1
- package/src/gallery/v1/edit.js +1 -1
- package/src/html/edit.js +2 -2
- package/src/image/edit.js +2 -4
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +1 -1
- package/src/index.js +7 -1
- package/src/index.native.js +12 -2
- package/src/latest-comments/edit.js +1 -1
- package/src/list/index.js +7 -3
- package/src/loginout/edit.js +1 -1
- package/src/media-text/edit.js +1 -2
- package/src/media-text/edit.native.js +1 -1
- package/src/navigation/block.json +1 -1
- package/src/navigation/edit/index.js +24 -0
- package/src/navigation/edit/navigation-menu-selector.js +15 -9
- package/src/navigation/edit/unsaved-inner-blocks.js +5 -4
- package/src/navigation/index.php +5 -0
- package/src/navigation/view-modal.js +36 -0
- package/src/navigation/view.js +0 -35
- package/src/paragraph/edit.native.js +13 -1
- package/src/post-author/edit.js +1 -1
- package/src/post-comments/block.json +4 -3
- package/src/post-comments-form/index.php +12 -4
- package/src/post-comments-form/style.scss +11 -0
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/edit.js +24 -12
- package/src/query/edit/index.js +125 -26
- package/src/query/edit/query-placeholder.js +3 -13
- package/src/query/edit/query-toolbar.js +6 -0
- package/src/query/editor.scss +38 -0
- package/src/quote/index.js +8 -4
- package/src/quote/v2/edit.js +3 -0
- package/src/rss/edit.js +1 -1
- package/src/search/edit.js +13 -7
- package/src/search/index.php +84 -33
- package/src/spacer/constants.js +1 -0
- package/src/spacer/controls.js +2 -2
- package/src/spacer/controls.native.js +1 -1
- package/src/spacer/edit.js +1 -2
- package/src/table/edit.js +11 -2
- package/src/table/editor.scss +13 -0
- package/src/table/style.scss +52 -0
- package/src/tag-cloud/edit.js +1 -1
- package/src/video/edit.js +1 -1
- package/src/video/edit.native.js +1 -1
package/src/query/edit/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { cloneBlock } from '@wordpress/blocks';
|
|
5
|
+
import { store as blocksStore, cloneBlock } from '@wordpress/blocks';
|
|
6
6
|
import { useInstanceId } from '@wordpress/compose';
|
|
7
|
-
import { useEffect } from '@wordpress/element';
|
|
7
|
+
import { useState, useEffect } from '@wordpress/element';
|
|
8
8
|
import {
|
|
9
9
|
BlockControls,
|
|
10
10
|
InspectorControls,
|
|
@@ -12,9 +12,15 @@ import {
|
|
|
12
12
|
useSetting,
|
|
13
13
|
store as blockEditorStore,
|
|
14
14
|
useInnerBlocksProps,
|
|
15
|
+
__experimentalGetMatchingVariation as getMatchingVariation,
|
|
15
16
|
__experimentalBlockPatternSetup as BlockPatternSetup,
|
|
16
17
|
} from '@wordpress/block-editor';
|
|
17
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
Button,
|
|
20
|
+
SelectControl,
|
|
21
|
+
Placeholder,
|
|
22
|
+
Modal,
|
|
23
|
+
} from '@wordpress/components';
|
|
18
24
|
import { __ } from '@wordpress/i18n';
|
|
19
25
|
|
|
20
26
|
/**
|
|
@@ -27,7 +33,11 @@ import { DEFAULTS_POSTS_PER_PAGE } from '../constants';
|
|
|
27
33
|
import { getFirstQueryClientIdFromBlocks } from '../utils';
|
|
28
34
|
|
|
29
35
|
const TEMPLATE = [ [ 'core/post-template' ] ];
|
|
30
|
-
export function QueryContent( {
|
|
36
|
+
export function QueryContent( {
|
|
37
|
+
attributes,
|
|
38
|
+
setAttributes,
|
|
39
|
+
openPatternSelectionModal,
|
|
40
|
+
} ) {
|
|
31
41
|
const {
|
|
32
42
|
queryId,
|
|
33
43
|
query,
|
|
@@ -102,6 +112,7 @@ export function QueryContent( { attributes, setAttributes } ) {
|
|
|
102
112
|
attributes={ attributes }
|
|
103
113
|
setQuery={ updateQuery }
|
|
104
114
|
setDisplayLayout={ updateDisplayLayout }
|
|
115
|
+
openPatternSelectionModal={ openPatternSelectionModal }
|
|
105
116
|
/>
|
|
106
117
|
</BlockControls>
|
|
107
118
|
<InspectorControls __experimentalGroup="advanced">
|
|
@@ -124,43 +135,131 @@ export function QueryContent( { attributes, setAttributes } ) {
|
|
|
124
135
|
);
|
|
125
136
|
}
|
|
126
137
|
|
|
127
|
-
function QueryPatternSetup(
|
|
128
|
-
|
|
138
|
+
function QueryPatternSetup( {
|
|
139
|
+
attributes,
|
|
140
|
+
clientId,
|
|
141
|
+
name,
|
|
142
|
+
openPatternSelectionModal,
|
|
143
|
+
setAttributes,
|
|
144
|
+
} ) {
|
|
145
|
+
const [ isStartingBlank, setIsStartingBlank ] = useState( false );
|
|
129
146
|
const blockProps = useBlockProps();
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
147
|
+
|
|
148
|
+
const { blockType, allVariations, hasPatterns } = useSelect(
|
|
149
|
+
( select ) => {
|
|
150
|
+
const { getBlockVariations, getBlockType } = select( blocksStore );
|
|
151
|
+
const {
|
|
152
|
+
getBlockRootClientId,
|
|
153
|
+
__experimentalGetPatternsByBlockTypes,
|
|
154
|
+
} = select( blockEditorStore );
|
|
155
|
+
const rootClientId = getBlockRootClientId( clientId );
|
|
156
|
+
|
|
157
|
+
return {
|
|
158
|
+
blockType: getBlockType( name ),
|
|
159
|
+
allVariations: getBlockVariations( name ),
|
|
160
|
+
hasPatterns: !! __experimentalGetPatternsByBlockTypes(
|
|
161
|
+
name,
|
|
162
|
+
rootClientId
|
|
163
|
+
).length,
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
[ name, clientId ]
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
const matchingVariation = getMatchingVariation( attributes, allVariations );
|
|
170
|
+
const icon = matchingVariation?.icon || blockType?.icon?.src;
|
|
171
|
+
const label = matchingVariation?.title || blockType?.title;
|
|
172
|
+
if ( isStartingBlank ) {
|
|
173
|
+
return (
|
|
174
|
+
<QueryPlaceholder
|
|
175
|
+
clientId={ clientId }
|
|
176
|
+
name={ name }
|
|
177
|
+
setAttributes={ setAttributes }
|
|
178
|
+
icon={ icon }
|
|
179
|
+
label={ label }
|
|
180
|
+
/>
|
|
135
181
|
);
|
|
136
|
-
|
|
137
|
-
if ( firstQueryClientId ) {
|
|
138
|
-
selectBlock( firstQueryClientId );
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
// `startBlankComponent` is what to render when clicking `Start blank`
|
|
142
|
-
// or if no matched patterns are found.
|
|
182
|
+
}
|
|
143
183
|
return (
|
|
144
184
|
<div { ...blockProps }>
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
185
|
+
<Placeholder
|
|
186
|
+
icon={ icon }
|
|
187
|
+
label={ label }
|
|
188
|
+
instructions={ __(
|
|
189
|
+
'Choose a pattern for the query loop or start blank.'
|
|
190
|
+
) }
|
|
191
|
+
>
|
|
192
|
+
{ !! hasPatterns && (
|
|
193
|
+
<Button
|
|
194
|
+
variant="primary"
|
|
195
|
+
onClick={ openPatternSelectionModal }
|
|
196
|
+
>
|
|
197
|
+
{ __( 'Choose' ) }
|
|
198
|
+
</Button>
|
|
199
|
+
) }
|
|
200
|
+
|
|
201
|
+
<Button
|
|
202
|
+
variant="secondary"
|
|
203
|
+
onClick={ () => {
|
|
204
|
+
setIsStartingBlank( true );
|
|
205
|
+
} }
|
|
206
|
+
>
|
|
207
|
+
{ __( 'Start blank' ) }
|
|
208
|
+
</Button>
|
|
209
|
+
</Placeholder>
|
|
151
210
|
</div>
|
|
152
211
|
);
|
|
153
212
|
}
|
|
154
213
|
|
|
155
214
|
const QueryEdit = ( props ) => {
|
|
156
|
-
const { clientId } = props;
|
|
215
|
+
const { clientId, name } = props;
|
|
216
|
+
const [
|
|
217
|
+
isPatternSelectionModalOpen,
|
|
218
|
+
setIsPatternSelectionModalOpen,
|
|
219
|
+
] = useState( false );
|
|
220
|
+
const { replaceBlock, selectBlock } = useDispatch( blockEditorStore );
|
|
157
221
|
const hasInnerBlocks = useSelect(
|
|
158
222
|
( select ) =>
|
|
159
223
|
!! select( blockEditorStore ).getBlocks( clientId ).length,
|
|
160
224
|
[ clientId ]
|
|
161
225
|
);
|
|
162
226
|
const Component = hasInnerBlocks ? QueryContent : QueryPatternSetup;
|
|
163
|
-
|
|
227
|
+
const onBlockPatternSelect = ( blocks ) => {
|
|
228
|
+
const clonedBlocks = blocks.map( ( block ) => cloneBlock( block ) );
|
|
229
|
+
const firstQueryClientId = getFirstQueryClientIdFromBlocks(
|
|
230
|
+
clonedBlocks
|
|
231
|
+
);
|
|
232
|
+
replaceBlock( clientId, clonedBlocks );
|
|
233
|
+
if ( firstQueryClientId ) {
|
|
234
|
+
selectBlock( firstQueryClientId );
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
return (
|
|
238
|
+
<>
|
|
239
|
+
<Component
|
|
240
|
+
{ ...props }
|
|
241
|
+
openPatternSelectionModal={ () =>
|
|
242
|
+
setIsPatternSelectionModalOpen( true )
|
|
243
|
+
}
|
|
244
|
+
/>
|
|
245
|
+
{ isPatternSelectionModalOpen && (
|
|
246
|
+
<Modal
|
|
247
|
+
className="block-editor-query-pattern__selection-modal"
|
|
248
|
+
title={ __( 'Choose a pattern' ) }
|
|
249
|
+
closeLabel={ __( 'Cancel' ) }
|
|
250
|
+
onRequestClose={ () =>
|
|
251
|
+
setIsPatternSelectionModalOpen( false )
|
|
252
|
+
}
|
|
253
|
+
>
|
|
254
|
+
<BlockPatternSetup
|
|
255
|
+
blockName={ name }
|
|
256
|
+
clientId={ clientId }
|
|
257
|
+
onBlockPatternSelect={ onBlockPatternSelect }
|
|
258
|
+
/>
|
|
259
|
+
</Modal>
|
|
260
|
+
) }
|
|
261
|
+
</>
|
|
262
|
+
);
|
|
164
263
|
};
|
|
165
264
|
|
|
166
265
|
export default QueryEdit;
|
|
@@ -5,7 +5,6 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
5
5
|
import {
|
|
6
6
|
useBlockProps,
|
|
7
7
|
__experimentalBlockVariationPicker,
|
|
8
|
-
__experimentalGetMatchingVariation as getMatchingVariation,
|
|
9
8
|
store as blockEditorStore,
|
|
10
9
|
} from '@wordpress/block-editor';
|
|
11
10
|
import {
|
|
@@ -13,13 +12,8 @@ import {
|
|
|
13
12
|
store as blocksStore,
|
|
14
13
|
} from '@wordpress/blocks';
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
blockType,
|
|
19
|
-
defaultVariation,
|
|
20
|
-
scopeVariations,
|
|
21
|
-
allVariations,
|
|
22
|
-
} = useSelect(
|
|
15
|
+
function QueryPlaceholder( { clientId, name, setAttributes, icon, label } ) {
|
|
16
|
+
const { defaultVariation, scopeVariations } = useSelect(
|
|
23
17
|
( select ) => {
|
|
24
18
|
const {
|
|
25
19
|
getBlockVariations,
|
|
@@ -31,16 +25,12 @@ const QueryPlaceholder = ( { clientId, name, attributes, setAttributes } ) => {
|
|
|
31
25
|
blockType: getBlockType( name ),
|
|
32
26
|
defaultVariation: getDefaultBlockVariation( name, 'block' ),
|
|
33
27
|
scopeVariations: getBlockVariations( name, 'block' ),
|
|
34
|
-
allVariations: getBlockVariations( name ),
|
|
35
28
|
};
|
|
36
29
|
},
|
|
37
30
|
[ name ]
|
|
38
31
|
);
|
|
39
32
|
const { replaceInnerBlocks } = useDispatch( blockEditorStore );
|
|
40
33
|
const blockProps = useBlockProps();
|
|
41
|
-
const matchingVariation = getMatchingVariation( attributes, allVariations );
|
|
42
|
-
const icon = matchingVariation?.icon || blockType?.icon?.src;
|
|
43
|
-
const label = matchingVariation?.title || blockType?.title;
|
|
44
34
|
return (
|
|
45
35
|
<div { ...blockProps }>
|
|
46
36
|
<__experimentalBlockVariationPicker
|
|
@@ -64,6 +54,6 @@ const QueryPlaceholder = ( { clientId, name, attributes, setAttributes } ) => {
|
|
|
64
54
|
/>
|
|
65
55
|
</div>
|
|
66
56
|
);
|
|
67
|
-
}
|
|
57
|
+
}
|
|
68
58
|
|
|
69
59
|
export default QueryPlaceholder;
|
|
@@ -16,6 +16,7 @@ export default function QueryToolbar( {
|
|
|
16
16
|
attributes: { query, displayLayout },
|
|
17
17
|
setQuery,
|
|
18
18
|
setDisplayLayout,
|
|
19
|
+
openPatternSelectionModal,
|
|
19
20
|
} ) {
|
|
20
21
|
const maxPageInputId = useInstanceId(
|
|
21
22
|
QueryToolbar,
|
|
@@ -128,6 +129,11 @@ export default function QueryToolbar( {
|
|
|
128
129
|
/>
|
|
129
130
|
</ToolbarGroup>
|
|
130
131
|
) }
|
|
132
|
+
<ToolbarGroup className="wp-block-template-part__block-control-group">
|
|
133
|
+
<ToolbarButton onClick={ openPatternSelectionModal }>
|
|
134
|
+
{ __( 'Replace' ) }
|
|
135
|
+
</ToolbarButton>
|
|
136
|
+
</ToolbarGroup>
|
|
131
137
|
<ToolbarGroup controls={ displayLayoutControls } />
|
|
132
138
|
</>
|
|
133
139
|
);
|
package/src/query/editor.scss
CHANGED
|
@@ -5,3 +5,41 @@
|
|
|
5
5
|
.wp-block-query__create-new-link {
|
|
6
6
|
padding: 0 $grid-unit-20 $grid-unit-20 56px;
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
.block-library-query__pattern-selection-content .block-editor-block-patterns-list {
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
12
|
+
grid-gap: $grid-unit-10;
|
|
13
|
+
|
|
14
|
+
.block-editor-block-patterns-list__list-item {
|
|
15
|
+
margin-bottom: 0;
|
|
16
|
+
.block-editor-block-preview__container {
|
|
17
|
+
max-height: 250px;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.block-editor-query-pattern__selection-modal .components-modal__content {
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
padding: 0;
|
|
25
|
+
&::before {
|
|
26
|
+
margin-bottom: 0;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.block-editor-query-pattern__selection-modal {
|
|
31
|
+
// To keep modal dimensions consistent as subsections are navigated, width
|
|
32
|
+
// and height are used instead of max-(width/height).
|
|
33
|
+
@include break-small() {
|
|
34
|
+
width: calc(100% - #{ $grid-unit-20 * 2 });
|
|
35
|
+
height: calc(100% - #{ $header-height * 2 });
|
|
36
|
+
}
|
|
37
|
+
@include break-medium() {
|
|
38
|
+
width: $break-medium - $grid-unit-20 * 2;
|
|
39
|
+
}
|
|
40
|
+
@include break-large() {
|
|
41
|
+
height: 80%;
|
|
42
|
+
width: 80%;
|
|
43
|
+
max-height: none;
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/quote/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import settingsV2 from './v2';
|
|
|
16
16
|
|
|
17
17
|
const { name } = metadata;
|
|
18
18
|
|
|
19
|
-
export { metadata, name };
|
|
19
|
+
export { metadata, name, settingsV2 };
|
|
20
20
|
|
|
21
21
|
export const settingsV1 = {
|
|
22
22
|
icon,
|
|
@@ -53,6 +53,10 @@ export const settingsV1 = {
|
|
|
53
53
|
deprecated,
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
let settings = settingsV1;
|
|
57
|
+
if ( process.env.IS_GUTENBERG_PLUGIN ) {
|
|
58
|
+
settings = window?.__experimentalEnableQuoteBlockV2
|
|
59
|
+
? settingsV2
|
|
60
|
+
: settingsV1;
|
|
61
|
+
}
|
|
62
|
+
export { settings };
|
package/src/quote/v2/edit.js
CHANGED
|
@@ -74,6 +74,7 @@ export default function QuoteEdit( {
|
|
|
74
74
|
insertBlocksAfter,
|
|
75
75
|
clientId,
|
|
76
76
|
className,
|
|
77
|
+
style,
|
|
77
78
|
} ) {
|
|
78
79
|
const { citation, align } = attributes;
|
|
79
80
|
|
|
@@ -88,6 +89,7 @@ export default function QuoteEdit( {
|
|
|
88
89
|
className: classNames( className, {
|
|
89
90
|
[ `has-text-align-${ align }` ]: align,
|
|
90
91
|
} ),
|
|
92
|
+
...( ! isWebPlatform && { style } ),
|
|
91
93
|
} );
|
|
92
94
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
93
95
|
template: TEMPLATE,
|
|
@@ -128,6 +130,7 @@ export default function QuoteEdit( {
|
|
|
128
130
|
__unstableOnSplitAtEnd={ () =>
|
|
129
131
|
insertBlocksAfter( createBlock( 'core/paragraph' ) )
|
|
130
132
|
}
|
|
133
|
+
{ ...( ! isWebPlatform ? { textAlign: align } : {} ) }
|
|
131
134
|
/>
|
|
132
135
|
) }
|
|
133
136
|
</BlockQuotation>
|
package/src/rss/edit.js
CHANGED
|
@@ -109,7 +109,7 @@ export default function RSSEdit( { attributes, setAttributes } ) {
|
|
|
109
109
|
<ToolbarGroup controls={ toolbarControls } />
|
|
110
110
|
</BlockControls>
|
|
111
111
|
<InspectorControls>
|
|
112
|
-
<PanelBody title={ __( '
|
|
112
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
113
113
|
<RangeControl
|
|
114
114
|
label={ __( 'Number of items' ) }
|
|
115
115
|
value={ itemsToShow }
|
package/src/search/edit.js
CHANGED
|
@@ -103,8 +103,6 @@ export default function SearchEdit( {
|
|
|
103
103
|
} );
|
|
104
104
|
}, [ insertedInNavigationBlock ] );
|
|
105
105
|
const borderRadius = style?.border?.radius;
|
|
106
|
-
const borderColor = style?.border?.color;
|
|
107
|
-
const borderWidth = style?.border?.width;
|
|
108
106
|
const borderProps = useBorderProps( attributes );
|
|
109
107
|
|
|
110
108
|
// Check for old deprecated numerical border radius. Done as a separate
|
|
@@ -392,10 +390,18 @@ export default function SearchEdit( {
|
|
|
392
390
|
radius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;
|
|
393
391
|
|
|
394
392
|
const getWrapperStyles = () => {
|
|
395
|
-
const styles =
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
393
|
+
const styles = isButtonPositionInside
|
|
394
|
+
? borderProps.style
|
|
395
|
+
: {
|
|
396
|
+
borderRadius: borderProps.style?.borderRadius,
|
|
397
|
+
borderTopLeftRadius: borderProps.style?.borderTopLeftRadius,
|
|
398
|
+
borderTopRightRadius:
|
|
399
|
+
borderProps.style?.borderTopRightRadius,
|
|
400
|
+
borderBottomLeftRadius:
|
|
401
|
+
borderProps.style?.borderBottomLeftRadius,
|
|
402
|
+
borderBottomRightRadius:
|
|
403
|
+
borderProps.style?.borderBottomRightRadius,
|
|
404
|
+
};
|
|
399
405
|
|
|
400
406
|
const isNonZeroBorderRadius =
|
|
401
407
|
borderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;
|
|
@@ -417,11 +423,11 @@ export default function SearchEdit( {
|
|
|
417
423
|
} = borderRadius;
|
|
418
424
|
|
|
419
425
|
return {
|
|
426
|
+
...styles,
|
|
420
427
|
borderTopLeftRadius: padBorderRadius( topLeft ),
|
|
421
428
|
borderTopRightRadius: padBorderRadius( topRight ),
|
|
422
429
|
borderBottomLeftRadius: padBorderRadius( bottomLeft ),
|
|
423
430
|
borderBottomRightRadius: padBorderRadius( bottomRight ),
|
|
424
|
-
...styles,
|
|
425
431
|
};
|
|
426
432
|
}
|
|
427
433
|
|
package/src/search/index.php
CHANGED
|
@@ -171,6 +171,75 @@ function classnames_for_block_core_search( $attributes ) {
|
|
|
171
171
|
return implode( ' ', $classnames );
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
+
/**
|
|
175
|
+
* This generates a CSS rule for the given border property and side if provided.
|
|
176
|
+
* Based on whether the Search block is configured to display the button inside
|
|
177
|
+
* or not, the generated rule is injected into the appropriate collection of
|
|
178
|
+
* styles for later application in the block's markup.
|
|
179
|
+
*
|
|
180
|
+
* @param array $attributes The block attributes.
|
|
181
|
+
* @param string $property Border property to generate rule for e.g. width or color.
|
|
182
|
+
* @param string $side Optional side border. The dictates the value retrieved and final CSS property.
|
|
183
|
+
* @param array $wrapper_styles Current collection of wrapper styles.
|
|
184
|
+
* @param array $button_styles Current collection of button styles.
|
|
185
|
+
* @param array $input_styles Current collection of input styles.
|
|
186
|
+
*
|
|
187
|
+
* @return void
|
|
188
|
+
*/
|
|
189
|
+
function apply_block_core_search_border_style( $attributes, $property, $side, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
|
190
|
+
$is_button_inside = 'button-inside' === _wp_array_get( $attributes, array( 'buttonPosition' ), false );
|
|
191
|
+
|
|
192
|
+
$path = array( 'style', 'border', $property );
|
|
193
|
+
|
|
194
|
+
if ( $side ) {
|
|
195
|
+
array_splice( $path, 2, 0, $side );
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
$value = _wp_array_get( $attributes, $path, false );
|
|
199
|
+
|
|
200
|
+
if ( empty( $value ) ) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if ( 'color' === $property && $side ) {
|
|
205
|
+
$has_color_preset = strpos( $value, 'var:preset|color|' ) !== false;
|
|
206
|
+
if ( $has_color_preset ) {
|
|
207
|
+
$named_color_value = substr( $value, strrpos( $value, '|' ) + 1 );
|
|
208
|
+
$value = sprintf( 'var(--wp--preset--color--%s)', $named_color_value );
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
$property_suffix = $side ? sprintf( '%s-%s', $side, $property ) : $property;
|
|
213
|
+
|
|
214
|
+
if ( $is_button_inside ) {
|
|
215
|
+
$wrapper_styles[] = sprintf( 'border-%s: %s;', $property_suffix, esc_attr( $value ) );
|
|
216
|
+
} else {
|
|
217
|
+
$button_styles[] = sprintf( 'border-%s: %s;', $property_suffix, esc_attr( $value ) );
|
|
218
|
+
$input_styles[] = sprintf( 'border-%s: %s;', $property_suffix, esc_attr( $value ) );
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* This adds CSS rules for a given border property e.g. width or color. It
|
|
224
|
+
* injects rules into the provided wrapper, button and input style arrays for
|
|
225
|
+
* uniform "flat" borders or those with individual sides configured.
|
|
226
|
+
*
|
|
227
|
+
* @param array $attributes The block attributes.
|
|
228
|
+
* @param string $property Border property to generate rule for e.g. width or color.
|
|
229
|
+
* @param array $wrapper_styles Current collection of wrapper styles.
|
|
230
|
+
* @param array $button_styles Current collection of button styles.
|
|
231
|
+
* @param array $input_styles Current collection of input styles.
|
|
232
|
+
*
|
|
233
|
+
* @return void
|
|
234
|
+
*/
|
|
235
|
+
function apply_block_core_search_border_styles( $attributes, $property, &$wrapper_styles, &$button_styles, &$input_styles ) {
|
|
236
|
+
apply_block_core_search_border_style( $attributes, $property, null, $wrapper_styles, $button_styles, $input_styles );
|
|
237
|
+
apply_block_core_search_border_style( $attributes, $property, 'top', $wrapper_styles, $button_styles, $input_styles );
|
|
238
|
+
apply_block_core_search_border_style( $attributes, $property, 'right', $wrapper_styles, $button_styles, $input_styles );
|
|
239
|
+
apply_block_core_search_border_style( $attributes, $property, 'bottom', $wrapper_styles, $button_styles, $input_styles );
|
|
240
|
+
apply_block_core_search_border_style( $attributes, $property, 'left', $wrapper_styles, $button_styles, $input_styles );
|
|
241
|
+
}
|
|
242
|
+
|
|
174
243
|
/**
|
|
175
244
|
* Builds an array of inline styles for the search block.
|
|
176
245
|
*
|
|
@@ -201,19 +270,10 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
201
270
|
);
|
|
202
271
|
}
|
|
203
272
|
|
|
204
|
-
// Add border width styles.
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
$border_width = $attributes['style']['border']['width'];
|
|
209
|
-
|
|
210
|
-
if ( $is_button_inside ) {
|
|
211
|
-
$wrapper_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) );
|
|
212
|
-
} else {
|
|
213
|
-
$button_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) );
|
|
214
|
-
$input_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) );
|
|
215
|
-
}
|
|
216
|
-
}
|
|
273
|
+
// Add border width and color styles.
|
|
274
|
+
apply_block_core_search_border_styles( $attributes, 'width', $wrapper_styles, $button_styles, $input_styles );
|
|
275
|
+
apply_block_core_search_border_styles( $attributes, 'color', $wrapper_styles, $button_styles, $input_styles );
|
|
276
|
+
apply_block_core_search_border_styles( $attributes, 'style', $wrapper_styles, $button_styles, $input_styles );
|
|
217
277
|
|
|
218
278
|
// Add border radius styles.
|
|
219
279
|
$has_border_radius = ! empty( $attributes['style']['border']['radius'] );
|
|
@@ -269,21 +329,6 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
269
329
|
}
|
|
270
330
|
}
|
|
271
331
|
|
|
272
|
-
// Add border color styles.
|
|
273
|
-
$has_border_color = ! empty( $attributes['style']['border']['color'] );
|
|
274
|
-
|
|
275
|
-
if ( $has_border_color ) {
|
|
276
|
-
$border_color = $attributes['style']['border']['color'];
|
|
277
|
-
|
|
278
|
-
// Apply wrapper border color if button placed inside.
|
|
279
|
-
if ( $is_button_inside ) {
|
|
280
|
-
$wrapper_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
|
281
|
-
} else {
|
|
282
|
-
$button_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
|
283
|
-
$input_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
332
|
// Add color styles.
|
|
288
333
|
$has_text_color = ! empty( $attributes['style']['color']['text'] );
|
|
289
334
|
if ( $has_text_color ) {
|
|
@@ -315,13 +360,19 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
315
360
|
* @return string The border color classnames to be applied to the block elements.
|
|
316
361
|
*/
|
|
317
362
|
function get_border_color_classes_for_block_core_search( $attributes ) {
|
|
363
|
+
$border_color_classes = array();
|
|
318
364
|
$has_custom_border_color = ! empty( $attributes['style']['border']['color'] );
|
|
319
|
-
$
|
|
320
|
-
|
|
321
|
-
if ( $has_custom_border_color
|
|
322
|
-
$border_color_classes = 'has-border-color';
|
|
365
|
+
$has_named_border_color = ! empty( $attributes['borderColor'] );
|
|
366
|
+
|
|
367
|
+
if ( $has_custom_border_color || $has_named_border_color ) {
|
|
368
|
+
$border_color_classes[] = 'has-border-color';
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if ( $has_named_border_color ) {
|
|
372
|
+
$border_color_classes[] = sprintf( 'has-%s-border-color', esc_attr( $attributes['borderColor'] ) );
|
|
323
373
|
}
|
|
324
|
-
|
|
374
|
+
|
|
375
|
+
return implode( ' ', $border_color_classes );
|
|
325
376
|
}
|
|
326
377
|
|
|
327
378
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const MIN_SPACER_SIZE = 0;
|
package/src/spacer/controls.js
CHANGED
|
@@ -15,7 +15,7 @@ import { useInstanceId } from '@wordpress/compose';
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
-
import { MIN_SPACER_SIZE } from './
|
|
18
|
+
import { MIN_SPACER_SIZE } from './constants';
|
|
19
19
|
|
|
20
20
|
function DimensionInput( { label, onChange, isResizing, value = '' } ) {
|
|
21
21
|
const inputId = useInstanceId( UnitControl, 'block-spacer-height-input' );
|
|
@@ -75,7 +75,7 @@ export default function SpacerControls( {
|
|
|
75
75
|
} ) {
|
|
76
76
|
return (
|
|
77
77
|
<InspectorControls>
|
|
78
|
-
<PanelBody title={ __( '
|
|
78
|
+
<PanelBody title={ __( 'Settings' ) }>
|
|
79
79
|
{ orientation === 'horizontal' && (
|
|
80
80
|
<DimensionInput
|
|
81
81
|
label={ __( 'Width' ) }
|
|
@@ -14,7 +14,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
import { MIN_SPACER_SIZE } from './
|
|
17
|
+
import { MIN_SPACER_SIZE } from './constants';
|
|
18
18
|
import styles from './style.scss';
|
|
19
19
|
|
|
20
20
|
const DEFAULT_VALUES = { px: 100, em: 10, rem: 10, vw: 10, vh: 25 };
|
package/src/spacer/edit.js
CHANGED
|
@@ -15,8 +15,7 @@ import { View } from '@wordpress/primitives';
|
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
17
|
import SpacerControls from './controls';
|
|
18
|
-
|
|
19
|
-
export const MIN_SPACER_SIZE = 0;
|
|
18
|
+
import { MIN_SPACER_SIZE } from './constants';
|
|
20
19
|
|
|
21
20
|
const ResizableSpacer = ( {
|
|
22
21
|
orientation,
|
package/src/table/edit.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
TextControl,
|
|
26
26
|
ToggleControl,
|
|
27
27
|
ToolbarDropdownMenu,
|
|
28
|
+
__experimentalHasSplitBorders as hasSplitBorders,
|
|
28
29
|
} from '@wordpress/components';
|
|
29
30
|
import {
|
|
30
31
|
alignLeft,
|
|
@@ -451,7 +452,7 @@ function TableEdit( {
|
|
|
451
452
|
{ ! isEmpty && (
|
|
452
453
|
<InspectorControls>
|
|
453
454
|
<PanelBody
|
|
454
|
-
title={ __( '
|
|
455
|
+
title={ __( 'Settings' ) }
|
|
455
456
|
className="blocks-table-settings"
|
|
456
457
|
>
|
|
457
458
|
<ToggleControl
|
|
@@ -477,7 +478,15 @@ function TableEdit( {
|
|
|
477
478
|
className={ classnames(
|
|
478
479
|
colorProps.className,
|
|
479
480
|
borderProps.className,
|
|
480
|
-
{
|
|
481
|
+
{
|
|
482
|
+
'has-fixed-layout': hasFixedLayout,
|
|
483
|
+
// This is required in the editor only to overcome
|
|
484
|
+
// the fact the editor rewrites individual border
|
|
485
|
+
// widths into a shorthand format.
|
|
486
|
+
'has-individual-borders': hasSplitBorders(
|
|
487
|
+
attributes?.style?.border
|
|
488
|
+
),
|
|
489
|
+
}
|
|
481
490
|
) }
|
|
482
491
|
style={ { ...colorProps.style, ...borderProps.style } }
|
|
483
492
|
>
|
package/src/table/editor.scss
CHANGED
|
@@ -43,6 +43,19 @@
|
|
|
43
43
|
figcaption {
|
|
44
44
|
@include caption-style-theme();
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
// This is only required in the editor to overcome the fact the editor
|
|
48
|
+
// rewrites border width styles into shorthand.
|
|
49
|
+
table.has-individual-borders {
|
|
50
|
+
> *,
|
|
51
|
+
tr,
|
|
52
|
+
th,
|
|
53
|
+
td {
|
|
54
|
+
border-width: $border-width;
|
|
55
|
+
border-style: solid;
|
|
56
|
+
border-color: currentColor;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
46
59
|
}
|
|
47
60
|
|
|
48
61
|
.blocks-table__placeholder-form.blocks-table__placeholder-form {
|