@wordpress/block-library 9.0.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/button/save.js +0 -3
- package/build/button/save.js.map +1 -1
- package/build/comment-date/edit.js +1 -1
- package/build/comment-date/edit.js.map +1 -1
- package/build/embed/variations.js +0 -10
- package/build/embed/variations.js.map +1 -1
- package/build/gallery/v1/gallery-image.js +16 -4
- package/build/gallery/v1/gallery-image.js.map +1 -1
- package/build/list-item/edit.native.js +1 -15
- package/build/list-item/edit.native.js.map +1 -1
- package/build/missing/edit.native.js +29 -4
- package/build/missing/edit.native.js.map +1 -1
- package/build/navigation/view.js +1 -1
- package/build/navigation/view.js.map +1 -1
- package/build/page-list/convert-to-links-modal.js +1 -0
- package/build/page-list/convert-to-links-modal.js.map +1 -1
- package/build/page-list/edit.js +1 -0
- package/build/page-list/edit.js.map +1 -1
- package/build/post-content/index.js +13 -1
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/edit.js +1 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/pullquote/index.js +13 -0
- package/build/pullquote/index.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +10 -10
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +2 -2
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/quote/index.js +13 -0
- package/build/quote/index.js.map +1 -1
- package/build/template-part/edit/title-modal.js +1 -1
- package/build/template-part/edit/title-modal.js.map +1 -1
- package/build/verse/index.js +13 -0
- package/build/verse/index.js.map +1 -1
- package/build-module/button/save.js +0 -3
- package/build-module/button/save.js.map +1 -1
- package/build-module/comment-date/edit.js +2 -2
- package/build-module/comment-date/edit.js.map +1 -1
- package/build-module/embed/variations.js +0 -10
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/gallery/v1/gallery-image.js +16 -4
- package/build-module/gallery/v1/gallery-image.js.map +1 -1
- package/build-module/list-item/edit.native.js +2 -16
- package/build-module/list-item/edit.native.js.map +1 -1
- package/build-module/missing/edit.native.js +30 -5
- package/build-module/missing/edit.native.js.map +1 -1
- package/build-module/navigation/view.js +1 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/page-list/convert-to-links-modal.js +1 -0
- package/build-module/page-list/convert-to-links-modal.js.map +1 -1
- package/build-module/page-list/edit.js +1 -0
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-content/index.js +13 -1
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/edit.js +2 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/pullquote/index.js +13 -0
- package/build-module/pullquote/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +10 -10
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +2 -2
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/quote/index.js +13 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/template-part/edit/title-modal.js +1 -1
- package/build-module/template-part/edit/title-modal.js.map +1 -1
- package/build-module/verse/index.js +13 -0
- package/build-module/verse/index.js.map +1 -1
- package/build-style/editor-rtl.css +2 -16
- package/build-style/editor.css +2 -16
- package/build-style/media-text/style-rtl.css +17 -17
- package/build-style/media-text/style.css +17 -17
- package/build-style/navigation/editor-rtl.css +0 -15
- package/build-style/navigation/editor.css +0 -15
- package/build-style/query/editor-rtl.css +2 -1
- package/build-style/query/editor.css +2 -1
- package/build-style/style-rtl.css +17 -17
- package/build-style/style.css +17 -17
- package/package.json +35 -35
- package/src/button/index.php +80 -0
- package/src/button/save.js +0 -4
- package/src/buttons/test/__snapshots__/edit.native.js.snap +30 -10
- package/src/buttons/test/edit.native.js +53 -12
- package/src/comment-date/edit.js +8 -2
- package/src/comment-date/index.php +7 -5
- package/src/embed/variations.js +0 -8
- package/src/gallery/v1/gallery-image.js +8 -0
- package/src/list-item/edit.native.js +2 -22
- package/src/media-text/style.scss +16 -15
- package/src/missing/edit.native.js +44 -12
- package/src/missing/test/__snapshots__/edit.native.js.snap +75 -59
- package/src/navigation/editor.scss +0 -16
- package/src/navigation/index.php +8 -8
- package/src/navigation/view.js +1 -1
- package/src/page-list/convert-to-links-modal.js +1 -0
- package/src/page-list/edit.js +1 -0
- package/src/post-content/block.json +13 -1
- package/src/post-date/edit.js +8 -2
- package/src/post-date/index.php +14 -3
- package/src/pullquote/block.json +13 -0
- package/src/query/edit/inspector-controls/create-new-post-link.js +12 -8
- package/src/query/edit/inspector-controls/index.js +5 -3
- package/src/query/editor.scss +2 -1
- package/src/query-pagination-next/index.php +1 -1
- package/src/query-pagination-previous/index.php +1 -1
- package/src/quote/block.json +13 -0
- package/src/search/index.php +2 -2
- package/src/site-logo/index.php +6 -0
- package/src/social-links/test/edit.native.js +41 -5
- package/src/template-part/edit/title-modal.js +1 -1
- package/src/verse/block.json +13 -0
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
initializeEditor,
|
|
11
11
|
triggerBlockListLayout,
|
|
12
12
|
typeInRichText,
|
|
13
|
+
screen,
|
|
13
14
|
openBlockSettings,
|
|
14
15
|
waitFor,
|
|
15
16
|
} from 'test/helpers';
|
|
@@ -21,7 +22,9 @@ import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
|
|
|
21
22
|
import { registerCoreBlocks } from '@wordpress/block-library';
|
|
22
23
|
|
|
23
24
|
const BUTTONS_HTML = `<!-- wp:buttons -->
|
|
24
|
-
<div class="wp-block-buttons"><!-- wp:button
|
|
25
|
+
<div class="wp-block-buttons"><!-- wp:button -->
|
|
26
|
+
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button"></a></div>
|
|
27
|
+
<!-- /wp:button --></div>
|
|
25
28
|
<!-- /wp:buttons -->`;
|
|
26
29
|
|
|
27
30
|
beforeAll( () => {
|
|
@@ -90,7 +93,7 @@ describe( 'Buttons block', () => {
|
|
|
90
93
|
} );
|
|
91
94
|
|
|
92
95
|
it( 'adds another button using the inline appender', async () => {
|
|
93
|
-
|
|
96
|
+
await initializeEditor( {
|
|
94
97
|
initialHtml: BUTTONS_HTML,
|
|
95
98
|
} );
|
|
96
99
|
|
|
@@ -141,7 +144,7 @@ describe( 'Buttons block', () => {
|
|
|
141
144
|
} );
|
|
142
145
|
|
|
143
146
|
it( 'adds another button using the inserter', async () => {
|
|
144
|
-
|
|
147
|
+
await initializeEditor( {
|
|
145
148
|
initialHtml: BUTTONS_HTML,
|
|
146
149
|
} );
|
|
147
150
|
|
|
@@ -200,9 +203,48 @@ describe( 'Buttons block', () => {
|
|
|
200
203
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
201
204
|
} );
|
|
202
205
|
|
|
206
|
+
it( 'shows only the button block when using the inserter', async () => {
|
|
207
|
+
await initializeEditor();
|
|
208
|
+
|
|
209
|
+
// Add block
|
|
210
|
+
await addBlock( screen, 'Buttons' );
|
|
211
|
+
|
|
212
|
+
// Get block
|
|
213
|
+
const buttonsBlock = await getBlock( screen, 'Buttons' );
|
|
214
|
+
fireEvent.press( buttonsBlock );
|
|
215
|
+
await triggerBlockListLayout( buttonsBlock );
|
|
216
|
+
|
|
217
|
+
// Get inner button block
|
|
218
|
+
const buttonBlock = await getBlock( screen, 'Button' );
|
|
219
|
+
fireEvent.press( buttonBlock );
|
|
220
|
+
|
|
221
|
+
// Open the block inserter
|
|
222
|
+
fireEvent.press( screen.getByLabelText( 'Add block' ) );
|
|
223
|
+
|
|
224
|
+
const inserterList = screen.getByTestId( 'InserterUI-Blocks' );
|
|
225
|
+
// onScroll event used to force the FlatList to render all items
|
|
226
|
+
fireEvent.scroll( inserterList, {
|
|
227
|
+
nativeEvent: {
|
|
228
|
+
contentOffset: { y: 0, x: 0 },
|
|
229
|
+
contentSize: { width: 100, height: 100 },
|
|
230
|
+
layoutMeasurement: { width: 100, height: 100 },
|
|
231
|
+
},
|
|
232
|
+
} );
|
|
233
|
+
|
|
234
|
+
// Check the Button block is in the list
|
|
235
|
+
const buttonInserterBlock =
|
|
236
|
+
await within( inserterList ).findByText( 'Button' );
|
|
237
|
+
expect( buttonInserterBlock ).toBeVisible();
|
|
238
|
+
|
|
239
|
+
// Check the Paragraph core block is not in the list
|
|
240
|
+
expect(
|
|
241
|
+
within( inserterList ).queryByLabelText( 'Paragraph block' )
|
|
242
|
+
).toBeNull();
|
|
243
|
+
} );
|
|
244
|
+
|
|
203
245
|
describe( 'removing button along with buttons block', () => {
|
|
204
246
|
it( 'removes the button and buttons block when deleting the block using the block delete action', async () => {
|
|
205
|
-
|
|
247
|
+
await initializeEditor( {
|
|
206
248
|
initialHtml: BUTTONS_HTML,
|
|
207
249
|
} );
|
|
208
250
|
|
|
@@ -248,10 +290,9 @@ describe( 'Buttons block', () => {
|
|
|
248
290
|
'Justify items right',
|
|
249
291
|
].forEach( ( justificationOption ) =>
|
|
250
292
|
it( `sets ${ justificationOption } option`, async () => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const screen = await initializeEditor( { initialHtml } );
|
|
293
|
+
await initializeEditor( {
|
|
294
|
+
initialHtml: BUTTONS_HTML,
|
|
295
|
+
} );
|
|
255
296
|
|
|
256
297
|
const [ block ] = await screen.findAllByLabelText(
|
|
257
298
|
/Buttons Block\. Row 1/
|
|
@@ -275,7 +316,7 @@ describe( 'Buttons block', () => {
|
|
|
275
316
|
describe( 'color customization', () => {
|
|
276
317
|
it( 'sets a text color', async () => {
|
|
277
318
|
// Arrange
|
|
278
|
-
|
|
319
|
+
await initializeEditor();
|
|
279
320
|
await addBlock( screen, 'Buttons' );
|
|
280
321
|
|
|
281
322
|
// Act
|
|
@@ -316,7 +357,7 @@ describe( 'Buttons block', () => {
|
|
|
316
357
|
|
|
317
358
|
it( 'sets a background color', async () => {
|
|
318
359
|
// Arrange
|
|
319
|
-
|
|
360
|
+
await initializeEditor();
|
|
320
361
|
await addBlock( screen, 'Buttons' );
|
|
321
362
|
|
|
322
363
|
// Act
|
|
@@ -353,7 +394,7 @@ describe( 'Buttons block', () => {
|
|
|
353
394
|
|
|
354
395
|
it( 'sets a gradient background color', async () => {
|
|
355
396
|
// Arrange
|
|
356
|
-
|
|
397
|
+
await initializeEditor();
|
|
357
398
|
await addBlock( screen, 'Buttons' );
|
|
358
399
|
|
|
359
400
|
// Act
|
|
@@ -395,7 +436,7 @@ describe( 'Buttons block', () => {
|
|
|
395
436
|
|
|
396
437
|
it( 'sets a custom gradient background color', async () => {
|
|
397
438
|
// Arrange
|
|
398
|
-
|
|
439
|
+
await initializeEditor();
|
|
399
440
|
await addBlock( screen, 'Buttons' );
|
|
400
441
|
|
|
401
442
|
// Act
|
package/src/comment-date/edit.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useEntityProp } from '@wordpress/core-data';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
dateI18n,
|
|
7
|
+
humanTimeDiff,
|
|
8
|
+
getSettings as getDateSettings,
|
|
9
|
+
} from '@wordpress/date';
|
|
6
10
|
import {
|
|
7
11
|
InspectorControls,
|
|
8
12
|
useBlockProps,
|
|
@@ -64,7 +68,9 @@ export default function Edit( {
|
|
|
64
68
|
let commentDate =
|
|
65
69
|
date instanceof Date ? (
|
|
66
70
|
<time dateTime={ dateI18n( 'c', date ) }>
|
|
67
|
-
{
|
|
71
|
+
{ format === 'human-diff'
|
|
72
|
+
? humanTimeDiff( date )
|
|
73
|
+
: dateI18n( format || siteFormat, date ) }
|
|
68
74
|
</time>
|
|
69
75
|
) : (
|
|
70
76
|
<time>{ date }</time>
|
|
@@ -28,11 +28,13 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
|
|
|
28
28
|
$classes = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
|
|
29
29
|
|
|
30
30
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
|
|
31
|
-
$
|
|
32
|
-
|
|
33
|
-
$comment
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
if ( isset( $attributes['format'] ) && 'human-diff' === $attributes['format'] ) {
|
|
32
|
+
// translators: %s: human-readable time difference.
|
|
33
|
+
$formatted_date = sprintf( __( '%s ago', 'gutenberg' ), human_time_diff( get_comment_date( 'U', $comment ) ) );
|
|
34
|
+
} else {
|
|
35
|
+
$formatted_date = get_comment_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $comment );
|
|
36
|
+
}
|
|
37
|
+
$link = get_comment_link( $comment );
|
|
36
38
|
|
|
37
39
|
if ( ! empty( $attributes['isLink'] ) ) {
|
|
38
40
|
$formatted_date = sprintf( '<a href="%1s">%2s</a>', esc_url( $link ), $formatted_date );
|
package/src/embed/variations.js
CHANGED
|
@@ -259,14 +259,6 @@ const variations = [
|
|
|
259
259
|
patterns: [ /^https?:\/\/(www\.)?scribd\.com\/.+/i ],
|
|
260
260
|
attributes: { providerNameSlug: 'scribd', responsive: true },
|
|
261
261
|
},
|
|
262
|
-
{
|
|
263
|
-
name: 'slideshare',
|
|
264
|
-
title: 'Slideshare',
|
|
265
|
-
icon: embedContentIcon,
|
|
266
|
-
description: __( 'Embed Slideshare content.' ),
|
|
267
|
-
patterns: [ /^https?:\/\/(.+?\.)?slideshare\.net\/.+/i ],
|
|
268
|
-
attributes: { providerNameSlug: 'slideshare', responsive: true },
|
|
269
|
-
},
|
|
270
262
|
{
|
|
271
263
|
name: 'smugmug',
|
|
272
264
|
title: 'SmugMug',
|
|
@@ -222,6 +222,8 @@ class GalleryImage extends Component {
|
|
|
222
222
|
onClick={ isFirstItem ? undefined : onMoveBackward }
|
|
223
223
|
label={ __( 'Move image backward' ) }
|
|
224
224
|
aria-disabled={ isFirstItem }
|
|
225
|
+
// Disable reason: Truly disable when image is not selected.
|
|
226
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
225
227
|
disabled={ ! isSelected }
|
|
226
228
|
/>
|
|
227
229
|
<Button
|
|
@@ -229,6 +231,8 @@ class GalleryImage extends Component {
|
|
|
229
231
|
onClick={ isLastItem ? undefined : onMoveForward }
|
|
230
232
|
label={ __( 'Move image forward' ) }
|
|
231
233
|
aria-disabled={ isLastItem }
|
|
234
|
+
// Disable reason: Truly disable when image is not selected.
|
|
235
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
232
236
|
disabled={ ! isSelected }
|
|
233
237
|
/>
|
|
234
238
|
</ButtonGroup>
|
|
@@ -237,12 +241,16 @@ class GalleryImage extends Component {
|
|
|
237
241
|
icon={ edit }
|
|
238
242
|
onClick={ this.onEdit }
|
|
239
243
|
label={ __( 'Replace image' ) }
|
|
244
|
+
// Disable reason: Truly disable when image is not selected.
|
|
245
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
240
246
|
disabled={ ! isSelected }
|
|
241
247
|
/>
|
|
242
248
|
<Button
|
|
243
249
|
icon={ closeSmall }
|
|
244
250
|
onClick={ onRemove }
|
|
245
251
|
label={ __( 'Remove image' ) }
|
|
252
|
+
// Disable reason: Truly disable when image is not selected.
|
|
253
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
246
254
|
disabled={ ! isSelected }
|
|
247
255
|
/>
|
|
248
256
|
</ButtonGroup>
|
|
@@ -21,8 +21,7 @@ import { useState, useCallback, useRef } from '@wordpress/element';
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
|
-
import {
|
|
25
|
-
import { convertToListItems } from './utils';
|
|
24
|
+
import { useMerge, useEnter } from './hooks';
|
|
26
25
|
import { IndentUI } from './edit.js';
|
|
27
26
|
import styles from './style.scss';
|
|
28
27
|
import ListStyleType from './list-style-type';
|
|
@@ -32,7 +31,6 @@ const OPACITY = '9e';
|
|
|
32
31
|
export default function ListItemEdit( {
|
|
33
32
|
attributes,
|
|
34
33
|
setAttributes,
|
|
35
|
-
onReplace,
|
|
36
34
|
clientId,
|
|
37
35
|
style,
|
|
38
36
|
mergeBlocks,
|
|
@@ -118,24 +116,7 @@ export default function ListItemEdit( {
|
|
|
118
116
|
|
|
119
117
|
const preventDefault = useRef( false );
|
|
120
118
|
const { onEnter } = useEnter( { content, clientId }, preventDefault );
|
|
121
|
-
const onSplit = useSplit( clientId );
|
|
122
119
|
const onMerge = useMerge( clientId, mergeBlocks );
|
|
123
|
-
const onSplitList = useCallback(
|
|
124
|
-
( value ) => {
|
|
125
|
-
if ( ! preventDefault.current ) {
|
|
126
|
-
return onSplit( value );
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
[ clientId, onSplit ]
|
|
130
|
-
);
|
|
131
|
-
const onReplaceList = useCallback(
|
|
132
|
-
( blocks, ...args ) => {
|
|
133
|
-
if ( ! preventDefault.current ) {
|
|
134
|
-
onReplace( convertToListItems( blocks ), ...args );
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
[ clientId, onReplace, convertToListItems ]
|
|
138
|
-
);
|
|
139
120
|
const onLayout = useCallback( ( { nativeEvent } ) => {
|
|
140
121
|
setContentWidth( ( prevState ) => {
|
|
141
122
|
const { width } = nativeEvent.layout;
|
|
@@ -166,6 +147,7 @@ export default function ListItemEdit( {
|
|
|
166
147
|
onLayout={ onLayout }
|
|
167
148
|
>
|
|
168
149
|
<RichText
|
|
150
|
+
__unstableUseSplitSelection
|
|
169
151
|
identifier="content"
|
|
170
152
|
tagName="p"
|
|
171
153
|
onChange={ ( nextContent ) =>
|
|
@@ -176,9 +158,7 @@ export default function ListItemEdit( {
|
|
|
176
158
|
placeholderTextColor={
|
|
177
159
|
defaultPlaceholderTextColorWithOpacity
|
|
178
160
|
}
|
|
179
|
-
onSplit={ onSplitList }
|
|
180
161
|
onMerge={ onMerge }
|
|
181
|
-
onReplace={ onReplaceList }
|
|
182
162
|
onEnter={ onEnter }
|
|
183
163
|
style={ styleWithPlaceholderOpacity }
|
|
184
164
|
deleteEnter
|
|
@@ -15,27 +15,28 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.wp-block-media-text.is-vertically-aligned-top {
|
|
18
|
-
.wp-block-media-text__content,
|
|
19
|
-
.wp-block-media-text__media {
|
|
18
|
+
> .wp-block-media-text__content,
|
|
19
|
+
> .wp-block-media-text__media {
|
|
20
20
|
align-self: start;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
|
|
23
24
|
.wp-block-media-text,
|
|
24
25
|
.wp-block-media-text.is-vertically-aligned-center {
|
|
25
|
-
.wp-block-media-text__content,
|
|
26
|
-
.wp-block-media-text__media {
|
|
26
|
+
> .wp-block-media-text__content,
|
|
27
|
+
> .wp-block-media-text__media {
|
|
27
28
|
align-self: center;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
.wp-block-media-text.is-vertically-aligned-bottom {
|
|
32
|
-
.wp-block-media-text__content,
|
|
33
|
-
.wp-block-media-text__media {
|
|
33
|
+
> .wp-block-media-text__content,
|
|
34
|
+
> .wp-block-media-text__media {
|
|
34
35
|
align-self: end;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
.wp-block-media-text .wp-block-media-text__media {
|
|
39
|
+
.wp-block-media-text > .wp-block-media-text__media {
|
|
39
40
|
/*!rtl:begin:ignore*/
|
|
40
41
|
grid-column: 1;
|
|
41
42
|
grid-row: 1;
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
margin: 0;
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
.wp-block-media-text .wp-block-media-text__content {
|
|
47
|
+
.wp-block-media-text > .wp-block-media-text__content {
|
|
47
48
|
direction: ltr;
|
|
48
49
|
/*!rtl:begin:ignore*/
|
|
49
50
|
grid-column: 2;
|
|
@@ -53,14 +54,14 @@
|
|
|
53
54
|
word-break: break-word;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media {
|
|
57
|
+
.wp-block-media-text.has-media-on-the-right > .wp-block-media-text__media {
|
|
57
58
|
/*!rtl:begin:ignore*/
|
|
58
59
|
grid-column: 2;
|
|
59
60
|
grid-row: 1;
|
|
60
61
|
/*!rtl:end:ignore*/
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
.wp-block-media-text.has-media-on-the-right .wp-block-media-text__content {
|
|
64
|
+
.wp-block-media-text.has-media-on-the-right > .wp-block-media-text__content {
|
|
64
65
|
/*!rtl:begin:ignore*/
|
|
65
66
|
grid-column: 1;
|
|
66
67
|
grid-row: 1;
|
|
@@ -75,18 +76,18 @@
|
|
|
75
76
|
vertical-align: middle;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
.wp-block-media-text.is-image-fill .wp-block-media-text__media {
|
|
79
|
+
.wp-block-media-text.is-image-fill > .wp-block-media-text__media {
|
|
79
80
|
height: 100%;
|
|
80
81
|
min-height: 250px;
|
|
81
82
|
background-size: cover;
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
.wp-block-media-text.is-image-fill .wp-block-media-text__media > a {
|
|
85
|
+
.wp-block-media-text.is-image-fill > .wp-block-media-text__media > a {
|
|
85
86
|
display: block;
|
|
86
87
|
height: 100%;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
.wp-block-media-text.is-image-fill .wp-block-media-text__media img {
|
|
90
|
+
.wp-block-media-text.is-image-fill > .wp-block-media-text__media img {
|
|
90
91
|
// The image is visually hidden but accessible to assistive technologies.
|
|
91
92
|
position: absolute;
|
|
92
93
|
width: 1px;
|
|
@@ -107,11 +108,11 @@
|
|
|
107
108
|
@media (max-width: #{ ($break-small) }) {
|
|
108
109
|
.wp-block-media-text.is-stacked-on-mobile {
|
|
109
110
|
grid-template-columns: 100% !important;
|
|
110
|
-
.wp-block-media-text__media {
|
|
111
|
+
> .wp-block-media-text__media {
|
|
111
112
|
grid-column: 1;
|
|
112
113
|
grid-row: 1;
|
|
113
114
|
}
|
|
114
|
-
.wp-block-media-text__content {
|
|
115
|
+
> .wp-block-media-text__content {
|
|
115
116
|
grid-column: 1;
|
|
116
117
|
grid-row: 2;
|
|
117
118
|
}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
View,
|
|
6
|
-
Text,
|
|
7
|
-
TouchableWithoutFeedback,
|
|
8
|
-
TouchableOpacity,
|
|
9
|
-
} from 'react-native';
|
|
4
|
+
import { View, Text, TouchableOpacity } from 'react-native';
|
|
10
5
|
|
|
11
6
|
/**
|
|
12
7
|
* WordPress dependencies
|
|
@@ -25,6 +20,7 @@ import {
|
|
|
25
20
|
store as blockEditorStore,
|
|
26
21
|
} from '@wordpress/block-editor';
|
|
27
22
|
import { store as noticesStore } from '@wordpress/notices';
|
|
23
|
+
import { requestUnsupportedBlockFallback } from '@wordpress/react-native-bridge';
|
|
28
24
|
|
|
29
25
|
/**
|
|
30
26
|
* Internal dependencies
|
|
@@ -48,11 +44,40 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
toggleSheet() {
|
|
47
|
+
const { attributes, block, clientId } = this.props;
|
|
48
|
+
const { originalName } = attributes;
|
|
49
|
+
const title = this.getTitle();
|
|
50
|
+
const blockContent = serialize( block ? [ block ] : [] );
|
|
51
|
+
|
|
52
|
+
if ( this.canEditUnsupportedBlock() ) {
|
|
53
|
+
requestUnsupportedBlockFallback(
|
|
54
|
+
blockContent,
|
|
55
|
+
clientId,
|
|
56
|
+
originalName,
|
|
57
|
+
title
|
|
58
|
+
);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
51
62
|
this.setState( {
|
|
52
63
|
showHelp: ! this.state.showHelp,
|
|
53
64
|
} );
|
|
54
65
|
}
|
|
55
66
|
|
|
67
|
+
canEditUnsupportedBlock() {
|
|
68
|
+
const {
|
|
69
|
+
canEnableUnsupportedBlockEditor,
|
|
70
|
+
isEditableInUnsupportedBlockEditor,
|
|
71
|
+
isUnsupportedBlockEditorSupported,
|
|
72
|
+
} = this.props;
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
! canEnableUnsupportedBlockEditor &&
|
|
76
|
+
isUnsupportedBlockEditorSupported &&
|
|
77
|
+
isEditableInUnsupportedBlockEditor
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
56
81
|
closeSheet() {
|
|
57
82
|
this.setState( {
|
|
58
83
|
showHelp: false,
|
|
@@ -171,7 +196,8 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
171
196
|
|
|
172
197
|
render() {
|
|
173
198
|
const { originalName } = this.props.attributes;
|
|
174
|
-
const { getStylesFromColorScheme, preferredColorScheme } =
|
|
199
|
+
const { isSelected, getStylesFromColorScheme, preferredColorScheme } =
|
|
200
|
+
this.props;
|
|
175
201
|
const blockType = coreBlocks[ originalName ];
|
|
176
202
|
|
|
177
203
|
const title = this.getTitle();
|
|
@@ -186,7 +212,11 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
186
212
|
);
|
|
187
213
|
|
|
188
214
|
const subtitle = (
|
|
189
|
-
<Text style={ subTitleStyle }>
|
|
215
|
+
<Text style={ subTitleStyle }>
|
|
216
|
+
{ this.canEditUnsupportedBlock()
|
|
217
|
+
? __( 'Tap to edit' )
|
|
218
|
+
: __( 'Unsupported' ) }
|
|
219
|
+
</Text>
|
|
190
220
|
);
|
|
191
221
|
|
|
192
222
|
const icon = blockType
|
|
@@ -198,8 +228,9 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
198
228
|
);
|
|
199
229
|
const iconClassName = 'unsupported-icon' + '-' + preferredColorScheme;
|
|
200
230
|
return (
|
|
201
|
-
<
|
|
202
|
-
disabled={ !
|
|
231
|
+
<TouchableOpacity
|
|
232
|
+
disabled={ ! isSelected }
|
|
233
|
+
activeOpacity={ 0.5 }
|
|
203
234
|
accessibilityLabel={ __( 'Help button' ) }
|
|
204
235
|
accessibilityRole="button"
|
|
205
236
|
accessibilityHint={ __( 'Tap here to show help' ) }
|
|
@@ -211,7 +242,8 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
211
242
|
styles.unsupportedBlockDark
|
|
212
243
|
) }
|
|
213
244
|
>
|
|
214
|
-
{ this.
|
|
245
|
+
{ ! this.canEditUnsupportedBlock() &&
|
|
246
|
+
this.renderHelpIcon() }
|
|
215
247
|
<View style={ styles.unsupportedBlockHeader }>
|
|
216
248
|
<Icon
|
|
217
249
|
className={ iconClassName }
|
|
@@ -223,7 +255,7 @@ export class UnsupportedBlockEdit extends Component {
|
|
|
223
255
|
{ subtitle }
|
|
224
256
|
{ this.renderSheet( title, originalName ) }
|
|
225
257
|
</View>
|
|
226
|
-
</
|
|
258
|
+
</TouchableOpacity>
|
|
227
259
|
);
|
|
228
260
|
}
|
|
229
261
|
}
|
|
@@ -14,7 +14,16 @@ exports[`Missing block renders without crashing 1`] = `
|
|
|
14
14
|
"selected": undefined,
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
+
accessibilityValue={
|
|
18
|
+
{
|
|
19
|
+
"max": undefined,
|
|
20
|
+
"min": undefined,
|
|
21
|
+
"now": undefined,
|
|
22
|
+
"text": undefined,
|
|
23
|
+
}
|
|
24
|
+
}
|
|
17
25
|
accessible={true}
|
|
26
|
+
collapsable={false}
|
|
18
27
|
focusable={true}
|
|
19
28
|
onClick={[Function]}
|
|
20
29
|
onResponderGrant={[Function]}
|
|
@@ -23,72 +32,79 @@ exports[`Missing block renders without crashing 1`] = `
|
|
|
23
32
|
onResponderTerminate={[Function]}
|
|
24
33
|
onResponderTerminationRequest={[Function]}
|
|
25
34
|
onStartShouldSetResponder={[Function]}
|
|
35
|
+
style={
|
|
36
|
+
{
|
|
37
|
+
"opacity": 1,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
26
40
|
>
|
|
27
|
-
<View
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
<View>
|
|
42
|
+
<View
|
|
43
|
+
accessibilityHint="Tap here to show help"
|
|
44
|
+
accessibilityLabel="Help button"
|
|
45
|
+
accessibilityRole="button"
|
|
46
|
+
accessibilityState={
|
|
47
|
+
{
|
|
48
|
+
"busy": undefined,
|
|
49
|
+
"checked": undefined,
|
|
50
|
+
"disabled": undefined,
|
|
51
|
+
"expanded": undefined,
|
|
52
|
+
"selected": undefined,
|
|
53
|
+
}
|
|
38
54
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
55
|
+
accessibilityValue={
|
|
56
|
+
{
|
|
57
|
+
"max": undefined,
|
|
58
|
+
"min": undefined,
|
|
59
|
+
"now": undefined,
|
|
60
|
+
"text": undefined,
|
|
61
|
+
}
|
|
46
62
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
accessible={true}
|
|
64
|
+
collapsable={false}
|
|
65
|
+
focusable={true}
|
|
66
|
+
onClick={[Function]}
|
|
67
|
+
onResponderGrant={[Function]}
|
|
68
|
+
onResponderMove={[Function]}
|
|
69
|
+
onResponderRelease={[Function]}
|
|
70
|
+
onResponderTerminate={[Function]}
|
|
71
|
+
onResponderTerminationRequest={[Function]}
|
|
72
|
+
onStartShouldSetResponder={[Function]}
|
|
73
|
+
style={
|
|
74
|
+
{
|
|
75
|
+
"opacity": 1,
|
|
76
|
+
}
|
|
61
77
|
}
|
|
62
|
-
}
|
|
63
|
-
>
|
|
64
|
-
<Svg
|
|
65
|
-
height={24}
|
|
66
|
-
label="Help icon"
|
|
67
|
-
style={{}}
|
|
68
|
-
viewBox="0 0 24 24"
|
|
69
|
-
width={24}
|
|
70
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
71
|
-
>
|
|
72
|
-
Path
|
|
73
|
-
</Svg>
|
|
74
|
-
</View>
|
|
75
|
-
<View>
|
|
76
|
-
<Svg
|
|
77
|
-
fill="white"
|
|
78
|
-
height={24}
|
|
79
|
-
style={{}}
|
|
80
|
-
viewBox="0 0 24 24"
|
|
81
|
-
width={24}
|
|
82
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
83
78
|
>
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
<Svg
|
|
80
|
+
height={24}
|
|
81
|
+
label="Help icon"
|
|
82
|
+
style={{}}
|
|
83
|
+
viewBox="0 0 24 24"
|
|
84
|
+
width={24}
|
|
85
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
86
|
+
>
|
|
87
|
+
Path
|
|
88
|
+
</Svg>
|
|
89
|
+
</View>
|
|
90
|
+
<View>
|
|
91
|
+
<Svg
|
|
92
|
+
fill="white"
|
|
93
|
+
height={24}
|
|
94
|
+
style={{}}
|
|
95
|
+
viewBox="0 0 24 24"
|
|
96
|
+
width={24}
|
|
97
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
98
|
+
>
|
|
99
|
+
Path
|
|
100
|
+
</Svg>
|
|
101
|
+
<Text>
|
|
102
|
+
missing/block/title
|
|
103
|
+
</Text>
|
|
104
|
+
</View>
|
|
86
105
|
<Text>
|
|
87
|
-
|
|
106
|
+
Unsupported
|
|
88
107
|
</Text>
|
|
89
108
|
</View>
|
|
90
|
-
<Text>
|
|
91
|
-
Unsupported
|
|
92
|
-
</Text>
|
|
93
109
|
</View>
|
|
94
110
|
`;
|
|
@@ -457,21 +457,11 @@ $color-control-label-height: 20px;
|
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open {
|
|
461
|
-
@include break-medium() {
|
|
462
|
-
top: $admin-bar-height + $header-height + $block-toolbar-height + $border-width;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
460
|
.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,
|
|
467
461
|
.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open {
|
|
468
462
|
top: $admin-bar-height + $header-height + $block-toolbar-height + $border-width;
|
|
469
463
|
}
|
|
470
464
|
|
|
471
|
-
.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open {
|
|
472
|
-
right: $sidebar-width;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
465
|
// When fullscreen.
|
|
476
466
|
.is-fullscreen-mode {
|
|
477
467
|
.wp-block-navigation__responsive-container.is-menu-open {
|
|
@@ -483,12 +473,6 @@ $color-control-label-height: 20px;
|
|
|
483
473
|
}
|
|
484
474
|
}
|
|
485
475
|
|
|
486
|
-
.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open {
|
|
487
|
-
@include break-medium() {
|
|
488
|
-
top: $header-height + $block-toolbar-height + $border-width;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
476
|
.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,
|
|
493
477
|
.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open {
|
|
494
478
|
top: $header-height + $block-toolbar-height + $border-width;
|