@wordpress/block-library 7.15.0 → 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 +1 -0
- package/build/comments-pagination-numbers/index.js +7 -0
- package/build/comments-pagination-numbers/index.js.map +1 -1
- package/build/gallery/gallery.js +2 -28
- package/build/gallery/gallery.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-module/comments-pagination-numbers/index.js +7 -0
- package/build-module/comments-pagination-numbers/index.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -29
- package/build-module/gallery/gallery.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-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/package.json +28 -28
- package/src/archives/index.php +4 -7
- package/src/classic.scss +15 -0
- package/src/comment-template/index.php +18 -8
- package/src/comments-pagination-numbers/block.json +7 -0
- package/src/gallery/gallery.js +1 -31
- package/src/image/editor.scss +4 -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/tag-cloud/index.php +1 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "7.15.0",
|
|
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,32 +31,32 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.18.0",
|
|
35
|
-
"@wordpress/api-fetch": "^6.15.0",
|
|
36
|
-
"@wordpress/autop": "^3.18.0",
|
|
37
|
-
"@wordpress/blob": "^3.18.0",
|
|
38
|
-
"@wordpress/block-editor": "^10.1.0",
|
|
39
|
-
"@wordpress/blocks": "^11.
|
|
40
|
-
"@wordpress/components": "^21.1.0",
|
|
41
|
-
"@wordpress/compose": "^5.16.0",
|
|
42
|
-
"@wordpress/core-data": "^5.1.0",
|
|
43
|
-
"@wordpress/data": "^7.2.0",
|
|
44
|
-
"@wordpress/date": "^4.18.0",
|
|
45
|
-
"@wordpress/deprecated": "^3.18.0",
|
|
46
|
-
"@wordpress/dom": "^3.18.0",
|
|
47
|
-
"@wordpress/element": "^4.16.0",
|
|
48
|
-
"@wordpress/hooks": "^3.18.0",
|
|
49
|
-
"@wordpress/html-entities": "^3.18.0",
|
|
50
|
-
"@wordpress/i18n": "^4.18.0",
|
|
51
|
-
"@wordpress/icons": "^9.9.0",
|
|
52
|
-
"@wordpress/keycodes": "^3.18.0",
|
|
53
|
-
"@wordpress/notices": "^3.18.0",
|
|
54
|
-
"@wordpress/primitives": "^3.16.0",
|
|
55
|
-
"@wordpress/reusable-blocks": "^3.16.0",
|
|
56
|
-
"@wordpress/rich-text": "^5.16.0",
|
|
57
|
-
"@wordpress/server-side-render": "^3.16.0",
|
|
58
|
-
"@wordpress/url": "^3.19.0",
|
|
59
|
-
"@wordpress/viewport": "^4.16.0",
|
|
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",
|
|
@@ -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/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
|
+
}
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
function block_core_comment_template_render_comments( $comments, $block ) {
|
|
18
18
|
global $comment_depth;
|
|
19
|
+
$thread_comments = get_option( 'thread_comments' );
|
|
20
|
+
$thread_comments_depth = get_option( 'thread_comments_depth' );
|
|
19
21
|
|
|
20
22
|
if ( empty( $comment_depth ) ) {
|
|
21
23
|
$comment_depth = 1;
|
|
@@ -46,14 +48,22 @@ function block_core_comment_template_render_comments( $comments, $block ) {
|
|
|
46
48
|
|
|
47
49
|
// If the comment has children, recurse to create the HTML for the nested
|
|
48
50
|
// comments.
|
|
49
|
-
if ( ! empty( $children ) ) {
|
|
50
|
-
$comment_depth
|
|
51
|
-
|
|
52
|
-
$
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
if ( ! empty( $children ) && ! empty( $thread_comments ) ) {
|
|
52
|
+
if ( $comment_depth < $thread_comments_depth ) {
|
|
53
|
+
$comment_depth += 1;
|
|
54
|
+
$inner_content = block_core_comment_template_render_comments(
|
|
55
|
+
$children,
|
|
56
|
+
$block
|
|
57
|
+
);
|
|
58
|
+
$block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
|
|
59
|
+
$comment_depth -= 1;
|
|
60
|
+
} else {
|
|
61
|
+
$inner_content = block_core_comment_template_render_comments(
|
|
62
|
+
$children,
|
|
63
|
+
$block
|
|
64
|
+
);
|
|
65
|
+
$block_content .= sprintf( $inner_content );
|
|
66
|
+
}
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
$content .= sprintf( '<li id="comment-%1$s" %2$s>%3$s</li>', $comment->comment_ID, $comment_classes, $block_content );
|
package/src/gallery/gallery.js
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
__experimentalGetElementClassName,
|
|
13
13
|
} from '@wordpress/block-editor';
|
|
14
14
|
import { VisuallyHidden } from '@wordpress/components';
|
|
15
|
-
import { useState, useEffect } from '@wordpress/element';
|
|
16
15
|
import { __ } from '@wordpress/i18n';
|
|
17
16
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
18
17
|
import { View } from '@wordpress/primitives';
|
|
@@ -38,26 +37,6 @@ export const Gallery = ( props ) => {
|
|
|
38
37
|
__experimentalLayout: { type: 'default', alignments: [] },
|
|
39
38
|
} );
|
|
40
39
|
|
|
41
|
-
const [ captionFocused, setCaptionFocused ] = useState( false );
|
|
42
|
-
|
|
43
|
-
function onFocusCaption() {
|
|
44
|
-
if ( ! captionFocused ) {
|
|
45
|
-
setCaptionFocused( true );
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function removeCaptionFocus() {
|
|
50
|
-
if ( captionFocused ) {
|
|
51
|
-
setCaptionFocused( false );
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
useEffect( () => {
|
|
56
|
-
if ( ! isSelected ) {
|
|
57
|
-
setCaptionFocused( false );
|
|
58
|
-
}
|
|
59
|
-
}, [ isSelected ] );
|
|
60
|
-
|
|
61
40
|
return (
|
|
62
41
|
<figure
|
|
63
42
|
{ ...innerBlocksProps }
|
|
@@ -74,17 +53,12 @@ export const Gallery = ( props ) => {
|
|
|
74
53
|
>
|
|
75
54
|
{ children }
|
|
76
55
|
{ isSelected && ! children && (
|
|
77
|
-
<View
|
|
78
|
-
className="blocks-gallery-media-placeholder-wrapper"
|
|
79
|
-
onClick={ removeCaptionFocus }
|
|
80
|
-
>
|
|
56
|
+
<View className="blocks-gallery-media-placeholder-wrapper">
|
|
81
57
|
{ mediaPlaceholder }
|
|
82
58
|
</View>
|
|
83
59
|
) }
|
|
84
60
|
<RichTextVisibilityHelper
|
|
85
61
|
isHidden={ ! isSelected && RichText.isEmpty( caption ) }
|
|
86
|
-
captionFocused={ captionFocused }
|
|
87
|
-
onFocusCaption={ onFocusCaption }
|
|
88
62
|
tagName="figcaption"
|
|
89
63
|
className={ classnames(
|
|
90
64
|
'blocks-gallery-caption',
|
|
@@ -105,8 +79,6 @@ export const Gallery = ( props ) => {
|
|
|
105
79
|
|
|
106
80
|
function RichTextVisibilityHelper( {
|
|
107
81
|
isHidden,
|
|
108
|
-
captionFocused,
|
|
109
|
-
onFocusCaption,
|
|
110
82
|
className,
|
|
111
83
|
value,
|
|
112
84
|
placeholder,
|
|
@@ -125,8 +97,6 @@ function RichTextVisibilityHelper( {
|
|
|
125
97
|
placeholder={ placeholder }
|
|
126
98
|
className={ className }
|
|
127
99
|
tagName={ tagName }
|
|
128
|
-
isSelected={ captionFocused }
|
|
129
|
-
onClick={ onFocusCaption }
|
|
130
100
|
{ ...richTextProps }
|
|
131
101
|
/>
|
|
132
102
|
);
|
package/src/image/editor.scss
CHANGED
|
@@ -148,7 +148,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
148
148
|
|
|
149
149
|
$css_classes = trim( implode( ' ', $classes ) );
|
|
150
150
|
$has_submenu = count( $block->inner_blocks ) > 0;
|
|
151
|
-
$is_active = ! empty( $attributes['id'] ) && (
|
|
151
|
+
$is_active = ! empty( $attributes['id'] ) && ( get_queried_object_id() === (int) $attributes['id'] );
|
|
152
152
|
|
|
153
153
|
$show_submenu_indicators = isset( $block->context['showSubmenuIcon'] ) && $block->context['showSubmenuIcon'];
|
|
154
154
|
$open_on_click = isset( $block->context['openSubmenusOnClick'] ) && $block->context['openSubmenusOnClick'];
|
|
@@ -183,7 +183,16 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
183
183
|
if ( ! $open_on_click ) {
|
|
184
184
|
$item_url = isset( $attributes['url'] ) ? $attributes['url'] : '';
|
|
185
185
|
// Start appending HTML attributes to anchor tag.
|
|
186
|
-
$html .= '<a class="wp-block-navigation-item__content"
|
|
186
|
+
$html .= '<a class="wp-block-navigation-item__content"';
|
|
187
|
+
|
|
188
|
+
// The href attribute on a and area elements is not required;
|
|
189
|
+
// when those elements do not have href attributes they do not create hyperlinks.
|
|
190
|
+
// But also The href attribute must have a value that is a valid URL potentially
|
|
191
|
+
// surrounded by spaces.
|
|
192
|
+
// see: https://html.spec.whatwg.org/multipage/links.html#links-created-by-a-and-area-elements.
|
|
193
|
+
if ( ! empty( $item_url ) ) {
|
|
194
|
+
$html .= ' href="' . esc_url( $item_url ) . '"';
|
|
195
|
+
}
|
|
187
196
|
|
|
188
197
|
if ( $is_active ) {
|
|
189
198
|
$html .= ' aria-current="page"';
|
package/src/page-list/index.php
CHANGED
|
@@ -264,7 +264,7 @@ function render_block_core_page_list( $attributes, $content, $block ) {
|
|
|
264
264
|
$active_page_ancestor_ids = array();
|
|
265
265
|
|
|
266
266
|
foreach ( (array) $all_pages as $page ) {
|
|
267
|
-
$is_active = ! empty( $page->ID ) && (
|
|
267
|
+
$is_active = ! empty( $page->ID ) && ( get_queried_object_id() === $page->ID );
|
|
268
268
|
|
|
269
269
|
if ( $is_active ) {
|
|
270
270
|
$active_page_ancestor_ids = get_post_ancestors( $page->ID );
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import {
|
|
7
|
+
__experimentalUseOnBlockDrop as useOnBlockDrop,
|
|
8
|
+
store as blockEditorStore,
|
|
9
|
+
} from '@wordpress/block-editor';
|
|
10
|
+
import {
|
|
11
|
+
__experimentalUseDropZone as useDropZone,
|
|
12
|
+
useReducedMotion,
|
|
13
|
+
} from '@wordpress/compose';
|
|
14
|
+
import {
|
|
15
|
+
Popover,
|
|
16
|
+
__unstableMotion as motion,
|
|
17
|
+
__unstableAnimatePresence as AnimatePresence,
|
|
18
|
+
} from '@wordpress/components';
|
|
19
|
+
|
|
20
|
+
const animateVariants = {
|
|
21
|
+
hide: { opacity: 0, scaleY: 0.75 },
|
|
22
|
+
show: { opacity: 1, scaleY: 1 },
|
|
23
|
+
exit: { opacity: 0, scaleY: 0.9 },
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default function DropZone( { paragraphElement, clientId } ) {
|
|
27
|
+
const { rootClientId, blockIndex } = useSelect(
|
|
28
|
+
( select ) => {
|
|
29
|
+
const selectors = select( blockEditorStore );
|
|
30
|
+
return {
|
|
31
|
+
rootClientId: selectors.getBlockRootClientId( clientId ),
|
|
32
|
+
blockIndex: selectors.getBlockIndex( clientId ),
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
[ clientId ]
|
|
36
|
+
);
|
|
37
|
+
const onBlockDrop = useOnBlockDrop( rootClientId, blockIndex, {
|
|
38
|
+
action: 'replace',
|
|
39
|
+
} );
|
|
40
|
+
const [ isDragging, setIsDragging ] = useState( false );
|
|
41
|
+
const [ isVisible, setIsVisible ] = useState( false );
|
|
42
|
+
const popoverRef = useDropZone( {
|
|
43
|
+
onDragStart: () => {
|
|
44
|
+
setIsDragging( true );
|
|
45
|
+
},
|
|
46
|
+
onDragEnd: () => {
|
|
47
|
+
setIsDragging( false );
|
|
48
|
+
},
|
|
49
|
+
} );
|
|
50
|
+
const dropZoneRef = useDropZone( {
|
|
51
|
+
onDrop: onBlockDrop,
|
|
52
|
+
onDragEnter: () => {
|
|
53
|
+
setIsVisible( true );
|
|
54
|
+
},
|
|
55
|
+
onDragLeave: () => {
|
|
56
|
+
setIsVisible( false );
|
|
57
|
+
},
|
|
58
|
+
} );
|
|
59
|
+
const reducedMotion = useReducedMotion();
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Popover
|
|
63
|
+
anchor={ paragraphElement }
|
|
64
|
+
animate={ false }
|
|
65
|
+
placement="top-start"
|
|
66
|
+
focusOnMount={ false }
|
|
67
|
+
flip={ false }
|
|
68
|
+
resize={ false }
|
|
69
|
+
className="wp-block-paragraph__drop-zone"
|
|
70
|
+
ref={ popoverRef }
|
|
71
|
+
>
|
|
72
|
+
{ isDragging ? (
|
|
73
|
+
<div
|
|
74
|
+
className="wp-block-paragraph__drop-zone-backdrop"
|
|
75
|
+
ref={ dropZoneRef }
|
|
76
|
+
style={ {
|
|
77
|
+
width: paragraphElement?.offsetWidth,
|
|
78
|
+
height: paragraphElement?.offsetHeight,
|
|
79
|
+
} }
|
|
80
|
+
>
|
|
81
|
+
<AnimatePresence>
|
|
82
|
+
{ isVisible ? (
|
|
83
|
+
<motion.div
|
|
84
|
+
key="drop-zone-foreground"
|
|
85
|
+
data-testid="empty-paragraph-drop-zone"
|
|
86
|
+
initial={
|
|
87
|
+
reducedMotion
|
|
88
|
+
? animateVariants.show
|
|
89
|
+
: animateVariants.hide
|
|
90
|
+
}
|
|
91
|
+
animate={ animateVariants.show }
|
|
92
|
+
exit={
|
|
93
|
+
reducedMotion
|
|
94
|
+
? animateVariants.show
|
|
95
|
+
: animateVariants.exit
|
|
96
|
+
}
|
|
97
|
+
className="wp-block-paragraph__drop-zone-foreground"
|
|
98
|
+
/>
|
|
99
|
+
) : null }
|
|
100
|
+
</AnimatePresence>
|
|
101
|
+
</div>
|
|
102
|
+
) : null }
|
|
103
|
+
</Popover>
|
|
104
|
+
);
|
|
105
|
+
}
|
package/src/paragraph/edit.js
CHANGED
|
@@ -6,6 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
9
10
|
import { __, _x, isRTL } from '@wordpress/i18n';
|
|
10
11
|
import {
|
|
11
12
|
ToolbarButton,
|
|
@@ -20,6 +21,7 @@ import {
|
|
|
20
21
|
useBlockProps,
|
|
21
22
|
useSetting,
|
|
22
23
|
} from '@wordpress/block-editor';
|
|
24
|
+
import { useMergeRefs } from '@wordpress/compose';
|
|
23
25
|
import { createBlock } from '@wordpress/blocks';
|
|
24
26
|
import { formatLtr } from '@wordpress/icons';
|
|
25
27
|
|
|
@@ -27,6 +29,7 @@ import { formatLtr } from '@wordpress/icons';
|
|
|
27
29
|
* Internal dependencies
|
|
28
30
|
*/
|
|
29
31
|
import { useOnEnter } from './use-enter';
|
|
32
|
+
import DropZone from './drop-zone';
|
|
30
33
|
|
|
31
34
|
const name = 'core/paragraph';
|
|
32
35
|
|
|
@@ -55,8 +58,12 @@ function ParagraphBlock( {
|
|
|
55
58
|
} ) {
|
|
56
59
|
const { align, content, direction, dropCap, placeholder } = attributes;
|
|
57
60
|
const isDropCapFeatureEnabled = useSetting( 'typography.dropCap' );
|
|
61
|
+
const [ paragraphElement, setParagraphElement ] = useState( null );
|
|
58
62
|
const blockProps = useBlockProps( {
|
|
59
|
-
ref:
|
|
63
|
+
ref: useMergeRefs( [
|
|
64
|
+
useOnEnter( { clientId, content } ),
|
|
65
|
+
setParagraphElement,
|
|
66
|
+
] ),
|
|
60
67
|
className: classnames( {
|
|
61
68
|
'has-drop-cap': dropCap,
|
|
62
69
|
[ `has-text-align-${ align }` ]: align,
|
|
@@ -108,6 +115,12 @@ function ParagraphBlock( {
|
|
|
108
115
|
</ToolsPanelItem>
|
|
109
116
|
</InspectorControls>
|
|
110
117
|
) }
|
|
118
|
+
{ ! content && (
|
|
119
|
+
<DropZone
|
|
120
|
+
clientId={ clientId }
|
|
121
|
+
paragraphElement={ paragraphElement }
|
|
122
|
+
/>
|
|
123
|
+
) }
|
|
111
124
|
<RichText
|
|
112
125
|
identifier="content"
|
|
113
126
|
tagName="p"
|
|
@@ -17,3 +17,23 @@
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
.components-popover.wp-block-paragraph__drop-zone {
|
|
22
|
+
.components-popover__content {
|
|
23
|
+
border: none;
|
|
24
|
+
outline: none;
|
|
25
|
+
box-shadow: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.wp-block-paragraph__drop-zone-backdrop {
|
|
29
|
+
position: absolute;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.wp-block-paragraph__drop-zone-foreground {
|
|
33
|
+
position: absolute;
|
|
34
|
+
inset: 0;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
background-color: var(--wp-admin-theme-color);
|
|
37
|
+
border-radius: 2px;
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/post-content/edit.js
CHANGED
|
@@ -46,7 +46,9 @@ function EditableContent( { layout, context = {} } ) {
|
|
|
46
46
|
return getSettings()?.supportsLayout;
|
|
47
47
|
}, [] );
|
|
48
48
|
const defaultLayout = useSetting( 'layout' ) || {};
|
|
49
|
-
const usedLayout =
|
|
49
|
+
const usedLayout = ! layout?.type
|
|
50
|
+
? { ...defaultLayout, ...layout, type: 'default' }
|
|
51
|
+
: { ...defaultLayout, ...layout };
|
|
50
52
|
const [ blocks, onInput, onChange ] = useEntityBlockEditor(
|
|
51
53
|
'postType',
|
|
52
54
|
postType,
|
package/src/tag-cloud/index.php
CHANGED
|
@@ -28,14 +28,7 @@ function render_block_core_tag_cloud( $attributes ) {
|
|
|
28
28
|
$tag_cloud = wp_tag_cloud( $args );
|
|
29
29
|
|
|
30
30
|
if ( ! $tag_cloud ) {
|
|
31
|
-
$
|
|
32
|
-
$tag_cloud = esc_html(
|
|
33
|
-
sprintf(
|
|
34
|
-
/* translators: %s: taxonomy name */
|
|
35
|
-
__( 'Your site doesn’t have any %s, so there’s nothing to display here at the moment.' ),
|
|
36
|
-
strtolower( $labels->name )
|
|
37
|
-
)
|
|
38
|
-
);
|
|
31
|
+
$tag_cloud = __( 'There’s no content to show here yet.' );
|
|
39
32
|
}
|
|
40
33
|
|
|
41
34
|
$wrapper_attributes = get_block_wrapper_attributes();
|