@wordpress/block-library 7.14.2 → 7.15.1-next.4d3b314fd5.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 +3 -0
- package/build/avatar/index.js +1 -1
- package/build/block/edit.native.js +1 -1
- package/build/block/edit.native.js.map +1 -1
- package/build/buttons/edit.native.js +1 -3
- package/build/buttons/edit.native.js.map +1 -1
- package/build/calendar/index.js +9 -0
- package/build/calendar/index.js.map +1 -1
- package/build/code/index.js +1 -1
- package/build/code/index.js.map +1 -1
- package/build/comments/edit/comments-legacy.js +1 -1
- package/build/comments/edit/comments-legacy.js.map +1 -1
- package/build/comments-pagination-next/index.js +1 -1
- package/build/comments-pagination-numbers/index.js +8 -1
- package/build/comments-pagination-numbers/index.js.map +1 -1
- package/build/comments-pagination-previous/index.js +1 -1
- package/build/comments-title/edit.js +1 -1
- package/build/comments-title/edit.js.map +1 -1
- package/build/cover/edit/use-cover-is-dark.js +10 -7
- package/build/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build/cover/index.js +9 -2
- package/build/cover/index.js.map +1 -1
- package/build/embed/deprecated.js +12 -6
- package/build/embed/deprecated.js.map +1 -1
- package/build/embed/index.js +12 -6
- package/build/embed/index.js.map +1 -1
- package/build/embed/transforms.js +12 -6
- package/build/embed/transforms.js.map +1 -1
- package/build/embed/util.js +12 -6
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +1 -1
- package/build/embed/variations.js.map +1 -1
- package/build/freeform/edit.js +5 -8
- package/build/freeform/edit.js.map +1 -1
- package/build/gallery/deprecated.js +4 -4
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/gallery.js +2 -28
- package/build/gallery/gallery.js.map +1 -1
- package/build/list-item/edit.js +2 -1
- package/build/list-item/edit.js.map +1 -1
- package/build/missing/edit.js +9 -2
- package/build/missing/edit.js.map +1 -1
- package/build/more/edit.js +1 -1
- package/build/more/edit.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +16 -6
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/paragraph/drop-zone.js +99 -0
- package/build/paragraph/drop-zone.js.map +1 -0
- package/build/paragraph/edit.js +11 -3
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-content/edit.js +6 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-excerpt/edit.js +1 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-navigation-link/edit.js +35 -4
- package/build/post-navigation-link/edit.js.map +1 -1
- package/build/post-navigation-link/index.js +6 -1
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/edit.js +13 -28
- package/build/post-template/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +4 -8
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/sticky-control.js +1 -1
- package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build/query/edit/query-placeholder.js +2 -2
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query-title/edit.js +1 -1
- package/build/query-title/edit.js.map +1 -1
- package/build/quote/transforms.js +2 -2
- package/build/quote/transforms.js.map +1 -1
- package/build/read-more/edit.js +1 -1
- package/build/read-more/edit.js.map +1 -1
- package/build/site-tagline/index.js +1 -1
- package/build/social-links/edit.native.js +1 -0
- package/build/social-links/edit.native.js.map +1 -1
- package/build/template-part/edit/index.js +2 -2
- package/build/template-part/edit/index.js.map +1 -1
- package/build-module/avatar/index.js +1 -1
- package/build-module/block/edit.native.js +1 -1
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/buttons/edit.native.js +1 -2
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/calendar/index.js +9 -0
- package/build-module/calendar/index.js.map +1 -1
- package/build-module/code/index.js +1 -1
- package/build-module/code/index.js.map +1 -1
- package/build-module/comments/edit/comments-legacy.js +1 -1
- package/build-module/comments/edit/comments-legacy.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +1 -1
- package/build-module/comments-pagination-numbers/index.js +8 -1
- package/build-module/comments-pagination-numbers/index.js.map +1 -1
- package/build-module/comments-pagination-previous/index.js +1 -1
- package/build-module/comments-title/edit.js +1 -1
- package/build-module/comments-title/edit.js.map +1 -1
- package/build-module/cover/edit/use-cover-is-dark.js +9 -4
- package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
- package/build-module/cover/index.js +9 -2
- package/build-module/cover/index.js.map +1 -1
- package/build-module/embed/deprecated.js +12 -6
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/embed/index.js +12 -6
- package/build-module/embed/index.js.map +1 -1
- package/build-module/embed/transforms.js +12 -6
- package/build-module/embed/transforms.js.map +1 -1
- package/build-module/embed/util.js +12 -6
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +1 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/freeform/edit.js +3 -6
- package/build-module/freeform/edit.js.map +1 -1
- package/build-module/gallery/deprecated.js +4 -4
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -29
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/list-item/edit.js +2 -1
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/missing/edit.js +11 -4
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/more/edit.js +1 -1
- package/build-module/more/edit.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +16 -6
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/paragraph/drop-zone.js +88 -0
- package/build-module/paragraph/drop-zone.js.map +1 -0
- package/build-module/paragraph/edit.js +10 -3
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-content/edit.js +6 -1
- package/build-module/post-content/edit.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-navigation-link/edit.js +37 -6
- package/build-module/post-navigation-link/edit.js.map +1 -1
- package/build-module/post-navigation-link/index.js +6 -1
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/edit.js +14 -29
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +2 -6
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/sticky-control.js +1 -1
- package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +2 -2
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query-title/edit.js +1 -1
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/quote/transforms.js +2 -2
- package/build-module/quote/transforms.js.map +1 -1
- package/build-module/read-more/edit.js +1 -1
- package/build-module/read-more/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -1
- package/build-module/social-links/edit.native.js +1 -0
- package/build-module/social-links/edit.native.js.map +1 -1
- package/build-module/template-part/edit/index.js +3 -3
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-style/calendar/style-rtl.css +21 -12
- package/build-style/calendar/style.css +21 -12
- package/build-style/classic-rtl.css +85 -0
- package/build-style/classic.css +85 -0
- package/build-style/editor-rtl.css +41 -2
- package/build-style/editor.css +41 -2
- package/build-style/group/editor-rtl.css +11 -1
- package/build-style/group/editor.css +11 -1
- package/build-style/image/editor-rtl.css +3 -0
- package/build-style/image/editor.css +3 -0
- package/build-style/navigation/editor-rtl.css +11 -1
- package/build-style/navigation/editor.css +11 -1
- package/build-style/paragraph/editor-rtl.css +16 -0
- package/build-style/paragraph/editor.css +16 -0
- package/build-style/post-navigation-link/style-rtl.css +90 -0
- package/build-style/post-navigation-link/style.css +90 -0
- package/build-style/style-rtl.css +36 -12
- package/build-style/style.css +36 -12
- package/package.json +29 -29
- package/src/archives/index.php +4 -7
- package/src/avatar/block.json +1 -1
- package/src/block/edit.native.js +1 -1
- package/src/buttons/edit.native.js +1 -2
- package/src/buttons/test/__snapshots__/edit.native.js.snap +28 -0
- package/src/buttons/test/edit.native.js +170 -0
- package/src/calendar/block.json +9 -0
- package/src/calendar/index.php +22 -1
- package/src/calendar/style.scss +28 -15
- package/src/classic.scss +15 -0
- package/src/code/index.js +1 -1
- package/src/columns/test/__snapshots__/edit.native.js.snap +219 -0
- package/src/columns/test/edit.native.js +432 -0
- package/src/comment-template/index.php +18 -8
- package/src/comments/edit/comments-legacy.js +1 -1
- package/src/comments-pagination-next/block.json +1 -1
- package/src/comments-pagination-numbers/block.json +8 -1
- package/src/comments-pagination-previous/block.json +1 -1
- package/src/comments-title/edit.js +1 -1
- package/src/cover/edit/use-cover-is-dark.js +11 -7
- package/src/cover/index.js +8 -1
- package/src/cover/test/__snapshots__/edit.native.js.snap +64 -0
- package/src/cover/test/edit.native.js +136 -4
- package/src/embed/block.json +12 -6
- package/src/embed/test/index.native.js +1 -2
- package/src/embed/variations.js +1 -1
- package/src/freeform/edit.js +12 -10
- package/src/gallery/deprecated.js +4 -4
- package/src/gallery/gallery.js +1 -31
- package/src/group/test/__snapshots__/edit.native.js.snap +19 -0
- package/src/group/test/edit.native.js +102 -0
- package/src/image/editor.scss +4 -0
- package/src/list-item/edit.js +1 -0
- package/src/missing/edit.js +15 -4
- package/src/more/edit.js +1 -1
- package/src/navigation/menu-items-to-blocks.js +39 -22
- package/src/navigation/test/menu-items-to-blocks.js +6 -0
- package/src/navigation-submenu/index.php +11 -2
- package/src/page-list/index.php +1 -1
- package/src/paragraph/drop-zone.js +105 -0
- package/src/paragraph/edit.js +14 -1
- package/src/paragraph/editor.scss +20 -0
- package/src/post-content/edit.js +3 -1
- package/src/post-excerpt/edit.js +1 -1
- package/src/post-featured-image/index.php +11 -18
- package/src/post-navigation-link/block.json +6 -1
- package/src/post-navigation-link/edit.js +64 -3
- package/src/post-navigation-link/index.php +23 -0
- package/src/post-navigation-link/style.scss +23 -0
- package/src/post-template/edit.js +14 -23
- package/src/query/edit/inspector-controls/index.js +2 -6
- package/src/query/edit/inspector-controls/sticky-control.js +1 -1
- package/src/query/edit/query-placeholder.js +4 -1
- package/src/query-title/edit.js +1 -1
- package/src/quote/transforms.js +1 -1
- package/src/read-more/edit.js +1 -1
- package/src/site-tagline/block.json +1 -1
- package/src/social-links/edit.native.js +7 -1
- package/src/social-links/test/__snapshots__/edit.native.js.snap +57 -0
- package/src/social-links/test/edit.native.js +199 -0
- package/src/style.scss +1 -0
- package/src/tag-cloud/index.php +1 -8
- package/src/template-part/edit/index.js +60 -58
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.15.1-next.4d3b314fd5.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,36 +31,36 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/autop": "^3.
|
|
37
|
-
"@wordpress/blob": "^3.
|
|
38
|
-
"@wordpress/block-editor": "^10.0
|
|
39
|
-
"@wordpress/blocks": "^11.
|
|
40
|
-
"@wordpress/components": "^21.
|
|
41
|
-
"@wordpress/compose": "^5.
|
|
42
|
-
"@wordpress/core-data": "^5.0
|
|
43
|
-
"@wordpress/data": "^7.1.
|
|
44
|
-
"@wordpress/date": "^4.
|
|
45
|
-
"@wordpress/deprecated": "^3.
|
|
46
|
-
"@wordpress/dom": "^3.
|
|
47
|
-
"@wordpress/element": "^4.
|
|
48
|
-
"@wordpress/hooks": "^3.
|
|
49
|
-
"@wordpress/html-entities": "^3.
|
|
50
|
-
"@wordpress/i18n": "^4.
|
|
51
|
-
"@wordpress/icons": "^9.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/notices": "^3.
|
|
54
|
-
"@wordpress/primitives": "^3.
|
|
55
|
-
"@wordpress/reusable-blocks": "^3.
|
|
56
|
-
"@wordpress/rich-text": "^5.
|
|
57
|
-
"@wordpress/server-side-render": "^3.
|
|
58
|
-
"@wordpress/url": "^3.
|
|
59
|
-
"@wordpress/viewport": "^4.
|
|
34
|
+
"@wordpress/a11y": "^3.18.1-next.4d3b314fd5.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.15.1-next.4d3b314fd5.0",
|
|
36
|
+
"@wordpress/autop": "^3.18.1-next.4d3b314fd5.0",
|
|
37
|
+
"@wordpress/blob": "^3.18.1-next.4d3b314fd5.0",
|
|
38
|
+
"@wordpress/block-editor": "^10.1.1-next.4d3b314fd5.0",
|
|
39
|
+
"@wordpress/blocks": "^11.18.1-next.4d3b314fd5.0",
|
|
40
|
+
"@wordpress/components": "^21.1.2-next.4d3b314fd5.0",
|
|
41
|
+
"@wordpress/compose": "^5.16.1-next.4d3b314fd5.0",
|
|
42
|
+
"@wordpress/core-data": "^5.1.1-next.4d3b314fd5.0",
|
|
43
|
+
"@wordpress/data": "^7.2.1-next.4d3b314fd5.0",
|
|
44
|
+
"@wordpress/date": "^4.18.1-next.4d3b314fd5.0",
|
|
45
|
+
"@wordpress/deprecated": "^3.18.1-next.4d3b314fd5.0",
|
|
46
|
+
"@wordpress/dom": "^3.18.1-next.4d3b314fd5.0",
|
|
47
|
+
"@wordpress/element": "^4.16.1-next.4d3b314fd5.0",
|
|
48
|
+
"@wordpress/hooks": "^3.18.1-next.4d3b314fd5.0",
|
|
49
|
+
"@wordpress/html-entities": "^3.18.1-next.4d3b314fd5.0",
|
|
50
|
+
"@wordpress/i18n": "^4.18.1-next.4d3b314fd5.0",
|
|
51
|
+
"@wordpress/icons": "^9.9.1-next.4d3b314fd5.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.18.1-next.4d3b314fd5.0",
|
|
53
|
+
"@wordpress/notices": "^3.18.1-next.4d3b314fd5.0",
|
|
54
|
+
"@wordpress/primitives": "^3.16.1-next.4d3b314fd5.0",
|
|
55
|
+
"@wordpress/reusable-blocks": "^3.16.1-next.4d3b314fd5.0",
|
|
56
|
+
"@wordpress/rich-text": "^5.16.1-next.4d3b314fd5.0",
|
|
57
|
+
"@wordpress/server-side-render": "^3.16.1-next.4d3b314fd5.0",
|
|
58
|
+
"@wordpress/url": "^3.19.1-next.4d3b314fd5.0",
|
|
59
|
+
"@wordpress/viewport": "^4.16.1-next.4d3b314fd5.0",
|
|
60
60
|
"change-case": "^4.1.2",
|
|
61
61
|
"classnames": "^2.3.1",
|
|
62
62
|
"colord": "^2.7.0",
|
|
63
|
-
"fast-average-color": "^
|
|
63
|
+
"fast-average-color": "^9.1.1",
|
|
64
64
|
"lodash": "^4.17.21",
|
|
65
65
|
"memize": "^1.1.0",
|
|
66
66
|
"micromodal": "^0.4.10",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "25054766423cb49d959eb656c2533530073ff5c2"
|
|
77
77
|
}
|
package/src/archives/index.php
CHANGED
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
function render_block_core_archives( $attributes ) {
|
|
18
18
|
$show_post_count = ! empty( $attributes['showPostCounts'] );
|
|
19
19
|
$type = isset( $attributes['type'] ) ? $attributes['type'] : 'monthly';
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
$class = 'wp-block-archives-list';
|
|
21
22
|
|
|
22
23
|
if ( ! empty( $attributes['displayAsDropdown'] ) ) {
|
|
23
24
|
|
|
24
|
-
$class
|
|
25
|
+
$class = 'wp-block-archives-dropdown';
|
|
25
26
|
|
|
26
27
|
$dropdown_id = wp_unique_id( 'wp-block-archives-' );
|
|
27
28
|
$title = __( 'Archives' );
|
|
@@ -40,9 +41,7 @@ function render_block_core_archives( $attributes ) {
|
|
|
40
41
|
|
|
41
42
|
$archives = wp_get_archives( $dropdown_args );
|
|
42
43
|
|
|
43
|
-
$
|
|
44
|
-
|
|
45
|
-
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) );
|
|
44
|
+
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $class ) );
|
|
46
45
|
|
|
47
46
|
switch ( $dropdown_args['type'] ) {
|
|
48
47
|
case 'yearly':
|
|
@@ -75,8 +74,6 @@ function render_block_core_archives( $attributes ) {
|
|
|
75
74
|
);
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
$class .= ' wp-block-archives-list';
|
|
79
|
-
|
|
80
77
|
/** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */
|
|
81
78
|
$archives_args = apply_filters(
|
|
82
79
|
'widget_archives_args',
|
package/src/avatar/block.json
CHANGED
package/src/block/edit.native.js
CHANGED
|
@@ -163,7 +163,7 @@ export default function ReusableBlockEdit( {
|
|
|
163
163
|
</Text>
|
|
164
164
|
<Text style={ [ infoTextStyle, infoDescriptionStyle ] }>
|
|
165
165
|
{ __(
|
|
166
|
-
'Alternatively, you can detach and edit these blocks separately by tapping
|
|
166
|
+
'Alternatively, you can detach and edit these blocks separately by tapping “Convert to regular blocks”.'
|
|
167
167
|
) }
|
|
168
168
|
</Text>
|
|
169
169
|
<TextControl
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { debounce } from 'lodash';
|
|
5
4
|
import { View } from 'react-native';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -14,7 +13,7 @@ import {
|
|
|
14
13
|
store as blockEditorStore,
|
|
15
14
|
} from '@wordpress/block-editor';
|
|
16
15
|
import { createBlock, getBlockSupport } from '@wordpress/blocks';
|
|
17
|
-
import { useResizeObserver } from '@wordpress/compose';
|
|
16
|
+
import { debounce, useResizeObserver } from '@wordpress/compose';
|
|
18
17
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
19
18
|
import { useState, useEffect, useRef, useCallback } from '@wordpress/element';
|
|
20
19
|
import { alignmentHelpers } from '@wordpress/components';
|
|
@@ -18,6 +18,28 @@ exports[`Buttons block justify content sets Justify items right option 1`] = `
|
|
|
18
18
|
<!-- /wp:buttons -->"
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
|
+
exports[`Buttons block when a button is shown adds another button using the inline appender 1`] = `
|
|
22
|
+
"<!-- wp:buttons -->
|
|
23
|
+
<div class=\\"wp-block-buttons\\"><!-- wp:button /-->
|
|
24
|
+
|
|
25
|
+
<!-- wp:button /--></div>
|
|
26
|
+
<!-- /wp:buttons -->
|
|
27
|
+
|
|
28
|
+
<!-- wp:paragraph -->
|
|
29
|
+
<p></p>
|
|
30
|
+
<!-- /wp:paragraph -->"
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
exports[`Buttons block when a button is shown adds another button using the inserter 1`] = `
|
|
34
|
+
"<!-- wp:buttons -->
|
|
35
|
+
<div class=\\"wp-block-buttons\\"><!-- wp:button /-->
|
|
36
|
+
|
|
37
|
+
<!-- wp:button -->
|
|
38
|
+
<div class=\\"wp-block-button\\"><a class=\\"wp-block-button__link wp-element-button\\">Hello!</a></div>
|
|
39
|
+
<!-- /wp:button --></div>
|
|
40
|
+
<!-- /wp:buttons -->"
|
|
41
|
+
`;
|
|
42
|
+
|
|
21
43
|
exports[`Buttons block when a button is shown adjusts the border radius 1`] = `
|
|
22
44
|
"<!-- wp:buttons -->
|
|
23
45
|
<div class=\\"wp-block-buttons\\"><!-- wp:button {\\"style\\":{\\"border\\":{\\"radius\\":\\"6px\\"}}} -->
|
|
@@ -25,3 +47,9 @@ exports[`Buttons block when a button is shown adjusts the border radius 1`] = `
|
|
|
25
47
|
<!-- /wp:button --></div>
|
|
26
48
|
<!-- /wp:buttons -->"
|
|
27
49
|
`;
|
|
50
|
+
|
|
51
|
+
exports[`Buttons block when a button is shown removing button along with buttons block removes the button and buttons block when deleting the block using the block delete action 1`] = `
|
|
52
|
+
"<!-- wp:paragraph -->
|
|
53
|
+
<p></p>
|
|
54
|
+
<!-- /wp:paragraph -->"
|
|
55
|
+
`;
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
waitFor,
|
|
7
7
|
getEditorHtml,
|
|
8
8
|
within,
|
|
9
|
+
getBlock,
|
|
9
10
|
initializeEditor,
|
|
11
|
+
changeTextOfRichText,
|
|
10
12
|
} from 'test/helpers';
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -15,6 +17,19 @@ import {
|
|
|
15
17
|
import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
16
18
|
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
17
19
|
|
|
20
|
+
// Mock debounce to prevent potentially belated state updates.
|
|
21
|
+
jest.mock( 'lodash', () => ( {
|
|
22
|
+
...jest.requireActual( 'lodash' ),
|
|
23
|
+
debounce: ( fn ) => {
|
|
24
|
+
fn.cancel = jest.fn();
|
|
25
|
+
return fn;
|
|
26
|
+
},
|
|
27
|
+
} ) );
|
|
28
|
+
|
|
29
|
+
const BUTTONS_HTML = `<!-- wp:buttons -->
|
|
30
|
+
<div class="wp-block-buttons"><!-- wp:button /--></div>
|
|
31
|
+
<!-- /wp:buttons -->`;
|
|
32
|
+
|
|
18
33
|
beforeAll( () => {
|
|
19
34
|
// Register all core blocks.
|
|
20
35
|
registerCoreBlocks();
|
|
@@ -78,6 +93,161 @@ describe( 'Buttons block', () => {
|
|
|
78
93
|
|
|
79
94
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
80
95
|
} );
|
|
96
|
+
|
|
97
|
+
it( 'adds another button using the inline appender', async () => {
|
|
98
|
+
const screen = await initializeEditor( {
|
|
99
|
+
initialHtml: BUTTONS_HTML,
|
|
100
|
+
} );
|
|
101
|
+
const { getByA11yLabel } = screen;
|
|
102
|
+
|
|
103
|
+
// Get block
|
|
104
|
+
const buttonsBlock = await getBlock( screen, 'Buttons' );
|
|
105
|
+
|
|
106
|
+
// Trigger inner blocks layout
|
|
107
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
108
|
+
within( buttonsBlock ).getByTestId( 'block-list-wrapper' )
|
|
109
|
+
);
|
|
110
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
111
|
+
nativeEvent: {
|
|
112
|
+
layout: {
|
|
113
|
+
width: 300,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
} );
|
|
117
|
+
|
|
118
|
+
// Get inner button block
|
|
119
|
+
const buttonBlock = await getBlock( screen, 'Button' );
|
|
120
|
+
fireEvent.press( buttonBlock );
|
|
121
|
+
|
|
122
|
+
// Add another Button using the inline appender
|
|
123
|
+
const appenderButton =
|
|
124
|
+
within( buttonsBlock ).getByTestId( 'appender-button' );
|
|
125
|
+
fireEvent.press( appenderButton );
|
|
126
|
+
|
|
127
|
+
// Check for new button
|
|
128
|
+
const secondButtonBlock = await waitFor( () =>
|
|
129
|
+
within( buttonsBlock ).getByA11yLabel( /Button Block\. Row 2/ )
|
|
130
|
+
);
|
|
131
|
+
expect( secondButtonBlock ).toBeVisible();
|
|
132
|
+
|
|
133
|
+
// Add a Paragraph block using the empty placeholder at the bottom
|
|
134
|
+
const paragraphPlaceholder = await waitFor( () =>
|
|
135
|
+
getByA11yLabel( 'Add paragraph block' )
|
|
136
|
+
);
|
|
137
|
+
fireEvent.press( paragraphPlaceholder );
|
|
138
|
+
|
|
139
|
+
// Check for inline appenders
|
|
140
|
+
const appenderButtons =
|
|
141
|
+
within( buttonsBlock ).queryAllByTestId( 'appender-button' );
|
|
142
|
+
expect( appenderButtons.length ).toBe( 0 );
|
|
143
|
+
|
|
144
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
145
|
+
} );
|
|
146
|
+
|
|
147
|
+
it( 'adds another button using the inserter', async () => {
|
|
148
|
+
const screen = await initializeEditor( {
|
|
149
|
+
initialHtml: BUTTONS_HTML,
|
|
150
|
+
} );
|
|
151
|
+
const {
|
|
152
|
+
getByA11yLabel,
|
|
153
|
+
getByTestId,
|
|
154
|
+
queryAllByA11yLabel,
|
|
155
|
+
getByText,
|
|
156
|
+
} = screen;
|
|
157
|
+
|
|
158
|
+
// Get block
|
|
159
|
+
const buttonsBlock = await getBlock( screen, 'Buttons' );
|
|
160
|
+
fireEvent.press( buttonsBlock );
|
|
161
|
+
|
|
162
|
+
// Trigger inner blocks layout
|
|
163
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
164
|
+
within( buttonsBlock ).getByTestId( 'block-list-wrapper' )
|
|
165
|
+
);
|
|
166
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
167
|
+
nativeEvent: {
|
|
168
|
+
layout: {
|
|
169
|
+
width: 300,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
} );
|
|
173
|
+
|
|
174
|
+
// Get inner button block
|
|
175
|
+
const buttonBlock = await getBlock( screen, 'Button' );
|
|
176
|
+
fireEvent.press( buttonBlock );
|
|
177
|
+
|
|
178
|
+
// Open the block inserter
|
|
179
|
+
fireEvent.press( getByA11yLabel( 'Add block' ) );
|
|
180
|
+
|
|
181
|
+
const blockList = getByTestId( 'InserterUI-Blocks' );
|
|
182
|
+
// onScroll event used to force the FlatList to render all items
|
|
183
|
+
fireEvent.scroll( blockList, {
|
|
184
|
+
nativeEvent: {
|
|
185
|
+
contentOffset: { y: 0, x: 0 },
|
|
186
|
+
contentSize: { width: 100, height: 100 },
|
|
187
|
+
layoutMeasurement: { width: 100, height: 100 },
|
|
188
|
+
},
|
|
189
|
+
} );
|
|
190
|
+
|
|
191
|
+
// Check the Add block here placeholder is not visible
|
|
192
|
+
const addBlockHerePlaceholders =
|
|
193
|
+
queryAllByA11yLabel( 'ADD BLOCK HERE' );
|
|
194
|
+
expect( addBlockHerePlaceholders.length ).toBe( 0 );
|
|
195
|
+
|
|
196
|
+
// Add a new Button block
|
|
197
|
+
fireEvent.press( await waitFor( () => getByText( 'Button' ) ) );
|
|
198
|
+
|
|
199
|
+
// Get new button
|
|
200
|
+
const secondButtonBlock = await getBlock( screen, 'Button', {
|
|
201
|
+
rowIndex: 2,
|
|
202
|
+
} );
|
|
203
|
+
const secondButtonInput =
|
|
204
|
+
within( secondButtonBlock ).getByA11yLabel(
|
|
205
|
+
'Text input. Empty'
|
|
206
|
+
);
|
|
207
|
+
changeTextOfRichText( secondButtonInput, 'Hello!' );
|
|
208
|
+
|
|
209
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
210
|
+
} );
|
|
211
|
+
|
|
212
|
+
describe( 'removing button along with buttons block', () => {
|
|
213
|
+
it( 'removes the button and buttons block when deleting the block using the block delete action', async () => {
|
|
214
|
+
const screen = await initializeEditor( {
|
|
215
|
+
initialHtml: BUTTONS_HTML,
|
|
216
|
+
} );
|
|
217
|
+
const { getByA11yLabel } = screen;
|
|
218
|
+
|
|
219
|
+
// Get block
|
|
220
|
+
const buttonsBlock = await getBlock( screen, 'Buttons' );
|
|
221
|
+
|
|
222
|
+
// Trigger inner blocks layout
|
|
223
|
+
const innerBlockListWrapper = await waitFor( () =>
|
|
224
|
+
within( buttonsBlock ).getByTestId( 'block-list-wrapper' )
|
|
225
|
+
);
|
|
226
|
+
fireEvent( innerBlockListWrapper, 'layout', {
|
|
227
|
+
nativeEvent: {
|
|
228
|
+
layout: {
|
|
229
|
+
width: 300,
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
} );
|
|
233
|
+
|
|
234
|
+
// Get inner button block
|
|
235
|
+
const buttonBlock = await getBlock( screen, 'Button' );
|
|
236
|
+
fireEvent.press( buttonBlock );
|
|
237
|
+
|
|
238
|
+
// Open block actions menu
|
|
239
|
+
const blockActionsButton = getByA11yLabel(
|
|
240
|
+
/Open Block Actions Menu/
|
|
241
|
+
);
|
|
242
|
+
fireEvent.press( blockActionsButton );
|
|
243
|
+
|
|
244
|
+
// Delete block
|
|
245
|
+
const deleteButton = getByA11yLabel( /Remove block/ );
|
|
246
|
+
fireEvent.press( deleteButton );
|
|
247
|
+
|
|
248
|
+
expect( getEditorHtml() ).toMatchSnapshot();
|
|
249
|
+
} );
|
|
250
|
+
} );
|
|
81
251
|
} );
|
|
82
252
|
|
|
83
253
|
describe( 'justify content', () => {
|
package/src/calendar/block.json
CHANGED
|
@@ -17,6 +17,15 @@
|
|
|
17
17
|
},
|
|
18
18
|
"supports": {
|
|
19
19
|
"align": true,
|
|
20
|
+
"color": {
|
|
21
|
+
"link": true,
|
|
22
|
+
"__experimentalSkipSerialization": [ "text", "background" ],
|
|
23
|
+
"__experimentalDefaultControls": {
|
|
24
|
+
"background": true,
|
|
25
|
+
"text": true
|
|
26
|
+
},
|
|
27
|
+
"__experimentalSelector": "table, th"
|
|
28
|
+
},
|
|
20
29
|
"typography": {
|
|
21
30
|
"fontSize": true,
|
|
22
31
|
"lineHeight": true,
|
package/src/calendar/index.php
CHANGED
|
@@ -40,11 +40,32 @@ function render_block_core_calendar( $attributes ) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
$color_block_styles = array();
|
|
44
|
+
|
|
45
|
+
// Text color.
|
|
46
|
+
$preset_text_color = array_key_exists( 'textColor', $attributes ) ? "var:preset|color|{$attributes['textColor']}" : null;
|
|
47
|
+
$custom_text_color = _wp_array_get( $attributes, array( 'style', 'color', 'text' ), null );
|
|
48
|
+
$color_block_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color;
|
|
49
|
+
|
|
50
|
+
// Background Color.
|
|
51
|
+
$preset_background_color = array_key_exists( 'backgroundColor', $attributes ) ? "var:preset|color|{$attributes['backgroundColor']}" : null;
|
|
52
|
+
$custom_background_color = _wp_array_get( $attributes, array( 'style', 'color', 'background' ), null );
|
|
53
|
+
$color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color;
|
|
54
|
+
|
|
55
|
+
// Generate color styles and classes.
|
|
56
|
+
$styles = gutenberg_style_engine_get_styles( array( 'color' => $color_block_styles ), array( 'convert_vars_to_classnames' => true ) );
|
|
57
|
+
$inline_styles = empty( $styles['css'] ) ? '' : sprintf( ' style="%s"', esc_attr( $styles['css'] ) );
|
|
58
|
+
$classnames = empty( $styles['classnames'] ) ? '' : ' ' . esc_attr( $styles['classnames'] );
|
|
59
|
+
|
|
60
|
+
// Apply color classes and styles to the calendar.
|
|
61
|
+
$calendar = str_replace( '<table', '<table' . $inline_styles, get_calendar( true, false ) );
|
|
62
|
+
$calendar = str_replace( 'class="wp-calendar-table', 'class="wp-calendar-table' . $classnames, $calendar );
|
|
63
|
+
|
|
43
64
|
$wrapper_attributes = get_block_wrapper_attributes();
|
|
44
65
|
$output = sprintf(
|
|
45
66
|
'<div %1$s>%2$s</div>',
|
|
46
67
|
$wrapper_attributes,
|
|
47
|
-
|
|
68
|
+
$calendar
|
|
48
69
|
);
|
|
49
70
|
|
|
50
71
|
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.OverrideProhibited
|
package/src/calendar/style.scss
CHANGED
|
@@ -2,31 +2,44 @@
|
|
|
2
2
|
text-align: center;
|
|
3
3
|
|
|
4
4
|
th,
|
|
5
|
-
|
|
5
|
+
td {
|
|
6
6
|
padding: 0.25em;
|
|
7
|
-
border: 1px solid
|
|
7
|
+
border: 1px solid;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
th {
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
caption {
|
|
15
|
+
background-color: inherit;
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
table {
|
|
15
19
|
width: 100%;
|
|
16
20
|
border-collapse: collapse;
|
|
17
|
-
}
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
background: $gray-300;
|
|
22
|
-
}
|
|
22
|
+
&:where(:not(.has-text-color)) {
|
|
23
|
+
color: #40464d;
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
// Keep the hard-coded border color for backward compatibility.
|
|
26
|
+
th,
|
|
27
|
+
td {
|
|
28
|
+
border-color: $gray-300;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.has-background th {
|
|
33
|
+
background-color: inherit;
|
|
34
|
+
}
|
|
27
35
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
&.has-text-color th {
|
|
37
|
+
color: inherit;
|
|
38
|
+
}
|
|
31
39
|
}
|
|
32
40
|
}
|
|
41
|
+
|
|
42
|
+
// Keep the hard-coded header background color for backward compatibility.
|
|
43
|
+
:where(.wp-block-calendar table:not(.has-background) th) {
|
|
44
|
+
background: $gray-300;
|
|
45
|
+
}
|
package/src/classic.scss
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// These rules are needed for backwards compatibility.
|
|
2
|
+
.wp-block-button__link {
|
|
3
|
+
color: $white;
|
|
4
|
+
background-color: #32373c;
|
|
5
|
+
border-radius: 9999px; // 100% causes an oval, but any explicit but really high value retains the pill shape.
|
|
6
|
+
|
|
7
|
+
// This needs a low specificity so it won't override the rules from the button element if defined in theme.json.
|
|
8
|
+
box-shadow: none;
|
|
9
|
+
text-decoration: none;
|
|
10
|
+
|
|
11
|
+
// The extra 2px are added to size solids the same as the outline versions.
|
|
12
|
+
padding: calc(0.667em + 2px) calc(1.333em + 2px);
|
|
13
|
+
|
|
14
|
+
font-size: 1.125em;
|
|
15
|
+
}
|
package/src/code/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export const settings = {
|
|
|
24
24
|
/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */
|
|
25
25
|
// translators: Preserve \n markers for line breaks
|
|
26
26
|
content: __(
|
|
27
|
-
'// A
|
|
27
|
+
'// A “block” is the abstract term used\n// to describe units of markup that\n// when composed together, form the\n// content or layout of a page.\nregisterBlockType( name, settings );'
|
|
28
28
|
),
|
|
29
29
|
/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */
|
|
30
30
|
},
|