@wordpress/block-library 9.35.1-next.dc3f6d3c1.0 → 9.36.1-next.6deb34194.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/accordion/view.js +46 -4
- package/build/accordion/view.js.map +2 -2
- package/build/accordion-heading/block.json +1 -1
- package/build/accordion-heading/deprecated.js +1 -1
- package/build/accordion-heading/deprecated.js.map +2 -2
- package/build/accordion-panel/block.json +1 -1
- package/build/audio/index.js +13 -10
- package/build/audio/index.js.map +3 -3
- package/build/avatar/edit.js +13 -38
- package/build/avatar/edit.js.map +2 -2
- package/build/breadcrumbs/block.json +3 -2
- package/build/breadcrumbs/edit.js +18 -18
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/button/index.js +14 -11
- package/build/button/index.js.map +3 -3
- package/build/code/index.js +10 -7
- package/build/code/index.js.map +3 -3
- package/build/comments-pagination-numbers/block.json +7 -0
- package/build/cover/edit/block-controls.js +37 -3
- package/build/cover/edit/block-controls.js.map +3 -3
- package/build/cover/edit/cover-placeholder.js +0 -1
- package/build/cover/edit/cover-placeholder.js.map +2 -2
- package/build/cover/edit/embed-video-url-input.js +83 -0
- package/build/cover/edit/embed-video-url-input.js.map +7 -0
- package/build/cover/edit/index.js +60 -0
- package/build/cover/edit/index.js.map +2 -2
- package/build/cover/embed-video-utils.js +151 -0
- package/build/cover/embed-video-utils.js.map +7 -0
- package/build/cover/index.js +11 -5
- package/build/cover/index.js.map +3 -3
- package/build/cover/save.js +12 -0
- package/build/cover/save.js.map +2 -2
- package/build/cover/shared.js +3 -0
- package/build/cover/shared.js.map +2 -2
- package/build/details/index.js +10 -7
- package/build/details/index.js.map +3 -3
- package/build/file/index.js +15 -15
- package/build/file/index.js.map +3 -3
- package/build/freeform/block.json +1 -1
- package/build/gallery/edit.js +1 -3
- package/build/gallery/edit.js.map +2 -2
- package/build/gallery/transforms.js +7 -3
- package/build/gallery/transforms.js.map +2 -2
- package/build/heading/index.js +10 -7
- package/build/heading/index.js.map +3 -3
- package/build/html/modal.js +141 -121
- package/build/html/modal.js.map +3 -3
- package/build/image/edit.js +0 -1
- package/build/image/edit.js.map +2 -2
- package/build/image/image.js +0 -1
- package/build/image/image.js.map +2 -2
- package/build/image/index.js +19 -19
- package/build/image/index.js.map +3 -3
- package/build/index.js +9 -3
- package/build/index.js.map +2 -2
- package/build/list-item/index.js +9 -7
- package/build/list-item/index.js.map +3 -3
- package/build/math/block.json +28 -1
- package/build/math/edit.js +17 -2
- package/build/math/edit.js.map +2 -2
- package/build/media-text/index.js +16 -9
- package/build/media-text/index.js.map +3 -3
- package/build/media-text/media-container.js +0 -2
- package/build/media-text/media-container.js.map +2 -2
- package/build/missing/block.json +1 -1
- package/build/missing/edit.js +2 -2
- package/build/missing/edit.js.map +1 -1
- package/build/more/index.js +10 -7
- package/build/more/index.js.map +3 -3
- package/build/navigation-link/edit.js +36 -11
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/index.js +12 -9
- package/build/navigation-link/index.js.map +3 -3
- package/build/navigation-submenu/index.js +12 -9
- package/build/navigation-submenu/index.js.map +3 -3
- package/build/page-list-item/edit.js +4 -3
- package/build/page-list-item/edit.js.map +2 -2
- package/build/paragraph/deprecated-attributes.js +68 -0
- package/build/paragraph/deprecated-attributes.js.map +7 -0
- package/build/paragraph/edit.js +2 -0
- package/build/paragraph/edit.js.map +3 -3
- package/build/paragraph/index.js +10 -7
- package/build/paragraph/index.js.map +3 -3
- package/build/pattern/block.json +1 -1
- package/build/post-title/edit.js +6 -4
- package/build/post-title/edit.js.map +2 -2
- package/build/preformatted/index.js +10 -7
- package/build/preformatted/index.js.map +3 -3
- package/build/pullquote/index.js +12 -12
- package/build/pullquote/index.js.map +3 -3
- package/build/search/index.js +15 -17
- package/build/search/index.js.map +3 -3
- package/build/social-link/index.js +12 -9
- package/build/social-link/index.js.map +3 -3
- package/build/template-part/edit/index.js +37 -7
- package/build/template-part/edit/index.js.map +2 -2
- package/build/template-part/edit/utils/get-template-part-icon.js +9 -4
- package/build/template-part/edit/utils/get-template-part-icon.js.map +3 -3
- package/build/template-part/edit/utils/hooks.js +2 -3
- package/build/template-part/edit/utils/hooks.js.map +2 -2
- package/build/term-count/index.js +1 -0
- package/build/term-count/index.js.map +2 -2
- package/build/term-name/index.js +1 -0
- package/build/term-name/index.js.map +2 -2
- package/build/verse/index.js +10 -7
- package/build/verse/index.js.map +3 -3
- package/build/video/index.js +13 -10
- package/build/video/index.js.map +3 -3
- package/build-module/accordion/view.js +46 -4
- package/build-module/accordion/view.js.map +2 -2
- package/build-module/accordion-heading/block.json +1 -1
- package/build-module/accordion-heading/deprecated.js +1 -1
- package/build-module/accordion-heading/deprecated.js.map +2 -2
- package/build-module/accordion-panel/block.json +1 -1
- package/build-module/audio/index.js +13 -10
- package/build-module/audio/index.js.map +2 -2
- package/build-module/avatar/edit.js +13 -38
- package/build-module/avatar/edit.js.map +2 -2
- package/build-module/breadcrumbs/block.json +3 -2
- package/build-module/breadcrumbs/edit.js +18 -18
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +14 -11
- package/build-module/button/index.js.map +2 -2
- package/build-module/code/index.js +10 -7
- package/build-module/code/index.js.map +2 -2
- package/build-module/comments-pagination-numbers/block.json +7 -0
- package/build-module/cover/edit/block-controls.js +27 -3
- package/build-module/cover/edit/block-controls.js.map +2 -2
- package/build-module/cover/edit/cover-placeholder.js +0 -1
- package/build-module/cover/edit/cover-placeholder.js.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.js +67 -0
- package/build-module/cover/edit/embed-video-url-input.js.map +7 -0
- package/build-module/cover/edit/index.js +61 -0
- package/build-module/cover/edit/index.js.map +2 -2
- package/build-module/cover/embed-video-utils.js +122 -0
- package/build-module/cover/embed-video-utils.js.map +7 -0
- package/build-module/cover/index.js +11 -5
- package/build-module/cover/index.js.map +2 -2
- package/build-module/cover/save.js +13 -0
- package/build-module/cover/save.js.map +2 -2
- package/build-module/cover/shared.js +2 -0
- package/build-module/cover/shared.js.map +2 -2
- package/build-module/details/index.js +10 -7
- package/build-module/details/index.js.map +2 -2
- package/build-module/file/index.js +15 -15
- package/build-module/file/index.js.map +2 -2
- package/build-module/freeform/block.json +1 -1
- package/build-module/gallery/edit.js +1 -3
- package/build-module/gallery/edit.js.map +2 -2
- package/build-module/gallery/transforms.js +7 -3
- package/build-module/gallery/transforms.js.map +2 -2
- package/build-module/heading/index.js +10 -7
- package/build-module/heading/index.js.map +2 -2
- package/build-module/html/modal.js +143 -122
- package/build-module/html/modal.js.map +2 -2
- package/build-module/image/edit.js +0 -1
- package/build-module/image/edit.js.map +2 -2
- package/build-module/image/image.js +0 -1
- package/build-module/image/image.js.map +2 -2
- package/build-module/image/index.js +19 -19
- package/build-module/image/index.js.map +2 -2
- package/build-module/index.js +9 -3
- package/build-module/index.js.map +2 -2
- package/build-module/list-item/index.js +9 -7
- package/build-module/list-item/index.js.map +2 -2
- package/build-module/math/block.json +28 -1
- package/build-module/math/edit.js +18 -3
- package/build-module/math/edit.js.map +2 -2
- package/build-module/media-text/index.js +16 -9
- package/build-module/media-text/index.js.map +2 -2
- package/build-module/media-text/media-container.js +0 -2
- package/build-module/media-text/media-container.js.map +2 -2
- package/build-module/missing/block.json +1 -1
- package/build-module/missing/edit.js +2 -2
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/more/index.js +10 -7
- package/build-module/more/index.js.map +2 -2
- package/build-module/navigation-link/edit.js +37 -12
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/index.js +12 -9
- package/build-module/navigation-link/index.js.map +2 -2
- package/build-module/navigation-submenu/index.js +12 -9
- package/build-module/navigation-submenu/index.js.map +2 -2
- package/build-module/page-list-item/edit.js +4 -3
- package/build-module/page-list-item/edit.js.map +2 -2
- package/build-module/paragraph/deprecated-attributes.js +37 -0
- package/build-module/paragraph/deprecated-attributes.js.map +7 -0
- package/build-module/paragraph/edit.js +2 -0
- package/build-module/paragraph/edit.js.map +2 -2
- package/build-module/paragraph/index.js +10 -7
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/pattern/block.json +1 -1
- package/build-module/post-title/edit.js +6 -4
- package/build-module/post-title/edit.js.map +2 -2
- package/build-module/preformatted/index.js +10 -7
- package/build-module/preformatted/index.js.map +2 -2
- package/build-module/pullquote/index.js +12 -12
- package/build-module/pullquote/index.js.map +2 -2
- package/build-module/search/index.js +15 -17
- package/build-module/search/index.js.map +2 -2
- package/build-module/social-link/index.js +12 -9
- package/build-module/social-link/index.js.map +2 -2
- package/build-module/template-part/edit/index.js +37 -7
- package/build-module/template-part/edit/index.js.map +2 -2
- package/build-module/template-part/edit/utils/get-template-part-icon.js +10 -4
- package/build-module/template-part/edit/utils/get-template-part-icon.js.map +2 -2
- package/build-module/template-part/edit/utils/hooks.js +2 -3
- package/build-module/template-part/edit/utils/hooks.js.map +2 -2
- package/build-module/term-count/index.js +1 -0
- package/build-module/term-count/index.js.map +2 -2
- package/build-module/term-name/index.js +1 -0
- package/build-module/term-name/index.js.map +2 -2
- package/build-module/verse/index.js +10 -7
- package/build-module/verse/index.js.map +2 -2
- package/build-module/video/index.js +13 -10
- package/build-module/video/index.js.map +2 -2
- package/build-style/accordion/style-rtl.css +3 -0
- package/build-style/accordion/style.css +3 -0
- package/build-style/accordion-heading/style-rtl.css +2 -19
- package/build-style/accordion-heading/style.css +2 -19
- package/build-style/accordion-item/style-rtl.css +0 -7
- package/build-style/accordion-item/style.css +0 -7
- package/build-style/accordion-panel/style-rtl.css +1 -4
- package/build-style/accordion-panel/style.css +1 -4
- package/build-style/classic-rtl.css +24 -0
- package/build-style/classic.css +24 -0
- package/build-style/common-rtl.css +4 -4
- package/build-style/common.css +4 -0
- package/build-style/cover/style-rtl.css +47 -0
- package/build-style/cover/style.css +47 -0
- package/build-style/editor-rtl.css +11 -13
- package/build-style/editor.css +11 -13
- package/build-style/html/editor-rtl.css +11 -13
- package/build-style/html/editor.css +11 -13
- package/build-style/style-rtl.css +59 -33
- package/build-style/style.css +59 -29
- package/build-style/verse/style-rtl.css +2 -0
- package/build-style/verse/style.css +2 -0
- package/package.json +40 -38
- package/src/accordion/style.scss +4 -0
- package/src/accordion/view.js +60 -3
- package/src/accordion-heading/block.json +1 -1
- package/src/accordion-heading/deprecated.js +1 -1
- package/src/accordion-heading/style.scss +2 -38
- package/src/accordion-item/index.php +1 -0
- package/src/accordion-item/style.scss +2 -9
- package/src/accordion-panel/block.json +1 -1
- package/src/accordion-panel/style.scss +1 -5
- package/src/audio/index.js +14 -10
- package/src/avatar/edit.js +68 -83
- package/src/breadcrumbs/block.json +3 -2
- package/src/breadcrumbs/edit.js +18 -18
- package/src/breadcrumbs/index.php +103 -93
- package/src/button/index.js +15 -11
- package/src/classic.scss +38 -0
- package/src/code/index.js +11 -7
- package/src/comments-pagination-numbers/block.json +7 -0
- package/src/common.scss +4 -0
- package/src/cover/edit/block-controls.js +26 -2
- package/src/cover/edit/cover-placeholder.js +0 -1
- package/src/cover/edit/embed-video-url-input.js +74 -0
- package/src/cover/edit/index.js +81 -0
- package/src/cover/embed-video-utils.js +196 -0
- package/src/cover/index.js +12 -5
- package/src/cover/index.php +106 -0
- package/src/cover/save.js +14 -0
- package/src/cover/shared.js +1 -0
- package/src/cover/style.scss +47 -0
- package/src/details/index.js +11 -7
- package/src/file/index.js +16 -15
- package/src/freeform/block.json +1 -1
- package/src/gallery/edit.js +4 -3
- package/src/gallery/transforms.js +6 -2
- package/src/heading/index.js +11 -7
- package/src/html/editor.scss +10 -15
- package/src/html/modal.js +54 -30
- package/src/image/edit.js +0 -1
- package/src/image/image.js +0 -1
- package/src/image/index.js +20 -19
- package/src/image/index.php +1 -0
- package/src/index.js +9 -3
- package/src/list-item/index.js +10 -7
- package/src/math/block.json +28 -1
- package/src/math/edit.js +18 -3
- package/src/media-text/index.js +17 -9
- package/src/media-text/media-container.js +0 -2
- package/src/missing/block.json +1 -1
- package/src/missing/edit.js +2 -2
- package/src/more/index.js +11 -7
- package/src/navigation-link/edit.js +72 -26
- package/src/navigation-link/index.js +13 -9
- package/src/navigation-submenu/index.js +13 -9
- package/src/page-list/index.php +3 -4
- package/src/page-list-item/edit.js +4 -3
- package/src/paragraph/deprecated-attributes.js +45 -0
- package/src/paragraph/edit.js +2 -0
- package/src/paragraph/index.js +11 -7
- package/src/pattern/block.json +1 -1
- package/src/post-title/edit.js +8 -4
- package/src/post-title/index.php +1 -1
- package/src/preformatted/index.js +11 -7
- package/src/pullquote/index.js +13 -12
- package/src/search/index.js +15 -16
- package/src/social-link/index.js +13 -9
- package/src/style.scss +1 -0
- package/src/template-part/edit/index.js +44 -6
- package/src/template-part/edit/utils/get-template-part-icon.js +23 -4
- package/src/template-part/edit/utils/hooks.js +2 -4
- package/src/term-count/index.js +1 -0
- package/src/term-name/index.js +1 -0
- package/src/verse/index.js +11 -7
- package/src/verse/style.scss +4 -0
- package/src/video/index.js +14 -10
- package/tsconfig.tsbuildinfo +1 -1
package/src/file/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { _x, __ } from '@wordpress/i18n';
|
|
5
5
|
import { file as icon } from '@wordpress/icons';
|
|
6
|
+
import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -13,6 +14,9 @@ import edit from './edit';
|
|
|
13
14
|
import metadata from './block.json';
|
|
14
15
|
import save from './save';
|
|
15
16
|
import transforms from './transforms';
|
|
17
|
+
import { unlock } from '../lock-unlock';
|
|
18
|
+
|
|
19
|
+
const { fieldsKey, formKey } = unlock( blocksPrivateApis );
|
|
16
20
|
|
|
17
21
|
const { name } = metadata;
|
|
18
22
|
|
|
@@ -32,15 +36,15 @@ export const settings = {
|
|
|
32
36
|
save,
|
|
33
37
|
};
|
|
34
38
|
|
|
35
|
-
if ( window.
|
|
36
|
-
settings
|
|
39
|
+
if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
40
|
+
settings[ fieldsKey ] = [
|
|
37
41
|
{
|
|
42
|
+
id: 'file',
|
|
38
43
|
label: __( 'File' ),
|
|
39
|
-
type: '
|
|
40
|
-
shownByDefault: true,
|
|
44
|
+
type: 'media',
|
|
41
45
|
mapping: {
|
|
42
46
|
id: 'id',
|
|
43
|
-
|
|
47
|
+
url: 'href',
|
|
44
48
|
},
|
|
45
49
|
args: {
|
|
46
50
|
allowedTypes: [],
|
|
@@ -48,22 +52,19 @@ if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
|
48
52
|
},
|
|
49
53
|
},
|
|
50
54
|
{
|
|
55
|
+
id: 'fileName',
|
|
51
56
|
label: __( 'Filename' ),
|
|
52
|
-
type: '
|
|
53
|
-
shownByDefault: false,
|
|
54
|
-
mapping: {
|
|
55
|
-
value: 'fileName',
|
|
56
|
-
},
|
|
57
|
+
type: 'richtext',
|
|
57
58
|
},
|
|
58
59
|
{
|
|
60
|
+
id: 'downloadButtonText',
|
|
59
61
|
label: __( 'Button Text' ),
|
|
60
|
-
type: '
|
|
61
|
-
shownByDefault: false,
|
|
62
|
-
mapping: {
|
|
63
|
-
value: 'downloadButtonText',
|
|
64
|
-
},
|
|
62
|
+
type: 'richtext',
|
|
65
63
|
},
|
|
66
64
|
];
|
|
65
|
+
settings[ formKey ] = {
|
|
66
|
+
fields: [ 'file' ],
|
|
67
|
+
};
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/freeform/block.json
CHANGED
package/src/gallery/edit.js
CHANGED
|
@@ -290,7 +290,10 @@ export default function GalleryEdit( props ) {
|
|
|
290
290
|
...newLinkTarget,
|
|
291
291
|
className: newClassName,
|
|
292
292
|
sizeSlug,
|
|
293
|
-
caption:
|
|
293
|
+
caption:
|
|
294
|
+
imageAttributes.caption.length > 0
|
|
295
|
+
? imageAttributes.caption
|
|
296
|
+
: image.caption?.raw,
|
|
294
297
|
alt: imageAttributes.alt || image.alt_text,
|
|
295
298
|
aspectRatio: aspectRatio === 'auto' ? undefined : aspectRatio,
|
|
296
299
|
};
|
|
@@ -596,7 +599,6 @@ export default function GalleryEdit( props ) {
|
|
|
596
599
|
instructions: PLACEHOLDER_TEXT,
|
|
597
600
|
} }
|
|
598
601
|
onSelect={ updateImages }
|
|
599
|
-
accept="image/*"
|
|
600
602
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
601
603
|
multiple
|
|
602
604
|
onError={ onUploadError }
|
|
@@ -910,7 +912,6 @@ export default function GalleryEdit( props ) {
|
|
|
910
912
|
<BlockControls group="other">
|
|
911
913
|
<MediaReplaceFlow
|
|
912
914
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
913
|
-
accept="image/*"
|
|
914
915
|
handleUpload={ false }
|
|
915
916
|
onSelect={ updateImages }
|
|
916
917
|
name={ __( 'Add' ) }
|
|
@@ -155,7 +155,7 @@ const transforms = {
|
|
|
155
155
|
{
|
|
156
156
|
type: 'shortcode',
|
|
157
157
|
tag: 'gallery',
|
|
158
|
-
transform( { named: { ids, columns = 3, link, orderby } } ) {
|
|
158
|
+
transform( { named: { ids, columns = 3, link, orderby, size } } ) {
|
|
159
159
|
const imageIds = parseShortcodeIds( ids ).map( ( id ) =>
|
|
160
160
|
parseInt( id, 10 )
|
|
161
161
|
);
|
|
@@ -173,9 +173,13 @@ const transforms = {
|
|
|
173
173
|
columns: parseInt( columns, 10 ),
|
|
174
174
|
linkTo,
|
|
175
175
|
randomOrder: orderby === 'rand',
|
|
176
|
+
...( size && { sizeSlug: size } ),
|
|
176
177
|
},
|
|
177
178
|
imageIds.map( ( imageId ) =>
|
|
178
|
-
createBlock( 'core/image', {
|
|
179
|
+
createBlock( 'core/image', {
|
|
180
|
+
id: imageId,
|
|
181
|
+
...( size && { sizeSlug: size } ),
|
|
182
|
+
} )
|
|
179
183
|
)
|
|
180
184
|
);
|
|
181
185
|
|
package/src/heading/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { heading as icon } from '@wordpress/icons';
|
|
5
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
|
+
import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -14,6 +15,9 @@ import metadata from './block.json';
|
|
|
14
15
|
import save from './save';
|
|
15
16
|
import transforms from './transforms';
|
|
16
17
|
import variations from './variations';
|
|
18
|
+
import { unlock } from '../lock-unlock';
|
|
19
|
+
|
|
20
|
+
const { fieldsKey, formKey } = unlock( blocksPrivateApis );
|
|
17
21
|
|
|
18
22
|
const { name } = metadata;
|
|
19
23
|
|
|
@@ -69,17 +73,17 @@ export const settings = {
|
|
|
69
73
|
variations,
|
|
70
74
|
};
|
|
71
75
|
|
|
72
|
-
if ( window.
|
|
73
|
-
settings
|
|
76
|
+
if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
77
|
+
settings[ fieldsKey ] = [
|
|
74
78
|
{
|
|
79
|
+
id: 'content',
|
|
75
80
|
label: __( 'Content' ),
|
|
76
|
-
type: '
|
|
77
|
-
shownByDefault: true,
|
|
78
|
-
mapping: {
|
|
79
|
-
value: 'content',
|
|
80
|
-
},
|
|
81
|
+
type: 'richtext',
|
|
81
82
|
},
|
|
82
83
|
];
|
|
84
|
+
settings[ formKey ] = {
|
|
85
|
+
fields: [ 'content' ],
|
|
86
|
+
};
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/html/editor.scss
CHANGED
|
@@ -14,22 +14,20 @@
|
|
|
14
14
|
|
|
15
15
|
// Modal styles
|
|
16
16
|
.block-library-html__modal {
|
|
17
|
-
|
|
18
|
-
.components-modal__content {
|
|
19
|
-
display: flex;
|
|
20
|
-
flex-direction: column;
|
|
21
|
-
padding: 0;
|
|
22
|
-
min-height: 70vh;
|
|
23
|
-
}
|
|
17
|
+
height: 100%;
|
|
24
18
|
|
|
25
19
|
.components-modal__children-container {
|
|
26
20
|
height: 100%;
|
|
27
|
-
padding: $grid-unit-20;
|
|
28
21
|
}
|
|
29
22
|
}
|
|
30
23
|
|
|
31
24
|
.block-library-html__modal-tabs {
|
|
32
|
-
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.block-library-html__modal-content {
|
|
29
|
+
flex: 1;
|
|
30
|
+
min-height: 0;
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
.block-library-html__modal-tab {
|
|
@@ -73,10 +71,7 @@
|
|
|
73
71
|
display: flex;
|
|
74
72
|
align-items: center;
|
|
75
73
|
justify-content: center;
|
|
76
|
-
padding: $grid-unit-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
.block-library-html__modal-actions {
|
|
80
|
-
margin-top: $grid-unit-20;
|
|
81
|
-
padding: 0 $grid-unit-40 $grid-unit-40;
|
|
74
|
+
padding: $grid-unit-20;
|
|
75
|
+
flex: 1;
|
|
76
|
+
min-height: 0;
|
|
82
77
|
}
|
package/src/html/modal.js
CHANGED
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
Modal,
|
|
9
9
|
Button,
|
|
10
10
|
Flex,
|
|
11
|
+
Notice,
|
|
11
12
|
privateApis as componentsPrivateApis,
|
|
12
13
|
__experimentalHStack as HStack,
|
|
13
|
-
|
|
14
|
+
__experimentalGrid as Grid,
|
|
14
15
|
} from '@wordpress/components';
|
|
15
16
|
import { PlainText, store as blockEditorStore } from '@wordpress/block-editor';
|
|
16
17
|
import { fullscreen, square } from '@wordpress/icons';
|
|
@@ -48,8 +49,9 @@ export default function HTMLEditModal( {
|
|
|
48
49
|
};
|
|
49
50
|
}, [] );
|
|
50
51
|
|
|
51
|
-
//
|
|
52
|
-
const
|
|
52
|
+
// Determine if we should show a warning about CSS/JS content being stripped
|
|
53
|
+
const hasRestrictedContent =
|
|
54
|
+
! canUserUseUnfilteredHTML && ( css.trim() || js.trim() );
|
|
53
55
|
|
|
54
56
|
if ( ! isOpen ) {
|
|
55
57
|
return null;
|
|
@@ -68,11 +70,13 @@ export default function HTMLEditModal( {
|
|
|
68
70
|
setIsDirty( true );
|
|
69
71
|
};
|
|
70
72
|
const handleUpdate = () => {
|
|
73
|
+
// For users without unfiltered_html capability, strip CSS and JS content
|
|
74
|
+
// to prevent kses from leaving broken content
|
|
71
75
|
setAttributes( {
|
|
72
76
|
content: serializeContent( {
|
|
73
77
|
html: editedHtml,
|
|
74
|
-
css: editedCss,
|
|
75
|
-
js: editedJs,
|
|
78
|
+
css: canUserUseUnfilteredHTML ? editedCss : '',
|
|
79
|
+
js: canUserUseUnfilteredHTML ? editedJs : '',
|
|
76
80
|
} ),
|
|
77
81
|
} );
|
|
78
82
|
setIsDirty( false );
|
|
@@ -117,13 +121,23 @@ export default function HTMLEditModal( {
|
|
|
117
121
|
__experimentalHideHeader
|
|
118
122
|
>
|
|
119
123
|
<Tabs orientation="horizontal" defaultTabId="html">
|
|
120
|
-
<
|
|
121
|
-
|
|
124
|
+
<Grid
|
|
125
|
+
columns={ 1 }
|
|
126
|
+
templateRows="auto 1fr auto"
|
|
127
|
+
gap={ 4 }
|
|
128
|
+
style={ { height: '100%' } }
|
|
129
|
+
>
|
|
130
|
+
<HStack
|
|
131
|
+
justify="space-between"
|
|
132
|
+
className="block-library-html__modal-header"
|
|
133
|
+
>
|
|
122
134
|
<div>
|
|
123
135
|
<Tabs.TabList>
|
|
124
136
|
<Tabs.Tab tabId="html">HTML</Tabs.Tab>
|
|
125
|
-
|
|
126
|
-
|
|
137
|
+
{ canUserUseUnfilteredHTML && (
|
|
138
|
+
<Tabs.Tab tabId="css">CSS</Tabs.Tab>
|
|
139
|
+
) }
|
|
140
|
+
{ canUserUseUnfilteredHTML && (
|
|
127
141
|
<Tabs.Tab tabId="js">
|
|
128
142
|
{ __( 'JavaScript' ) }
|
|
129
143
|
</Tabs.Tab>
|
|
@@ -140,14 +154,24 @@ export default function HTMLEditModal( {
|
|
|
140
154
|
/>
|
|
141
155
|
</div>
|
|
142
156
|
</HStack>
|
|
157
|
+
{ hasRestrictedContent && (
|
|
158
|
+
<Notice
|
|
159
|
+
status="warning"
|
|
160
|
+
isDismissible={ false }
|
|
161
|
+
className="block-library-html__modal-notice"
|
|
162
|
+
>
|
|
163
|
+
{ __(
|
|
164
|
+
'This block contains CSS or JavaScript that will be removed when you save because you do not have permission to use unfiltered HTML.'
|
|
165
|
+
) }
|
|
166
|
+
</Notice>
|
|
167
|
+
) }
|
|
143
168
|
<HStack
|
|
144
169
|
alignment="stretch"
|
|
145
170
|
justify="flex-start"
|
|
146
171
|
spacing={ 4 }
|
|
147
172
|
className="block-library-html__modal-tabs"
|
|
148
|
-
style={ { flexGrow: 1 } }
|
|
149
173
|
>
|
|
150
|
-
<div
|
|
174
|
+
<div className="block-library-html__modal-content">
|
|
151
175
|
<Tabs.TabPanel
|
|
152
176
|
tabId="html"
|
|
153
177
|
focusable={ false }
|
|
@@ -161,20 +185,22 @@ export default function HTMLEditModal( {
|
|
|
161
185
|
className="block-library-html__modal-editor"
|
|
162
186
|
/>
|
|
163
187
|
</Tabs.TabPanel>
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
188
|
+
{ canUserUseUnfilteredHTML && (
|
|
189
|
+
<Tabs.TabPanel
|
|
190
|
+
tabId="css"
|
|
191
|
+
focusable={ false }
|
|
192
|
+
className="block-library-html__modal-tab"
|
|
193
|
+
>
|
|
194
|
+
<PlainText
|
|
195
|
+
value={ editedCss }
|
|
196
|
+
onChange={ handleCssChange }
|
|
197
|
+
placeholder={ __( 'Write CSS…' ) }
|
|
198
|
+
aria-label={ __( 'CSS' ) }
|
|
199
|
+
className="block-library-html__modal-editor"
|
|
200
|
+
/>
|
|
201
|
+
</Tabs.TabPanel>
|
|
202
|
+
) }
|
|
203
|
+
{ canUserUseUnfilteredHTML && (
|
|
178
204
|
<Tabs.TabPanel
|
|
179
205
|
tabId="js"
|
|
180
206
|
focusable={ false }
|
|
@@ -192,10 +218,7 @@ export default function HTMLEditModal( {
|
|
|
192
218
|
</Tabs.TabPanel>
|
|
193
219
|
) }
|
|
194
220
|
</div>
|
|
195
|
-
<div
|
|
196
|
-
className="block-library-html__preview"
|
|
197
|
-
style={ { width: '50%' } }
|
|
198
|
-
>
|
|
221
|
+
<div className="block-library-html__preview">
|
|
199
222
|
<Preview
|
|
200
223
|
content={ serializeContent( {
|
|
201
224
|
html: editedHtml,
|
|
@@ -209,6 +232,7 @@ export default function HTMLEditModal( {
|
|
|
209
232
|
alignment="center"
|
|
210
233
|
justify="flex-end"
|
|
211
234
|
spacing={ 4 }
|
|
235
|
+
className="block-library-html__modal-footer"
|
|
212
236
|
>
|
|
213
237
|
<Button
|
|
214
238
|
__next40pxDefaultSize
|
|
@@ -225,7 +249,7 @@ export default function HTMLEditModal( {
|
|
|
225
249
|
{ __( 'Update' ) }
|
|
226
250
|
</Button>
|
|
227
251
|
</HStack>
|
|
228
|
-
</
|
|
252
|
+
</Grid>
|
|
229
253
|
</Tabs>
|
|
230
254
|
</Modal>
|
|
231
255
|
|
package/src/image/edit.js
CHANGED
|
@@ -464,7 +464,6 @@ export function ImageEdit( {
|
|
|
464
464
|
onSelectURL={ onSelectURL }
|
|
465
465
|
onError={ onUploadError }
|
|
466
466
|
placeholder={ placeholder }
|
|
467
|
-
accept="image/*"
|
|
468
467
|
allowedTypes={ ALLOWED_MEDIA_TYPES }
|
|
469
468
|
handleUpload={ ( files ) => files.length === 1 }
|
|
470
469
|
value={ { id, src } }
|
package/src/image/image.js
CHANGED
package/src/image/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { image as icon } from '@wordpress/icons';
|
|
6
|
+
import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -13,6 +14,9 @@ import edit from './edit';
|
|
|
13
14
|
import metadata from './block.json';
|
|
14
15
|
import save from './save';
|
|
15
16
|
import transforms from './transforms';
|
|
17
|
+
import { unlock } from '../lock-unlock';
|
|
18
|
+
|
|
19
|
+
const { fieldsKey, formKey } = unlock( blocksPrivateApis );
|
|
16
20
|
|
|
17
21
|
const { name } = metadata;
|
|
18
22
|
|
|
@@ -62,15 +66,15 @@ export const settings = {
|
|
|
62
66
|
deprecated,
|
|
63
67
|
};
|
|
64
68
|
|
|
65
|
-
if ( window.
|
|
66
|
-
settings
|
|
69
|
+
if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
70
|
+
settings[ fieldsKey ] = [
|
|
67
71
|
{
|
|
72
|
+
id: 'image',
|
|
68
73
|
label: __( 'Image' ),
|
|
69
|
-
type: '
|
|
70
|
-
shownByDefault: true,
|
|
74
|
+
type: 'media',
|
|
71
75
|
mapping: {
|
|
72
76
|
id: 'id',
|
|
73
|
-
|
|
77
|
+
url: 'url',
|
|
74
78
|
caption: 'caption',
|
|
75
79
|
alt: 'alt',
|
|
76
80
|
},
|
|
@@ -80,33 +84,30 @@ if ( window.__experimentalContentOnlyPatternInsertion ) {
|
|
|
80
84
|
},
|
|
81
85
|
},
|
|
82
86
|
{
|
|
87
|
+
id: 'link',
|
|
83
88
|
label: __( 'Link' ),
|
|
84
|
-
type: '
|
|
85
|
-
shownByDefault: false,
|
|
89
|
+
type: 'link',
|
|
86
90
|
mapping: {
|
|
87
|
-
|
|
91
|
+
url: 'href',
|
|
88
92
|
rel: 'rel',
|
|
89
|
-
|
|
93
|
+
linkTarget: 'linkTarget',
|
|
90
94
|
destination: 'linkDestination',
|
|
91
95
|
},
|
|
92
96
|
},
|
|
93
97
|
{
|
|
98
|
+
id: 'caption',
|
|
94
99
|
label: __( 'Caption' ),
|
|
95
|
-
type: '
|
|
96
|
-
shownByDefault: false,
|
|
97
|
-
mapping: {
|
|
98
|
-
value: 'caption',
|
|
99
|
-
},
|
|
100
|
+
type: 'richtext',
|
|
100
101
|
},
|
|
101
102
|
{
|
|
103
|
+
id: 'alt',
|
|
102
104
|
label: __( 'Alt text' ),
|
|
103
|
-
type: '
|
|
104
|
-
shownByDefault: false,
|
|
105
|
-
mapping: {
|
|
106
|
-
value: 'alt',
|
|
107
|
-
},
|
|
105
|
+
type: 'text',
|
|
108
106
|
},
|
|
109
107
|
];
|
|
108
|
+
settings[ formKey ] = {
|
|
109
|
+
fields: [ 'image' ],
|
|
110
|
+
};
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/image/index.php
CHANGED
|
@@ -196,6 +196,7 @@ function block_core_image_render_lightbox( $block_content, $block ) {
|
|
|
196
196
|
$img_styles = $processor->get_attribute( 'style' );
|
|
197
197
|
$img_width = 'none';
|
|
198
198
|
$img_height = 'none';
|
|
199
|
+
$img_srcset = false;
|
|
199
200
|
$aria_label = __( 'Enlarge' );
|
|
200
201
|
$dialog_aria_label = __( 'Enlarged image' );
|
|
201
202
|
|
package/src/index.js
CHANGED
|
@@ -334,11 +334,17 @@ export const registerCoreBlocks = (
|
|
|
334
334
|
const bootstrappedBlockType = unlock(
|
|
335
335
|
select( blocksStore )
|
|
336
336
|
).getBootstrappedBlockType( blockName );
|
|
337
|
-
const bootstrappedApiVersion = bootstrappedBlockType.apiVersion;
|
|
338
337
|
|
|
339
338
|
registerBlockType( blockName, {
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
// Use all metadata from PHP registration,
|
|
340
|
+
// but fall back title to block name if not provided,
|
|
341
|
+
// ensure minimum apiVersion 3 for block wrapper support,
|
|
342
|
+
// and override with a ServerSideRender-based edit function.
|
|
343
|
+
...bootstrappedBlockType,
|
|
344
|
+
title: bootstrappedBlockType?.title || blockName,
|
|
345
|
+
...( ( bootstrappedBlockType?.apiVersion ?? 0 ) < 3 && {
|
|
346
|
+
apiVersion: 3,
|
|
347
|
+
} ),
|
|
342
348
|
edit: function Edit( { attributes } ) {
|
|
343
349
|
const blockProps = useBlockProps();
|
|
344
350
|
const { content, status, error } = useServerSideRender( {
|
package/src/list-item/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import { listItem as icon } from '@wordpress/icons';
|
|
6
6
|
import { privateApis } from '@wordpress/block-editor';
|
|
7
|
+
import { privateApis as blocksPrivateApis } from '@wordpress/blocks';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -15,6 +16,8 @@ import save from './save';
|
|
|
15
16
|
import transforms from './transforms';
|
|
16
17
|
import { unlock } from '../lock-unlock';
|
|
17
18
|
|
|
19
|
+
const { fieldsKey, formKey } = unlock( blocksPrivateApis );
|
|
20
|
+
|
|
18
21
|
const { name } = metadata;
|
|
19
22
|
|
|
20
23
|
export { metadata, name };
|
|
@@ -33,17 +36,17 @@ export const settings = {
|
|
|
33
36
|
[ unlock( privateApis ).requiresWrapperOnCopy ]: true,
|
|
34
37
|
};
|
|
35
38
|
|
|
36
|
-
if ( window.
|
|
37
|
-
settings
|
|
39
|
+
if ( window.__experimentalContentOnlyInspectorFields ) {
|
|
40
|
+
settings[ fieldsKey ] = [
|
|
38
41
|
{
|
|
42
|
+
id: 'content',
|
|
39
43
|
label: __( 'Content' ),
|
|
40
|
-
type: '
|
|
41
|
-
shownByDefault: true,
|
|
42
|
-
mapping: {
|
|
43
|
-
value: 'content',
|
|
44
|
-
},
|
|
44
|
+
type: 'richtext',
|
|
45
45
|
},
|
|
46
46
|
];
|
|
47
|
+
settings[ formKey ] = {
|
|
48
|
+
fields: [ 'content' ],
|
|
49
|
+
};
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
export const init = () => initBlock( { name, metadata, settings } );
|
package/src/math/block.json
CHANGED
|
@@ -8,7 +8,34 @@
|
|
|
8
8
|
"keywords": [ "equation", "formula", "latex", "mathematics" ],
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"supports": {
|
|
11
|
-
"html": false
|
|
11
|
+
"html": false,
|
|
12
|
+
"__experimentalBorder": {
|
|
13
|
+
"color": true,
|
|
14
|
+
"radius": true,
|
|
15
|
+
"style": true,
|
|
16
|
+
"width": true
|
|
17
|
+
},
|
|
18
|
+
"color": {
|
|
19
|
+
"gradients": true,
|
|
20
|
+
"__experimentalDefaultControls": {
|
|
21
|
+
"background": true,
|
|
22
|
+
"text": true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"spacing": {
|
|
26
|
+
"margin": true,
|
|
27
|
+
"padding": true,
|
|
28
|
+
"__experimentalDefaultControls": {
|
|
29
|
+
"margin": false,
|
|
30
|
+
"padding": false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"typography": {
|
|
34
|
+
"fontSize": true,
|
|
35
|
+
"__experimentalDefaultControls": {
|
|
36
|
+
"fontSize": true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
12
39
|
},
|
|
13
40
|
"attributes": {
|
|
14
41
|
"latex": {
|
package/src/math/edit.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
useBlockProps,
|
|
7
7
|
store as blockEditorStore,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from '@wordpress/components';
|
|
15
15
|
import { useState, useEffect, useRef } from '@wordpress/element';
|
|
16
16
|
import { useDispatch } from '@wordpress/data';
|
|
17
|
+
import { speak } from '@wordpress/a11y';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
@@ -72,7 +73,8 @@ export default function MathEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
72
73
|
placement="bottom-start"
|
|
73
74
|
offset={ 8 }
|
|
74
75
|
anchor={ blockRef }
|
|
75
|
-
focusOnMount=
|
|
76
|
+
focusOnMount={ false }
|
|
77
|
+
__unstableSlotName="__unstable-block-tools-after"
|
|
76
78
|
>
|
|
77
79
|
<div style={ { padding: '4px', minWidth: '300px' } }>
|
|
78
80
|
<VStack spacing={ 1 }>
|
|
@@ -96,6 +98,15 @@ export default function MathEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
96
98
|
setError( null );
|
|
97
99
|
} catch ( err ) {
|
|
98
100
|
setError( err.message );
|
|
101
|
+
speak(
|
|
102
|
+
sprintf(
|
|
103
|
+
/* translators: %s: error message returned when parsing LaTeX. */
|
|
104
|
+
__(
|
|
105
|
+
'Error parsing mathematical expression: %s'
|
|
106
|
+
),
|
|
107
|
+
err.message
|
|
108
|
+
)
|
|
109
|
+
);
|
|
99
110
|
}
|
|
100
111
|
setAttributes( {
|
|
101
112
|
mathML: newMathML,
|
|
@@ -110,7 +121,11 @@ export default function MathEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
110
121
|
intent="error"
|
|
111
122
|
className="wp-block-math__error"
|
|
112
123
|
>
|
|
113
|
-
{
|
|
124
|
+
{ sprintf(
|
|
125
|
+
/* translators: %s: error message returned when parsing LaTeX. */
|
|
126
|
+
__( 'Error: %s' ),
|
|
127
|
+
error
|
|
128
|
+
) }
|
|
114
129
|
</Badge>
|
|
115
130
|
<style children=".wp-block-math__error .components-badge__content{white-space:normal}" />
|
|
116
131
|
</>
|