@wordpress/block-library 9.10.0 → 9.12.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 +4 -0
- package/README.md +10 -5
- package/build/archives/index.js +6 -0
- package/build/archives/index.js.map +1 -1
- package/build/avatar/hooks.js +2 -3
- package/build/avatar/hooks.js.map +1 -1
- package/build/button/get-updated-link-attributes.js +1 -1
- package/build/button/get-updated-link-attributes.js.map +1 -1
- package/build/button/index.js +1 -1
- package/build/button/index.js.map +1 -1
- package/build/comments/index.js +12 -0
- package/build/comments/index.js.map +1 -1
- package/build/cover/constants.js +8 -0
- package/build/cover/constants.js.map +1 -0
- package/build/cover/deprecated.js +140 -4
- package/build/cover/deprecated.js.map +1 -1
- package/build/cover/edit/block-controls.js +1 -1
- package/build/cover/edit/block-controls.js.map +1 -1
- package/build/cover/edit/cover-placeholder.js +1 -2
- package/build/cover/edit/cover-placeholder.js.map +1 -1
- package/build/cover/edit/index.js +42 -21
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +40 -2
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/cover/index.js +3 -0
- package/build/cover/index.js.map +1 -1
- package/build/cover/save.js +16 -14
- package/build/cover/save.js.map +1 -1
- package/build/details/index.js +1 -0
- package/build/details/index.js.map +1 -1
- package/build/file/edit.js +2 -3
- package/build/file/edit.js.map +1 -1
- package/build/gallery/constants.js +2 -1
- package/build/gallery/constants.js.map +1 -1
- package/build/gallery/edit.js +12 -3
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/utils.js +26 -5
- package/build/gallery/utils.js.map +1 -1
- package/build/html/edit.js +5 -1
- package/build/html/edit.js.map +1 -1
- package/build/html/preview.js +2 -2
- package/build/html/preview.js.map +1 -1
- package/build/image/edit.js +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +144 -78
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/latest-posts/edit.js +3 -9
- package/build/latest-posts/edit.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +1 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +2 -2
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/paragraph/edit.js +2 -2
- package/build/paragraph/edit.js.map +1 -1
- package/build/post-content/index.js +13 -0
- package/build/post-content/index.js.map +1 -1
- package/build/post-featured-image/edit.js +1 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-template/edit.js +11 -0
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/post-time-to-read/edit.js +2 -2
- package/build/post-time-to-read/edit.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/query/edit/inspector-controls/order-control.js +2 -2
- package/build/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build/query/edit/pattern-selection-modal.js +0 -3
- package/build/query/edit/pattern-selection-modal.js.map +1 -1
- package/build/query/edit/query-content.js +10 -12
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/index.js +1 -1
- package/build/query/utils.js +32 -1
- package/build/query/utils.js.map +1 -1
- package/build/query-title/edit.js +1 -1
- package/build/query-title/edit.js.map +1 -1
- package/build/search/edit.js +19 -14
- package/build/search/edit.js.map +1 -1
- package/build/separator/transforms.js +12 -0
- package/build/separator/transforms.js.map +1 -1
- package/build/social-links/edit.js +0 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/spacer/index.js +2 -0
- package/build/spacer/index.js.map +1 -1
- package/build/spacer/transforms.js +27 -0
- package/build/spacer/transforms.js.map +1 -0
- package/build/table/edit.js +0 -1
- package/build/table/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +2 -7
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/template-part/edit/index.js +2 -5
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/edit/selection-modal.js +0 -3
- package/build/template-part/edit/selection-modal.js.map +1 -1
- package/build/video/edit.js +1 -1
- package/build/video/edit.js.map +1 -1
- package/build/video/tracks-editor.js +1 -3
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/archives/index.js +6 -0
- package/build-module/archives/index.js.map +1 -1
- package/build-module/avatar/hooks.js +2 -3
- package/build-module/avatar/hooks.js.map +1 -1
- package/build-module/button/get-updated-link-attributes.js +1 -1
- package/build-module/button/get-updated-link-attributes.js.map +1 -1
- package/build-module/button/index.js +1 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/comments/index.js +12 -0
- package/build-module/comments/index.js.map +1 -1
- package/build-module/cover/constants.js +2 -0
- package/build-module/cover/constants.js.map +1 -0
- package/build-module/cover/deprecated.js +140 -4
- package/build-module/cover/deprecated.js.map +1 -1
- package/build-module/cover/edit/block-controls.js +1 -1
- package/build-module/cover/edit/block-controls.js.map +1 -1
- package/build-module/cover/edit/cover-placeholder.js +1 -2
- package/build-module/cover/edit/cover-placeholder.js.map +1 -1
- package/build-module/cover/edit/index.js +42 -21
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +41 -3
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/cover/index.js +3 -0
- package/build-module/cover/index.js.map +1 -1
- package/build-module/cover/save.js +16 -14
- package/build-module/cover/save.js.map +1 -1
- package/build-module/details/index.js +1 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/file/edit.js +2 -3
- package/build-module/file/edit.js.map +1 -1
- package/build-module/gallery/constants.js +1 -0
- package/build-module/gallery/constants.js.map +1 -1
- package/build-module/gallery/edit.js +15 -6
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/utils.js +27 -6
- package/build-module/gallery/utils.js.map +1 -1
- package/build-module/html/edit.js +6 -2
- package/build-module/html/edit.js.map +1 -1
- package/build-module/html/preview.js +2 -2
- package/build-module/html/preview.js.map +1 -1
- package/build-module/image/edit.js +1 -1
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +149 -83
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/latest-posts/edit.js +3 -9
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +1 -3
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/paragraph/edit.js +2 -2
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/post-content/index.js +13 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-featured-image/edit.js +1 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-template/edit.js +11 -0
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/post-time-to-read/edit.js +2 -2
- package/build-module/post-time-to-read/edit.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/query/edit/inspector-controls/order-control.js +2 -2
- package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
- package/build-module/query/edit/pattern-selection-modal.js +0 -3
- package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
- package/build-module/query/edit/query-content.js +10 -12
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/index.js +1 -1
- package/build-module/query/utils.js +29 -0
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-title/edit.js +2 -2
- package/build-module/query-title/edit.js.map +1 -1
- package/build-module/search/edit.js +20 -15
- package/build-module/search/edit.js.map +1 -1
- package/build-module/separator/transforms.js +12 -0
- package/build-module/separator/transforms.js.map +1 -1
- package/build-module/social-links/edit.js +0 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/spacer/index.js +2 -0
- package/build-module/spacer/index.js.map +1 -1
- package/build-module/spacer/transforms.js +20 -0
- package/build-module/spacer/transforms.js.map +1 -0
- package/build-module/table/edit.js +0 -1
- package/build-module/table/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +2 -7
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/template-part/edit/index.js +2 -5
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/edit/selection-modal.js +0 -3
- package/build-module/template-part/edit/selection-modal.js.map +1 -1
- package/build-module/video/edit.js +1 -1
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/tracks-editor.js +2 -4
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/archives/editor-rtl.css +5 -0
- package/build-style/archives/editor.css +5 -0
- package/build-style/button/style-rtl.css +3 -0
- package/build-style/button/style.css +3 -0
- package/build-style/comments/editor-rtl.css +4 -0
- package/build-style/comments/editor.css +4 -0
- package/build-style/comments/style-rtl.css +4 -0
- package/build-style/comments/style.css +4 -0
- package/build-style/cover/editor-rtl.css +3 -5
- package/build-style/cover/editor.css +3 -5
- package/build-style/cover/style-rtl.css +19 -10
- package/build-style/cover/style.css +19 -10
- package/build-style/editor-rtl.css +17 -12
- package/build-style/editor.css +17 -12
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/latest-posts/editor-rtl.css +0 -7
- package/build-style/latest-posts/editor.css +0 -7
- package/build-style/media-text/style-rtl.css +1 -1
- package/build-style/media-text/style.css +1 -1
- package/build-style/navigation/editor-rtl.css +1 -0
- package/build-style/navigation/editor.css +1 -0
- package/build-style/style-rtl.css +27 -11
- package/build-style/style.css +27 -11
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/package.json +41 -40
- package/src/archives/block.json +6 -0
- package/src/archives/editor.scss +8 -0
- package/src/avatar/hooks.js +2 -3
- package/src/avatar/index.php +4 -5
- package/src/button/get-updated-link-attributes.js +1 -1
- package/src/button/index.js +1 -1
- package/src/button/style.scss +3 -0
- package/src/button/test/get-updated-link-attributes.js +15 -0
- package/src/comment-author-avatar/index.php +1 -1
- package/src/comments/block.json +12 -0
- package/src/comments/style.scss +4 -1
- package/src/cover/block.json +3 -0
- package/src/cover/constants.js +1 -0
- package/src/cover/deprecated.js +182 -4
- package/src/cover/edit/block-controls.js +1 -1
- package/src/cover/edit/cover-placeholder.js +0 -3
- package/src/cover/edit/index.js +57 -24
- package/src/cover/edit/inspector-controls.js +46 -1
- package/src/cover/editor.scss +4 -5
- package/src/cover/save.js +29 -20
- package/src/cover/style.scss +40 -10
- package/src/cover/test/__snapshots__/edit.native.js.snap +9 -9
- package/src/cover/test/__snapshots__/transforms.native.js.snap +4 -4
- package/src/cover/test/edit.js +1 -3
- package/src/cover/test/edit.native.js +4 -4
- package/src/cover/test/transforms.native.js +4 -4
- package/src/details/block.json +1 -0
- package/src/file/edit.js +2 -3
- package/src/gallery/constants.js +1 -0
- package/src/gallery/edit.js +26 -3
- package/src/gallery/utils.js +23 -2
- package/src/html/edit.js +7 -1
- package/src/html/preview.js +3 -2
- package/src/image/block.json +1 -1
- package/src/image/edit.js +1 -1
- package/src/image/editor.scss +4 -0
- package/src/image/image.js +200 -109
- package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/latest-posts/edit.js +3 -8
- package/src/latest-posts/editor.scss +0 -11
- package/src/latest-posts/index.php +1 -1
- package/src/media-text/style.scss +1 -1
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/navigation/edit/menu-inspector-controls.js +2 -2
- package/src/navigation/edit/navigation-menu-selector.js +2 -2
- package/src/navigation/editor.scss +1 -0
- package/src/navigation/index.php +1 -1
- package/src/paragraph/edit.js +2 -2
- package/src/post-content/block.json +14 -1
- package/src/post-featured-image/edit.js +1 -1
- package/src/post-template/block.json +2 -1
- package/src/post-template/edit.js +19 -0
- package/src/post-time-to-read/edit.js +2 -2
- package/src/post-time-to-read/index.php +1 -1
- package/src/query/block.json +1 -1
- package/src/query/edit/inspector-controls/index.js +2 -2
- package/src/query/edit/inspector-controls/order-control.js +2 -2
- package/src/query/edit/pattern-selection-modal.js +0 -3
- package/src/query/edit/query-content.js +9 -17
- package/src/query/test/utils.js +59 -1
- package/src/query/utils.js +29 -0
- package/src/query-title/edit.js +2 -2
- package/src/rss/index.php +1 -1
- package/src/search/edit.js +28 -25
- package/src/search/index.php +2 -2
- package/src/separator/test/__snapshots__/transforms.native.js.snap +6 -0
- package/src/separator/test/transforms.native.js +1 -1
- package/src/separator/transforms.js +11 -0
- package/src/social-links/edit.js +0 -1
- package/src/spacer/index.js +2 -0
- package/src/spacer/test/__snapshots__/transforms.native.js.snap +6 -0
- package/src/spacer/test/transforms.native.js +1 -1
- package/src/spacer/transforms.js +20 -0
- package/src/table/edit.js +0 -1
- package/src/table-of-contents/edit.js +2 -6
- package/src/template-part/edit/index.js +2 -5
- package/src/template-part/edit/selection-modal.js +0 -3
- package/src/video/edit.js +1 -1
- package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/video/tracks-editor.js +2 -4
- package/tsconfig.tsbuildinfo +1 -1
- /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
|
@@ -34,7 +34,7 @@ exports[`color settings toggles between solid colors and gradients 1`] = `
|
|
|
34
34
|
|
|
35
35
|
exports[`minimum height settings changes the height value between units 1`] = `
|
|
36
36
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":50,"minHeightUnit":"px","isDark":false} -->
|
|
37
|
-
<div class="wp-block-cover is-light" style="min-height:50px"><
|
|
37
|
+
<div class="wp-block-cover is-light" style="min-height:50px"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
38
38
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
39
39
|
<!-- /wp:paragraph --></div></div>
|
|
40
40
|
<!-- /wp:cover -->"
|
|
@@ -42,7 +42,7 @@ exports[`minimum height settings changes the height value between units 1`] = `
|
|
|
42
42
|
|
|
43
43
|
exports[`minimum height settings changes the height value to 20(vw) 1`] = `
|
|
44
44
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":20,"minHeightUnit":"vw","isDark":false} -->
|
|
45
|
-
<div class="wp-block-cover is-light" style="min-height:20vw"><
|
|
45
|
+
<div class="wp-block-cover is-light" style="min-height:20vw"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
46
46
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
47
47
|
<!-- /wp:paragraph --></div></div>
|
|
48
48
|
<!-- /wp:cover -->"
|
|
@@ -50,7 +50,7 @@ exports[`minimum height settings changes the height value to 20(vw) 1`] = `
|
|
|
50
50
|
|
|
51
51
|
exports[`minimum height settings disables the decrease button when reaching the minimum value for Pixels (px) 1`] = `
|
|
52
52
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":50,"minHeightUnit":"px","isDark":false} -->
|
|
53
|
-
<div class="wp-block-cover is-light" style="min-height:50px"><
|
|
53
|
+
<div class="wp-block-cover is-light" style="min-height:50px"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
54
54
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
55
55
|
<!-- /wp:paragraph --></div></div>
|
|
56
56
|
<!-- /wp:cover -->"
|
|
@@ -58,7 +58,7 @@ exports[`minimum height settings disables the decrease button when reaching the
|
|
|
58
58
|
|
|
59
59
|
exports[`minimum height settings disables the decrease button when reaching the minimum value for Relative to parent font size (em) 1`] = `
|
|
60
60
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":1,"minHeightUnit":"em","isDark":false} -->
|
|
61
|
-
<div class="wp-block-cover is-light" style="min-height:1em"><
|
|
61
|
+
<div class="wp-block-cover is-light" style="min-height:1em"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
62
62
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
63
63
|
<!-- /wp:paragraph --></div></div>
|
|
64
64
|
<!-- /wp:cover -->"
|
|
@@ -66,7 +66,7 @@ exports[`minimum height settings disables the decrease button when reaching the
|
|
|
66
66
|
|
|
67
67
|
exports[`minimum height settings disables the decrease button when reaching the minimum value for Relative to root font size (rem) 1`] = `
|
|
68
68
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":1,"minHeightUnit":"rem","isDark":false} -->
|
|
69
|
-
<div class="wp-block-cover is-light" style="min-height:1rem"><
|
|
69
|
+
<div class="wp-block-cover is-light" style="min-height:1rem"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
70
70
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
71
71
|
<!-- /wp:paragraph --></div></div>
|
|
72
72
|
<!-- /wp:cover -->"
|
|
@@ -74,7 +74,7 @@ exports[`minimum height settings disables the decrease button when reaching the
|
|
|
74
74
|
|
|
75
75
|
exports[`minimum height settings disables the decrease button when reaching the minimum value for Viewport height (vh) 1`] = `
|
|
76
76
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":1,"minHeightUnit":"vh","isDark":false} -->
|
|
77
|
-
<div class="wp-block-cover is-light" style="min-height:1vh"><
|
|
77
|
+
<div class="wp-block-cover is-light" style="min-height:1vh"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
78
78
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
79
79
|
<!-- /wp:paragraph --></div></div>
|
|
80
80
|
<!-- /wp:cover -->"
|
|
@@ -82,7 +82,7 @@ exports[`minimum height settings disables the decrease button when reaching the
|
|
|
82
82
|
|
|
83
83
|
exports[`minimum height settings disables the decrease button when reaching the minimum value for Viewport width (vw) 1`] = `
|
|
84
84
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":1,"minHeightUnit":"vw","isDark":false} -->
|
|
85
|
-
<div class="wp-block-cover is-light" style="min-height:1vw"><
|
|
85
|
+
<div class="wp-block-cover is-light" style="min-height:1vw"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
86
86
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
87
87
|
<!-- /wp:paragraph --></div></div>
|
|
88
88
|
<!-- /wp:cover -->"
|
|
@@ -90,7 +90,7 @@ exports[`minimum height settings disables the decrease button when reaching the
|
|
|
90
90
|
|
|
91
91
|
exports[`when an image is attached updates background opacity 1`] = `
|
|
92
92
|
"<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":15,"overlayColor":"foreground","isUserOverlayColor":true,"isDark":false} -->
|
|
93
|
-
<div class="wp-block-cover is-light"><
|
|
93
|
+
<div class="wp-block-cover is-light"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
94
94
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
95
95
|
<!-- /wp:paragraph --></div></div>
|
|
96
96
|
<!-- /wp:cover -->"
|
|
@@ -98,7 +98,7 @@ exports[`when an image is attached updates background opacity 1`] = `
|
|
|
98
98
|
|
|
99
99
|
exports[`when no media is attached and overlay color is set adds image 1`] = `
|
|
100
100
|
"<!-- wp:cover {"url":"https://test.files.wordpress.com/local-image-1.mp4","id":2000,"dimRatio":50,"overlayColor":"cyan-bluish-gray","isUserOverlayColor":true} -->
|
|
101
|
-
<div class="wp-block-cover is-light"><
|
|
101
|
+
<div class="wp-block-cover is-light"><img class="wp-block-cover__image-background wp-image-2000" src="https://test.files.wordpress.com/local-image-1.mp4" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-cyan-bluish-gray-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
|
|
102
102
|
<p class="has-text-align-center"></p>
|
|
103
103
|
<!-- /wp:paragraph --></div></div>
|
|
104
104
|
<!-- /wp:cover -->"
|
|
@@ -4,7 +4,7 @@ exports[`Cover block transformations with Image to Columns block 1`] = `
|
|
|
4
4
|
"<!-- wp:columns -->
|
|
5
5
|
<div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
|
|
6
6
|
<div class="wp-block-column" style="flex-basis:100%"><!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":890,"dimRatio":20,"overlayColor":"luminous-vivid-orange","isUserOverlayColor":true,"focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219} -->
|
|
7
|
-
<div class="wp-block-cover" style="min-height:219px"><
|
|
7
|
+
<div class="wp-block-cover" style="min-height:219px"><img class="wp-block-cover__image-background wp-image-890" alt="" src="https://cldup.com/cXyG__fTLN.jpg" style="object-position:63% 83%" data-object-fit="cover" data-object-position="63% 83%"/><span aria-hidden="true" class="wp-block-cover__background has-luminous-vivid-orange-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","className":"has-text-color has-very-light-gray-color","fontSize":"large"} -->
|
|
8
8
|
<p class="has-text-align-center has-text-color has-very-light-gray-color has-large-font-size">Cool cover</p>
|
|
9
9
|
<!-- /wp:paragraph --></div></div>
|
|
10
10
|
<!-- /wp:cover --></div>
|
|
@@ -15,7 +15,7 @@ exports[`Cover block transformations with Image to Columns block 1`] = `
|
|
|
15
15
|
exports[`Cover block transformations with Image to Group block 1`] = `
|
|
16
16
|
"<!-- wp:group {"layout":{"type":"constrained"}} -->
|
|
17
17
|
<div class="wp-block-group"><!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":890,"dimRatio":20,"overlayColor":"luminous-vivid-orange","isUserOverlayColor":true,"focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219} -->
|
|
18
|
-
<div class="wp-block-cover" style="min-height:219px"><
|
|
18
|
+
<div class="wp-block-cover" style="min-height:219px"><img class="wp-block-cover__image-background wp-image-890" alt="" src="https://cldup.com/cXyG__fTLN.jpg" style="object-position:63% 83%" data-object-fit="cover" data-object-position="63% 83%"/><span aria-hidden="true" class="wp-block-cover__background has-luminous-vivid-orange-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","className":"has-text-color has-very-light-gray-color","fontSize":"large"} -->
|
|
19
19
|
<p class="has-text-align-center has-text-color has-very-light-gray-color has-large-font-size">Cool cover</p>
|
|
20
20
|
<!-- /wp:paragraph --></div></div>
|
|
21
21
|
<!-- /wp:cover --></div>
|
|
@@ -40,7 +40,7 @@ exports[`Cover block transformations with Video to Columns block 1`] = `
|
|
|
40
40
|
"<!-- wp:columns -->
|
|
41
41
|
<div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
|
|
42
42
|
<div class="wp-block-column" style="flex-basis:100%"><!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","id":891,"dimRatio":20,"overlayColor":"luminous-vivid-orange","isUserOverlayColor":true,"backgroundType":"video","focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219,"isDark":false} -->
|
|
43
|
-
<div class="wp-block-cover is-light" style="min-height:219px"><
|
|
43
|
+
<div class="wp-block-cover is-light" style="min-height:219px"><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" style="object-position:63% 83%" data-object-fit="cover" data-object-position="63% 83%"></video><span aria-hidden="true" class="wp-block-cover__background has-luminous-vivid-orange-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","className":"has-text-color has-very-light-gray-color","fontSize":"large"} -->
|
|
44
44
|
<p class="has-text-align-center has-text-color has-very-light-gray-color has-large-font-size">Cool cover</p>
|
|
45
45
|
<!-- /wp:paragraph --></div></div>
|
|
46
46
|
<!-- /wp:cover --></div>
|
|
@@ -51,7 +51,7 @@ exports[`Cover block transformations with Video to Columns block 1`] = `
|
|
|
51
51
|
exports[`Cover block transformations with Video to Group block 1`] = `
|
|
52
52
|
"<!-- wp:group {"layout":{"type":"constrained"}} -->
|
|
53
53
|
<div class="wp-block-group"><!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","id":891,"dimRatio":20,"overlayColor":"luminous-vivid-orange","isUserOverlayColor":true,"backgroundType":"video","focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219,"isDark":false} -->
|
|
54
|
-
<div class="wp-block-cover is-light" style="min-height:219px"><
|
|
54
|
+
<div class="wp-block-cover is-light" style="min-height:219px"><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" style="object-position:63% 83%" data-object-fit="cover" data-object-position="63% 83%"></video><span aria-hidden="true" class="wp-block-cover__background has-luminous-vivid-orange-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","className":"has-text-color has-very-light-gray-color","fontSize":"large"} -->
|
|
55
55
|
<p class="has-text-align-center has-text-color has-very-light-gray-color has-large-font-size">Cool cover</p>
|
|
56
56
|
<!-- /wp:paragraph --></div></div>
|
|
57
57
|
<!-- /wp:cover --></div>
|
package/src/cover/test/edit.js
CHANGED
|
@@ -119,9 +119,7 @@ describe( 'Cover block', () => {
|
|
|
119
119
|
'min-height: 100vh;'
|
|
120
120
|
);
|
|
121
121
|
|
|
122
|
-
await userEvent.click(
|
|
123
|
-
screen.getByLabelText( 'Toggle full height' )
|
|
124
|
-
);
|
|
122
|
+
await userEvent.click( screen.getByLabelText( 'Full height' ) );
|
|
125
123
|
|
|
126
124
|
expect( screen.getByLabelText( 'Block: Cover' ) ).toHaveStyle(
|
|
127
125
|
'min-height: 100vh;'
|
|
@@ -53,13 +53,13 @@ const COVER_BLOCK_SOLID_COLOR_HTML = `<!-- wp:cover {"overlayColor":"cyan-bluish
|
|
|
53
53
|
<p class="has-text-align-center"></p>
|
|
54
54
|
<!-- /wp:paragraph --></div></div>
|
|
55
55
|
<!-- /wp:cover -->`;
|
|
56
|
-
const COVER_BLOCK_IMAGE_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isDark":false} -->
|
|
57
|
-
<div class="wp-block-cover is-light"><
|
|
56
|
+
const COVER_BLOCK_IMAGE_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"isDark":false} -->
|
|
57
|
+
<div class="wp-block-cover is-light"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
58
58
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
59
59
|
<!-- /wp:paragraph --></div></div>
|
|
60
60
|
<!-- /wp:cover -->`;
|
|
61
|
-
const COVER_BLOCK_CUSTOM_HEIGHT_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","minHeight":20,"minHeightUnit":"vw","isDark":false} -->
|
|
62
|
-
<div class="wp-block-cover is-light" style="min-height:20vw"><
|
|
61
|
+
const COVER_BLOCK_CUSTOM_HEIGHT_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isUserOverlayColor":true,"minHeight":20,"minHeightUnit":"vw","isDark":false} -->
|
|
62
|
+
<div class="wp-block-cover is-light" style="min-height:20vw"><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
|
|
63
63
|
<p class="has-text-align-center has-large-font-size"></p>
|
|
64
64
|
<!-- /wp:paragraph --></div></div>
|
|
65
65
|
<!-- /wp:cover -->`;
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
|
|
12
12
|
const block = 'Cover';
|
|
13
13
|
const initialHtmlWithImage = `
|
|
14
|
-
<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":890,"dimRatio":20,"overlayColor":"luminous-vivid-orange","focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219} -->
|
|
15
|
-
<div class="wp-block-cover" style="min-height:219px"><
|
|
14
|
+
<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":890,"dimRatio":20,"overlayColor":"luminous-vivid-orange","isUserOverlayColor":true,"focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219} -->
|
|
15
|
+
<div class="wp-block-cover" style="min-height:219px"><img class="wp-block-cover__image-background wp-image-890" alt="" src="https://cldup.com/cXyG__fTLN.jpg" style="object-position:63% 83%" data-object-fit="cover" data-object-position="63% 83%"/><span aria-hidden="true" class="wp-block-cover__background has-luminous-vivid-orange-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","className":"has-text-color has-very-light-gray-color","fontSize":"large"} -->
|
|
16
16
|
<p class="has-text-align-center has-text-color has-very-light-gray-color has-large-font-size">Cool cover</p>
|
|
17
17
|
<!-- /wp:paragraph --></div></div>
|
|
18
18
|
<!-- /wp:cover -->`;
|
|
19
19
|
const initialHtmlWithVideo = `
|
|
20
|
-
<!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","id":891,"dimRatio":20,"overlayColor":"luminous-vivid-orange","backgroundType":"video","focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219,"isDark":false} -->
|
|
21
|
-
<div class="wp-block-cover is-light" style="min-height:219px"><
|
|
20
|
+
<!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","id":891,"dimRatio":20,"overlayColor":"luminous-vivid-orange","isUserOverlayColor":true,"backgroundType":"video","focalPoint":{"x":"0.63","y":"0.83"},"minHeight":219,"isDark":false} -->
|
|
21
|
+
<div class="wp-block-cover is-light" style="min-height:219px"><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" style="object-position:63% 83%" data-object-fit="cover" data-object-position="63% 83%"></video><span aria-hidden="true" class="wp-block-cover__background has-luminous-vivid-orange-background-color has-background-dim-20 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","className":"has-text-color has-very-light-gray-color","fontSize":"large"} -->
|
|
22
22
|
<p class="has-text-align-center has-text-color has-very-light-gray-color has-large-font-size">Cool cover</p>
|
|
23
23
|
<!-- /wp:paragraph --></div></div>
|
|
24
24
|
<!-- /wp:cover -->`;
|
package/src/details/block.json
CHANGED
package/src/file/edit.js
CHANGED
|
@@ -103,8 +103,7 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
103
103
|
downloadButtonText: _x( 'Download', 'button label' ),
|
|
104
104
|
} );
|
|
105
105
|
}
|
|
106
|
-
//
|
|
107
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
106
|
+
// This effect should only run on mount.
|
|
108
107
|
}, [] );
|
|
109
108
|
|
|
110
109
|
function onSelectFile( newMedia ) {
|
|
@@ -202,7 +201,7 @@ function FileEdit( { attributes, isSelected, setAttributes, clientId } ) {
|
|
|
202
201
|
labels={ {
|
|
203
202
|
title: __( 'File' ),
|
|
204
203
|
instructions: __(
|
|
205
|
-
'
|
|
204
|
+
'Drag and drop a file, upload, or choose from your library.'
|
|
206
205
|
),
|
|
207
206
|
} }
|
|
208
207
|
onSelect={ onSelectFile }
|
package/src/gallery/constants.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const LINK_DESTINATION_NONE = 'none';
|
|
2
2
|
export const LINK_DESTINATION_MEDIA = 'media';
|
|
3
|
+
export const LINK_DESTINATION_LIGHTBOX = 'lightbox';
|
|
3
4
|
export const LINK_DESTINATION_ATTACHMENT = 'attachment';
|
|
4
5
|
export const LINK_DESTINATION_MEDIA_WP_CORE = 'file';
|
|
5
6
|
export const LINK_DESTINATION_ATTACHMENT_WP_CORE = 'post';
|
package/src/gallery/edit.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
useInnerBlocksProps,
|
|
26
26
|
BlockControls,
|
|
27
27
|
MediaReplaceFlow,
|
|
28
|
+
useSettings,
|
|
28
29
|
} from '@wordpress/block-editor';
|
|
29
30
|
import { Platform, useEffect, useMemo } from '@wordpress/element';
|
|
30
31
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
@@ -38,6 +39,7 @@ import {
|
|
|
38
39
|
customLink,
|
|
39
40
|
image as imageIcon,
|
|
40
41
|
linkOff,
|
|
42
|
+
fullscreen,
|
|
41
43
|
} from '@wordpress/icons';
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -55,6 +57,7 @@ import {
|
|
|
55
57
|
LINK_DESTINATION_ATTACHMENT,
|
|
56
58
|
LINK_DESTINATION_MEDIA,
|
|
57
59
|
LINK_DESTINATION_NONE,
|
|
60
|
+
LINK_DESTINATION_LIGHTBOX,
|
|
58
61
|
} from './constants';
|
|
59
62
|
import useImageSizes from './use-image-sizes';
|
|
60
63
|
import useGetNewImages from './use-get-new-images';
|
|
@@ -62,7 +65,7 @@ import useGetMedia from './use-get-media';
|
|
|
62
65
|
import GapStyles from './gap-styles';
|
|
63
66
|
|
|
64
67
|
const MAX_COLUMNS = 8;
|
|
65
|
-
const
|
|
68
|
+
const LINK_OPTIONS = [
|
|
66
69
|
{
|
|
67
70
|
icon: customLink,
|
|
68
71
|
label: __( 'Link images to attachment pages' ),
|
|
@@ -75,6 +78,13 @@ const linkOptions = [
|
|
|
75
78
|
value: LINK_DESTINATION_MEDIA,
|
|
76
79
|
noticeText: __( 'Media Files' ),
|
|
77
80
|
},
|
|
81
|
+
{
|
|
82
|
+
icon: fullscreen,
|
|
83
|
+
label: __( 'Expand on click' ),
|
|
84
|
+
value: LINK_DESTINATION_LIGHTBOX,
|
|
85
|
+
noticeText: __( 'Lightbox effect' ),
|
|
86
|
+
infoText: __( 'Scale images with a lightbox effect' ),
|
|
87
|
+
},
|
|
78
88
|
{
|
|
79
89
|
icon: linkOff,
|
|
80
90
|
label: _x( 'None', 'Media item link option' ),
|
|
@@ -86,7 +96,7 @@ const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
|
86
96
|
|
|
87
97
|
const PLACEHOLDER_TEXT = Platform.isNative
|
|
88
98
|
? __( 'Add media' )
|
|
89
|
-
: __( 'Drag images, upload
|
|
99
|
+
: __( 'Drag and drop images, upload, or choose from your library.' );
|
|
90
100
|
|
|
91
101
|
const MOBILE_CONTROL_PROPS_RANGE_CONTROL = Platform.isNative
|
|
92
102
|
? { type: 'stepper' }
|
|
@@ -107,6 +117,14 @@ export default function GalleryEdit( props ) {
|
|
|
107
117
|
onFocus,
|
|
108
118
|
} = props;
|
|
109
119
|
|
|
120
|
+
const [ lightboxSetting ] = useSettings( 'blocks.core/image.lightbox' );
|
|
121
|
+
|
|
122
|
+
const linkOptions = ! lightboxSetting?.allowEditing
|
|
123
|
+
? LINK_OPTIONS.filter(
|
|
124
|
+
( option ) => option.value !== LINK_DESTINATION_LIGHTBOX
|
|
125
|
+
)
|
|
126
|
+
: LINK_OPTIONS;
|
|
127
|
+
|
|
110
128
|
const { columns, imageCrop, randomOrder, linkTarget, linkTo, sizeSlug } =
|
|
111
129
|
attributes;
|
|
112
130
|
|
|
@@ -363,9 +381,13 @@ export default function GalleryEdit( props ) {
|
|
|
363
381
|
const image = block.attributes.id
|
|
364
382
|
? imageData.find( ( { id } ) => id === block.attributes.id )
|
|
365
383
|
: null;
|
|
384
|
+
|
|
366
385
|
changedAttributes[ block.clientId ] = getHrefAndDestination(
|
|
367
386
|
image,
|
|
368
|
-
value
|
|
387
|
+
value,
|
|
388
|
+
false,
|
|
389
|
+
block.attributes,
|
|
390
|
+
lightboxSetting
|
|
369
391
|
);
|
|
370
392
|
} );
|
|
371
393
|
updateBlockAttributes( blocks, changedAttributes, true );
|
|
@@ -646,6 +668,7 @@ export default function GalleryEdit( props ) {
|
|
|
646
668
|
onClose();
|
|
647
669
|
} }
|
|
648
670
|
role="menuitemradio"
|
|
671
|
+
info={ linkItem.infoText }
|
|
649
672
|
>
|
|
650
673
|
{ linkItem.label }
|
|
651
674
|
</MenuItem>
|
package/src/gallery/utils.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
LINK_DESTINATION_NONE,
|
|
8
8
|
LINK_DESTINATION_MEDIA_WP_CORE,
|
|
9
9
|
LINK_DESTINATION_ATTACHMENT_WP_CORE,
|
|
10
|
+
LINK_DESTINATION_LIGHTBOX,
|
|
10
11
|
} from './constants';
|
|
11
12
|
import {
|
|
12
13
|
LINK_DESTINATION_ATTACHMENT as IMAGE_LINK_DESTINATION_ATTACHMENT,
|
|
@@ -20,13 +21,18 @@ import {
|
|
|
20
21
|
*
|
|
21
22
|
* @param {Object} image Gallery image.
|
|
22
23
|
* @param {string} galleryDestination Gallery's selected link destination.
|
|
23
|
-
* @param {Object} imageDestination Image
|
|
24
|
+
* @param {Object} imageDestination Image block link destination attribute.
|
|
25
|
+
* @param {Object} attributes Block attributes.
|
|
26
|
+
* @param {Object} lightboxSetting Lightbox setting.
|
|
27
|
+
*
|
|
24
28
|
* @return {Object} New attributes to assign to image block.
|
|
25
29
|
*/
|
|
26
30
|
export function getHrefAndDestination(
|
|
27
31
|
image,
|
|
28
32
|
galleryDestination,
|
|
29
|
-
imageDestination
|
|
33
|
+
imageDestination,
|
|
34
|
+
attributes,
|
|
35
|
+
lightboxSetting
|
|
30
36
|
) {
|
|
31
37
|
// Gutenberg and WordPress use different constants so if image_default_link_type
|
|
32
38
|
// option is set we need to map from the WP Core values.
|
|
@@ -36,17 +42,32 @@ export function getHrefAndDestination(
|
|
|
36
42
|
return {
|
|
37
43
|
href: image?.source_url || image?.url, // eslint-disable-line camelcase
|
|
38
44
|
linkDestination: IMAGE_LINK_DESTINATION_MEDIA,
|
|
45
|
+
lightbox: lightboxSetting?.enabled
|
|
46
|
+
? { ...attributes?.lightbox, enabled: false }
|
|
47
|
+
: undefined,
|
|
39
48
|
};
|
|
40
49
|
case LINK_DESTINATION_ATTACHMENT_WP_CORE:
|
|
41
50
|
case LINK_DESTINATION_ATTACHMENT:
|
|
42
51
|
return {
|
|
43
52
|
href: image?.link,
|
|
44
53
|
linkDestination: IMAGE_LINK_DESTINATION_ATTACHMENT,
|
|
54
|
+
lightbox: lightboxSetting?.enabled
|
|
55
|
+
? { ...attributes?.lightbox, enabled: false }
|
|
56
|
+
: undefined,
|
|
57
|
+
};
|
|
58
|
+
case LINK_DESTINATION_LIGHTBOX:
|
|
59
|
+
return {
|
|
60
|
+
href: undefined,
|
|
61
|
+
lightbox: ! lightboxSetting?.enabled
|
|
62
|
+
? { ...attributes?.lightbox, enabled: true }
|
|
63
|
+
: undefined,
|
|
64
|
+
linkDestination: IMAGE_LINK_DESTINATION_NONE,
|
|
45
65
|
};
|
|
46
66
|
case LINK_DESTINATION_NONE:
|
|
47
67
|
return {
|
|
48
68
|
href: undefined,
|
|
49
69
|
linkDestination: IMAGE_LINK_DESTINATION_NONE,
|
|
70
|
+
lightbox: undefined,
|
|
50
71
|
};
|
|
51
72
|
}
|
|
52
73
|
|
package/src/html/edit.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
BlockControls,
|
|
8
8
|
PlainText,
|
|
9
9
|
useBlockProps,
|
|
10
|
+
store as blockEditorStore,
|
|
10
11
|
} from '@wordpress/block-editor';
|
|
11
12
|
import {
|
|
12
13
|
ToolbarButton,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
ToolbarGroup,
|
|
15
16
|
VisuallyHidden,
|
|
16
17
|
} from '@wordpress/components';
|
|
18
|
+
import { useSelect } from '@wordpress/data';
|
|
17
19
|
import { useInstanceId } from '@wordpress/compose';
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -27,6 +29,10 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
27
29
|
|
|
28
30
|
const instanceId = useInstanceId( HTMLEdit, 'html-edit-desc' );
|
|
29
31
|
|
|
32
|
+
const isPreviewMode = useSelect( ( select ) => {
|
|
33
|
+
return select( blockEditorStore ).getSettings().isPreviewMode;
|
|
34
|
+
}, [] );
|
|
35
|
+
|
|
30
36
|
function switchToPreview() {
|
|
31
37
|
setIsPreview( true );
|
|
32
38
|
}
|
|
@@ -58,7 +64,7 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) {
|
|
|
58
64
|
</ToolbarButton>
|
|
59
65
|
</ToolbarGroup>
|
|
60
66
|
</BlockControls>
|
|
61
|
-
{ isPreview || isDisabled ? (
|
|
67
|
+
{ isPreview || isPreviewMode || isDisabled ? (
|
|
62
68
|
<>
|
|
63
69
|
<Preview
|
|
64
70
|
content={ attributes.content }
|
package/src/html/preview.js
CHANGED
|
@@ -23,14 +23,15 @@ const DEFAULT_STYLES = `
|
|
|
23
23
|
|
|
24
24
|
export default function HTMLEditPreview( { content, isSelected } ) {
|
|
25
25
|
const settingStyles = useSelect(
|
|
26
|
-
( select ) => select( blockEditorStore ).getSettings().styles
|
|
26
|
+
( select ) => select( blockEditorStore ).getSettings().styles,
|
|
27
|
+
[]
|
|
27
28
|
);
|
|
28
29
|
|
|
29
30
|
const styles = useMemo(
|
|
30
31
|
() => [
|
|
31
32
|
DEFAULT_STYLES,
|
|
32
33
|
...transformStyles(
|
|
33
|
-
settingStyles.filter( ( style ) => style.css )
|
|
34
|
+
( settingStyles ?? [] ).filter( ( style ) => style.css )
|
|
34
35
|
),
|
|
35
36
|
],
|
|
36
37
|
[ settingStyles ]
|
package/src/image/block.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "core/image",
|
|
5
5
|
"title": "Image",
|
|
6
6
|
"category": "media",
|
|
7
|
-
"usesContext": [ "allowResize", "imageCrop", "fixedHeight" ],
|
|
7
|
+
"usesContext": [ "allowResize", "imageCrop", "fixedHeight", "postId", "postType", "queryId" ],
|
|
8
8
|
"description": "Insert an image to make a visual statement.",
|
|
9
9
|
"keywords": [ "img", "photo", "picture" ],
|
|
10
10
|
"textdomain": "default",
|
package/src/image/edit.js
CHANGED
|
@@ -411,7 +411,7 @@ export function ImageEdit( {
|
|
|
411
411
|
! lockUrlControls &&
|
|
412
412
|
! isSmallContainer &&
|
|
413
413
|
__(
|
|
414
|
-
'
|
|
414
|
+
'Drag and drop an image, upload, or choose from your library.'
|
|
415
415
|
)
|
|
416
416
|
}
|
|
417
417
|
style={ {
|
package/src/image/editor.scss
CHANGED
|
@@ -159,6 +159,10 @@ figure.wp-block-image:not(.wp-block) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
.wp-block-image__toolbar_content_textarea__container {
|
|
163
|
+
padding: $grid-unit;
|
|
164
|
+
}
|
|
165
|
+
|
|
162
166
|
.wp-block-image__toolbar_content_textarea {
|
|
163
167
|
// Corresponds to the size of the textarea in the block inspector.
|
|
164
168
|
width: 250px;
|