@wordpress/block-editor 15.0.0 → 15.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/components/block-list/zoom-out-separator.js +0 -1
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-toolbar/index.js +6 -3
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/iframe/index.js +20 -15
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +49 -30
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/inserter-button/index.native.js +54 -64
- package/build/components/inserter-button/index.native.js.map +1 -1
- package/build/components/list-view/block.js +2 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +2 -1
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/use-click-selection.js +3 -1
- package/build/components/writing-flow/use-click-selection.js.map +1 -1
- package/build/private-apis.js +2 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +5 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/private-keys.js +2 -1
- package/build/store/private-keys.js.map +1 -1
- package/build/utils/block-bindings.js +2 -1
- package/build/utils/block-bindings.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +0 -1
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +6 -3
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/iframe/index.js +20 -15
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +50 -30
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/inserter-button/index.native.js +55 -65
- package/build-module/components/inserter-button/index.native.js.map +1 -1
- package/build-module/components/list-view/block.js +2 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +2 -1
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +2 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/use-click-selection.js +3 -1
- package/build-module/components/writing-flow/use-click-selection.js.map +1 -1
- package/build-module/private-apis.js +3 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +5 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-keys.js +1 -0
- package/build-module/store/private-keys.js.map +1 -1
- package/build-module/utils/block-bindings.js +2 -1
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-style/style-rtl.css +5 -23
- package/build-style/style.css +5 -23
- package/package.json +34 -34
- package/src/components/block-list/zoom-out-separator.js +0 -1
- package/src/components/block-toolbar/index.js +8 -2
- package/src/components/block-variation-transforms/style.scss +1 -0
- package/src/components/grid/style.scss +3 -2
- package/src/components/iframe/index.js +25 -16
- package/src/components/image-editor/use-save-image.js +58 -31
- package/src/components/inserter/style.scss +1 -1
- package/src/components/inserter-button/index.native.js +69 -80
- package/src/components/list-view/block.js +1 -0
- package/src/components/list-view/style.scss +2 -20
- package/src/components/media-replace-flow/style.scss +0 -6
- package/src/components/publish-date-time-picker/README.md +9 -0
- package/src/components/publish-date-time-picker/index.js +2 -1
- package/src/components/url-popover/image-url-input-ui.js +2 -1
- package/src/components/writing-flow/use-click-selection.js +3 -1
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +8 -1
- package/src/store/private-keys.js +1 -0
- package/src/store/test/actions.js +15 -2
- package/src/utils/block-bindings.js +1 -0
|
@@ -6,7 +6,7 @@ import { View, TouchableHighlight, Text } from 'react-native';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { useCallback } from '@wordpress/element';
|
|
10
10
|
import { Icon } from '@wordpress/components';
|
|
11
11
|
import { withPreferredColorScheme } from '@wordpress/compose';
|
|
12
12
|
import { __, sprintf } from '@wordpress/i18n';
|
|
@@ -17,93 +17,82 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
17
17
|
import { BlockIcon } from '../block-icon';
|
|
18
18
|
import styles from './style.scss';
|
|
19
19
|
import sparkles from './sparkles';
|
|
20
|
-
class MenuItem extends Component {
|
|
21
|
-
constructor() {
|
|
22
|
-
super( ...arguments );
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
function MenuItem( {
|
|
22
|
+
getStylesFromColorScheme,
|
|
23
|
+
item,
|
|
24
|
+
itemWidth,
|
|
25
|
+
maxWidth,
|
|
26
|
+
onSelect,
|
|
27
|
+
} ) {
|
|
28
|
+
const onPress = useCallback( () => {
|
|
29
29
|
onSelect( item );
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
const { getStylesFromColorScheme, item, itemWidth, maxWidth } =
|
|
34
|
-
this.props;
|
|
30
|
+
}, [ onSelect, item ] );
|
|
35
31
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
const modalIconWrapperStyle = getStylesFromColorScheme(
|
|
33
|
+
styles.modalIconWrapper,
|
|
34
|
+
styles.modalIconWrapperDark
|
|
35
|
+
);
|
|
36
|
+
const modalIconStyle = styles.modalIcon;
|
|
37
|
+
const modalItemLabelStyle = getStylesFromColorScheme(
|
|
38
|
+
styles.modalItemLabel,
|
|
39
|
+
styles.modalItemLabelDark
|
|
40
|
+
);
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
const clipboardBlockStyles = getStylesFromColorScheme(
|
|
43
|
+
styles.clipboardBlock,
|
|
44
|
+
styles.clipboardBlockDark
|
|
45
|
+
);
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
accessibilityLabelFormat,
|
|
61
|
-
item.title
|
|
62
|
-
);
|
|
47
|
+
const isClipboardBlock = item.id === 'clipboard';
|
|
48
|
+
const blockTitle = isClipboardBlock ? __( 'Copied block' ) : item.title;
|
|
49
|
+
const blockIsNew = item.isNew === true;
|
|
50
|
+
const accessibilityLabelFormat = blockIsNew
|
|
51
|
+
? // translators: Newly available block name. %s: The localized block name
|
|
52
|
+
__( '%s block, newly available' )
|
|
53
|
+
: // translators: %s: Block name e.g. "Image block"
|
|
54
|
+
__( '%s block' );
|
|
55
|
+
const accessibilityLabel = sprintf( accessibilityLabelFormat, item.title );
|
|
63
56
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
icon={ item.icon }
|
|
96
|
-
size={ modalIconStyle.width }
|
|
97
|
-
/>
|
|
98
|
-
</View>
|
|
57
|
+
return (
|
|
58
|
+
<TouchableHighlight
|
|
59
|
+
style={ [
|
|
60
|
+
styles.touchableArea,
|
|
61
|
+
item.isDisabled ? styles.disabled : null,
|
|
62
|
+
] }
|
|
63
|
+
underlayColor="transparent"
|
|
64
|
+
activeOpacity={ 0.5 }
|
|
65
|
+
accessibilityRole="button"
|
|
66
|
+
accessibilityLabel={ accessibilityLabel }
|
|
67
|
+
onPress={ onPress }
|
|
68
|
+
disabled={ item.isDisabled }
|
|
69
|
+
>
|
|
70
|
+
<View style={ [ styles.modalItem, { width: maxWidth } ] }>
|
|
71
|
+
<View
|
|
72
|
+
style={ [
|
|
73
|
+
modalIconWrapperStyle,
|
|
74
|
+
itemWidth && {
|
|
75
|
+
width: itemWidth,
|
|
76
|
+
},
|
|
77
|
+
isClipboardBlock && clipboardBlockStyles,
|
|
78
|
+
] }
|
|
79
|
+
>
|
|
80
|
+
{ blockIsNew && (
|
|
81
|
+
<Icon icon={ sparkles } style={ styles.newIndicator } />
|
|
82
|
+
) }
|
|
83
|
+
<View style={ modalIconStyle }>
|
|
84
|
+
<BlockIcon
|
|
85
|
+
icon={ item.icon }
|
|
86
|
+
size={ modalIconStyle.width }
|
|
87
|
+
/>
|
|
99
88
|
</View>
|
|
100
|
-
<Text numberOfLines={ 3 } style={ modalItemLabelStyle }>
|
|
101
|
-
{ blockTitle }
|
|
102
|
-
</Text>
|
|
103
89
|
</View>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
90
|
+
<Text numberOfLines={ 3 } style={ modalItemLabelStyle }>
|
|
91
|
+
{ blockTitle }
|
|
92
|
+
</Text>
|
|
93
|
+
</View>
|
|
94
|
+
</TouchableHighlight>
|
|
95
|
+
);
|
|
107
96
|
}
|
|
108
97
|
|
|
109
98
|
const InserterButton = withPreferredColorScheme( MenuItem );
|
|
@@ -78,10 +78,7 @@
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
&:focus::after {
|
|
81
|
-
box-shadow:
|
|
82
|
-
inset 0 0 0 1px $white,
|
|
83
|
-
0 0 0 var(--wp-admin-border-width-focus)
|
|
84
|
-
var(--wp-block-synced-color);
|
|
81
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-block-synced-color);
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
84
|
&.is-selected .block-editor-list-view-block-contents,
|
|
@@ -308,7 +305,7 @@
|
|
|
308
305
|
.block-editor-list-view-block__menu-cell,
|
|
309
306
|
.block-editor-list-view-block__mover-cell {
|
|
310
307
|
line-height: 0;
|
|
311
|
-
width: $button-size;
|
|
308
|
+
width: $button-size-small + $grid-unit-05;
|
|
312
309
|
vertical-align: middle;
|
|
313
310
|
|
|
314
311
|
> * {
|
|
@@ -323,21 +320,6 @@
|
|
|
323
320
|
opacity: 1;
|
|
324
321
|
}
|
|
325
322
|
}
|
|
326
|
-
|
|
327
|
-
&,
|
|
328
|
-
.components-button.has-icon {
|
|
329
|
-
width: $button-size-small;
|
|
330
|
-
min-width: $button-size-small;
|
|
331
|
-
padding: 0;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
.block-editor-list-view-block__menu-cell {
|
|
336
|
-
padding-right: $grid-unit-05;
|
|
337
|
-
|
|
338
|
-
.components-button.has-icon {
|
|
339
|
-
height: 24px;
|
|
340
|
-
}
|
|
341
323
|
}
|
|
342
324
|
|
|
343
325
|
.block-editor-list-view-block__mover-cell-alignment-wrapper {
|
|
@@ -34,12 +34,6 @@
|
|
|
34
34
|
margin: 0; // Reset default LinkControl margins.
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
.block-editor-link-control__search-item-title,
|
|
38
|
-
.block-editor-link-control__search-item-info {
|
|
39
|
-
max-width: 200px;
|
|
40
|
-
white-space: nowrap;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
37
|
.block-editor-link-control__tools {
|
|
44
38
|
justify-content: flex-end;
|
|
45
39
|
padding: $grid-unit-20 var(--wp-admin-border-width-focus) var(--wp-admin-border-width-focus);
|
|
@@ -32,6 +32,7 @@ const MyDateTimePicker = () => {
|
|
|
32
32
|
currentDate={ date }
|
|
33
33
|
onChange={ ( newDate ) => setDate( newDate ) }
|
|
34
34
|
onClose={ onClose }
|
|
35
|
+
title={ __( 'Select post date' ) }
|
|
35
36
|
/>
|
|
36
37
|
) }
|
|
37
38
|
/>
|
|
@@ -44,6 +45,14 @@ const MyDateTimePicker = () => {
|
|
|
44
45
|
`PublishDateTimePicker` supports all of the props that
|
|
45
46
|
[`DateTimePicker`](/packages/components/src/date-time#Props) supports, plus:
|
|
46
47
|
|
|
48
|
+
### title
|
|
49
|
+
|
|
50
|
+
The title displayed in the header of the popover that contains the `DateTimePicker`.
|
|
51
|
+
|
|
52
|
+
- Type: `String`
|
|
53
|
+
- Required: No
|
|
54
|
+
- Default: `Publish`
|
|
55
|
+
|
|
47
56
|
### onClose
|
|
48
57
|
|
|
49
58
|
Called when the user presses the close button.
|
|
@@ -18,6 +18,7 @@ export function PublishDateTimePicker(
|
|
|
18
18
|
showPopoverHeaderActions,
|
|
19
19
|
isCompact,
|
|
20
20
|
currentDate,
|
|
21
|
+
title,
|
|
21
22
|
...additionalProps
|
|
22
23
|
},
|
|
23
24
|
ref
|
|
@@ -33,7 +34,7 @@ export function PublishDateTimePicker(
|
|
|
33
34
|
return (
|
|
34
35
|
<div ref={ ref } className="block-editor-publish-date-time-picker">
|
|
35
36
|
<InspectorPopoverHeader
|
|
36
|
-
title={ __( 'Publish' ) }
|
|
37
|
+
title={ title || __( 'Publish' ) }
|
|
37
38
|
actions={
|
|
38
39
|
showPopoverHeaderActions
|
|
39
40
|
? [
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
fullscreen,
|
|
22
22
|
linkOff,
|
|
23
23
|
} from '@wordpress/icons';
|
|
24
|
+
import { prependHTTP } from '@wordpress/url';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Internal dependencies
|
|
@@ -149,7 +150,7 @@ const ImageURLInputUI = ( {
|
|
|
149
150
|
)?.linkDestination || LINK_DESTINATION_CUSTOM;
|
|
150
151
|
|
|
151
152
|
onChangeUrl( {
|
|
152
|
-
href: urlInput,
|
|
153
|
+
href: prependHTTP( urlInput ),
|
|
153
154
|
linkDestination: selectedDestination,
|
|
154
155
|
lightbox: { enabled: false },
|
|
155
156
|
} );
|
|
@@ -27,7 +27,9 @@ export default function useClickSelection() {
|
|
|
27
27
|
const clickedClientId = getBlockClientId( event.target );
|
|
28
28
|
|
|
29
29
|
if ( event.shiftKey ) {
|
|
30
|
-
|
|
30
|
+
// When selecting a single block in a document by holding the shift key,
|
|
31
|
+
// don't mark this action as multiselection.
|
|
32
|
+
if ( startClientId && startClientId !== clickedClientId ) {
|
|
31
33
|
node.contentEditable = true;
|
|
32
34
|
// Firefox doesn't automatically move focus.
|
|
33
35
|
node.focus();
|
package/src/private-apis.js
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
globalStylesDataKey,
|
|
40
40
|
globalStylesLinksDataKey,
|
|
41
41
|
sectionRootClientIdKey,
|
|
42
|
+
mediaEditKey,
|
|
42
43
|
} from './store/private-keys';
|
|
43
44
|
import { requiresWrapperOnCopy } from './components/writing-flow/utils';
|
|
44
45
|
import { PrivateRichText } from './components/rich-text/';
|
|
@@ -99,4 +100,5 @@ lock( privateApis, {
|
|
|
99
100
|
sectionRootClientIdKey,
|
|
100
101
|
CommentIconSlotFill,
|
|
101
102
|
CommentIconToolbarSlotFill,
|
|
103
|
+
mediaEditKey,
|
|
102
104
|
} );
|
package/src/store/actions.js
CHANGED
|
@@ -1255,7 +1255,14 @@ export const mergeBlocks =
|
|
|
1255
1255
|
}
|
|
1256
1256
|
|
|
1257
1257
|
if ( ! blockAType.merge ) {
|
|
1258
|
-
|
|
1258
|
+
if ( isUnmodifiedBlock( blockB, 'content' ) ) {
|
|
1259
|
+
dispatch.removeBlock(
|
|
1260
|
+
clientIdB,
|
|
1261
|
+
select.isBlockSelected( clientIdB )
|
|
1262
|
+
);
|
|
1263
|
+
} else {
|
|
1264
|
+
dispatch.selectBlock( blockA.clientId );
|
|
1265
|
+
}
|
|
1259
1266
|
return;
|
|
1260
1267
|
}
|
|
1261
1268
|
|
|
@@ -3,3 +3,4 @@ export const globalStylesLinksDataKey = Symbol( 'globalStylesLinks' );
|
|
|
3
3
|
export const selectBlockPatternsKey = Symbol( 'selectBlockPatternsKey' );
|
|
4
4
|
export const reusableBlocksSelectKey = Symbol( 'reusableBlocksSelect' );
|
|
5
5
|
export const sectionRootClientIdKey = Symbol( 'sectionRootClientIdKey' );
|
|
6
|
+
export const mediaEditKey = Symbol( 'mediaEditKey' );
|
|
@@ -808,8 +808,16 @@ describe( 'actions', () => {
|
|
|
808
808
|
} );
|
|
809
809
|
} );
|
|
810
810
|
|
|
811
|
-
it( 'should only focus the blockA if the blockA has no merge function', () => {
|
|
812
|
-
registerBlockType( 'core/test-block',
|
|
811
|
+
it( 'should only focus the blockA if the blockA has no merge function and the content of blockB is modified', () => {
|
|
812
|
+
registerBlockType( 'core/test-block', {
|
|
813
|
+
...defaultBlockSettings,
|
|
814
|
+
attributes: {
|
|
815
|
+
content: {
|
|
816
|
+
type: 'string',
|
|
817
|
+
role: 'content',
|
|
818
|
+
},
|
|
819
|
+
},
|
|
820
|
+
} );
|
|
813
821
|
const blockA = deepFreeze( {
|
|
814
822
|
clientId: 'chicken',
|
|
815
823
|
name: 'core/test-block',
|
|
@@ -817,15 +825,20 @@ describe( 'actions', () => {
|
|
|
817
825
|
const blockB = deepFreeze( {
|
|
818
826
|
clientId: 'ribs',
|
|
819
827
|
name: 'core/test-block',
|
|
828
|
+
attributes: {
|
|
829
|
+
content: 'Updated content',
|
|
830
|
+
},
|
|
820
831
|
} );
|
|
821
832
|
|
|
822
833
|
const select = {
|
|
823
834
|
getBlock: ( clientId ) =>
|
|
824
835
|
[ blockA, blockB ].find( ( b ) => b.clientId === clientId ),
|
|
825
836
|
getBlockEditingMode: () => 'default',
|
|
837
|
+
isBlockSelected: () => false,
|
|
826
838
|
};
|
|
827
839
|
const dispatch = Object.assign( jest.fn(), {
|
|
828
840
|
selectBlock: jest.fn(),
|
|
841
|
+
removeBlock: jest.fn(),
|
|
829
842
|
} );
|
|
830
843
|
|
|
831
844
|
mergeBlocks(
|