@wordpress/block-library 9.35.1-next.dc3f6d3c1.0 → 9.36.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 +12 -9
- package/build/audio/index.js.map +3 -3
- package/build/button/index.js +13 -10
- package/build/button/index.js.map +3 -3
- package/build/code/index.js +9 -6
- package/build/code/index.js.map +3 -3
- 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 +10 -4
- 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 +9 -6
- package/build/details/index.js.map +3 -3
- package/build/file/index.js +14 -14
- package/build/file/index.js.map +3 -3
- package/build/freeform/block.json +1 -1
- package/build/gallery/edit.js +0 -2
- package/build/gallery/edit.js.map +2 -2
- package/build/heading/index.js +9 -6
- package/build/heading/index.js.map +3 -3
- package/build/html/modal.js +127 -118
- 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 +18 -18
- package/build/image/index.js.map +3 -3
- package/build/list-item/index.js +8 -6
- package/build/list-item/index.js.map +3 -3
- package/build/math/block.json +28 -1
- package/build/math/edit.js +4 -1
- package/build/math/edit.js.map +2 -2
- package/build/media-text/index.js +15 -8
- 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 +9 -6
- 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 +11 -8
- package/build/navigation-link/index.js.map +3 -3
- package/build/navigation-submenu/index.js +11 -8
- package/build/navigation-submenu/index.js.map +3 -3
- 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 +9 -6
- package/build/paragraph/index.js.map +3 -3
- package/build/pattern/block.json +1 -1
- package/build/preformatted/index.js +9 -6
- package/build/preformatted/index.js.map +3 -3
- package/build/pullquote/index.js +11 -11
- package/build/pullquote/index.js.map +3 -3
- package/build/search/index.js +14 -16
- package/build/search/index.js.map +3 -3
- package/build/social-link/index.js +11 -8
- 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/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 +9 -6
- package/build/verse/index.js.map +3 -3
- package/build/video/index.js +12 -9
- 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 +12 -9
- package/build-module/audio/index.js.map +2 -2
- package/build-module/button/index.js +13 -10
- package/build-module/button/index.js.map +2 -2
- package/build-module/code/index.js +9 -6
- package/build-module/code/index.js.map +2 -2
- 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 +10 -4
- 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 +9 -6
- package/build-module/details/index.js.map +2 -2
- package/build-module/file/index.js +14 -14
- package/build-module/file/index.js.map +2 -2
- package/build-module/freeform/block.json +1 -1
- package/build-module/gallery/edit.js +0 -2
- package/build-module/gallery/edit.js.map +2 -2
- package/build-module/heading/index.js +9 -6
- package/build-module/heading/index.js.map +2 -2
- package/build-module/html/modal.js +128 -119
- 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 +18 -18
- package/build-module/image/index.js.map +2 -2
- package/build-module/list-item/index.js +8 -6
- package/build-module/list-item/index.js.map +2 -2
- package/build-module/math/block.json +28 -1
- package/build-module/math/edit.js +4 -1
- package/build-module/math/edit.js.map +2 -2
- package/build-module/media-text/index.js +15 -8
- 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 +9 -6
- 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 +11 -8
- package/build-module/navigation-link/index.js.map +2 -2
- package/build-module/navigation-submenu/index.js +11 -8
- package/build-module/navigation-submenu/index.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 +9 -6
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/pattern/block.json +1 -1
- package/build-module/preformatted/index.js +9 -6
- package/build-module/preformatted/index.js.map +2 -2
- package/build-module/pullquote/index.js +11 -11
- package/build-module/pullquote/index.js.map +2 -2
- package/build-module/search/index.js +14 -16
- package/build-module/search/index.js.map +2 -2
- package/build-module/social-link/index.js +11 -8
- 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/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 +9 -6
- package/build-module/verse/index.js.map +2 -2
- package/build-module/video/index.js +12 -9
- 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 +1 -2
- package/build-style/accordion-heading/style.css +1 -2
- 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/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 +52 -12
- package/build-style/style.css +52 -12
- package/package.json +37 -37
- 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 +1 -9
- 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 +13 -9
- package/src/breadcrumbs/index.php +71 -82
- package/src/button/index.js +14 -10
- package/src/code/index.js +10 -6
- 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 +11 -4
- 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 +10 -6
- package/src/file/index.js +15 -14
- package/src/freeform/block.json +1 -1
- package/src/gallery/edit.js +0 -2
- package/src/heading/index.js +10 -6
- package/src/html/editor.scss +10 -15
- package/src/html/modal.js +15 -10
- package/src/image/edit.js +0 -1
- package/src/image/image.js +0 -1
- package/src/image/index.js +19 -18
- package/src/image/index.php +1 -0
- package/src/list-item/index.js +9 -6
- package/src/math/block.json +28 -1
- package/src/math/edit.js +4 -1
- package/src/media-text/index.js +16 -8
- 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 +10 -6
- package/src/navigation-link/edit.js +72 -26
- package/src/navigation-link/index.js +12 -8
- package/src/navigation-submenu/index.js +12 -8
- package/src/paragraph/deprecated-attributes.js +45 -0
- package/src/paragraph/edit.js +2 -0
- package/src/paragraph/index.js +10 -6
- package/src/pattern/block.json +1 -1
- package/src/preformatted/index.js +10 -6
- package/src/pullquote/index.js +12 -11
- package/src/search/index.js +14 -15
- package/src/social-link/index.js +12 -8
- package/src/style.scss +1 -0
- package/src/template-part/edit/index.js +44 -6
- 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 +10 -6
- package/src/video/index.js +13 -9
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// packages/block-library/src/cover/embed-video-utils.js
|
|
2
|
+
import { getBlockVariations } from "@wordpress/blocks";
|
|
3
|
+
import { matchesPatterns } from "../embed/util";
|
|
4
|
+
var DEFAULT_EMBED_BLOCK = "core/embed";
|
|
5
|
+
var VIDEO_PROVIDERS = [
|
|
6
|
+
"youtube",
|
|
7
|
+
"vimeo",
|
|
8
|
+
"videopress",
|
|
9
|
+
"animoto",
|
|
10
|
+
"tiktok",
|
|
11
|
+
"wordpress-tv"
|
|
12
|
+
];
|
|
13
|
+
function isValidVideoEmbedUrl(url) {
|
|
14
|
+
if (!url) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const embedBlock = findVideoEmbedProvider(url);
|
|
18
|
+
return embedBlock !== null;
|
|
19
|
+
}
|
|
20
|
+
function getVideoEmbedProvider(url) {
|
|
21
|
+
const embedBlock = findVideoEmbedProvider(url);
|
|
22
|
+
return embedBlock ? embedBlock.name : null;
|
|
23
|
+
}
|
|
24
|
+
function findVideoEmbedProvider(url) {
|
|
25
|
+
const embedVariations = getBlockVariations(DEFAULT_EMBED_BLOCK);
|
|
26
|
+
if (!embedVariations) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const matchingVariation = embedVariations.find(
|
|
30
|
+
({ patterns }) => matchesPatterns(url, patterns)
|
|
31
|
+
);
|
|
32
|
+
if (!matchingVariation || !VIDEO_PROVIDERS.includes(matchingVariation.name)) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return matchingVariation;
|
|
36
|
+
}
|
|
37
|
+
function getIframeSrc(html) {
|
|
38
|
+
if (!html) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const srcMatch = html.match(/src=["']([^"']+)["']/);
|
|
42
|
+
return srcMatch ? srcMatch[1] : null;
|
|
43
|
+
}
|
|
44
|
+
function detectProviderFromSrc(src) {
|
|
45
|
+
if (!src) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const lowerSrc = src.toLowerCase();
|
|
49
|
+
if (lowerSrc.includes("youtube.com") || lowerSrc.includes("youtu.be")) {
|
|
50
|
+
return "youtube";
|
|
51
|
+
}
|
|
52
|
+
if (lowerSrc.includes("vimeo.com")) {
|
|
53
|
+
return "vimeo";
|
|
54
|
+
}
|
|
55
|
+
if (lowerSrc.includes("videopress.com")) {
|
|
56
|
+
return "videopress";
|
|
57
|
+
}
|
|
58
|
+
if (lowerSrc.includes("animoto.com")) {
|
|
59
|
+
return "animoto";
|
|
60
|
+
}
|
|
61
|
+
if (lowerSrc.includes("tiktok.com")) {
|
|
62
|
+
return "tiktok";
|
|
63
|
+
}
|
|
64
|
+
if (lowerSrc.includes("wordpress.tv")) {
|
|
65
|
+
return "wordpress-tv";
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
function getBackgroundVideoSrc(src) {
|
|
70
|
+
if (!src) {
|
|
71
|
+
return src;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const url = new URL(src);
|
|
75
|
+
const provider = detectProviderFromSrc(src);
|
|
76
|
+
switch (provider) {
|
|
77
|
+
case "youtube":
|
|
78
|
+
url.searchParams.set("autoplay", "1");
|
|
79
|
+
url.searchParams.set("mute", "1");
|
|
80
|
+
url.searchParams.set("loop", "1");
|
|
81
|
+
url.searchParams.set("controls", "0");
|
|
82
|
+
url.searchParams.set("showinfo", "0");
|
|
83
|
+
url.searchParams.set("modestbranding", "1");
|
|
84
|
+
url.searchParams.set("playsinline", "1");
|
|
85
|
+
url.searchParams.set("rel", "0");
|
|
86
|
+
const videoId = url.pathname.split("/").pop();
|
|
87
|
+
if (videoId) {
|
|
88
|
+
url.searchParams.set("playlist", videoId);
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
case "vimeo":
|
|
92
|
+
url.searchParams.set("autoplay", "1");
|
|
93
|
+
url.searchParams.set("muted", "1");
|
|
94
|
+
url.searchParams.set("loop", "1");
|
|
95
|
+
url.searchParams.set("background", "1");
|
|
96
|
+
url.searchParams.set("controls", "0");
|
|
97
|
+
break;
|
|
98
|
+
case "videopress":
|
|
99
|
+
case "wordpress-tv":
|
|
100
|
+
url.searchParams.set("autoplay", "1");
|
|
101
|
+
url.searchParams.set("loop", "1");
|
|
102
|
+
url.searchParams.set("muted", "1");
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
url.searchParams.set("autoplay", "1");
|
|
106
|
+
url.searchParams.set("muted", "1");
|
|
107
|
+
url.searchParams.set("loop", "1");
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
return url.toString();
|
|
111
|
+
} catch (error) {
|
|
112
|
+
return src;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
detectProviderFromSrc,
|
|
117
|
+
getBackgroundVideoSrc,
|
|
118
|
+
getIframeSrc,
|
|
119
|
+
getVideoEmbedProvider,
|
|
120
|
+
isValidVideoEmbedUrl
|
|
121
|
+
};
|
|
122
|
+
//# sourceMappingURL=embed-video-utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/cover/embed-video-utils.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockVariations } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { matchesPatterns } from '../embed/util';\n\nconst DEFAULT_EMBED_BLOCK = 'core/embed';\n\n// List of supported video providers for cover block backgrounds\nconst VIDEO_PROVIDERS = [\n\t'youtube',\n\t'vimeo',\n\t'videopress',\n\t'animoto',\n\t'tiktok',\n\t'wordpress-tv',\n];\n\n/**\n * Checks if a URL is a valid video embed URL from supported providers.\n *\n * @param {string} url The URL to validate.\n * @return {boolean} True if the URL matches a supported video provider pattern.\n */\nexport function isValidVideoEmbedUrl( url ) {\n\tif ( ! url ) {\n\t\treturn false;\n\t}\n\n\tconst embedBlock = findVideoEmbedProvider( url );\n\treturn embedBlock !== null;\n}\n\n/**\n * Finds the embed provider for a given URL if it's a supported video provider.\n *\n * @param {string} url The URL to check.\n * @return {string|null} The provider name slug (e.g., 'youtube') or null if not found.\n */\nexport function getVideoEmbedProvider( url ) {\n\tconst embedBlock = findVideoEmbedProvider( url );\n\treturn embedBlock ? embedBlock.name : null;\n}\n\n/**\n * Finds a matching video embed block variation for the given URL.\n *\n * @param {string} url The URL to match against provider patterns.\n * @return {Object|null} The matching block variation or null if not found.\n */\nfunction findVideoEmbedProvider( url ) {\n\tconst embedVariations = getBlockVariations( DEFAULT_EMBED_BLOCK );\n\n\tif ( ! embedVariations ) {\n\t\treturn null;\n\t}\n\n\tconst matchingVariation = embedVariations.find( ( { patterns } ) =>\n\t\tmatchesPatterns( url, patterns )\n\t);\n\n\tif (\n\t\t! matchingVariation ||\n\t\t! VIDEO_PROVIDERS.includes( matchingVariation.name )\n\t) {\n\t\treturn null;\n\t}\n\n\treturn matchingVariation;\n}\n\n/**\n * Extracts iframe src from embed HTML.\n *\n * @param {string} html The embed HTML.\n * @return {string|null} The iframe src URL or null if not found.\n */\nexport function getIframeSrc( html ) {\n\tif ( ! html ) {\n\t\treturn null;\n\t}\n\n\tconst srcMatch = html.match( /src=[\"']([^\"']+)[\"']/ );\n\treturn srcMatch ? srcMatch[ 1 ] : null;\n}\n\n/**\n * Detects the video provider from an iframe src URL.\n *\n * @param {string} src The iframe src URL.\n * @return {string|null} The provider name slug or null if not recognized.\n */\nexport function detectProviderFromSrc( src ) {\n\tif ( ! src ) {\n\t\treturn null;\n\t}\n\n\tconst lowerSrc = src.toLowerCase();\n\n\tif (\n\t\tlowerSrc.includes( 'youtube.com' ) ||\n\t\tlowerSrc.includes( 'youtu.be' )\n\t) {\n\t\treturn 'youtube';\n\t}\n\tif ( lowerSrc.includes( 'vimeo.com' ) ) {\n\t\treturn 'vimeo';\n\t}\n\tif ( lowerSrc.includes( 'videopress.com' ) ) {\n\t\treturn 'videopress';\n\t}\n\tif ( lowerSrc.includes( 'animoto.com' ) ) {\n\t\treturn 'animoto';\n\t}\n\tif ( lowerSrc.includes( 'tiktok.com' ) ) {\n\t\treturn 'tiktok';\n\t}\n\tif ( lowerSrc.includes( 'wordpress.tv' ) ) {\n\t\treturn 'wordpress-tv';\n\t}\n\n\treturn null;\n}\n\n/**\n * Modifies an iframe src URL to add background video parameters.\n * Automatically detects the provider from the URL.\n *\n * @param {string} src The iframe src URL.\n * @return {string} The modified URL.\n */\nexport function getBackgroundVideoSrc( src ) {\n\tif ( ! src ) {\n\t\treturn src;\n\t}\n\n\ttry {\n\t\tconst url = new URL( src );\n\n\t\t// Detect provider from the iframe src URL\n\t\tconst provider = detectProviderFromSrc( src );\n\n\t\t// Add provider-specific parameters for background video behavior\n\t\tswitch ( provider ) {\n\t\t\tcase 'youtube':\n\t\t\t\t// YouTube parameters for background video\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'mute', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'controls', '0' );\n\t\t\t\turl.searchParams.set( 'showinfo', '0' );\n\t\t\t\turl.searchParams.set( 'modestbranding', '1' );\n\t\t\t\turl.searchParams.set( 'playsinline', '1' );\n\t\t\t\turl.searchParams.set( 'rel', '0' );\n\t\t\t\t// For loop to work, we need the playlist parameter\n\t\t\t\tconst videoId = url.pathname.split( '/' ).pop();\n\t\t\t\tif ( videoId ) {\n\t\t\t\t\turl.searchParams.set( 'playlist', videoId );\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'vimeo':\n\t\t\t\t// Vimeo parameters for background video\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'background', '1' );\n\t\t\t\turl.searchParams.set( 'controls', '0' );\n\t\t\t\tbreak;\n\n\t\t\tcase 'videopress':\n\t\t\tcase 'wordpress-tv':\n\t\t\t\t// VideoPress parameters\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t// Generic parameters that might work for other providers\n\t\t\t\turl.searchParams.set( 'autoplay', '1' );\n\t\t\t\turl.searchParams.set( 'muted', '1' );\n\t\t\t\turl.searchParams.set( 'loop', '1' );\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn url.toString();\n\t} catch ( error ) {\n\t\t// If URL parsing fails, return original src\n\t\treturn src;\n\t}\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// packages/block-library/src/cover/index.js
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { cover as icon } from "@wordpress/icons";
|
|
4
|
+
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
|
|
4
5
|
import initBlock from "../utils/init-block";
|
|
5
6
|
import deprecated from "./deprecated";
|
|
6
7
|
import edit from "./edit";
|
|
@@ -8,6 +9,8 @@ import metadata from "./block.json";
|
|
|
8
9
|
import save from "./save";
|
|
9
10
|
import transforms from "./transforms";
|
|
10
11
|
import variations from "./variations";
|
|
12
|
+
import { unlock } from "../lock-unlock";
|
|
13
|
+
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
11
14
|
var { name } = metadata;
|
|
12
15
|
var settings = {
|
|
13
16
|
icon,
|
|
@@ -42,15 +45,15 @@ var settings = {
|
|
|
42
45
|
variations
|
|
43
46
|
};
|
|
44
47
|
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
45
|
-
settings
|
|
48
|
+
settings[fieldsKey] = [
|
|
46
49
|
{
|
|
50
|
+
id: "background",
|
|
47
51
|
label: __("Background"),
|
|
48
|
-
type: "
|
|
49
|
-
shownByDefault: true,
|
|
52
|
+
type: "media",
|
|
50
53
|
mapping: {
|
|
51
54
|
type: "backgroundType",
|
|
52
55
|
id: "id",
|
|
53
|
-
|
|
56
|
+
url: "url",
|
|
54
57
|
alt: "alt",
|
|
55
58
|
featuredImage: "useFeaturedImage"
|
|
56
59
|
},
|
|
@@ -62,6 +65,9 @@ if (window.__experimentalContentOnlyPatternInsertion) {
|
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
];
|
|
68
|
+
settings[formKey] = {
|
|
69
|
+
fields: ["content"]
|
|
70
|
+
};
|
|
65
71
|
}
|
|
66
72
|
var init = () => initBlock({ name, metadata, settings });
|
|
67
73
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cover/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomOverlayColor: '#065174',\n\t\t\tdimRatio: 40,\n\t\t\turl: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\tstyle: {\n\t\t\t\ttypography: {\n\t\t\t\t\tfontSize: 48,\n\t\t\t\t},\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: 'white',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: `<strong>${ __( 'Snow Patrol' ) }</strong>`,\n\t\t\t\t\talign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tsave,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { cover as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomOverlayColor: '#065174',\n\t\t\tdimRatio: 40,\n\t\t\turl: 'https://s.w.org/images/core/5.3/Windbuchencom.jpg',\n\t\t\tstyle: {\n\t\t\t\ttypography: {\n\t\t\t\t\tfontSize: 48,\n\t\t\t\t},\n\t\t\t\tcolor: {\n\t\t\t\t\ttext: 'white',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: `<strong>${ __( 'Snow Patrol' ) }</strong>`,\n\t\t\t\t\talign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tsave,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'background',\n\t\t\tlabel: __( 'Background' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\ttype: 'backgroundType',\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'url',\n\t\t\t\talt: 'alt',\n\t\t\t\tfeaturedImage: 'useFeaturedImage',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\t// TODO - How to support custom gradient?\n\t\t\t\t// Build it into Media, or use a custom control?\n\t\t\t\tallowedTypes: [ 'image', 'video' ],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,SAAS,YAAY;AAC9B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,oBAAoB;AAAA,MACpB,UAAU;AAAA,MACV,KAAK;AAAA,MACL,OAAO;AAAA,QACN,YAAY;AAAA,UACX,UAAU;AAAA,QACX;AAAA,QACA,OAAO;AAAA,UACN,MAAM;AAAA,QACP;AAAA,MACD;AAAA,IACD;AAAA,IACA,aAAa;AAAA,MACZ;AAAA,QACC,MAAM;AAAA,QACN,YAAY;AAAA,UACX,SAAS,WAAY,GAAI,aAAc,CAAE;AAAA,UACzC,OAAO;AAAA,QACR;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,YAAa;AAAA,MACxB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,MAAM;AAAA,QACN,IAAI;AAAA,QACJ,KAAK;AAAA,QACL,KAAK;AAAA,QACL,eAAe;AAAA,MAChB;AAAA,MACA,MAAM;AAAA;AAAA;AAAA,QAGL,cAAc,CAAE,SAAS,OAAQ;AAAA,QACjC,UAAU;AAAA,MACX;AAAA,IACD;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAU;AAAA,EACrB;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
IMAGE_BACKGROUND_TYPE,
|
|
11
11
|
VIDEO_BACKGROUND_TYPE,
|
|
12
|
+
EMBED_VIDEO_BACKGROUND_TYPE,
|
|
12
13
|
dimRatioToClass,
|
|
13
14
|
isContentPositionCenter,
|
|
14
15
|
getPositionClassName,
|
|
@@ -46,6 +47,7 @@ function save({ attributes }) {
|
|
|
46
47
|
const minHeight = minHeightProp && minHeightUnit ? `${minHeightProp}${minHeightUnit}` : minHeightProp;
|
|
47
48
|
const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
|
|
48
49
|
const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
50
|
+
const isEmbedVideoBackground = EMBED_VIDEO_BACKGROUND_TYPE === backgroundType;
|
|
49
51
|
const isImgElement = !(hasParallax || isRepeated);
|
|
50
52
|
const style = {
|
|
51
53
|
minHeight: minHeight || void 0
|
|
@@ -117,6 +119,17 @@ function save({ attributes }) {
|
|
|
117
119
|
"data-object-position": objectPosition
|
|
118
120
|
}
|
|
119
121
|
),
|
|
122
|
+
isEmbedVideoBackground && url && /* @__PURE__ */ jsx(
|
|
123
|
+
"figure",
|
|
124
|
+
{
|
|
125
|
+
className: clsx(
|
|
126
|
+
"wp-block-cover__video-background",
|
|
127
|
+
"wp-block-cover__embed-background",
|
|
128
|
+
"wp-block-embed"
|
|
129
|
+
),
|
|
130
|
+
children: /* @__PURE__ */ jsx("div", { className: "wp-block-embed__wrapper", children: url })
|
|
131
|
+
}
|
|
132
|
+
),
|
|
120
133
|
/* @__PURE__ */ jsx(
|
|
121
134
|
"span",
|
|
122
135
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cover/save.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInnerBlocksProps,\n\tgetColorClassName,\n\t__experimentalGetGradientClass,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} from './shared';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\tbackgroundType,\n\t\tgradient,\n\t\tcontentPosition,\n\t\tcustomGradient,\n\t\tcustomOverlayColor,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tuseFeaturedImage,\n\t\thasParallax,\n\t\tisDark,\n\t\tisRepeated,\n\t\toverlayColor,\n\t\turl,\n\t\talt,\n\t\tid,\n\t\tminHeight: minHeightProp,\n\t\tminHeightUnit,\n\t\ttagName: Tag,\n\t\tsizeSlug,\n\t\tposter,\n\t} = attributes;\n\tconst overlayColorClass = getColorClassName(\n\t\t'background-color',\n\t\toverlayColor\n\t);\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst minHeight =\n\t\tminHeightProp && minHeightUnit\n\t\t\t? `${ minHeightProp }${ minHeightUnit }`\n\t\t\t: minHeightProp;\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeight || undefined,\n\t};\n\n\tconst bgStyle = {\n\t\tbackgroundColor: ! overlayColorClass ? customOverlayColor : undefined,\n\t\tbackground: customGradient ? customGradient : undefined,\n\t};\n\n\tconst objectPosition =\n\t\t// prettier-ignore\n\t\tfocalPoint && isImgElement\n\t\t\t ? mediaPosition(focalPoint)\n\t\t\t : undefined;\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst classes = clsx(\n\t\t{\n\t\t\t'is-light': ! isDark,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t\t'has-custom-content-position':\n\t\t\t\t! isContentPositionCenter( contentPosition ),\n\t\t},\n\t\tgetPositionClassName( contentPosition )\n\t);\n\n\tconst imgClasses = clsx(\n\t\t'wp-block-cover__image-background',\n\t\tid ? `wp-image-${ id }` : null,\n\t\t{\n\t\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t}\n\t);\n\n\tconst gradientValue = gradient || customGradient;\n\n\treturn (\n\t\t<Tag { ...useBlockProps.save( { className: classes, style } ) }>\n\t\t\t{ ! useFeaturedImage &&\n\t\t\t\tisImageBackground &&\n\t\t\t\turl &&\n\t\t\t\t( isImgElement ? (\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName={ imgClasses }\n\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\tstyle={ { objectPosition } }\n\t\t\t\t\t\tdata-object-fit=\"cover\"\n\t\t\t\t\t\tdata-object-position={ objectPosition }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\trole={ alt ? 'img' : undefined }\n\t\t\t\t\t\taria-label={ alt ? alt : undefined }\n\t\t\t\t\t\tclassName={ imgClasses }\n\t\t\t\t\t\tstyle={ { backgroundPosition, backgroundImage } }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ isVideoBackground && url && (\n\t\t\t\t<video\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'wp-block-cover__video-background',\n\t\t\t\t\t\t'intrinsic-ignore'\n\t\t\t\t\t) }\n\t\t\t\t\tautoPlay\n\t\t\t\t\tmuted\n\t\t\t\t\tloop\n\t\t\t\t\tplaysInline\n\t\t\t\t\tsrc={ url }\n\t\t\t\t\tposter={ poster }\n\t\t\t\t\tstyle={ { objectPosition } }\n\t\t\t\t\tdata-object-fit=\"cover\"\n\t\t\t\t\tdata-object-position={ objectPosition }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ /* The `wp-block-cover__background` needs to be immediately before\n\t\t\tthe `wp-block-cover__inner-container`, so the exclusion CSS selector\n\t\t\t`.wp-block-cover__background + .wp-block-cover__inner-container`\n\t\t\tworks properly. If it needs to be changed in the future, the\n\t\t\tselector for the backward compatibility for v14 deprecation also\n\t\t\tneeds change. */ }\n\t\t\t<span\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'wp-block-cover__background',\n\t\t\t\t\toverlayColorClass,\n\t\t\t\t\tdimRatioToClass( dimRatio ),\n\t\t\t\t\t{\n\t\t\t\t\t\t'has-background-dim': dimRatio !== undefined,\n\t\t\t\t\t\t// For backwards compatibility. Former versions of the Cover Block applied\n\t\t\t\t\t\t// `.wp-block-cover__gradient-background` in the presence of\n\t\t\t\t\t\t// media, a gradient and a dim.\n\t\t\t\t\t\t'wp-block-cover__gradient-background':\n\t\t\t\t\t\t\turl && gradientValue && dimRatio !== 0,\n\t\t\t\t\t\t'has-background-gradient': gradientValue,\n\t\t\t\t\t\t[ gradientClass ]: gradientClass,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tstyle={ bgStyle }\n\t\t\t/>\n\n\t\t\t<div\n\t\t\t\t{ ...useInnerBlocksProps.save( {\n\t\t\t\t\tclassName: 'wp-block-cover__inner-container',\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</Tag>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAKP;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseInnerBlocksProps,\n\tgetColorClassName,\n\t__experimentalGetGradientClass,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport {\n\tIMAGE_BACKGROUND_TYPE,\n\tVIDEO_BACKGROUND_TYPE,\n\tEMBED_VIDEO_BACKGROUND_TYPE,\n\tdimRatioToClass,\n\tisContentPositionCenter,\n\tgetPositionClassName,\n\tmediaPosition,\n} from './shared';\n\nexport default function save( { attributes } ) {\n\tconst {\n\t\tbackgroundType,\n\t\tgradient,\n\t\tcontentPosition,\n\t\tcustomGradient,\n\t\tcustomOverlayColor,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\tuseFeaturedImage,\n\t\thasParallax,\n\t\tisDark,\n\t\tisRepeated,\n\t\toverlayColor,\n\t\turl,\n\t\talt,\n\t\tid,\n\t\tminHeight: minHeightProp,\n\t\tminHeightUnit,\n\t\ttagName: Tag,\n\t\tsizeSlug,\n\t\tposter,\n\t} = attributes;\n\tconst overlayColorClass = getColorClassName(\n\t\t'background-color',\n\t\toverlayColor\n\t);\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst minHeight =\n\t\tminHeightProp && minHeightUnit\n\t\t\t? `${ minHeightProp }${ minHeightUnit }`\n\t\t\t: minHeightProp;\n\n\tconst isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;\n\tconst isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;\n\tconst isEmbedVideoBackground =\n\t\tEMBED_VIDEO_BACKGROUND_TYPE === backgroundType;\n\n\tconst isImgElement = ! ( hasParallax || isRepeated );\n\n\tconst style = {\n\t\tminHeight: minHeight || undefined,\n\t};\n\n\tconst bgStyle = {\n\t\tbackgroundColor: ! overlayColorClass ? customOverlayColor : undefined,\n\t\tbackground: customGradient ? customGradient : undefined,\n\t};\n\n\tconst objectPosition =\n\t\t// prettier-ignore\n\t\tfocalPoint && isImgElement\n\t\t\t ? mediaPosition(focalPoint)\n\t\t\t : undefined;\n\n\tconst backgroundImage = url ? `url(${ url })` : undefined;\n\n\tconst backgroundPosition = mediaPosition( focalPoint );\n\n\tconst classes = clsx(\n\t\t{\n\t\t\t'is-light': ! isDark,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t\t'has-custom-content-position':\n\t\t\t\t! isContentPositionCenter( contentPosition ),\n\t\t},\n\t\tgetPositionClassName( contentPosition )\n\t);\n\n\tconst imgClasses = clsx(\n\t\t'wp-block-cover__image-background',\n\t\tid ? `wp-image-${ id }` : null,\n\t\t{\n\t\t\t[ `size-${ sizeSlug }` ]: sizeSlug,\n\t\t\t'has-parallax': hasParallax,\n\t\t\t'is-repeated': isRepeated,\n\t\t}\n\t);\n\n\tconst gradientValue = gradient || customGradient;\n\n\treturn (\n\t\t<Tag { ...useBlockProps.save( { className: classes, style } ) }>\n\t\t\t{ ! useFeaturedImage &&\n\t\t\t\tisImageBackground &&\n\t\t\t\turl &&\n\t\t\t\t( isImgElement ? (\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName={ imgClasses }\n\t\t\t\t\t\talt={ alt }\n\t\t\t\t\t\tsrc={ url }\n\t\t\t\t\t\tstyle={ { objectPosition } }\n\t\t\t\t\t\tdata-object-fit=\"cover\"\n\t\t\t\t\t\tdata-object-position={ objectPosition }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\trole={ alt ? 'img' : undefined }\n\t\t\t\t\t\taria-label={ alt ? alt : undefined }\n\t\t\t\t\t\tclassName={ imgClasses }\n\t\t\t\t\t\tstyle={ { backgroundPosition, backgroundImage } }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t{ isVideoBackground && url && (\n\t\t\t\t<video\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'wp-block-cover__video-background',\n\t\t\t\t\t\t'intrinsic-ignore'\n\t\t\t\t\t) }\n\t\t\t\t\tautoPlay\n\t\t\t\t\tmuted\n\t\t\t\t\tloop\n\t\t\t\t\tplaysInline\n\t\t\t\t\tsrc={ url }\n\t\t\t\t\tposter={ poster }\n\t\t\t\t\tstyle={ { objectPosition } }\n\t\t\t\t\tdata-object-fit=\"cover\"\n\t\t\t\t\tdata-object-position={ objectPosition }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isEmbedVideoBackground && url && (\n\t\t\t\t<figure\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'wp-block-cover__video-background',\n\t\t\t\t\t\t'wp-block-cover__embed-background',\n\t\t\t\t\t\t'wp-block-embed'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<div className=\"wp-block-embed__wrapper\">{ url }</div>\n\t\t\t\t</figure>\n\t\t\t) }\n\n\t\t\t{ /* The `wp-block-cover__background` needs to be immediately before\n\t\t\tthe `wp-block-cover__inner-container`, so the exclusion CSS selector\n\t\t\t`.wp-block-cover__background + .wp-block-cover__inner-container`\n\t\t\tworks properly. If it needs to be changed in the future, the\n\t\t\tselector for the backward compatibility for v14 deprecation also\n\t\t\tneeds change. */ }\n\t\t\t<span\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'wp-block-cover__background',\n\t\t\t\t\toverlayColorClass,\n\t\t\t\t\tdimRatioToClass( dimRatio ),\n\t\t\t\t\t{\n\t\t\t\t\t\t'has-background-dim': dimRatio !== undefined,\n\t\t\t\t\t\t// For backwards compatibility. Former versions of the Cover Block applied\n\t\t\t\t\t\t// `.wp-block-cover__gradient-background` in the presence of\n\t\t\t\t\t\t// media, a gradient and a dim.\n\t\t\t\t\t\t'wp-block-cover__gradient-background':\n\t\t\t\t\t\t\turl && gradientValue && dimRatio !== 0,\n\t\t\t\t\t\t'has-background-gradient': gradientValue,\n\t\t\t\t\t\t[ gradientClass ]: gradientClass,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tstyle={ bgStyle }\n\t\t\t/>\n\n\t\t\t<div\n\t\t\t\t{ ...useInnerBlocksProps.save( {\n\t\t\t\t\tclassName: 'wp-block-cover__inner-container',\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</Tag>\n\t);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -14,6 +14,7 @@ var POSITION_CLASSNAMES = {
|
|
|
14
14
|
};
|
|
15
15
|
var IMAGE_BACKGROUND_TYPE = "image";
|
|
16
16
|
var VIDEO_BACKGROUND_TYPE = "video";
|
|
17
|
+
var EMBED_VIDEO_BACKGROUND_TYPE = "embed-video";
|
|
17
18
|
var COVER_MIN_HEIGHT = 50;
|
|
18
19
|
var COVER_MAX_HEIGHT = 1e3;
|
|
19
20
|
var COVER_DEFAULT_HEIGHT = 300;
|
|
@@ -70,6 +71,7 @@ export {
|
|
|
70
71
|
COVER_MAX_HEIGHT,
|
|
71
72
|
COVER_MIN_HEIGHT,
|
|
72
73
|
DEFAULT_FOCAL_POINT,
|
|
74
|
+
EMBED_VIDEO_BACKGROUND_TYPE,
|
|
73
75
|
IMAGE_BACKGROUND_TYPE,
|
|
74
76
|
VIDEO_BACKGROUND_TYPE,
|
|
75
77
|
attributesFromMedia,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cover/shared.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport const DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {\n\treturn `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;\n}\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( media ) {\n\tif ( ! media || ( ! media.url && ! media.src ) ) {\n\t\treturn {\n\t\t\turl: undefined,\n\t\t\tid: undefined,\n\t\t};\n\t}\n\n\tif ( isBlobURL( media.url ) ) {\n\t\tmedia.type = getBlobTypeByURL( media.url );\n\t}\n\n\tlet mediaType;\n\t// For media selections originated from a file upload.\n\tif ( media.media_type ) {\n\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t} else {\n\t\t\t// Only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t}\n\t\t// For media selections originated from existing files in the media library.\n\t} else if (\n\t\tmedia.type &&\n\t\t( media.type === IMAGE_BACKGROUND_TYPE ||\n\t\t\tmedia.type === VIDEO_BACKGROUND_TYPE )\n\t) {\n\t\tmediaType = media.type;\n\t} else {\n\t\treturn;\n\t}\n\n\treturn {\n\t\turl: media.url || media.src,\n\t\tid: media.id,\n\t\talt: media?.alt,\n\t\tbackgroundType: mediaType,\n\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t? { hasParallax: undefined }\n\t\t\t: {} ),\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) {\n\t\treturn '';\n\t}\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,kBAAkB,iBAAiB;AAE5C,IAAM,sBAAsB;AAAA,EAC3B,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EACb,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,gBAAgB;AACjB;AAEO,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;AAC7B,IAAM,sBAAsB,EAAE,GAAG,KAAK,GAAG,IAAI;AAC7C,IAAM,sBAAsB,CAAE,SAAS,OAAQ;AAE/C,SAAS,cAAe,EAAE,GAAG,EAAE,IAAI,qBAAsB;AAC/D,SAAO,GAAI,KAAK,MAAO,IAAI,GAAI,CAAE,KAAM,KAAK,MAAO,IAAI,GAAI,CAAE;AAC9D;AAEO,SAAS,gBAAiB,OAAQ;AACxC,SAAO,UAAU,MAAM,UAAU,SAC9B,OACA,wBAAwB,KAAK,KAAK,MAAO,QAAQ,EAAG;AACxD;AAEO,SAAS,oBAAqB,OAAQ;AAC5C,MAAK,CAAE,SAAW,CAAE,MAAM,OAAO,CAAE,MAAM,KAAQ;AAChD,WAAO;AAAA,MACN,KAAK;AAAA,MACL,IAAI;AAAA,IACL;AAAA,EACD;AAEA,MAAK,UAAW,MAAM,GAAI,GAAI;AAC7B,UAAM,OAAO,iBAAkB,MAAM,GAAI;AAAA,EAC1C;AAEA,MAAI;AAEJ,MAAK,MAAM,YAAa;AACvB,QAAK,MAAM,eAAe,uBAAwB;AACjD,kBAAY;AAAA,IACb,OAAO;AAGN,kBAAY;AAAA,IACb;AAAA,EAED,WACC,MAAM,SACJ,MAAM,SAAS,yBAChB,MAAM,SAAS,wBACf;AACD,gBAAY,MAAM;AAAA,EACnB,OAAO;AACN;AAAA,EACD;AAEA,SAAO;AAAA,IACN,KAAK,MAAM,OAAO,MAAM;AAAA,IACxB,IAAI,MAAM;AAAA,IACV,KAAK,OAAO;AAAA,IACZ,gBAAgB;AAAA,IAChB,GAAK,cAAc,wBAChB,EAAE,aAAa,OAAU,IACzB,CAAC;AAAA,EACL;AACD;AAQO,SAAS,wBAAyB,iBAAkB;AAC1D,SACC,CAAE,mBACF,oBAAoB,mBACpB,oBAAoB;AAEtB;AASO,SAAS,qBAAsB,iBAAkB;AAIvD,MAAK,wBAAyB,eAAgB,GAAI;AACjD,WAAO;AAAA,EACR;AAEA,SAAO,oBAAqB,eAAgB;AAC7C;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const EMBED_VIDEO_BACKGROUND_TYPE = 'embed-video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport const DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {\n\treturn `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;\n}\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( media ) {\n\tif ( ! media || ( ! media.url && ! media.src ) ) {\n\t\treturn {\n\t\t\turl: undefined,\n\t\t\tid: undefined,\n\t\t};\n\t}\n\n\tif ( isBlobURL( media.url ) ) {\n\t\tmedia.type = getBlobTypeByURL( media.url );\n\t}\n\n\tlet mediaType;\n\t// For media selections originated from a file upload.\n\tif ( media.media_type ) {\n\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t} else {\n\t\t\t// Only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t}\n\t\t// For media selections originated from existing files in the media library.\n\t} else if (\n\t\tmedia.type &&\n\t\t( media.type === IMAGE_BACKGROUND_TYPE ||\n\t\t\tmedia.type === VIDEO_BACKGROUND_TYPE )\n\t) {\n\t\tmediaType = media.type;\n\t} else {\n\t\treturn;\n\t}\n\n\treturn {\n\t\turl: media.url || media.src,\n\t\tid: media.id,\n\t\talt: media?.alt,\n\t\tbackgroundType: mediaType,\n\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t? { hasParallax: undefined }\n\t\t\t: {} ),\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) {\n\t\treturn '';\n\t}\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,kBAAkB,iBAAiB;AAE5C,IAAM,sBAAsB;AAAA,EAC3B,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EACb,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,gBAAgB;AACjB;AAEO,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,8BAA8B;AACpC,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;AAC7B,IAAM,sBAAsB,EAAE,GAAG,KAAK,GAAG,IAAI;AAC7C,IAAM,sBAAsB,CAAE,SAAS,OAAQ;AAE/C,SAAS,cAAe,EAAE,GAAG,EAAE,IAAI,qBAAsB;AAC/D,SAAO,GAAI,KAAK,MAAO,IAAI,GAAI,CAAE,KAAM,KAAK,MAAO,IAAI,GAAI,CAAE;AAC9D;AAEO,SAAS,gBAAiB,OAAQ;AACxC,SAAO,UAAU,MAAM,UAAU,SAC9B,OACA,wBAAwB,KAAK,KAAK,MAAO,QAAQ,EAAG;AACxD;AAEO,SAAS,oBAAqB,OAAQ;AAC5C,MAAK,CAAE,SAAW,CAAE,MAAM,OAAO,CAAE,MAAM,KAAQ;AAChD,WAAO;AAAA,MACN,KAAK;AAAA,MACL,IAAI;AAAA,IACL;AAAA,EACD;AAEA,MAAK,UAAW,MAAM,GAAI,GAAI;AAC7B,UAAM,OAAO,iBAAkB,MAAM,GAAI;AAAA,EAC1C;AAEA,MAAI;AAEJ,MAAK,MAAM,YAAa;AACvB,QAAK,MAAM,eAAe,uBAAwB;AACjD,kBAAY;AAAA,IACb,OAAO;AAGN,kBAAY;AAAA,IACb;AAAA,EAED,WACC,MAAM,SACJ,MAAM,SAAS,yBAChB,MAAM,SAAS,wBACf;AACD,gBAAY,MAAM;AAAA,EACnB,OAAO;AACN;AAAA,EACD;AAEA,SAAO;AAAA,IACN,KAAK,MAAM,OAAO,MAAM;AAAA,IACxB,IAAI,MAAM;AAAA,IACV,KAAK,OAAO;AAAA,IACZ,gBAAgB;AAAA,IAChB,GAAK,cAAc,wBAChB,EAAE,aAAa,OAAU,IACzB,CAAC;AAAA,EACL;AACD;AAQO,SAAS,wBAAyB,iBAAkB;AAC1D,SACC,CAAE,mBACF,oBAAoB,mBACpB,oBAAoB;AAEtB;AASO,SAAS,qBAAsB,iBAAkB;AAIvD,MAAK,wBAAyB,eAAgB,GAAI;AACjD,WAAO;AAAA,EACR;AAEA,SAAO,oBAAqB,eAAgB;AAC7C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// packages/block-library/src/details/index.js
|
|
2
2
|
import { details as icon } from "@wordpress/icons";
|
|
3
3
|
import { __, sprintf } from "@wordpress/i18n";
|
|
4
|
+
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
|
|
4
5
|
import initBlock from "../utils/init-block";
|
|
5
6
|
import metadata from "./block.json";
|
|
6
7
|
import edit from "./edit";
|
|
7
8
|
import save from "./save";
|
|
8
9
|
import transforms from "./transforms";
|
|
10
|
+
import { unlock } from "../lock-unlock";
|
|
11
|
+
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
9
12
|
var { name } = metadata;
|
|
10
13
|
var settings = {
|
|
11
14
|
icon,
|
|
@@ -45,16 +48,16 @@ var settings = {
|
|
|
45
48
|
transforms
|
|
46
49
|
};
|
|
47
50
|
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
48
|
-
settings
|
|
51
|
+
settings[fieldsKey] = [
|
|
49
52
|
{
|
|
53
|
+
id: "summary",
|
|
50
54
|
label: __("Summary"),
|
|
51
|
-
type: "
|
|
52
|
-
shownByDefault: true,
|
|
53
|
-
mapping: {
|
|
54
|
-
value: "summary"
|
|
55
|
-
}
|
|
55
|
+
type: "richtext"
|
|
56
56
|
}
|
|
57
57
|
];
|
|
58
|
+
settings[formKey] = {
|
|
59
|
+
fields: ["summary"]
|
|
60
|
+
};
|
|
58
61
|
}
|
|
59
62
|
var init = () => initBlock({ name, metadata, settings });
|
|
60
63
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/details/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { details as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsummary: __( 'La Mancha' ),\n\t\t\tshowContent: true,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { summary } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasSummary = summary?.trim().length > 0;\n\n\t\t// In the list view, use the block's summary as the label.\n\t\t// If the summary is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasSummary ) ) {\n\t\t\treturn customName || summary;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! hasSummary\n\t\t\t\t? __( 'Details. Empty.' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: accessibility text; summary title. */\n\t\t\t\t\t\t__( 'Details. %s' ),\n\t\t\t\t\t\tsummary\n\t\t\t\t );\n\t\t}\n\t},\n\tsave,\n\tedit,\n\ttransforms,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings
|
|
5
|
-
"mappings": ";AAGA,SAAS,WAAW,YAAY;AAChC,SAAS,IAAI,eAAe;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { details as icon } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsummary: __( 'La Mancha' ),\n\t\t\tshowContent: true,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { summary } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasSummary = summary?.trim().length > 0;\n\n\t\t// In the list view, use the block's summary as the label.\n\t\t// If the summary is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasSummary ) ) {\n\t\t\treturn customName || summary;\n\t\t}\n\n\t\tif ( context === 'accessibility' ) {\n\t\t\treturn ! hasSummary\n\t\t\t\t? __( 'Details. Empty.' )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: accessibility text; summary title. */\n\t\t\t\t\t\t__( 'Details. %s' ),\n\t\t\t\t\t\tsummary\n\t\t\t\t );\n\t\t}\n\t},\n\tsave,\n\tedit,\n\ttransforms,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'summary',\n\t\t\tlabel: __( 'Summary' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'summary' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,WAAW,YAAY;AAChC,SAAS,IAAI,eAAe;AAC5B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAGV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,SAAS,GAAI,WAAY;AAAA,MACzB,aAAa;AAAA,IACd;AAAA,IACA,aAAa;AAAA,MACZ;AAAA,QACC,MAAM;AAAA,QACN,YAAY;AAAA,UACX,SAAS;AAAA,YACR;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,oBAAqB,YAAY,EAAE,QAAQ,GAAI;AAC9C,UAAM,EAAE,QAAQ,IAAI;AAEpB,UAAM,aAAa,YAAY,UAAU;AACzC,UAAM,aAAa,SAAS,KAAK,EAAE,SAAS;AAI5C,QAAK,YAAY,gBAAiB,cAAc,aAAe;AAC9D,aAAO,cAAc;AAAA,IACtB;AAEA,QAAK,YAAY,iBAAkB;AAClC,aAAO,CAAE,aACN,GAAI,iBAAkB,IACtB;AAAA;AAAA,QAEA,GAAI,aAAc;AAAA,QAClB;AAAA,MACA;AAAA,IACJ;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAU;AAAA,EACrB;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
// packages/block-library/src/file/index.js
|
|
2
2
|
import { _x, __ } from "@wordpress/i18n";
|
|
3
3
|
import { file as icon } from "@wordpress/icons";
|
|
4
|
+
import { privateApis as blocksPrivateApis } from "@wordpress/blocks";
|
|
4
5
|
import initBlock from "../utils/init-block";
|
|
5
6
|
import deprecated from "./deprecated";
|
|
6
7
|
import edit from "./edit";
|
|
7
8
|
import metadata from "./block.json";
|
|
8
9
|
import save from "./save";
|
|
9
10
|
import transforms from "./transforms";
|
|
11
|
+
import { unlock } from "../lock-unlock";
|
|
12
|
+
var { fieldsKey, formKey } = unlock(blocksPrivateApis);
|
|
10
13
|
var { name } = metadata;
|
|
11
14
|
var settings = {
|
|
12
15
|
icon,
|
|
@@ -22,14 +25,14 @@ var settings = {
|
|
|
22
25
|
save
|
|
23
26
|
};
|
|
24
27
|
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
25
|
-
settings
|
|
28
|
+
settings[fieldsKey] = [
|
|
26
29
|
{
|
|
30
|
+
id: "file",
|
|
27
31
|
label: __("File"),
|
|
28
|
-
type: "
|
|
29
|
-
shownByDefault: true,
|
|
32
|
+
type: "media",
|
|
30
33
|
mapping: {
|
|
31
34
|
id: "id",
|
|
32
|
-
|
|
35
|
+
url: "href"
|
|
33
36
|
},
|
|
34
37
|
args: {
|
|
35
38
|
allowedTypes: [],
|
|
@@ -37,22 +40,19 @@ if (window.__experimentalContentOnlyPatternInsertion) {
|
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
42
|
{
|
|
43
|
+
id: "fileName",
|
|
40
44
|
label: __("Filename"),
|
|
41
|
-
type: "
|
|
42
|
-
shownByDefault: false,
|
|
43
|
-
mapping: {
|
|
44
|
-
value: "fileName"
|
|
45
|
-
}
|
|
45
|
+
type: "richtext"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
+
id: "downloadButtonText",
|
|
48
49
|
label: __("Button Text"),
|
|
49
|
-
type: "
|
|
50
|
-
shownByDefault: false,
|
|
51
|
-
mapping: {
|
|
52
|
-
value: "downloadButtonText"
|
|
53
|
-
}
|
|
50
|
+
type: "richtext"
|
|
54
51
|
}
|
|
55
52
|
];
|
|
53
|
+
settings[formKey] = {
|
|
54
|
+
fields: ["file"]
|
|
55
|
+
};
|
|
56
56
|
}
|
|
57
57
|
var init = () => initBlock({ name, metadata, settings });
|
|
58
58
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/file/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thref: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',\n\t\t\tfileName: _x( 'Armstrong_Small_Step', 'Name of the file' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings
|
|
5
|
-
"mappings": ";AAGA,SAAS,IAAI,UAAU;AACvB,SAAS,QAAQ,YAAY;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { file as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thref: 'https://upload.wikimedia.org/wikipedia/commons/d/dd/Armstrong_Small_Step.ogg',\n\t\t\tfileName: _x( 'Armstrong_Small_Step', 'Name of the file' ),\n\t\t},\n\t},\n\ttransforms,\n\tdeprecated,\n\tedit,\n\tsave,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'file',\n\t\t\tlabel: __( 'File' ),\n\t\t\ttype: 'media',\n\t\t\tmapping: {\n\t\t\t\tid: 'id',\n\t\t\t\turl: 'href',\n\t\t\t},\n\t\t\targs: {\n\t\t\t\tallowedTypes: [],\n\t\t\t\tmultiple: false,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'fileName',\n\t\t\tlabel: __( 'Filename' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'downloadButtonText',\n\t\t\tlabel: __( 'Button Text' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'file' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,UAAU;AACvB,SAAS,QAAQ,YAAY;AAC7B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,MAAM;AAAA,MACN,UAAU,GAAI,wBAAwB,kBAAmB;AAAA,IAC1D;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,MAAO;AAAA,MAClB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,IAAI;AAAA,QACJ,KAAK;AAAA,MACN;AAAA,MACA,MAAM;AAAA,QACL,cAAc,CAAC;AAAA,QACf,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,UAAW;AAAA,MACtB,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,aAAc;AAAA,MACzB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,MAAO;AAAA,EAClB;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -461,7 +461,6 @@ function GalleryEdit(props) {
|
|
|
461
461
|
instructions: PLACEHOLDER_TEXT
|
|
462
462
|
},
|
|
463
463
|
onSelect: updateImages,
|
|
464
|
-
accept: "image/*",
|
|
465
464
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
466
465
|
multiple: true,
|
|
467
466
|
onError: onUploadError,
|
|
@@ -766,7 +765,6 @@ function GalleryEdit(props) {
|
|
|
766
765
|
MediaReplaceFlow,
|
|
767
766
|
{
|
|
768
767
|
allowedTypes: ALLOWED_MEDIA_TYPES,
|
|
769
|
-
accept: "image/*",
|
|
770
768
|
handleUpload: false,
|
|
771
769
|
onSelect: updateImages,
|
|
772
770
|
name: __("Add"),
|