@wordpress/block-library 6.0.18 → 6.0.24
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/build/gallery/deprecated.js +1 -5
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit.js +0 -7
- package/build/gallery/edit.js.map +1 -1
- package/build/navigation/edit/index.js +8 -2
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +42 -4
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/placeholder/index.js +6 -41
- package/build/navigation/edit/placeholder/index.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/use-convert-classic-menu.js +59 -0
- package/build/navigation/use-convert-classic-menu.js.map +1 -0
- package/build/navigation/view.js +1 -1
- package/build/navigation/view.js.map +1 -1
- package/build/site-logo/edit.js +2 -2
- package/build/site-logo/edit.js.map +1 -1
- package/build/template-part/index.js +0 -8
- package/build/template-part/index.js.map +1 -1
- package/build-module/gallery/deprecated.js +2 -6
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit.js +0 -6
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +7 -2
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +39 -4
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/placeholder/index.js +5 -41
- package/build-module/navigation/edit/placeholder/index.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/use-convert-classic-menu.js +47 -0
- package/build-module/navigation/use-convert-classic-menu.js.map +1 -0
- package/build-module/navigation/view.js +1 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/site-logo/edit.js +2 -2
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/template-part/index.js +0 -8
- package/build-module/template-part/index.js.map +1 -1
- package/build-style/common-rtl.css +2 -2
- package/build-style/common.css +2 -2
- package/build-style/editor-rtl.css +2 -2
- package/build-style/editor.css +2 -2
- package/build-style/navigation/style-rtl.css +1 -0
- package/build-style/navigation/style.css +1 -0
- package/build-style/page-list/style-rtl.css +4 -4
- package/build-style/page-list/style.css +4 -4
- package/build-style/post-template/style-rtl.css +2 -29
- package/build-style/post-template/style.css +2 -29
- package/build-style/style-rtl.css +9 -35
- package/build-style/style.css +9 -35
- package/package.json +8 -9
- package/src/common.scss +2 -2
- package/src/editor.scss +2 -2
- package/src/gallery/deprecated.js +2 -5
- package/src/gallery/edit.js +0 -7
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/index.js +9 -1
- package/src/navigation/edit/navigation-menu-selector.js +65 -15
- package/src/navigation/edit/placeholder/index.js +9 -44
- package/src/navigation/style.scss +1 -0
- package/src/navigation/use-convert-classic-menu.js +58 -0
- package/src/navigation/view.js +1 -1
- package/src/navigation-submenu/index.php +2 -2
- package/src/page-list/index.php +1 -1
- package/src/page-list/style.scss +4 -4
- package/src/post-content/index.php +5 -0
- package/src/post-template/style.scss +2 -13
- package/src/query-pagination-next/index.php +3 -2
- package/src/search/index.php +9 -9
- package/src/site-logo/edit.js +3 -2
- package/src/template-part/block.json +0 -8
- package/build/gallery/use-mobile-warning.js +0 -43
- package/build/gallery/use-mobile-warning.js.map +0 -1
- package/build-module/gallery/use-mobile-warning.js +0 -32
- package/build-module/gallery/use-mobile-warning.js.map +0 -1
- package/src/gallery/use-mobile-warning.js +0 -28
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useCallback, useState, useEffect } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import useNavigationEntities from './use-navigation-entities';
|
|
10
|
+
import menuItemsToBlocks from './menu-items-to-blocks';
|
|
11
|
+
|
|
12
|
+
export default function useConvertClassicMenu( onFinish ) {
|
|
13
|
+
const [ selectedMenu, setSelectedMenu ] = useState();
|
|
14
|
+
const [
|
|
15
|
+
isAwaitingMenuItemResolution,
|
|
16
|
+
setIsAwaitingMenuItemResolution,
|
|
17
|
+
] = useState( false );
|
|
18
|
+
const [ menuName, setMenuName ] = useState( '' );
|
|
19
|
+
|
|
20
|
+
const { menuItems, hasResolvedMenuItems } = useNavigationEntities(
|
|
21
|
+
selectedMenu
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const createFromMenu = useCallback(
|
|
25
|
+
( name ) => {
|
|
26
|
+
const { innerBlocks: blocks } = menuItemsToBlocks( menuItems );
|
|
27
|
+
onFinish( blocks, name );
|
|
28
|
+
},
|
|
29
|
+
[ menuItems, menuItemsToBlocks, onFinish ]
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
useEffect( () => {
|
|
33
|
+
// If the user selected a menu but we had to wait for menu items to
|
|
34
|
+
// finish resolving, then create the block once resolution finishes.
|
|
35
|
+
if ( isAwaitingMenuItemResolution && hasResolvedMenuItems ) {
|
|
36
|
+
createFromMenu( menuName );
|
|
37
|
+
setIsAwaitingMenuItemResolution( false );
|
|
38
|
+
}
|
|
39
|
+
}, [ isAwaitingMenuItemResolution, hasResolvedMenuItems, menuName ] );
|
|
40
|
+
|
|
41
|
+
return useCallback(
|
|
42
|
+
( id, name ) => {
|
|
43
|
+
setSelectedMenu( id );
|
|
44
|
+
|
|
45
|
+
// If we have menu items, create the block right away.
|
|
46
|
+
if ( hasResolvedMenuItems ) {
|
|
47
|
+
createFromMenu( name );
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Otherwise, create the block when resolution finishes.
|
|
52
|
+
setIsAwaitingMenuItemResolution( true );
|
|
53
|
+
// Store the name to use later.
|
|
54
|
+
setMenuName( name );
|
|
55
|
+
},
|
|
56
|
+
[ hasResolvedMenuItems, createFromMenu ]
|
|
57
|
+
);
|
|
58
|
+
}
|
package/src/navigation/view.js
CHANGED
|
@@ -5,7 +5,7 @@ import MicroModal from 'micromodal';
|
|
|
5
5
|
|
|
6
6
|
// Responsive navigation toggle.
|
|
7
7
|
function navigationToggleModal( modal ) {
|
|
8
|
-
const dialogContainer =
|
|
8
|
+
const dialogContainer = modal.querySelector(
|
|
9
9
|
`.wp-block-navigation__responsive-dialog`
|
|
10
10
|
);
|
|
11
11
|
|
|
@@ -191,7 +191,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
191
191
|
$aria_label = sprintf(
|
|
192
192
|
/* translators: Accessibility text. %s: Parent page title. */
|
|
193
193
|
__( '%s submenu' ),
|
|
194
|
-
$label
|
|
194
|
+
wp_strip_all_tags( $label )
|
|
195
195
|
);
|
|
196
196
|
|
|
197
197
|
$html = '<li ' . $wrapper_attributes . '>';
|
|
@@ -231,7 +231,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
231
231
|
|
|
232
232
|
if ( $show_submenu_indicators ) {
|
|
233
233
|
// The submenu icon is rendered in a button here
|
|
234
|
-
// so that there's a clickable
|
|
234
|
+
// so that there's a clickable element to open the submenu.
|
|
235
235
|
$html .= '<button aria-label="' . $aria_label . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';
|
|
236
236
|
}
|
|
237
237
|
} else {
|
package/src/page-list/index.php
CHANGED
|
@@ -177,7 +177,7 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
|
|
|
177
177
|
$aria_label = sprintf(
|
|
178
178
|
/* translators: Accessibility text. %s: Parent page title. */
|
|
179
179
|
__( '%s submenu' ),
|
|
180
|
-
$title
|
|
180
|
+
wp_strip_all_tags( $title )
|
|
181
181
|
);
|
|
182
182
|
|
|
183
183
|
$markup .= '<li class="wp-block-pages-list__item' . $css_class . '"' . $style_attribute . '>';
|
package/src/page-list/style.scss
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
.wp-block-navigation {
|
|
3
3
|
.wp-block-page-list {
|
|
4
4
|
display: flex;
|
|
5
|
-
flex-direction: var(--layout-direction, initial);
|
|
6
|
-
justify-content: var(--layout-justify, initial);
|
|
7
|
-
align-items: var(--layout-align, initial);
|
|
8
|
-
flex-wrap: var(--layout-wrap, wrap);
|
|
5
|
+
flex-direction: var(--navigation-layout-direction, initial);
|
|
6
|
+
justify-content: var(--navigation-layout-justify, initial);
|
|
7
|
+
align-items: var(--navigation-layout-align, initial);
|
|
8
|
+
flex-wrap: var(--navigation-layout-wrap, wrap);
|
|
9
9
|
background-color: inherit;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -46,6 +46,11 @@ function render_block_core_post_content( $attributes, $content, $block ) {
|
|
|
46
46
|
// so that `the_preview` for the current post can apply.
|
|
47
47
|
// We force this behavior by omitting the third argument (post ID) from the `get_the_content`.
|
|
48
48
|
$content = get_the_content( null, false );
|
|
49
|
+
// Check for nextpage to display page links for paginated posts.
|
|
50
|
+
if ( has_block( 'core/nextpage' ) ) {
|
|
51
|
+
$content .= wp_link_pages( array( 'echo' => 0 ) );
|
|
52
|
+
}
|
|
53
|
+
|
|
49
54
|
/** This filter is documented in wp-includes/post-template.php */
|
|
50
55
|
$content = apply_filters( 'the_content', str_replace( ']]>', ']]>', $content ) );
|
|
51
56
|
unset( $seen_ids[ $post_id ] );
|
|
@@ -11,32 +11,21 @@
|
|
|
11
11
|
list-style: none;
|
|
12
12
|
padding: 0;
|
|
13
13
|
|
|
14
|
-
li {
|
|
15
|
-
clear: both;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
&.is-flex-container {
|
|
19
15
|
flex-direction: row;
|
|
20
16
|
display: flex;
|
|
21
17
|
flex-wrap: wrap;
|
|
18
|
+
gap: 1.25em;
|
|
22
19
|
|
|
23
20
|
li {
|
|
24
|
-
margin: 0
|
|
21
|
+
margin: 0;
|
|
25
22
|
width: 100%;
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
@include break-small {
|
|
29
|
-
li {
|
|
30
|
-
margin-right: 1.25em;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
26
|
@for $i from 2 through 6 {
|
|
34
27
|
&.is-flex-container.columns-#{ $i } > li {
|
|
35
28
|
width: calc((100% / #{ $i }) - 1.25em + (1.25em / #{ $i }));
|
|
36
|
-
|
|
37
|
-
&:nth-child( #{ $i }n ) {
|
|
38
|
-
margin-right: 0;
|
|
39
|
-
}
|
|
40
29
|
}
|
|
41
30
|
}
|
|
42
31
|
}
|
|
@@ -43,8 +43,9 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
|
|
|
43
43
|
$content = get_next_posts_link( $label, $max_page );
|
|
44
44
|
remove_filter( 'next_posts_link_attributes', $filter_link_attributes );
|
|
45
45
|
} elseif ( ! $max_page || $max_page > $page ) {
|
|
46
|
-
$custom_query
|
|
47
|
-
|
|
46
|
+
$custom_query = new WP_Query( build_query_vars_from_query_block( $block, $page ) );
|
|
47
|
+
$custom_query_max_pages = (int) $custom_query->max_num_pages;
|
|
48
|
+
if ( $custom_query_max_pages && $custom_query_max_pages !== $page ) {
|
|
48
49
|
$content = sprintf(
|
|
49
50
|
'<a href="%1$s" %2$s>%3$s</a>',
|
|
50
51
|
esc_url( add_query_arg( $page_key, $page + 1 ) ),
|
package/src/search/index.php
CHANGED
|
@@ -46,13 +46,13 @@ function render_block_core_search( $attributes ) {
|
|
|
46
46
|
$label_markup = sprintf(
|
|
47
47
|
'<label for="%1$s" class="wp-block-search__label screen-reader-text">%2$s</label>',
|
|
48
48
|
$input_id,
|
|
49
|
-
empty( $attributes['label'] ) ? __( 'Search' ) : $attributes['label']
|
|
49
|
+
empty( $attributes['label'] ) ? __( 'Search' ) : esc_html( $attributes['label'] )
|
|
50
50
|
);
|
|
51
51
|
if ( $show_label && ! empty( $attributes['label'] ) ) {
|
|
52
52
|
$label_markup = sprintf(
|
|
53
53
|
'<label for="%1$s" class="wp-block-search__label">%2$s</label>',
|
|
54
54
|
$input_id,
|
|
55
|
-
$attributes['label']
|
|
55
|
+
esc_html( $attributes['label'] )
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -61,7 +61,7 @@ function render_block_core_search( $attributes ) {
|
|
|
61
61
|
$input_markup = sprintf(
|
|
62
62
|
'<input type="search" id="%s" class="wp-block-search__input %s" name="s" value="%s" placeholder="%s" %s required />',
|
|
63
63
|
$input_id,
|
|
64
|
-
$input_classes,
|
|
64
|
+
esc_attr( $input_classes ),
|
|
65
65
|
esc_attr( get_search_query() ),
|
|
66
66
|
esc_attr( $attributes['placeholder'] ),
|
|
67
67
|
$inline_styles['input']
|
|
@@ -77,7 +77,7 @@ function render_block_core_search( $attributes ) {
|
|
|
77
77
|
}
|
|
78
78
|
if ( ! $use_icon_button ) {
|
|
79
79
|
if ( ! empty( $attributes['buttonText'] ) ) {
|
|
80
|
-
$button_internal_markup = $attributes['buttonText'];
|
|
80
|
+
$button_internal_markup = esc_html( $attributes['buttonText'] );
|
|
81
81
|
}
|
|
82
82
|
} else {
|
|
83
83
|
$button_classes .= ' has-icon';
|
|
@@ -89,7 +89,7 @@ function render_block_core_search( $attributes ) {
|
|
|
89
89
|
|
|
90
90
|
$button_markup = sprintf(
|
|
91
91
|
'<button type="submit" class="wp-block-search__button %s" %s>%s</button>',
|
|
92
|
-
$button_classes,
|
|
92
|
+
esc_attr( $button_classes ),
|
|
93
93
|
$inline_styles['button'],
|
|
94
94
|
$button_internal_markup
|
|
95
95
|
);
|
|
@@ -98,7 +98,7 @@ function render_block_core_search( $attributes ) {
|
|
|
98
98
|
$field_markup_classes = $is_button_inside ? $border_color_classes : '';
|
|
99
99
|
$field_markup = sprintf(
|
|
100
100
|
'<div class="wp-block-search__inside-wrapper %s" %s>%s</div>',
|
|
101
|
-
$field_markup_classes,
|
|
101
|
+
esc_attr( $field_markup_classes ),
|
|
102
102
|
$inline_styles['wrapper'],
|
|
103
103
|
$input_markup . $button_markup
|
|
104
104
|
);
|
|
@@ -285,9 +285,9 @@ function styles_for_block_core_search( $attributes ) {
|
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
return array(
|
|
288
|
-
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', implode( ' ', $input_styles ) ) : '',
|
|
289
|
-
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', implode( ' ', $button_styles ) ) : '',
|
|
290
|
-
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', implode( ' ', $wrapper_styles ) ) : '',
|
|
288
|
+
'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '',
|
|
289
|
+
'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '',
|
|
290
|
+
'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '',
|
|
291
291
|
);
|
|
292
292
|
}
|
|
293
293
|
|
package/src/site-logo/edit.js
CHANGED
|
@@ -166,9 +166,10 @@ const SiteLogo = ( {
|
|
|
166
166
|
const currentWidth = width || defaultWidth;
|
|
167
167
|
const ratio = naturalWidth / naturalHeight;
|
|
168
168
|
const currentHeight = currentWidth / ratio;
|
|
169
|
-
const minWidth =
|
|
169
|
+
const minWidth =
|
|
170
|
+
naturalWidth < naturalHeight ? MIN_SIZE : Math.ceil( MIN_SIZE * ratio );
|
|
170
171
|
const minHeight =
|
|
171
|
-
naturalHeight < naturalWidth ? MIN_SIZE : MIN_SIZE / ratio;
|
|
172
|
+
naturalHeight < naturalWidth ? MIN_SIZE : Math.ceil( MIN_SIZE / ratio );
|
|
172
173
|
|
|
173
174
|
// With the current implementation of ResizableBox, an image needs an
|
|
174
175
|
// explicit pixel value for the max-width. In absence of being able to
|
|
@@ -22,14 +22,6 @@
|
|
|
22
22
|
"supports": {
|
|
23
23
|
"align": true,
|
|
24
24
|
"html": false,
|
|
25
|
-
"color": {
|
|
26
|
-
"gradients": true,
|
|
27
|
-
"link": true
|
|
28
|
-
},
|
|
29
|
-
"spacing": {
|
|
30
|
-
"padding": true
|
|
31
|
-
},
|
|
32
|
-
"__experimentalLayout": true,
|
|
33
25
|
"reusable": false
|
|
34
26
|
},
|
|
35
27
|
"editorStyle": "wp-block-template-part-editor"
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useMobileWarning;
|
|
7
|
-
|
|
8
|
-
var _i18n = require("@wordpress/i18n");
|
|
9
|
-
|
|
10
|
-
var _data = require("@wordpress/data");
|
|
11
|
-
|
|
12
|
-
var _interface = require("@wordpress/interface");
|
|
13
|
-
|
|
14
|
-
var _notices = require("@wordpress/notices");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
function useMobileWarning(newImages) {
|
|
20
|
-
const {
|
|
21
|
-
createWarningNotice
|
|
22
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
23
|
-
const {
|
|
24
|
-
toggleFeature
|
|
25
|
-
} = (0, _data.useDispatch)(_interface.store);
|
|
26
|
-
const isMobileWarningActive = (0, _data.useSelect)(select => {
|
|
27
|
-
const {
|
|
28
|
-
isFeatureActive
|
|
29
|
-
} = select(_interface.store);
|
|
30
|
-
return isFeatureActive('core/edit-post', 'mobileGalleryWarning');
|
|
31
|
-
}, []);
|
|
32
|
-
|
|
33
|
-
if (!isMobileWarningActive || !newImages) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
createWarningNotice((0, _i18n.__)('If you want to edit the gallery you just added in the mobile app, to avoid losing any data please make sure you use version 18.2 of the app or above.'), {
|
|
38
|
-
type: 'snackbar',
|
|
39
|
-
explicitDismiss: true
|
|
40
|
-
});
|
|
41
|
-
toggleFeature('core/edit-post', 'mobileGalleryWarning');
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=use-mobile-warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/gallery/use-mobile-warning.js"],"names":["useMobileWarning","newImages","createWarningNotice","noticesStore","toggleFeature","interfaceStore","isMobileWarningActive","select","isFeatureActive","type","explicitDismiss"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AANA;AACA;AACA;AAMe,SAASA,gBAAT,CAA2BC,SAA3B,EAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,cAAb,CAAhC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,gBAAb,CAA1B;AACA,QAAMC,qBAAqB,GAAG,qBAAaC,MAAF,IAAc;AACtD,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEF,gBAAF,CAAlC;AACA,WAAOG,eAAe,CAAE,gBAAF,EAAoB,sBAApB,CAAtB;AACA,GAH6B,EAG3B,EAH2B,CAA9B;;AAKA,MAAK,CAAEF,qBAAF,IAA2B,CAAEL,SAAlC,EAA8C;AAC7C;AACA;;AAEDC,EAAAA,mBAAmB,CAClB,cACC,uJADD,CADkB,EAIlB;AAAEO,IAAAA,IAAI,EAAE,UAAR;AAAoBC,IAAAA,eAAe,EAAE;AAArC,GAJkB,CAAnB;AAMAN,EAAAA,aAAa,CAAE,gBAAF,EAAoB,sBAApB,CAAb;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function useMobileWarning( newImages ) {\n\tconst { createWarningNotice } = useDispatch( noticesStore );\n\tconst { toggleFeature } = useDispatch( interfaceStore );\n\tconst isMobileWarningActive = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( interfaceStore );\n\t\treturn isFeatureActive( 'core/edit-post', 'mobileGalleryWarning' );\n\t}, [] );\n\n\tif ( ! isMobileWarningActive || ! newImages ) {\n\t\treturn;\n\t}\n\n\tcreateWarningNotice(\n\t\t__(\n\t\t\t'If you want to edit the gallery you just added in the mobile app, to avoid losing any data please make sure you use version 18.2 of the app or above.'\n\t\t),\n\t\t{ type: 'snackbar', explicitDismiss: true }\n\t);\n\ttoggleFeature( 'core/edit-post', 'mobileGalleryWarning' );\n}\n"]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
7
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
8
|
-
export default function useMobileWarning(newImages) {
|
|
9
|
-
const {
|
|
10
|
-
createWarningNotice
|
|
11
|
-
} = useDispatch(noticesStore);
|
|
12
|
-
const {
|
|
13
|
-
toggleFeature
|
|
14
|
-
} = useDispatch(interfaceStore);
|
|
15
|
-
const isMobileWarningActive = useSelect(select => {
|
|
16
|
-
const {
|
|
17
|
-
isFeatureActive
|
|
18
|
-
} = select(interfaceStore);
|
|
19
|
-
return isFeatureActive('core/edit-post', 'mobileGalleryWarning');
|
|
20
|
-
}, []);
|
|
21
|
-
|
|
22
|
-
if (!isMobileWarningActive || !newImages) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
createWarningNotice(__('If you want to edit the gallery you just added in the mobile app, to avoid losing any data please make sure you use version 18.2 of the app or above.'), {
|
|
27
|
-
type: 'snackbar',
|
|
28
|
-
explicitDismiss: true
|
|
29
|
-
});
|
|
30
|
-
toggleFeature('core/edit-post', 'mobileGalleryWarning');
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=use-mobile-warning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/gallery/use-mobile-warning.js"],"names":["__","useDispatch","useSelect","store","interfaceStore","noticesStore","useMobileWarning","newImages","createWarningNotice","toggleFeature","isMobileWarningActive","select","isFeatureActive","type","explicitDismiss"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,gBAAT,CAA2BC,SAA3B,EAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAA0BP,WAAW,CAAEI,YAAF,CAA3C;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAoBR,WAAW,CAAEG,cAAF,CAArC;AACA,QAAMM,qBAAqB,GAAGR,SAAS,CAAIS,MAAF,IAAc;AACtD,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEP,cAAF,CAAlC;AACA,WAAOQ,eAAe,CAAE,gBAAF,EAAoB,sBAApB,CAAtB;AACA,GAHsC,EAGpC,EAHoC,CAAvC;;AAKA,MAAK,CAAEF,qBAAF,IAA2B,CAAEH,SAAlC,EAA8C;AAC7C;AACA;;AAEDC,EAAAA,mBAAmB,CAClBR,EAAE,CACD,uJADC,CADgB,EAIlB;AAAEa,IAAAA,IAAI,EAAE,UAAR;AAAoBC,IAAAA,eAAe,EAAE;AAArC,GAJkB,CAAnB;AAMAL,EAAAA,aAAa,CAAE,gBAAF,EAAoB,sBAApB,CAAb;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function useMobileWarning( newImages ) {\n\tconst { createWarningNotice } = useDispatch( noticesStore );\n\tconst { toggleFeature } = useDispatch( interfaceStore );\n\tconst isMobileWarningActive = useSelect( ( select ) => {\n\t\tconst { isFeatureActive } = select( interfaceStore );\n\t\treturn isFeatureActive( 'core/edit-post', 'mobileGalleryWarning' );\n\t}, [] );\n\n\tif ( ! isMobileWarningActive || ! newImages ) {\n\t\treturn;\n\t}\n\n\tcreateWarningNotice(\n\t\t__(\n\t\t\t'If you want to edit the gallery you just added in the mobile app, to avoid losing any data please make sure you use version 18.2 of the app or above.'\n\t\t),\n\t\t{ type: 'snackbar', explicitDismiss: true }\n\t);\n\ttoggleFeature( 'core/edit-post', 'mobileGalleryWarning' );\n}\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
7
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
8
|
-
|
|
9
|
-
export default function useMobileWarning( newImages ) {
|
|
10
|
-
const { createWarningNotice } = useDispatch( noticesStore );
|
|
11
|
-
const { toggleFeature } = useDispatch( interfaceStore );
|
|
12
|
-
const isMobileWarningActive = useSelect( ( select ) => {
|
|
13
|
-
const { isFeatureActive } = select( interfaceStore );
|
|
14
|
-
return isFeatureActive( 'core/edit-post', 'mobileGalleryWarning' );
|
|
15
|
-
}, [] );
|
|
16
|
-
|
|
17
|
-
if ( ! isMobileWarningActive || ! newImages ) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
createWarningNotice(
|
|
22
|
-
__(
|
|
23
|
-
'If you want to edit the gallery you just added in the mobile app, to avoid losing any data please make sure you use version 18.2 of the app or above.'
|
|
24
|
-
),
|
|
25
|
-
{ type: 'snackbar', explicitDismiss: true }
|
|
26
|
-
);
|
|
27
|
-
toggleFeature( 'core/edit-post', 'mobileGalleryWarning' );
|
|
28
|
-
}
|