@wordpress/block-library 7.0.0 → 7.0.2
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/README.md +16 -0
- package/build/button/edit.native.js +2 -2
- package/build/button/edit.native.js.map +1 -1
- package/build/columns/index.js +12 -0
- package/build/columns/index.js.map +1 -1
- package/build/comment-author-avatar/edit.js +17 -4
- package/build/comment-author-avatar/edit.js.map +1 -1
- package/build/comment-template/edit.js +94 -36
- package/build/comment-template/edit.js.map +1 -1
- package/build/comment-template/hooks.js +175 -0
- package/build/comment-template/hooks.js.map +1 -0
- package/build/comment-template/index.js +1 -1
- package/build/comment-template/util.js.map +1 -1
- package/build/comments-pagination-next/index.js +1 -1
- package/build/comments-pagination-numbers/index.js +1 -1
- package/build/comments-query-loop/edit/comments-inspector-controls.js +20 -9
- package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build/comments-query-loop/edit.js +1 -19
- package/build/comments-query-loop/edit.js.map +1 -1
- package/build/comments-query-loop/index.js +5 -0
- package/build/comments-query-loop/index.js.map +1 -1
- package/build/cover/edit.js +21 -22
- package/build/cover/edit.js.map +1 -1
- package/build/cover/edit.native.js +7 -5
- package/build/cover/edit.native.js.map +1 -1
- package/build/cover/overlay-color-settings.native.js +4 -3
- package/build/cover/overlay-color-settings.native.js.map +1 -1
- package/build/cover/transforms.js +4 -2
- package/build/cover/transforms.js.map +1 -1
- package/build/group/index.js +1 -0
- package/build/group/index.js.map +1 -1
- package/build/heading/edit.js +14 -2
- package/build/heading/edit.js.map +1 -1
- package/build/image/deprecated.js +89 -5
- package/build/image/deprecated.js.map +1 -1
- package/build/image/save.js +0 -7
- package/build/image/save.js.map +1 -1
- package/build/latest-posts/edit.js +1 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/navigation/edit/index.js +17 -15
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +44 -27
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +8 -22
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/use-navigation-menu.js +6 -6
- package/build/navigation/use-navigation-menu.js.map +1 -1
- package/build/navigation-submenu/edit.js +41 -9
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +11 -17
- package/build/page-list/edit.js.map +1 -1
- package/build/social-links/deprecated.js +1 -62
- package/build/social-links/deprecated.js.map +1 -1
- package/build/template-part/edit/index.js +36 -64
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/placeholder.js +64 -0
- package/build/template-part/edit/placeholder.js.map +1 -0
- package/build/template-part/edit/selection-modal.js +103 -0
- package/build/template-part/edit/selection-modal.js.map +1 -0
- package/build/template-part/edit/title-modal.js +54 -0
- package/build/template-part/edit/title-modal.js.map +1 -0
- package/build/template-part/edit/utils/hooks.js +156 -0
- package/build/template-part/edit/utils/hooks.js.map +1 -0
- package/build/template-part/index.js +3 -1
- package/build/template-part/index.js.map +1 -1
- package/build-module/button/edit.native.js +4 -4
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/columns/index.js +12 -0
- package/build-module/columns/index.js.map +1 -1
- package/build-module/comment-author-avatar/edit.js +18 -6
- package/build-module/comment-author-avatar/edit.js.map +1 -1
- package/build-module/comment-template/edit.js +95 -37
- package/build-module/comment-template/edit.js.map +1 -1
- package/build-module/comment-template/hooks.js +156 -0
- package/build-module/comment-template/hooks.js.map +1 -0
- package/build-module/comment-template/index.js +1 -1
- package/build-module/comment-template/util.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -1
- package/build-module/comments-pagination-numbers/index.js +1 -1
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js +20 -9
- package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/comments-query-loop/edit.js +2 -19
- package/build-module/comments-query-loop/edit.js.map +1 -1
- package/build-module/comments-query-loop/index.js +5 -0
- package/build-module/comments-query-loop/index.js.map +1 -1
- package/build-module/cover/edit.js +23 -24
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/cover/edit.native.js +10 -8
- package/build-module/cover/edit.native.js.map +1 -1
- package/build-module/cover/overlay-color-settings.native.js +4 -4
- package/build-module/cover/overlay-color-settings.native.js.map +1 -1
- package/build-module/cover/transforms.js +4 -2
- package/build-module/cover/transforms.js.map +1 -1
- package/build-module/group/index.js +1 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/heading/edit.js +15 -3
- package/build-module/heading/edit.js.map +1 -1
- package/build-module/image/deprecated.js +90 -7
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/save.js +0 -7
- package/build-module/image/save.js.map +1 -1
- package/build-module/latest-posts/edit.js +1 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +17 -15
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +45 -27
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +8 -21
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/use-navigation-menu.js +6 -6
- package/build-module/navigation/use-navigation-menu.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +41 -10
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +12 -18
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/social-links/deprecated.js +1 -62
- package/build-module/social-links/deprecated.js.map +1 -1
- package/build-module/template-part/edit/index.js +37 -65
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/placeholder.js +52 -0
- package/build-module/template-part/edit/placeholder.js.map +1 -0
- package/build-module/template-part/edit/selection-modal.js +89 -0
- package/build-module/template-part/edit/selection-modal.js.map +1 -0
- package/build-module/template-part/edit/title-modal.js +46 -0
- package/build-module/template-part/edit/title-modal.js.map +1 -0
- package/build-module/template-part/edit/utils/hooks.js +135 -0
- package/build-module/template-part/edit/utils/hooks.js.map +1 -0
- package/build-module/template-part/index.js +2 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-style/comment-author-avatar/editor-rtl.css +83 -0
- package/build-style/comment-author-avatar/editor.css +83 -0
- package/build-style/cover/style-rtl.css +4 -0
- package/build-style/cover/style.css +4 -0
- package/build-style/editor-rtl.css +27 -81
- package/build-style/editor.css +27 -81
- package/build-style/image/editor-rtl.css +0 -16
- package/build-style/image/editor.css +0 -16
- package/build-style/image/style-rtl.css +2 -0
- package/build-style/image/style.css +2 -0
- package/build-style/navigation/style-rtl.css +14 -3
- package/build-style/navigation/style.css +14 -3
- package/build-style/page-list/editor-rtl.css +0 -9
- package/build-style/page-list/editor.css +0 -9
- package/build-style/style-rtl.css +20 -3
- package/build-style/style.css +20 -3
- package/build-style/template-part/editor-rtl.css +19 -56
- package/build-style/template-part/editor.css +19 -56
- package/package.json +15 -15
- package/src/archives/index.php +1 -1
- package/src/button/edit.native.js +3 -3
- package/src/columns/block.json +12 -0
- package/src/comment-author-avatar/edit.js +13 -8
- package/src/comment-author-avatar/editor.scss +7 -0
- package/src/comment-template/block.json +7 -1
- package/src/comment-template/edit.js +102 -40
- package/src/comment-template/hooks.js +151 -0
- package/src/comment-template/index.php +8 -0
- package/src/comment-template/util.js +1 -0
- package/src/comments-pagination-next/block.json +8 -1
- package/src/comments-pagination-next/index.php +6 -8
- package/src/comments-pagination-numbers/block.json +7 -1
- package/src/comments-pagination-numbers/index.php +3 -10
- package/src/comments-query-loop/block.json +5 -0
- package/src/comments-query-loop/edit/comments-inspector-controls.js +22 -4
- package/src/comments-query-loop/edit.js +1 -16
- package/src/cover/edit.js +15 -28
- package/src/cover/edit.native.js +15 -7
- package/src/cover/overlay-color-settings.native.js +3 -4
- package/src/cover/style.scss +4 -0
- package/src/cover/transforms.js +2 -0
- package/src/editor.scss +1 -0
- package/src/gallery/index.php +1 -8
- package/src/group/block.json +1 -0
- package/src/heading/edit.js +18 -5
- package/src/home-link/index.php +1 -19
- package/src/image/deprecated.js +105 -1
- package/src/image/editor.scss +0 -18
- package/src/image/save.js +0 -8
- package/src/image/style.scss +3 -0
- package/src/image/test/edit.native.js +0 -10
- package/src/latest-posts/edit.js +1 -0
- package/src/latest-posts/index.php +1 -1
- package/src/navigation/edit/index.js +25 -26
- package/src/navigation/edit/navigation-menu-selector.js +73 -28
- package/src/navigation/edit/placeholder/index.js +8 -32
- package/src/navigation/index.php +4 -4
- package/src/navigation/style.scss +22 -3
- package/src/navigation/use-navigation-menu.js +6 -6
- package/src/navigation-link/index.php +3 -22
- package/src/navigation-submenu/edit.js +50 -12
- package/src/navigation-submenu/index.php +3 -21
- package/src/page-list/edit.js +21 -25
- package/src/page-list/editor.scss +0 -10
- package/src/page-list/index.php +4 -4
- package/src/post-navigation-link/index.php +3 -3
- package/src/search/index.php +6 -3
- package/src/site-logo/index.php +1 -1
- package/src/social-links/deprecated.js +0 -59
- package/src/template-part/edit/index.js +61 -71
- package/src/template-part/edit/placeholder.js +78 -0
- package/src/template-part/edit/selection-modal.js +115 -0
- package/src/template-part/edit/title-modal.js +59 -0
- package/src/template-part/edit/utils/hooks.js +158 -0
- package/src/template-part/editor.scss +16 -74
- package/src/template-part/index.js +4 -1
- package/build/navigation/edit/existing-menus-options.js +0 -62
- package/build/navigation/edit/existing-menus-options.js.map +0 -1
- package/build/template-part/edit/placeholder/index.js +0 -141
- package/build/template-part/edit/placeholder/index.js.map +0 -1
- package/build/template-part/edit/placeholder/patterns-setup.js +0 -100
- package/build/template-part/edit/placeholder/patterns-setup.js.map +0 -1
- package/build/template-part/edit/selection/index.js +0 -45
- package/build/template-part/edit/selection/index.js.map +0 -1
- package/build/template-part/edit/selection/template-part-previews.js +0 -317
- package/build/template-part/edit/selection/template-part-previews.js.map +0 -1
- package/build-module/navigation/edit/existing-menus-options.js +0 -53
- package/build-module/navigation/edit/existing-menus-options.js.map +0 -1
- package/build-module/template-part/edit/placeholder/index.js +0 -124
- package/build-module/template-part/edit/placeholder/index.js.map +0 -1
- package/build-module/template-part/edit/placeholder/patterns-setup.js +0 -91
- package/build-module/template-part/edit/placeholder/patterns-setup.js.map +0 -1
- package/build-module/template-part/edit/selection/index.js +0 -35
- package/build-module/template-part/edit/selection/index.js.map +0 -1
- package/build-module/template-part/edit/selection/template-part-previews.js +0 -298
- package/build-module/template-part/edit/selection/template-part-previews.js.map +0 -1
- package/src/navigation/edit/existing-menus-options.js +0 -70
- package/src/template-part/edit/placeholder/index.js +0 -172
- package/src/template-part/edit/placeholder/patterns-setup.js +0 -124
- package/src/template-part/edit/selection/index.js +0 -37
- package/src/template-part/edit/selection/template-part-previews.js +0 -372
package/src/cover/edit.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
__experimentalBoxControl as BoxControl,
|
|
28
28
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
29
29
|
} from '@wordpress/components';
|
|
30
|
-
import { compose,
|
|
30
|
+
import { compose, useInstanceId } from '@wordpress/compose';
|
|
31
31
|
import {
|
|
32
32
|
BlockControls,
|
|
33
33
|
BlockIcon,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
store as blockEditorStore,
|
|
48
48
|
} from '@wordpress/block-editor';
|
|
49
49
|
import { __ } from '@wordpress/i18n';
|
|
50
|
-
import {
|
|
50
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
51
51
|
import { cover as icon } from '@wordpress/icons';
|
|
52
52
|
import { isBlobURL } from '@wordpress/blob';
|
|
53
53
|
|
|
@@ -310,7 +310,6 @@ function CoverEdit( {
|
|
|
310
310
|
setAttributes,
|
|
311
311
|
setOverlayColor,
|
|
312
312
|
toggleSelection,
|
|
313
|
-
markNextChangeAsNotPersistent,
|
|
314
313
|
} ) {
|
|
315
314
|
const {
|
|
316
315
|
contentPosition,
|
|
@@ -329,6 +328,9 @@ function CoverEdit( {
|
|
|
329
328
|
allowedBlocks,
|
|
330
329
|
templateLock,
|
|
331
330
|
} = attributes;
|
|
331
|
+
const { __unstableMarkNextChangeAsNotPersistent } = useDispatch(
|
|
332
|
+
blockEditorStore
|
|
333
|
+
);
|
|
332
334
|
const {
|
|
333
335
|
gradientClass,
|
|
334
336
|
gradientValue,
|
|
@@ -393,15 +395,13 @@ function CoverEdit( {
|
|
|
393
395
|
|
|
394
396
|
useEffect( () => {
|
|
395
397
|
// This side-effect should not create an undo level.
|
|
396
|
-
|
|
398
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
397
399
|
setAttributes( { isDark: isCoverDark } );
|
|
398
400
|
}, [ isCoverDark ] );
|
|
399
401
|
|
|
400
402
|
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
|
|
401
403
|
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
402
404
|
|
|
403
|
-
const [ temporaryMinHeight, setTemporaryMinHeight ] = useState( null );
|
|
404
|
-
|
|
405
405
|
const minHeightWithUnit = minHeightUnit
|
|
406
406
|
? `${ minHeight }${ minHeightUnit }`
|
|
407
407
|
: minHeight;
|
|
@@ -412,7 +412,7 @@ function CoverEdit( {
|
|
|
412
412
|
...( isImageBackground && ! isImgElement
|
|
413
413
|
? backgroundImageStyles( url )
|
|
414
414
|
: undefined ),
|
|
415
|
-
minHeight:
|
|
415
|
+
minHeight: minHeightWithUnit || undefined,
|
|
416
416
|
};
|
|
417
417
|
|
|
418
418
|
const bgStyle = { backgroundColor: overlayColor.color };
|
|
@@ -593,7 +593,7 @@ function CoverEdit( {
|
|
|
593
593
|
panelId={ clientId }
|
|
594
594
|
>
|
|
595
595
|
<CoverHeightInput
|
|
596
|
-
value={
|
|
596
|
+
value={ minHeight }
|
|
597
597
|
unit={ minHeightUnit }
|
|
598
598
|
onChange={ ( newMinHeight ) =>
|
|
599
599
|
setAttributes( { minHeight: newMinHeight } )
|
|
@@ -646,10 +646,7 @@ function CoverEdit( {
|
|
|
646
646
|
onSelectMedia={ onSelectMedia }
|
|
647
647
|
noticeOperations={ noticeOperations }
|
|
648
648
|
style={ {
|
|
649
|
-
minHeight:
|
|
650
|
-
temporaryMinHeight ||
|
|
651
|
-
minHeightWithUnit ||
|
|
652
|
-
undefined,
|
|
649
|
+
minHeight: minHeightWithUnit || undefined,
|
|
653
650
|
} }
|
|
654
651
|
>
|
|
655
652
|
<div className="wp-block-cover__placeholder-background-options">
|
|
@@ -667,11 +664,12 @@ function CoverEdit( {
|
|
|
667
664
|
setAttributes( { minHeightUnit: 'px' } );
|
|
668
665
|
toggleSelection( false );
|
|
669
666
|
} }
|
|
670
|
-
onResize={
|
|
667
|
+
onResize={ ( value ) => {
|
|
668
|
+
setAttributes( { minHeight: value } );
|
|
669
|
+
} }
|
|
671
670
|
onResizeStop={ ( newMinHeight ) => {
|
|
672
671
|
toggleSelection( true );
|
|
673
672
|
setAttributes( { minHeight: newMinHeight } );
|
|
674
|
-
setTemporaryMinHeight( null );
|
|
675
673
|
} }
|
|
676
674
|
showHandle={ isSelected }
|
|
677
675
|
/>
|
|
@@ -714,11 +712,12 @@ function CoverEdit( {
|
|
|
714
712
|
setAttributes( { minHeightUnit: 'px' } );
|
|
715
713
|
toggleSelection( false );
|
|
716
714
|
} }
|
|
717
|
-
onResize={
|
|
715
|
+
onResize={ ( value ) => {
|
|
716
|
+
setAttributes( { minHeight: value } );
|
|
717
|
+
} }
|
|
718
718
|
onResizeStop={ ( newMinHeight ) => {
|
|
719
719
|
toggleSelection( true );
|
|
720
720
|
setAttributes( { minHeight: newMinHeight } );
|
|
721
|
-
setTemporaryMinHeight( null );
|
|
722
721
|
} }
|
|
723
722
|
showHandle={ isSelected }
|
|
724
723
|
/>
|
|
@@ -777,18 +776,6 @@ function CoverEdit( {
|
|
|
777
776
|
}
|
|
778
777
|
|
|
779
778
|
export default compose( [
|
|
780
|
-
withDispatch( ( dispatch ) => {
|
|
781
|
-
const {
|
|
782
|
-
toggleSelection,
|
|
783
|
-
__unstableMarkNextChangeAsNotPersistent,
|
|
784
|
-
} = dispatch( blockEditorStore );
|
|
785
|
-
|
|
786
|
-
return {
|
|
787
|
-
toggleSelection,
|
|
788
|
-
markNextChangeAsNotPersistent: __unstableMarkNextChangeAsNotPersistent,
|
|
789
|
-
};
|
|
790
|
-
} ),
|
|
791
779
|
withColors( { overlayColor: 'background-color' } ),
|
|
792
780
|
withNotices,
|
|
793
|
-
withInstanceId,
|
|
794
781
|
] )( CoverEdit );
|
package/src/cover/edit.native.js
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
ColorPicker,
|
|
32
32
|
BottomSheetConsumer,
|
|
33
33
|
useConvertUnitToMobile,
|
|
34
|
+
useMobileGlobalStylesColors,
|
|
34
35
|
} from '@wordpress/components';
|
|
35
36
|
import {
|
|
36
37
|
BlockControls,
|
|
@@ -43,12 +44,17 @@ import {
|
|
|
43
44
|
getColorObjectByColorValue,
|
|
44
45
|
getColorObjectByAttributeValues,
|
|
45
46
|
getGradientValueBySlug,
|
|
46
|
-
useSetting,
|
|
47
47
|
store as blockEditorStore,
|
|
48
48
|
} from '@wordpress/block-editor';
|
|
49
49
|
import { compose, withPreferredColorScheme } from '@wordpress/compose';
|
|
50
50
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
51
|
-
import {
|
|
51
|
+
import {
|
|
52
|
+
useEffect,
|
|
53
|
+
useState,
|
|
54
|
+
useRef,
|
|
55
|
+
useCallback,
|
|
56
|
+
useMemo,
|
|
57
|
+
} from '@wordpress/element';
|
|
52
58
|
import { cover as icon, replace, image, warning } from '@wordpress/icons';
|
|
53
59
|
import { getProtocol } from '@wordpress/url';
|
|
54
60
|
import { store as editPostStore } from '@wordpress/edit-post';
|
|
@@ -142,11 +148,13 @@ const Cover = ( {
|
|
|
142
148
|
const isImage = backgroundType === MEDIA_TYPE_IMAGE;
|
|
143
149
|
|
|
144
150
|
const THEME_COLORS_COUNT = 4;
|
|
145
|
-
const colorsDefault =
|
|
146
|
-
const coverDefaultPalette = {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
const colorsDefault = useMobileGlobalStylesColors();
|
|
152
|
+
const coverDefaultPalette = useMemo( () => {
|
|
153
|
+
return {
|
|
154
|
+
colors: colorsDefault.slice( 0, THEME_COLORS_COUNT ),
|
|
155
|
+
};
|
|
156
|
+
}, [ colorsDefault ] );
|
|
157
|
+
const gradients = useMobileGlobalStylesColors( 'gradients' );
|
|
150
158
|
const gradientValue =
|
|
151
159
|
customGradient || getGradientValueBySlug( gradients, gradient );
|
|
152
160
|
const overlayColorValue = getColorObjectByAttributeValues(
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
getGradientValueBySlug,
|
|
13
13
|
getGradientSlugByValue,
|
|
14
14
|
__experimentalPanelColorGradientSettings as PanelColorGradientSettings,
|
|
15
|
-
useSetting,
|
|
16
15
|
} from '@wordpress/block-editor';
|
|
17
16
|
import { useMemo } from '@wordpress/element';
|
|
17
|
+
import { useMobileGlobalStylesColors } from '@wordpress/components';
|
|
18
18
|
|
|
19
19
|
function OverlayColorSettings( {
|
|
20
20
|
overlayColor,
|
|
@@ -23,9 +23,8 @@ function OverlayColorSettings( {
|
|
|
23
23
|
customGradient,
|
|
24
24
|
setAttributes,
|
|
25
25
|
} ) {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const gradients = useSetting( 'color.gradients' ) || EMPTY_ARRAY;
|
|
26
|
+
const colors = useMobileGlobalStylesColors();
|
|
27
|
+
const gradients = useMobileGlobalStylesColors( 'gradients' );
|
|
29
28
|
|
|
30
29
|
const gradientValue =
|
|
31
30
|
customGradient || getGradientValueBySlug( gradients, gradient );
|
package/src/cover/style.scss
CHANGED
package/src/cover/transforms.js
CHANGED
|
@@ -33,6 +33,7 @@ const transforms = {
|
|
|
33
33
|
createBlock( 'core/paragraph', {
|
|
34
34
|
content: caption,
|
|
35
35
|
fontSize: 'large',
|
|
36
|
+
align: 'center',
|
|
36
37
|
} ),
|
|
37
38
|
]
|
|
38
39
|
),
|
|
@@ -55,6 +56,7 @@ const transforms = {
|
|
|
55
56
|
createBlock( 'core/paragraph', {
|
|
56
57
|
content: caption,
|
|
57
58
|
fontSize: 'large',
|
|
59
|
+
align: 'center',
|
|
58
60
|
} ),
|
|
59
61
|
]
|
|
60
62
|
),
|
package/src/editor.scss
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@import "./buttons/editor.scss";
|
|
6
6
|
@import "./categories/editor.scss";
|
|
7
7
|
@import "./columns/editor.scss";
|
|
8
|
+
@import "./comment-author-avatar/editor.scss";
|
|
8
9
|
@import "./comments-query-loop/editor.scss";
|
|
9
10
|
@import "./comments-pagination/editor.scss";
|
|
10
11
|
@import "./comments-pagination-numbers/editor.scss";
|
package/src/gallery/index.php
CHANGED
|
@@ -34,17 +34,10 @@ add_filter( 'render_block_data', 'block_core_gallery_data_id_backcompatibility'
|
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Registers the `core/gallery` block on server.
|
|
37
|
-
* This render callback needs to be here
|
|
38
|
-
* so that the gallery styles are loaded in block-based themes.
|
|
39
37
|
*/
|
|
40
38
|
function register_block_core_gallery() {
|
|
41
39
|
register_block_type_from_metadata(
|
|
42
|
-
__DIR__ . '/gallery'
|
|
43
|
-
array(
|
|
44
|
-
'render_callback' => function ( $attributes, $content ) {
|
|
45
|
-
return $content;
|
|
46
|
-
},
|
|
47
|
-
)
|
|
40
|
+
__DIR__ . '/gallery'
|
|
48
41
|
);
|
|
49
42
|
}
|
|
50
43
|
|
package/src/group/block.json
CHANGED
package/src/heading/edit.js
CHANGED
|
@@ -8,7 +8,7 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import { useEffect, Platform } from '@wordpress/element';
|
|
11
|
-
import { useDispatch } from '@wordpress/data';
|
|
11
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
12
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
13
13
|
import {
|
|
14
14
|
AlignmentControl,
|
|
@@ -41,6 +41,14 @@ function HeadingEdit( {
|
|
|
41
41
|
style,
|
|
42
42
|
} );
|
|
43
43
|
|
|
44
|
+
const { canGenerateAnchors } = useSelect( ( select ) => {
|
|
45
|
+
const settings = select( blockEditorStore ).getSettings();
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
canGenerateAnchors: !! settings.__experimentalGenerateAnchors,
|
|
49
|
+
};
|
|
50
|
+
}, [] );
|
|
51
|
+
|
|
44
52
|
const { __unstableMarkNextChangeAsNotPersistent } = useDispatch(
|
|
45
53
|
blockEditorStore
|
|
46
54
|
);
|
|
@@ -48,6 +56,10 @@ function HeadingEdit( {
|
|
|
48
56
|
// Initially set anchor for headings that have content but no anchor set.
|
|
49
57
|
// This is used when transforming a block to heading, or for legacy anchors.
|
|
50
58
|
useEffect( () => {
|
|
59
|
+
if ( ! canGenerateAnchors ) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
51
63
|
if ( ! anchor && content ) {
|
|
52
64
|
// This side-effect should not create an undo level.
|
|
53
65
|
__unstableMarkNextChangeAsNotPersistent();
|
|
@@ -59,14 +71,15 @@ function HeadingEdit( {
|
|
|
59
71
|
|
|
60
72
|
// Remove anchor map when block unmounts.
|
|
61
73
|
return () => setAnchor( clientId, null );
|
|
62
|
-
}, [ content,
|
|
74
|
+
}, [ anchor, content, clientId, canGenerateAnchors ] );
|
|
63
75
|
|
|
64
76
|
const onContentChange = ( value ) => {
|
|
65
77
|
const newAttrs = { content: value };
|
|
66
78
|
if (
|
|
67
|
-
|
|
68
|
-
!
|
|
69
|
-
|
|
79
|
+
canGenerateAnchors &&
|
|
80
|
+
( ! anchor ||
|
|
81
|
+
! value ||
|
|
82
|
+
generateAnchor( clientId, content ) === anchor )
|
|
70
83
|
) {
|
|
71
84
|
newAttrs.anchor = generateAnchor( clientId, value );
|
|
72
85
|
}
|
package/src/home-link/index.php
CHANGED
|
@@ -138,25 +138,7 @@ function render_block_core_home_link( $attributes, $content, $block ) {
|
|
|
138
138
|
$html .= '>';
|
|
139
139
|
|
|
140
140
|
if ( isset( $attributes['label'] ) ) {
|
|
141
|
-
$html .=
|
|
142
|
-
$attributes['label'],
|
|
143
|
-
array(
|
|
144
|
-
'code' => array(),
|
|
145
|
-
'em' => array(),
|
|
146
|
-
'img' => array(
|
|
147
|
-
'scale' => array(),
|
|
148
|
-
'class' => array(),
|
|
149
|
-
'style' => array(),
|
|
150
|
-
'src' => array(),
|
|
151
|
-
'alt' => array(),
|
|
152
|
-
),
|
|
153
|
-
's' => array(),
|
|
154
|
-
'span' => array(
|
|
155
|
-
'style' => array(),
|
|
156
|
-
),
|
|
157
|
-
'strong' => array(),
|
|
158
|
-
)
|
|
159
|
-
);
|
|
141
|
+
$html .= wp_kses_post( $attributes['label'] );
|
|
160
142
|
}
|
|
161
143
|
|
|
162
144
|
$html .= '</a></li>';
|
package/src/image/deprecated.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
+
import { isEmpty } from 'lodash';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
8
9
|
*/
|
|
9
|
-
import { RichText } from '@wordpress/block-editor';
|
|
10
|
+
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
10
11
|
|
|
11
12
|
const blockAttributes = {
|
|
12
13
|
align: {
|
|
@@ -68,7 +69,110 @@ const blockAttributes = {
|
|
|
68
69
|
},
|
|
69
70
|
};
|
|
70
71
|
|
|
72
|
+
const blockSupports = {
|
|
73
|
+
anchor: true,
|
|
74
|
+
color: {
|
|
75
|
+
__experimentalDuotone: 'img',
|
|
76
|
+
text: false,
|
|
77
|
+
background: false,
|
|
78
|
+
},
|
|
79
|
+
__experimentalBorder: {
|
|
80
|
+
radius: true,
|
|
81
|
+
__experimentalDefaultControls: {
|
|
82
|
+
radius: true,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
71
87
|
const deprecated = [
|
|
88
|
+
{
|
|
89
|
+
attributes: {
|
|
90
|
+
...blockAttributes,
|
|
91
|
+
title: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
source: 'attribute',
|
|
94
|
+
selector: 'img',
|
|
95
|
+
attribute: 'title',
|
|
96
|
+
},
|
|
97
|
+
sizeSlug: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
supports: blockSupports,
|
|
102
|
+
save( { attributes } ) {
|
|
103
|
+
const {
|
|
104
|
+
url,
|
|
105
|
+
alt,
|
|
106
|
+
caption,
|
|
107
|
+
align,
|
|
108
|
+
href,
|
|
109
|
+
rel,
|
|
110
|
+
linkClass,
|
|
111
|
+
width,
|
|
112
|
+
height,
|
|
113
|
+
id,
|
|
114
|
+
linkTarget,
|
|
115
|
+
sizeSlug,
|
|
116
|
+
title,
|
|
117
|
+
} = attributes;
|
|
118
|
+
|
|
119
|
+
const newRel = isEmpty( rel ) ? undefined : rel;
|
|
120
|
+
|
|
121
|
+
const classes = classnames( {
|
|
122
|
+
[ `align${ align }` ]: align,
|
|
123
|
+
[ `size-${ sizeSlug }` ]: sizeSlug,
|
|
124
|
+
'is-resized': width || height,
|
|
125
|
+
} );
|
|
126
|
+
|
|
127
|
+
const image = (
|
|
128
|
+
<img
|
|
129
|
+
src={ url }
|
|
130
|
+
alt={ alt }
|
|
131
|
+
className={ id ? `wp-image-${ id }` : null }
|
|
132
|
+
width={ width }
|
|
133
|
+
height={ height }
|
|
134
|
+
title={ title }
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const figure = (
|
|
139
|
+
<>
|
|
140
|
+
{ href ? (
|
|
141
|
+
<a
|
|
142
|
+
className={ linkClass }
|
|
143
|
+
href={ href }
|
|
144
|
+
target={ linkTarget }
|
|
145
|
+
rel={ newRel }
|
|
146
|
+
>
|
|
147
|
+
{ image }
|
|
148
|
+
</a>
|
|
149
|
+
) : (
|
|
150
|
+
image
|
|
151
|
+
) }
|
|
152
|
+
{ ! RichText.isEmpty( caption ) && (
|
|
153
|
+
<RichText.Content
|
|
154
|
+
tagName="figcaption"
|
|
155
|
+
value={ caption }
|
|
156
|
+
/>
|
|
157
|
+
) }
|
|
158
|
+
</>
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
if ( 'left' === align || 'right' === align || 'center' === align ) {
|
|
162
|
+
return (
|
|
163
|
+
<div { ...useBlockProps.save() }>
|
|
164
|
+
<figure className={ classes }>{ figure }</figure>
|
|
165
|
+
</div>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<figure { ...useBlockProps.save( { className: classes } ) }>
|
|
171
|
+
{ figure }
|
|
172
|
+
</figure>
|
|
173
|
+
);
|
|
174
|
+
},
|
|
175
|
+
},
|
|
72
176
|
{
|
|
73
177
|
attributes: blockAttributes,
|
|
74
178
|
save( { attributes } ) {
|
package/src/image/editor.scss
CHANGED
|
@@ -70,24 +70,6 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
*:not([data-align]) {
|
|
74
|
-
> .wp-block-image {
|
|
75
|
-
display: grid;
|
|
76
|
-
grid-template-columns: [image] minmax(0, max-content) [placeholder] auto;
|
|
77
|
-
.components-placeholder {
|
|
78
|
-
grid-column: placeholder;
|
|
79
|
-
}
|
|
80
|
-
> div:not(.components-placeholder) {
|
|
81
|
-
grid-column: image;
|
|
82
|
-
}
|
|
83
|
-
> figcaption {
|
|
84
|
-
grid-column: image;
|
|
85
|
-
display: table-caption;
|
|
86
|
-
caption-side: bottom;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
73
|
.wp-block[data-align="left"] > .wp-block-image {
|
|
92
74
|
margin-right: 1em;
|
|
93
75
|
margin-left: 0;
|
package/src/image/save.js
CHANGED
|
@@ -65,14 +65,6 @@ export default function save( { attributes } ) {
|
|
|
65
65
|
</>
|
|
66
66
|
);
|
|
67
67
|
|
|
68
|
-
if ( 'left' === align || 'right' === align || 'center' === align ) {
|
|
69
|
-
return (
|
|
70
|
-
<div { ...useBlockProps.save() }>
|
|
71
|
-
<figure className={ classes }>{ figure }</figure>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
68
|
return (
|
|
77
69
|
<figure { ...useBlockProps.save( { className: classes } ) }>
|
|
78
70
|
{ figure }
|
package/src/image/style.scss
CHANGED
|
@@ -15,7 +15,6 @@ import Clipboard from '@react-native-clipboard/clipboard';
|
|
|
15
15
|
* WordPress dependencies
|
|
16
16
|
*/
|
|
17
17
|
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
18
|
-
import { apiFetch } from '@wordpress/data-controls';
|
|
19
18
|
import {
|
|
20
19
|
setFeaturedImage,
|
|
21
20
|
sendMediaUpload,
|
|
@@ -40,14 +39,6 @@ sendMediaUpload.mockImplementation( ( payload ) => {
|
|
|
40
39
|
uploadCallBack( payload );
|
|
41
40
|
} );
|
|
42
41
|
|
|
43
|
-
jest.mock( '@wordpress/data-controls', () => {
|
|
44
|
-
const dataControls = jest.requireActual( '@wordpress/data-controls' );
|
|
45
|
-
return {
|
|
46
|
-
...dataControls,
|
|
47
|
-
apiFetch: jest.fn(),
|
|
48
|
-
};
|
|
49
|
-
} );
|
|
50
|
-
|
|
51
42
|
/**
|
|
52
43
|
* Immediately invoke delayed functions. A better alternative would be using
|
|
53
44
|
* fake timers and test the delay itself. However, fake timers does not work
|
|
@@ -59,7 +50,6 @@ jest.mock( 'lodash', () => {
|
|
|
59
50
|
} );
|
|
60
51
|
|
|
61
52
|
const apiFetchPromise = Promise.resolve( {} );
|
|
62
|
-
apiFetch.mockImplementation( () => apiFetchPromise );
|
|
63
53
|
|
|
64
54
|
const clipboardPromise = Promise.resolve( '' );
|
|
65
55
|
Clipboard.getString.mockImplementation( () => clipboardPromise );
|
package/src/latest-posts/edit.js
CHANGED
|
@@ -480,6 +480,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
|
|
|
480
480
|
<div className={ imageClasses }>
|
|
481
481
|
{ addLinkToFeaturedImage ? (
|
|
482
482
|
<a
|
|
483
|
+
className="wp-block-latest-posts__post-title"
|
|
483
484
|
href={ post.link }
|
|
484
485
|
rel="noreferrer noopener"
|
|
485
486
|
>
|
|
@@ -223,12 +223,12 @@ function Navigation( {
|
|
|
223
223
|
hasResolvedNavigationMenus,
|
|
224
224
|
navigationMenus,
|
|
225
225
|
navigationMenu,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
226
|
+
canUserUpdateNavigationMenu,
|
|
227
|
+
hasResolvedCanUserUpdateNavigationMenu,
|
|
228
|
+
canUserDeleteNavigationMenu,
|
|
229
|
+
hasResolvedCanUserDeleteNavigationMenu,
|
|
230
|
+
canUserCreateNavigationMenu,
|
|
231
|
+
hasResolvedCanUserCreateNavigationMenu,
|
|
232
232
|
} = useNavigationMenu( ref );
|
|
233
233
|
|
|
234
234
|
const navRef = useRef();
|
|
@@ -361,16 +361,16 @@ function Navigation( {
|
|
|
361
361
|
|
|
362
362
|
if ( isSelected || isInnerBlockSelected ) {
|
|
363
363
|
if (
|
|
364
|
-
|
|
365
|
-
!
|
|
364
|
+
hasResolvedCanUserUpdateNavigationMenu &&
|
|
365
|
+
! canUserUpdateNavigationMenu
|
|
366
366
|
) {
|
|
367
367
|
showCantEditNotice();
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
if (
|
|
371
371
|
! ref &&
|
|
372
|
-
|
|
373
|
-
!
|
|
372
|
+
hasResolvedCanUserCreateNavigationMenu &&
|
|
373
|
+
! canUserCreateNavigationMenu
|
|
374
374
|
) {
|
|
375
375
|
showCantCreateNotice();
|
|
376
376
|
}
|
|
@@ -378,10 +378,10 @@ function Navigation( {
|
|
|
378
378
|
}, [
|
|
379
379
|
isSelected,
|
|
380
380
|
isInnerBlockSelected,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
canUserUpdateNavigationMenu,
|
|
382
|
+
hasResolvedCanUserUpdateNavigationMenu,
|
|
383
|
+
canUserCreateNavigationMenu,
|
|
384
|
+
hasResolvedCanUserCreateNavigationMenu,
|
|
385
385
|
ref,
|
|
386
386
|
] );
|
|
387
387
|
|
|
@@ -496,12 +496,9 @@ function Navigation( {
|
|
|
496
496
|
onClose();
|
|
497
497
|
} }
|
|
498
498
|
onCreateNew={ startWithEmptyMenu }
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
canUserSwitchNavigation={
|
|
503
|
-
canSwitchNavigationMenu
|
|
504
|
-
}
|
|
499
|
+
/* translators: %s: The name of a menu. */
|
|
500
|
+
actionLabel={ __( "Switch to '%s'" ) }
|
|
501
|
+
showManageActions
|
|
505
502
|
/>
|
|
506
503
|
) }
|
|
507
504
|
</ToolbarDropdownMenu>
|
|
@@ -648,12 +645,12 @@ function Navigation( {
|
|
|
648
645
|
</InspectorControls>
|
|
649
646
|
{ isEntityAvailable && (
|
|
650
647
|
<InspectorControls __experimentalGroup="advanced">
|
|
651
|
-
{
|
|
652
|
-
|
|
648
|
+
{ hasResolvedCanUserUpdateNavigationMenu &&
|
|
649
|
+
canUserUpdateNavigationMenu && (
|
|
653
650
|
<NavigationMenuNameControl />
|
|
654
651
|
) }
|
|
655
|
-
{
|
|
656
|
-
|
|
652
|
+
{ hasResolvedCanUserDeleteNavigationMenu &&
|
|
653
|
+
canUserDeleteNavigationMenu && (
|
|
657
654
|
<NavigationMenuDeleteControl
|
|
658
655
|
onDelete={ startWithEmptyMenu }
|
|
659
656
|
/>
|
|
@@ -675,10 +672,12 @@ function Navigation( {
|
|
|
675
672
|
hasResolvedNavigationMenus
|
|
676
673
|
}
|
|
677
674
|
clientId={ clientId }
|
|
678
|
-
|
|
675
|
+
canUserCreateNavigationMenu={
|
|
676
|
+
canUserCreateNavigationMenu
|
|
677
|
+
}
|
|
679
678
|
/>
|
|
680
679
|
) }
|
|
681
|
-
{ !
|
|
680
|
+
{ ! hasResolvedCanUserCreateNavigationMenu ||
|
|
682
681
|
( ! isEntityAvailable && ! isPlaceholderShown && (
|
|
683
682
|
<PlaceholderPreview isLoading />
|
|
684
683
|
) ) }
|