@wordpress/block-library 9.30.1-next.836ecdcae.0 → 9.31.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/edit.js +6 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/buttons/index.js +2 -1
- package/build/buttons/index.js.map +1 -1
- package/build/categories/edit.js +3 -1
- package/build/categories/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +5 -8
- package/build/image/image.js.map +1 -1
- package/build/image/save.js +6 -2
- package/build/image/save.js.map +1 -1
- package/build/index.js +4 -0
- package/build/index.js.map +1 -1
- package/build/navigation/edit/index.js +0 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation-link/block-inserter.js +69 -0
- package/build/navigation-link/block-inserter.js.map +1 -0
- package/build/navigation-link/dialog-wrapper.js +80 -0
- package/build/navigation-link/dialog-wrapper.js.map +1 -0
- package/build/navigation-link/link-ui.js +34 -82
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-link/page-creator.js +12 -18
- package/build/navigation-link/page-creator.js.map +1 -1
- package/build/post-date/edit.js +2 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +7 -2
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-title/edit.js +8 -2
- package/build/post-title/edit.js.map +1 -1
- package/build/query/edit/pattern-selection.js +9 -1
- package/build/query/edit/pattern-selection.js.map +1 -1
- package/build/query/index.js +2 -1
- package/build/query/index.js.map +1 -1
- package/build/rss/edit.js +6 -1
- package/build/rss/edit.js.map +1 -1
- package/build/site-tagline/index.js +1 -0
- package/build/site-tagline/index.js.map +1 -1
- package/build/social-link/edit.js +6 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/index.js +2 -1
- package/build/social-links/index.js.map +1 -1
- package/build/spacer/edit.js +2 -1
- package/build/spacer/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +33 -9
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +4 -0
- package/build/table-of-contents/index.js.map +1 -1
- package/build/table-of-contents/list.js +6 -3
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/save.js +6 -3
- package/build/table-of-contents/save.js.map +1 -1
- package/build/term-template/edit.js +318 -0
- package/build/term-template/edit.js.map +1 -0
- package/build/term-template/index.js +109 -0
- package/build/term-template/index.js.map +1 -0
- package/build/term-template/save.js +16 -0
- package/build/term-template/save.js.map +1 -0
- package/build/term-template/variations.js +83 -0
- package/build/term-template/variations.js.map +1 -0
- package/build/terms-query/edit.js +20 -0
- package/build/terms-query/edit.js.map +1 -0
- package/build/terms-query/index.js +83 -0
- package/build/terms-query/index.js.map +1 -0
- package/build/terms-query/inspector-controls.js +231 -0
- package/build/terms-query/inspector-controls.js.map +1 -0
- package/build/terms-query/save.js +24 -0
- package/build/terms-query/save.js.map +1 -0
- package/build/terms-query/terms-query-content.js +71 -0
- package/build/terms-query/terms-query-content.js.map +1 -0
- package/build/utils/hooks.js +3 -0
- package/build/utils/hooks.js.map +1 -1
- package/build-module/button/edit.js +7 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/buttons/index.js +2 -1
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/categories/edit.js +3 -1
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +5 -8
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/save.js +6 -2
- package/build-module/image/save.js.map +1 -1
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +0 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation-link/block-inserter.js +61 -0
- package/build-module/navigation-link/block-inserter.js.map +1 -0
- package/build-module/navigation-link/dialog-wrapper.js +75 -0
- package/build-module/navigation-link/dialog-wrapper.js.map +1 -0
- package/build-module/navigation-link/link-ui.js +37 -85
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-link/page-creator.js +12 -19
- package/build-module/navigation-link/page-creator.js.map +1 -1
- package/build-module/post-date/edit.js +3 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +9 -4
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-title/edit.js +9 -3
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/query/edit/pattern-selection.js +9 -1
- package/build-module/query/edit/pattern-selection.js.map +1 -1
- package/build-module/query/index.js +2 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/rss/edit.js +8 -3
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -0
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/social-link/edit.js +8 -3
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-links/index.js +2 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/spacer/edit.js +3 -2
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +35 -11
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +4 -0
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/table-of-contents/list.js +6 -3
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/save.js +6 -3
- package/build-module/table-of-contents/save.js.map +1 -1
- package/build-module/term-template/edit.js +310 -0
- package/build-module/term-template/edit.js.map +1 -0
- package/build-module/term-template/index.js +102 -0
- package/build-module/term-template/index.js.map +1 -0
- package/build-module/term-template/save.js +9 -0
- package/build-module/term-template/save.js.map +1 -0
- package/build-module/term-template/variations.js +76 -0
- package/build-module/term-template/variations.js.map +1 -0
- package/build-module/terms-query/edit.js +12 -0
- package/build-module/terms-query/edit.js.map +1 -0
- package/build-module/terms-query/index.js +76 -0
- package/build-module/terms-query/index.js.map +1 -0
- package/build-module/terms-query/inspector-controls.js +224 -0
- package/build-module/terms-query/inspector-controls.js.map +1 -0
- package/build-module/terms-query/save.js +17 -0
- package/build-module/terms-query/save.js.map +1 -0
- package/build-module/terms-query/terms-query-content.js +63 -0
- package/build-module/terms-query/terms-query-content.js.map +1 -0
- package/build-module/utils/hooks.js +3 -0
- package/build-module/utils/hooks.js.map +1 -1
- package/build-style/editor-rtl.css +24 -0
- package/build-style/editor.css +24 -0
- package/build-style/style-rtl.css +16 -0
- package/build-style/style.css +16 -0
- package/build-style/term-template/editor-rtl.css +160 -0
- package/build-style/term-template/editor.css +160 -0
- package/build-style/term-template/style-rtl.css +146 -0
- package/build-style/term-template/style.css +146 -0
- package/build-style/terms-query/style-rtl.css +140 -0
- package/build-style/terms-query/style.css +140 -0
- package/build-types/table-of-contents/list.d.ts +2 -1
- package/build-types/table-of-contents/list.d.ts.map +1 -1
- package/package.json +35 -35
- package/src/button/edit.js +12 -1
- package/src/button/edit.native.js +1 -1
- package/src/buttons/block.json +2 -1
- package/src/categories/edit.js +2 -1
- package/src/editor.scss +1 -0
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +5 -8
- package/src/image/save.js +7 -1
- package/src/index.js +4 -0
- package/src/navigation/edit/index.js +0 -1
- package/src/navigation-link/block-inserter.js +65 -0
- package/src/navigation-link/dialog-wrapper.js +74 -0
- package/src/navigation-link/link-ui.js +32 -95
- package/src/navigation-link/page-creator.js +13 -20
- package/src/post-date/edit.js +64 -53
- package/src/post-date/index.php +5 -13
- package/src/post-featured-image/edit.js +19 -3
- package/src/post-title/edit.js +14 -2
- package/src/query/block.json +2 -1
- package/src/query/edit/pattern-selection.js +10 -1
- package/src/rss/edit.js +13 -2
- package/src/site-tagline/block.json +1 -0
- package/src/social-link/edit.js +13 -2
- package/src/social-links/block.json +2 -1
- package/src/spacer/edit.js +5 -1
- package/src/style.scss +2 -0
- package/src/table-of-contents/block.json +4 -0
- package/src/table-of-contents/edit.js +58 -21
- package/src/table-of-contents/list.tsx +7 -2
- package/src/table-of-contents/save.js +7 -3
- package/src/term-template/block.json +73 -0
- package/src/term-template/edit.js +391 -0
- package/src/term-template/editor.scss +26 -0
- package/src/term-template/index.js +26 -0
- package/src/term-template/index.php +224 -0
- package/src/term-template/save.js +8 -0
- package/src/term-template/style.scss +12 -0
- package/src/term-template/variations.js +87 -0
- package/src/terms-query/block.json +49 -0
- package/src/terms-query/edit.js +10 -0
- package/src/terms-query/index.js +24 -0
- package/src/terms-query/index.php +44 -0
- package/src/terms-query/inspector-controls.js +239 -0
- package/src/terms-query/save.js +10 -0
- package/src/terms-query/style.scss +6 -0
- package/src/terms-query/terms-query-content.js +74 -0
- package/src/utils/hooks.js +4 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -9,13 +9,16 @@ import {
|
|
|
9
9
|
__experimentalVStack as VStack,
|
|
10
10
|
__experimentalHStack as HStack,
|
|
11
11
|
} from '@wordpress/components';
|
|
12
|
-
import { __
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
13
13
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
14
14
|
import { store as coreStore } from '@wordpress/core-data';
|
|
15
15
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
16
16
|
import { useState } from '@wordpress/element';
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
import DialogWrapper from './dialog-wrapper';
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Component for creating new pages within the Navigation Link UI.
|
|
@@ -35,9 +38,6 @@ export function LinkUIPageCreator( {
|
|
|
35
38
|
const [ title, setTitle ] = useState( initialTitle );
|
|
36
39
|
const [ shouldPublish, setShouldPublish ] = useState( false );
|
|
37
40
|
|
|
38
|
-
// Focus the first element when the component mounts
|
|
39
|
-
const focusOnMountRef = useFocusOnMount( 'firstElement' );
|
|
40
|
-
|
|
41
41
|
// Check if the title is valid for submission
|
|
42
42
|
const isTitleValid = title.trim().length > 0;
|
|
43
43
|
|
|
@@ -95,19 +95,12 @@ export function LinkUIPageCreator( {
|
|
|
95
95
|
const isSubmitDisabled = isSaving || ! isTitleValid;
|
|
96
96
|
|
|
97
97
|
return (
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
onBack();
|
|
105
|
-
} }
|
|
106
|
-
size="small"
|
|
107
|
-
>
|
|
108
|
-
{ __( 'Back' ) }
|
|
109
|
-
</Button>
|
|
110
|
-
|
|
98
|
+
<DialogWrapper
|
|
99
|
+
className="link-ui-page-creator"
|
|
100
|
+
title={ __( 'Create page' ) }
|
|
101
|
+
description={ __( 'Create a new page to add to your Navigation.' ) }
|
|
102
|
+
onBack={ onBack }
|
|
103
|
+
>
|
|
111
104
|
<VStack className="link-ui-page-creator__inner" spacing={ 4 }>
|
|
112
105
|
<form onSubmit={ createPage }>
|
|
113
106
|
<VStack spacing={ 4 }>
|
|
@@ -159,6 +152,6 @@ export function LinkUIPageCreator( {
|
|
|
159
152
|
</VStack>
|
|
160
153
|
</form>
|
|
161
154
|
</VStack>
|
|
162
|
-
</
|
|
155
|
+
</DialogWrapper>
|
|
163
156
|
);
|
|
164
157
|
}
|
package/src/post-date/edit.js
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
InspectorControls,
|
|
20
20
|
store as blockEditorStore,
|
|
21
21
|
useBlockProps,
|
|
22
|
+
useBlockEditingMode,
|
|
22
23
|
__experimentalDateFormatPicker as DateFormatPicker,
|
|
23
24
|
__experimentalPublishDateTimePicker as PublishDateTimePicker,
|
|
24
25
|
} from '@wordpress/block-editor';
|
|
@@ -99,6 +100,8 @@ export default function PostDateEdit( {
|
|
|
99
100
|
[ postTypeSlug ]
|
|
100
101
|
);
|
|
101
102
|
|
|
103
|
+
const blockEditingMode = useBlockEditingMode();
|
|
104
|
+
|
|
102
105
|
let postDate = (
|
|
103
106
|
<time dateTime={ dateI18n( 'c', datetime ) } ref={ setPopoverAnchor }>
|
|
104
107
|
{ format === 'human-diff'
|
|
@@ -120,61 +123,69 @@ export default function PostDateEdit( {
|
|
|
120
123
|
|
|
121
124
|
return (
|
|
122
125
|
<>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
126
|
+
{ ( blockEditingMode === 'default' ||
|
|
127
|
+
! isDescendentOfQueryLoop ) && (
|
|
128
|
+
<BlockControls group="block">
|
|
129
|
+
<AlignmentControl
|
|
130
|
+
value={ textAlign }
|
|
131
|
+
onChange={ ( nextAlign ) => {
|
|
132
|
+
setAttributes( { textAlign: nextAlign } );
|
|
133
|
+
} }
|
|
134
|
+
/>
|
|
135
|
+
|
|
136
|
+
{ displayType !== 'modified' &&
|
|
137
|
+
! isDescendentOfQueryLoop && (
|
|
138
|
+
<ToolbarGroup>
|
|
139
|
+
<Dropdown
|
|
140
|
+
popoverProps={ popoverProps }
|
|
141
|
+
renderContent={ ( { onClose } ) => (
|
|
142
|
+
<PublishDateTimePicker
|
|
143
|
+
title={
|
|
144
|
+
displayType === 'date'
|
|
145
|
+
? __( 'Publish Date' )
|
|
146
|
+
: __( 'Date' )
|
|
147
|
+
}
|
|
148
|
+
currentDate={ datetime }
|
|
149
|
+
onChange={ ( newDatetime ) =>
|
|
150
|
+
setAttributes( {
|
|
151
|
+
datetime: newDatetime,
|
|
152
|
+
} )
|
|
153
|
+
}
|
|
154
|
+
is12Hour={ is12HourFormat(
|
|
155
|
+
siteTimeFormat
|
|
156
|
+
) }
|
|
157
|
+
onClose={ onClose }
|
|
158
|
+
dateOrder={
|
|
159
|
+
/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
|
|
160
|
+
_x( 'dmy', 'date order' )
|
|
161
|
+
}
|
|
162
|
+
/>
|
|
149
163
|
) }
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
164
|
+
renderToggle={ ( { isOpen, onToggle } ) => {
|
|
165
|
+
const openOnArrowDown = ( event ) => {
|
|
166
|
+
if (
|
|
167
|
+
! isOpen &&
|
|
168
|
+
event.keyCode === DOWN
|
|
169
|
+
) {
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
onToggle();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
return (
|
|
175
|
+
<ToolbarButton
|
|
176
|
+
aria-expanded={ isOpen }
|
|
177
|
+
icon={ edit }
|
|
178
|
+
title={ __( 'Change Date' ) }
|
|
179
|
+
onClick={ onToggle }
|
|
180
|
+
onKeyDown={ openOnArrowDown }
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
} }
|
|
155
184
|
/>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
event.preventDefault();
|
|
161
|
-
onToggle();
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
return (
|
|
165
|
-
<ToolbarButton
|
|
166
|
-
aria-expanded={ isOpen }
|
|
167
|
-
icon={ edit }
|
|
168
|
-
title={ __( 'Change Date' ) }
|
|
169
|
-
onClick={ onToggle }
|
|
170
|
-
onKeyDown={ openOnArrowDown }
|
|
171
|
-
/>
|
|
172
|
-
);
|
|
173
|
-
} }
|
|
174
|
-
/>
|
|
175
|
-
</ToolbarGroup>
|
|
176
|
-
) }
|
|
177
|
-
</BlockControls>
|
|
185
|
+
</ToolbarGroup>
|
|
186
|
+
) }
|
|
187
|
+
</BlockControls>
|
|
188
|
+
) }
|
|
178
189
|
|
|
179
190
|
<InspectorControls>
|
|
180
191
|
<ToolsPanel
|
package/src/post-date/index.php
CHANGED
|
@@ -20,19 +20,11 @@ function render_block_core_post_date( $attributes, $content, $block ) {
|
|
|
20
20
|
$classes = array();
|
|
21
21
|
|
|
22
22
|
if (
|
|
23
|
-
isset( $attributes['
|
|
24
|
-
|
|
23
|
+
! isset( $attributes['datetime'] ) && ! (
|
|
24
|
+
isset( $attributes['metadata']['bindings']['datetime']['source'] ) &&
|
|
25
|
+
isset( $attributes['metadata']['bindings']['datetime']['args'] )
|
|
26
|
+
)
|
|
25
27
|
) {
|
|
26
|
-
/*
|
|
27
|
-
* We might be running on a version of WordPress that doesn't support binding the block's `datetime` attribute
|
|
28
|
-
* to a Block Bindings source. In this case, we need to manually set the `datetime` attribute to its correct value.
|
|
29
|
-
* This branch can be removed once the minimum required WordPress version is 6.9 or newer.
|
|
30
|
-
*/
|
|
31
|
-
$source = get_block_bindings_source( $attributes['metadata']['bindings']['datetime']['source'] );
|
|
32
|
-
$source_args = $attributes['metadata']['bindings']['datetime']['args'];
|
|
33
|
-
|
|
34
|
-
$attributes['datetime'] = $source->get_value( $source_args, $block, 'datetime' );
|
|
35
|
-
} elseif ( ! isset( $attributes['datetime'] ) ) {
|
|
36
28
|
/*
|
|
37
29
|
* This is the legacy version of the block that didn't have the `datetime` attribute.
|
|
38
30
|
* This branch needs to be kept for backward compatibility.
|
|
@@ -61,7 +53,7 @@ function render_block_core_post_date( $attributes, $content, $block ) {
|
|
|
61
53
|
// (See https://github.com/WordPress/gutenberg/pull/46839 where this logic was originally
|
|
62
54
|
// implemented.)
|
|
63
55
|
// In this case, we have to respect and return the empty value.
|
|
64
|
-
return
|
|
56
|
+
return '';
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
$unformatted_date = $attributes['datetime'];
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
Button,
|
|
16
16
|
Spinner,
|
|
17
17
|
TextControl,
|
|
18
|
+
ExternalLink,
|
|
18
19
|
__experimentalToolsPanel as ToolsPanel,
|
|
19
20
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
20
21
|
} from '@wordpress/components';
|
|
@@ -30,7 +31,12 @@ import {
|
|
|
30
31
|
privateApis as blockEditorPrivateApis,
|
|
31
32
|
store as blockEditorStore,
|
|
32
33
|
} from '@wordpress/block-editor';
|
|
33
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
useMemo,
|
|
36
|
+
useEffect,
|
|
37
|
+
useState,
|
|
38
|
+
createInterpolateElement,
|
|
39
|
+
} from '@wordpress/element';
|
|
34
40
|
import { __, sprintf } from '@wordpress/i18n';
|
|
35
41
|
import { upload } from '@wordpress/icons';
|
|
36
42
|
import { store as noticesStore } from '@wordpress/notices';
|
|
@@ -316,7 +322,7 @@ export default function PostFeaturedImageEdit( {
|
|
|
316
322
|
) }
|
|
317
323
|
{ isLink && (
|
|
318
324
|
<ToolsPanelItem
|
|
319
|
-
label={ __( 'Link
|
|
325
|
+
label={ __( 'Link relation' ) }
|
|
320
326
|
isShownByDefault
|
|
321
327
|
hasValue={ () => !! rel }
|
|
322
328
|
onDeselect={ () =>
|
|
@@ -328,7 +334,17 @@ export default function PostFeaturedImageEdit( {
|
|
|
328
334
|
<TextControl
|
|
329
335
|
__next40pxDefaultSize
|
|
330
336
|
__nextHasNoMarginBottom
|
|
331
|
-
label={ __( 'Link
|
|
337
|
+
label={ __( 'Link relation' ) }
|
|
338
|
+
help={ createInterpolateElement(
|
|
339
|
+
__(
|
|
340
|
+
'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
|
|
341
|
+
),
|
|
342
|
+
{
|
|
343
|
+
a: (
|
|
344
|
+
<ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
|
|
345
|
+
),
|
|
346
|
+
}
|
|
347
|
+
) }
|
|
332
348
|
value={ rel }
|
|
333
349
|
onChange={ ( newRel ) =>
|
|
334
350
|
setAttributes( { rel: newRel } )
|
package/src/post-title/edit.js
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
ToggleControl,
|
|
20
20
|
TextControl,
|
|
21
|
+
ExternalLink,
|
|
21
22
|
__experimentalToolsPanel as ToolsPanel,
|
|
22
23
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
23
24
|
} from '@wordpress/components';
|
|
@@ -25,6 +26,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
25
26
|
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
|
|
26
27
|
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
27
28
|
import { useSelect } from '@wordpress/data';
|
|
29
|
+
import { createInterpolateElement } from '@wordpress/element';
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Internal dependencies
|
|
@@ -205,7 +207,7 @@ export default function PostTitleEdit( {
|
|
|
205
207
|
/>
|
|
206
208
|
</ToolsPanelItem>
|
|
207
209
|
<ToolsPanelItem
|
|
208
|
-
label={ __( 'Link
|
|
210
|
+
label={ __( 'Link relation' ) }
|
|
209
211
|
isShownByDefault
|
|
210
212
|
hasValue={ () => !! rel }
|
|
211
213
|
onDeselect={ () =>
|
|
@@ -215,7 +217,17 @@ export default function PostTitleEdit( {
|
|
|
215
217
|
<TextControl
|
|
216
218
|
__next40pxDefaultSize
|
|
217
219
|
__nextHasNoMarginBottom
|
|
218
|
-
label={ __( 'Link
|
|
220
|
+
label={ __( 'Link relation' ) }
|
|
221
|
+
help={ createInterpolateElement(
|
|
222
|
+
__(
|
|
223
|
+
'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
|
|
224
|
+
),
|
|
225
|
+
{
|
|
226
|
+
a: (
|
|
227
|
+
<ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
|
|
228
|
+
),
|
|
229
|
+
}
|
|
230
|
+
) }
|
|
219
231
|
value={ rel }
|
|
220
232
|
onChange={ ( newRel ) =>
|
|
221
233
|
setAttributes( { rel: newRel } )
|
package/src/query/block.json
CHANGED
|
@@ -43,7 +43,16 @@ export function useBlockPatterns( clientId, attributes ) {
|
|
|
43
43
|
clientId,
|
|
44
44
|
attributes
|
|
45
45
|
);
|
|
46
|
-
|
|
46
|
+
const allPatterns = usePatterns( clientId, blockNameForPatterns );
|
|
47
|
+
// Filter out any patterns that don't have Query as their root block
|
|
48
|
+
// so that a Query block is always replaced by another Query block.
|
|
49
|
+
const rootBlockPatterns = useMemo( () => {
|
|
50
|
+
return allPatterns.filter( ( pattern ) => {
|
|
51
|
+
return pattern.blocks?.[ 0 ]?.name === blockNameForPatterns;
|
|
52
|
+
} );
|
|
53
|
+
}, [ allPatterns, blockNameForPatterns ] );
|
|
54
|
+
|
|
55
|
+
return rootBlockPatterns;
|
|
47
56
|
}
|
|
48
57
|
|
|
49
58
|
export default function PatternSelection( {
|
package/src/rss/edit.js
CHANGED
|
@@ -14,11 +14,12 @@ import {
|
|
|
14
14
|
ToggleControl,
|
|
15
15
|
ToolbarGroup,
|
|
16
16
|
TextControl,
|
|
17
|
+
ExternalLink,
|
|
17
18
|
__experimentalInputControl as InputControl,
|
|
18
19
|
__experimentalToolsPanel as ToolsPanel,
|
|
19
20
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
20
21
|
} from '@wordpress/components';
|
|
21
|
-
import { useState } from '@wordpress/element';
|
|
22
|
+
import { createInterpolateElement, useState } from '@wordpress/element';
|
|
22
23
|
import { grid, list, edit, rss } from '@wordpress/icons';
|
|
23
24
|
import { __, _x } from '@wordpress/i18n';
|
|
24
25
|
import { prependHTTP } from '@wordpress/url';
|
|
@@ -301,7 +302,17 @@ export default function RSSEdit( { attributes, setAttributes } ) {
|
|
|
301
302
|
<TextControl
|
|
302
303
|
__next40pxDefaultSize
|
|
303
304
|
__nextHasNoMarginBottom
|
|
304
|
-
label={ __( 'Link
|
|
305
|
+
label={ __( 'Link relation' ) }
|
|
306
|
+
help={ createInterpolateElement(
|
|
307
|
+
__(
|
|
308
|
+
'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
|
|
309
|
+
),
|
|
310
|
+
{
|
|
311
|
+
a: (
|
|
312
|
+
<ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
|
|
313
|
+
),
|
|
314
|
+
}
|
|
315
|
+
) }
|
|
305
316
|
value={ rel || '' }
|
|
306
317
|
onChange={ ( value ) => setAttributes( { rel: value } ) }
|
|
307
318
|
/>
|
package/src/social-link/edit.js
CHANGED
|
@@ -17,13 +17,14 @@ import {
|
|
|
17
17
|
useBlockProps,
|
|
18
18
|
store as blockEditorStore,
|
|
19
19
|
} from '@wordpress/block-editor';
|
|
20
|
-
import { useState, useRef } from '@wordpress/element';
|
|
20
|
+
import { useState, useRef, createInterpolateElement } from '@wordpress/element';
|
|
21
21
|
import {
|
|
22
22
|
Icon,
|
|
23
23
|
Button,
|
|
24
24
|
Dropdown,
|
|
25
25
|
TextControl,
|
|
26
26
|
ToolbarButton,
|
|
27
|
+
ExternalLink,
|
|
27
28
|
__experimentalToolsPanel as ToolsPanel,
|
|
28
29
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
29
30
|
__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
|
|
@@ -243,7 +244,17 @@ const SocialLinkEdit = ( {
|
|
|
243
244
|
<TextControl
|
|
244
245
|
__next40pxDefaultSize
|
|
245
246
|
__nextHasNoMarginBottom
|
|
246
|
-
label={ __( 'Link
|
|
247
|
+
label={ __( 'Link relation' ) }
|
|
248
|
+
help={ createInterpolateElement(
|
|
249
|
+
__(
|
|
250
|
+
'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
|
|
251
|
+
),
|
|
252
|
+
{
|
|
253
|
+
a: (
|
|
254
|
+
<ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
|
|
255
|
+
),
|
|
256
|
+
}
|
|
257
|
+
) }
|
|
247
258
|
value={ rel || '' }
|
|
248
259
|
onChange={ ( value ) => setAttributes( { rel: value } ) }
|
|
249
260
|
/>
|
package/src/spacer/edit.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
getSpacingPresetCssVar,
|
|
13
13
|
store as blockEditorStore,
|
|
14
14
|
privateApis as blockEditorPrivateApis,
|
|
15
|
+
useBlockEditingMode,
|
|
15
16
|
} from '@wordpress/block-editor';
|
|
16
17
|
import { ResizableBox } from '@wordpress/components';
|
|
17
18
|
import { useState, useEffect } from '@wordpress/element';
|
|
@@ -346,6 +347,8 @@ const SpacerEdit = ( {
|
|
|
346
347
|
__unstableMarkNextChangeAsNotPersistent,
|
|
347
348
|
] );
|
|
348
349
|
|
|
350
|
+
const blockEditingMode = useBlockEditingMode();
|
|
351
|
+
|
|
349
352
|
return (
|
|
350
353
|
<>
|
|
351
354
|
<View
|
|
@@ -356,7 +359,8 @@ const SpacerEdit = ( {
|
|
|
356
359
|
} ),
|
|
357
360
|
} ) }
|
|
358
361
|
>
|
|
359
|
-
{
|
|
362
|
+
{ blockEditingMode === 'default' &&
|
|
363
|
+
resizableBoxWithOrientation( inheritedOrientation ) }
|
|
360
364
|
</View>
|
|
361
365
|
{ ! isFlexLayout && (
|
|
362
366
|
<SpacerControls
|
package/src/style.scss
CHANGED
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
@import "./table/style.scss";
|
|
69
69
|
@import "./table-of-contents/style.scss";
|
|
70
70
|
@import "./term-description/style.scss";
|
|
71
|
+
@import "./term-template/style.scss";
|
|
72
|
+
@import "./terms-query/style.scss";
|
|
71
73
|
@import "./text-columns/style.scss";
|
|
72
74
|
@import "./verse/style.scss";
|
|
73
75
|
@import "./video/style.scss";
|
|
@@ -20,10 +20,16 @@ import {
|
|
|
20
20
|
} from '@wordpress/components';
|
|
21
21
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
22
22
|
import { renderToString } from '@wordpress/element';
|
|
23
|
-
import { __ } from '@wordpress/i18n';
|
|
23
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
24
24
|
import { useInstanceId } from '@wordpress/compose';
|
|
25
25
|
import { store as noticeStore } from '@wordpress/notices';
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
tableOfContents as icon,
|
|
28
|
+
formatListBullets,
|
|
29
|
+
formatListBulletsRTL,
|
|
30
|
+
formatListNumbered,
|
|
31
|
+
formatListNumberedRTL,
|
|
32
|
+
} from '@wordpress/icons';
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
35
|
* Internal dependencies
|
|
@@ -43,13 +49,19 @@ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
|
43
49
|
* @param {HeadingData[]} props.attributes.headings The list of data for each heading in the post.
|
|
44
50
|
* @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).
|
|
45
51
|
* @param {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.
|
|
52
|
+
* @param {boolean} props.attributes.ordered Whether to display as an ordered list (true) or unordered list (false).
|
|
46
53
|
* @param {string} props.clientId The client id.
|
|
47
54
|
* @param {(attributes: Object) => void} props.setAttributes The set attributes function.
|
|
48
55
|
*
|
|
49
56
|
* @return {Component} The component.
|
|
50
57
|
*/
|
|
51
58
|
export default function TableOfContentsEdit( {
|
|
52
|
-
attributes: {
|
|
59
|
+
attributes: {
|
|
60
|
+
headings = [],
|
|
61
|
+
onlyIncludeCurrentPage,
|
|
62
|
+
maxLevel,
|
|
63
|
+
ordered = true,
|
|
64
|
+
},
|
|
53
65
|
clientId,
|
|
54
66
|
setAttributes,
|
|
55
67
|
} ) {
|
|
@@ -86,27 +98,48 @@ export default function TableOfContentsEdit( {
|
|
|
86
98
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
87
99
|
const headingTree = linearToNestedHeadingList( headings );
|
|
88
100
|
|
|
89
|
-
const toolbarControls =
|
|
101
|
+
const toolbarControls = (
|
|
90
102
|
<BlockControls>
|
|
91
103
|
<ToolbarGroup>
|
|
92
104
|
<ToolbarButton
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
),
|
|
103
|
-
} )
|
|
104
|
-
)
|
|
105
|
+
icon={ isRTL() ? formatListBulletsRTL : formatListBullets }
|
|
106
|
+
title={ __( 'Unordered' ) }
|
|
107
|
+
description={ __( 'Convert to unordered list' ) }
|
|
108
|
+
onClick={ () => setAttributes( { ordered: false } ) }
|
|
109
|
+
isActive={ ordered === false }
|
|
110
|
+
/>
|
|
111
|
+
<ToolbarButton
|
|
112
|
+
icon={
|
|
113
|
+
isRTL() ? formatListNumberedRTL : formatListNumbered
|
|
105
114
|
}
|
|
106
|
-
|
|
107
|
-
{ __( 'Convert to
|
|
108
|
-
|
|
115
|
+
title={ __( 'Ordered' ) }
|
|
116
|
+
description={ __( 'Convert to ordered list' ) }
|
|
117
|
+
onClick={ () => setAttributes( { ordered: true } ) }
|
|
118
|
+
isActive={ ordered === true }
|
|
119
|
+
/>
|
|
109
120
|
</ToolbarGroup>
|
|
121
|
+
{ canInsertList && (
|
|
122
|
+
<ToolbarGroup>
|
|
123
|
+
<ToolbarButton
|
|
124
|
+
onClick={ () =>
|
|
125
|
+
replaceBlocks(
|
|
126
|
+
clientId,
|
|
127
|
+
createBlock( 'core/list', {
|
|
128
|
+
ordered,
|
|
129
|
+
values: renderToString(
|
|
130
|
+
<TableOfContentsList
|
|
131
|
+
nestedHeadingList={ headingTree }
|
|
132
|
+
ordered={ ordered }
|
|
133
|
+
/>
|
|
134
|
+
),
|
|
135
|
+
} )
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
>
|
|
139
|
+
{ __( 'Convert to static list' ) }
|
|
140
|
+
</ToolbarButton>
|
|
141
|
+
</ToolbarGroup>
|
|
142
|
+
) }
|
|
110
143
|
</BlockControls>
|
|
111
144
|
);
|
|
112
145
|
|
|
@@ -118,6 +151,7 @@ export default function TableOfContentsEdit( {
|
|
|
118
151
|
setAttributes( {
|
|
119
152
|
onlyIncludeCurrentPage: false,
|
|
120
153
|
maxLevel: undefined,
|
|
154
|
+
ordered: true,
|
|
121
155
|
} );
|
|
122
156
|
} }
|
|
123
157
|
dropdownMenuProps={ dropdownMenuProps }
|
|
@@ -210,16 +244,19 @@ export default function TableOfContentsEdit( {
|
|
|
210
244
|
);
|
|
211
245
|
}
|
|
212
246
|
|
|
247
|
+
const ListTag = ordered ? 'ol' : 'ul';
|
|
248
|
+
|
|
213
249
|
return (
|
|
214
250
|
<>
|
|
215
251
|
<nav { ...blockProps }>
|
|
216
|
-
<
|
|
252
|
+
<ListTag>
|
|
217
253
|
<TableOfContentsList
|
|
218
254
|
nestedHeadingList={ headingTree }
|
|
219
255
|
disableLinkActivation
|
|
220
256
|
onClick={ showRedirectionPreventedNotice }
|
|
257
|
+
ordered={ ordered }
|
|
221
258
|
/>
|
|
222
|
-
</
|
|
259
|
+
</ListTag>
|
|
223
260
|
</nav>
|
|
224
261
|
{ toolbarControls }
|
|
225
262
|
{ inspectorControls }
|
|
@@ -14,10 +14,12 @@ export default function TableOfContentsList( {
|
|
|
14
14
|
nestedHeadingList,
|
|
15
15
|
disableLinkActivation,
|
|
16
16
|
onClick,
|
|
17
|
+
ordered = true,
|
|
17
18
|
}: {
|
|
18
19
|
nestedHeadingList: NestedHeadingData[];
|
|
19
20
|
disableLinkActivation?: boolean;
|
|
20
21
|
onClick?: ( event: MouseEvent< HTMLAnchorElement > ) => void;
|
|
22
|
+
ordered?: boolean;
|
|
21
23
|
} ): ReactElement {
|
|
22
24
|
return (
|
|
23
25
|
<>
|
|
@@ -42,11 +44,13 @@ export default function TableOfContentsList( {
|
|
|
42
44
|
<span className={ ENTRY_CLASS_NAME }>{ content }</span>
|
|
43
45
|
);
|
|
44
46
|
|
|
47
|
+
const NestedListTag = ordered ? 'ol' : 'ul';
|
|
48
|
+
|
|
45
49
|
return (
|
|
46
50
|
<li key={ index }>
|
|
47
51
|
{ entry }
|
|
48
52
|
{ node.children ? (
|
|
49
|
-
<
|
|
53
|
+
<NestedListTag>
|
|
50
54
|
<TableOfContentsList
|
|
51
55
|
nestedHeadingList={ node.children }
|
|
52
56
|
disableLinkActivation={
|
|
@@ -58,8 +62,9 @@ export default function TableOfContentsList( {
|
|
|
58
62
|
? onClick
|
|
59
63
|
: undefined
|
|
60
64
|
}
|
|
65
|
+
ordered={ ordered }
|
|
61
66
|
/>
|
|
62
|
-
</
|
|
67
|
+
</NestedListTag>
|
|
63
68
|
) : null }
|
|
64
69
|
</li>
|
|
65
70
|
);
|