@wordpress/block-library 9.47.0 → 9.48.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/comments/edit/placeholder.cjs +1 -1
- package/build/comments/edit/placeholder.cjs.map +2 -2
- package/build/cover/edit/inspector-controls.cjs +16 -4
- package/build/cover/edit/inspector-controls.cjs.map +2 -2
- package/build/image/image.cjs +14 -3
- package/build/image/image.cjs.map +2 -2
- package/build/image/use-open-image-media-editor-modal.cjs +8 -2
- package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
- package/build/post-featured-image/edit.cjs +6 -4
- package/build/post-featured-image/edit.cjs.map +2 -2
- package/build/site-logo/edit.cjs +4 -1
- package/build/site-logo/edit.cjs.map +2 -2
- package/build-module/comments/edit/placeholder.mjs +1 -1
- package/build-module/comments/edit/placeholder.mjs.map +2 -2
- package/build-module/cover/edit/inspector-controls.mjs +16 -4
- package/build-module/cover/edit/inspector-controls.mjs.map +2 -2
- package/build-module/image/image.mjs +15 -3
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs +8 -2
- package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
- package/build-module/post-featured-image/edit.mjs +6 -4
- package/build-module/post-featured-image/edit.mjs.map +2 -2
- package/build-module/site-logo/edit.mjs +5 -1
- package/build-module/site-logo/edit.mjs.map +2 -2
- package/package.json +42 -42
- package/src/comments/edit/placeholder.js +1 -1
- package/src/cover/edit/inspector-controls.js +61 -45
- package/src/cover/test/edit.js +38 -0
- package/src/image/image.js +50 -35
- package/src/image/test/use-open-image-media-editor-modal.js +41 -0
- package/src/image/use-open-image-media-editor-modal.js +7 -1
- package/src/navigation-link/test/__snapshots__/hooks.js.snap +45 -134
- package/src/post-featured-image/edit.js +15 -10
- package/src/site-logo/edit.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -47,7 +47,7 @@ function PostCommentsPlaceholder({ postType, postId }) {
|
|
|
47
47
|
(select) => select(import_block_editor.store).getSettings().__experimentalDiscussionSettings?.avatarURL,
|
|
48
48
|
[]
|
|
49
49
|
);
|
|
50
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wp-block-comments__legacy-placeholder", inert: true, children: [
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "wp-block-comments__legacy-placeholder", inert: "true", children: [
|
|
51
51
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", {
|
|
52
52
|
/* translators: %s: Post title. */
|
|
53
53
|
children: (0, import_i18n.sprintf)((0, import_i18n.__)("One response to %s"), postTitle)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/comments/edit/placeholder.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from '../../post-comments-form/form';\n\nexport default function PostCommentsPlaceholder( { postType, postId } ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst avatarURL = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings?.avatarURL,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div className=\"wp-block-comments__legacy-placeholder\" inert>\n\t\t\t<h3>\n\t\t\t\t{\n\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t}\n\t\t\t</h3>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">\u00AB { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } \u00BB</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<ol className=\"commentlist\">\n\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ __( 'Commenter Avatar' ) }\n\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<b className=\"fn\">\n\t\t\t\t\t\t\t\t\t<a href=\"#top\" className=\"url\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'A WordPress Commenter' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</b>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"says\">{ __( 'says' ) }:</span>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T00:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'January 1, 2000 at 00:00 am' ) }\n\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Commenter avatars come from <a>Gravatar</a>.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\" />\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t'Reply to A WordPress Commenter'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t/* translators: Comment reply button text. */\n\t\t\t\t\t\t\t\t\t_x( 'Reply', 'verb' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</article>\n\t\t\t\t</li>\n\t\t\t</ol>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">\u00AB { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } \u00BB</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<CommentsForm postId={ postId } postType={ postType } />\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0C;AAC1C,kBAAgC;AAChC,kBAA0B;AAC1B,uBAA8B;AAC9B,qBAAyC;AAKzC,kBAAyB;AAetB;AAbY,SAAR,wBAA0C,EAAE,UAAU,OAAO,GAAI;AACvE,MAAI,CAAE,SAAU,QAAI,gCAAe,YAAY,UAAU,SAAS,MAAO;AACzE,cAAY,iBAAa,gBAAI,YAAa;AAE1C,QAAM,gBAAY;AAAA,IACjB,CAAE,WACD,OAAQ,oBAAAA,KAAiB,EAAE,YAAY,EACrC,kCAAkC;AAAA,IACrC,CAAC;AAAA,EACF;AAEA,SACC,6CAAC,SAAI,WAAU,yCAAwC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CommentsForm from '../../post-comments-form/form';\n\nexport default function PostCommentsPlaceholder( { postType, postId } ) {\n\tlet [ postTitle ] = useEntityProp( 'postType', postType, 'title', postId );\n\tpostTitle = postTitle || __( 'Post Title' );\n\n\tconst avatarURL = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalDiscussionSettings?.avatarURL,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<div className=\"wp-block-comments__legacy-placeholder\" inert=\"true\">\n\t\t\t<h3>\n\t\t\t\t{\n\t\t\t\t\t/* translators: %s: Post title. */\n\t\t\t\t\tsprintf( __( 'One response to %s' ), postTitle )\n\t\t\t\t}\n\t\t\t</h3>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">\u00AB { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } \u00BB</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<ol className=\"commentlist\">\n\t\t\t\t<li className=\"comment even thread-even depth-1\">\n\t\t\t\t\t<article className=\"comment-body\">\n\t\t\t\t\t\t<footer className=\"comment-meta\">\n\t\t\t\t\t\t\t<div className=\"comment-author vcard\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ __( 'Commenter Avatar' ) }\n\t\t\t\t\t\t\t\t\tsrc={ avatarURL }\n\t\t\t\t\t\t\t\t\tclassName=\"avatar avatar-32 photo\"\n\t\t\t\t\t\t\t\t\theight=\"32\"\n\t\t\t\t\t\t\t\t\twidth=\"32\"\n\t\t\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<b className=\"fn\">\n\t\t\t\t\t\t\t\t\t<a href=\"#top\" className=\"url\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'A WordPress Commenter' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</b>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"says\">{ __( 'says' ) }:</span>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t<div className=\"comment-metadata\">\n\t\t\t\t\t\t\t\t<a href=\"#top\">\n\t\t\t\t\t\t\t\t\t<time dateTime=\"2000-01-01T00:00:00+00:00\">\n\t\t\t\t\t\t\t\t\t\t{ __( 'January 1, 2000 at 00:00 am' ) }\n\t\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t\t</a>{ ' ' }\n\t\t\t\t\t\t\t\t<span className=\"edit-link\">\n\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\tclassName=\"comment-edit-link\"\n\t\t\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</footer>\n\n\t\t\t\t\t\t<div className=\"comment-content\">\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t{ __( 'Hi, this is a comment.' ) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'To get started with moderating, editing, and deleting comments, please visit the Comments screen in the dashboard.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'Commenter avatars come from <a>Gravatar</a>.'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t\t<a href=\"https://gravatar.com/\" />\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div className=\"reply\">\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\tclassName=\"comment-reply-link\"\n\t\t\t\t\t\t\t\thref=\"#top\"\n\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t'Reply to A WordPress Commenter'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t/* translators: Comment reply button text. */\n\t\t\t\t\t\t\t\t\t_x( 'Reply', 'verb' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</article>\n\t\t\t\t</li>\n\t\t\t</ol>\n\n\t\t\t<div className=\"navigation\">\n\t\t\t\t<div className=\"alignleft\">\n\t\t\t\t\t<a href=\"#top\">\u00AB { __( 'Older Comments' ) }</a>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"alignright\">\n\t\t\t\t\t<a href=\"#top\">{ __( 'Newer Comments' ) } \u00BB</a>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<CommentsForm postId={ postId } postType={ postType } />\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAA0C;AAC1C,kBAAgC;AAChC,kBAA0B;AAC1B,uBAA8B;AAC9B,qBAAyC;AAKzC,kBAAyB;AAetB;AAbY,SAAR,wBAA0C,EAAE,UAAU,OAAO,GAAI;AACvE,MAAI,CAAE,SAAU,QAAI,gCAAe,YAAY,UAAU,SAAS,MAAO;AACzE,cAAY,iBAAa,gBAAI,YAAa;AAE1C,QAAM,gBAAY;AAAA,IACjB,CAAE,WACD,OAAQ,oBAAAA,KAAiB,EAAE,YAAY,EACrC,kCAAkC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ACD;AAAA,MAEA,4CAAC,SAAI,WAAU,mBACd,uDAAC,OACE;AAAA,4BAAI,wBAAyB;AAAA,QAC/B,4CAAC,QAAG;AAAA,YACF;AAAA,UACD;AAAA,QACD;AAAA,QACA,4CAAC,QAAG;AAAA,YACF;AAAA,cACD;AAAA,YACC;AAAA,UACD;AAAA,UACA;AAAA,YACC;AAAA;AAAA,cAEC,4CAAC,OAAE,MAAK,yBAAwB;AAAA;AAAA,UAElC;AAAA,QACD;AAAA,SACD,GACD;AAAA,MAEA,4CAAC,SAAI,WAAU,SACd;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,MAAK;AAAA,UACL,kBAAa;AAAA,YACZ;AAAA,UACD;AAAA;AAAA,UAIC,8BAAI,SAAS,MAAO;AAAA;AAAA,MAEtB,GACD;AAAA,OACD,GACD,GACD;AAAA,IAEA,6CAAC,SAAI,WAAU,cACd;AAAA,kDAAC,SAAI,WAAU,aACd,uDAAC,OAAE,MAAK,QAAO;AAAA;AAAA,YAAI,gBAAI,gBAAiB;AAAA,SAAG,GAC5C;AAAA,MACA,4CAAC,SAAI,WAAU,cACd,uDAAC,OAAE,MAAK,QAAS;AAAA,4BAAI,gBAAiB;AAAA,QAAG;AAAA,SAAE,GAC5C;AAAA,OACD;AAAA,IAEA,4CAAC,YAAAC,SAAA,EAAa,QAAkB,UAAsB;AAAA,KACvD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "CommentsForm"]
|
|
7
7
|
}
|
|
@@ -123,8 +123,19 @@ function CoverInspectorControls({
|
|
|
123
123
|
} = currentSettings;
|
|
124
124
|
const sizeSlug = attributes.sizeSlug || import_constants.DEFAULT_MEDIA_SIZE_SLUG;
|
|
125
125
|
const { gradientValue, setGradient } = (0, import_block_editor.__experimentalUseGradient)();
|
|
126
|
-
const {
|
|
127
|
-
|
|
126
|
+
const { imageSizes, hasSelectedStyleState } = (0, import_data.useSelect)(
|
|
127
|
+
(select) => {
|
|
128
|
+
const {
|
|
129
|
+
getSettings,
|
|
130
|
+
hasSelectedStyleState: hasSelectedBlockStyleState
|
|
131
|
+
} = (0, import_lock_unlock.unlock)(select(import_block_editor.store));
|
|
132
|
+
return {
|
|
133
|
+
imageSizes: getSettings()?.imageSizes,
|
|
134
|
+
hasSelectedStyleState: hasSelectedBlockStyleState(clientId)
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
[clientId]
|
|
138
|
+
);
|
|
128
139
|
const image = (0, import_data.useSelect)(
|
|
129
140
|
(select) => id && isImageBackground ? select(import_core_data.store).getEntityRecord(
|
|
130
141
|
"postType",
|
|
@@ -165,6 +176,7 @@ function CoverInspectorControls({
|
|
|
165
176
|
styleOfRef[property] = (0, import_shared.mediaPosition)(value);
|
|
166
177
|
};
|
|
167
178
|
const colorGradientSettings = (0, import_block_editor.__experimentalUseMultipleOriginColorsAndGradients)();
|
|
179
|
+
const showOverlayControls = colorGradientSettings.hasColorsOrGradients && !hasSelectedStyleState;
|
|
168
180
|
const dropdownMenuProps = (0, import_hooks.useToolsPanelDropdownMenuProps)();
|
|
169
181
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
170
182
|
(!!url || useFeaturedImage) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -307,7 +319,7 @@ function CoverInspectorControls({
|
|
|
307
319
|
]
|
|
308
320
|
}
|
|
309
321
|
) }),
|
|
310
|
-
|
|
322
|
+
showOverlayControls && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_block_editor.InspectorControls, { group: "color", children: [
|
|
311
323
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
312
324
|
import_block_editor.__experimentalColorGradientSettingsDropdown,
|
|
313
325
|
{
|
|
@@ -362,7 +374,7 @@ function CoverInspectorControls({
|
|
|
362
374
|
}
|
|
363
375
|
)
|
|
364
376
|
] }),
|
|
365
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { group: "dimensions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
377
|
+
!hasSelectedStyleState && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { group: "dimensions", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
366
378
|
import_components.__experimentalToolsPanelItem,
|
|
367
379
|
{
|
|
368
380
|
className: "single-column",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cover/edit/inspector-controls.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tFocalPointPicker,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\tstore as blockEditorStore,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Link } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\nimport { unlock } from '../../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';\nimport PosterImage from '../../utils/poster-image';\n\nconst { cleanEmptyObject, ResolutionTool, HTMLElementControl } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tfeaturedImage,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tid,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t\tposter,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst sizeSlug = attributes.sizeSlug || DEFAULT_MEDIA_SIZE_SLUG;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\tconst { getSettings } = useSelect( blockEditorStore );\n\n\tconst imageSizes = getSettings()?.imageSizes;\n\n\tconst image = useSelect(\n\t\t( select ) =>\n\t\t\tid && isImageBackground\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t )\n\t\t\t\t: null,\n\t\t[ id, isImageBackground ]\n\t);\n\n\tconst currentBackgroundImage = useFeaturedImage ? featuredImage : image;\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl =\n\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ newSizeSlug ]\n\t\t\t\t?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t?.filter(\n\t\t\t( { slug } ) =>\n\t\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ slug ]\n\t\t\t\t\t?.source_url\n\t\t)\n\t\t?.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker = isVideoBackground || isImageBackground;\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t{ ( !! url || useFeaturedImage ) && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\talt: '',\n\t\t\t\t\t\t\t\tposter: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tupdateImage( DEFAULT_MEDIA_SIZE_SLUG );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => !! hasParallax }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ !! hasParallax }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => isRepeated }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! focalPoint }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isVideoBackground && (\n\t\t\t\t\t\t\t<PosterImage\n\t\t\t\t\t\t\t\tposter={ poster }\n\t\t\t\t\t\t\t\tonChange={ ( posterImage ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tposter: posterImage?.url,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! alt }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: '' } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\t\t\topenInNewTab\n\t\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Leave empty if decorative.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! imageSizeOptions?.length && (\n\t\t\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tattributes?.style?.dimensions?.aspectRatio\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: minHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeight: newMinHeight,\n\t\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\t\t\t\tdimensions: {\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\t\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AACxB,wBA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A,MACxB;AAAA,MACA,UAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA,OAAQ;AAAA;AAAA,EACT;AAEF;AACe,SAAR,uBAAyC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AACJ,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI;AAEJ,QAAM,WAAW,WAAW,YAAY;AAExC,QAAM,EAAE,eAAe,YAAY,QAAI,+CAA0B;AACjE,QAAM,EAAE,YAAY,QAAI,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tFocalPointPicker,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\tstore as blockEditorStore,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { Link } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\nimport { unlock } from '../../lock-unlock';\nimport { useToolsPanelDropdownMenuProps } from '../../utils/hooks';\nimport { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';\nimport PosterImage from '../../utils/poster-image';\n\nconst { cleanEmptyObject, ResolutionTool, HTMLElementControl } = unlock(\n\tblockEditorPrivateApis\n);\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tfeaturedImage,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tid,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t\tposter,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst sizeSlug = attributes.sizeSlug || DEFAULT_MEDIA_SIZE_SLUG;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\tconst { imageSizes, hasSelectedStyleState } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetSettings,\n\t\t\t\thasSelectedStyleState: hasSelectedBlockStyleState,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\treturn {\n\t\t\t\timageSizes: getSettings()?.imageSizes,\n\t\t\t\thasSelectedStyleState: hasSelectedBlockStyleState( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst image = useSelect(\n\t\t( select ) =>\n\t\t\tid && isImageBackground\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tid,\n\t\t\t\t\t\t{ context: 'view' }\n\t\t\t\t )\n\t\t\t\t: null,\n\t\t[ id, isImageBackground ]\n\t);\n\n\tconst currentBackgroundImage = useFeaturedImage ? featuredImage : image;\n\n\tfunction updateImage( newSizeSlug ) {\n\t\tconst newUrl =\n\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ newSizeSlug ]\n\t\t\t\t?.source_url;\n\t\tif ( ! newUrl ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\turl: newUrl,\n\t\t\tsizeSlug: newSizeSlug,\n\t\t} );\n\t}\n\n\tconst imageSizeOptions = imageSizes\n\t\t?.filter(\n\t\t\t( { slug } ) =>\n\t\t\t\tcurrentBackgroundImage?.media_details?.sizes?.[ slug ]\n\t\t\t\t\t?.source_url\n\t\t)\n\t\t?.map( ( { name, slug } ) => ( { value: slug, label: name } ) );\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker = isVideoBackground || isImageBackground;\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst showOverlayControls =\n\t\tcolorGradientSettings.hasColorsOrGradients && ! hasSelectedStyleState;\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\treturn (\n\t\t<>\n\t\t\t{ ( !! url || useFeaturedImage ) && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\talt: '',\n\t\t\t\t\t\t\t\tposter: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tupdateImage( DEFAULT_MEDIA_SIZE_SLUG );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => !! hasParallax }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\thasParallax: false,\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ !! hasParallax }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\n\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\thasValue={ () => isRepeated }\n\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tisRepeated: false,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! focalPoint }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: undefined,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isVideoBackground && (\n\t\t\t\t\t\t\t<PosterImage\n\t\t\t\t\t\t\t\tposter={ poster }\n\t\t\t\t\t\t\t\tonChange={ ( posterImage ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tposter: posterImage?.url,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => !! alt }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: '' } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\t\t\t\t\t\topenInNewTab\n\t\t\t\t\t\t\t\t\t\t\t\thref={\n\t\t\t\t\t\t\t\t\t\t\t\t\t// translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations.\n\t\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'https://www.w3.org/WAI/tutorials/images/decision-tree/'\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Leave empty if decorative.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ !! imageSizeOptions?.length && (\n\t\t\t\t\t\t\t<ResolutionTool\n\t\t\t\t\t\t\t\tvalue={ sizeSlug }\n\t\t\t\t\t\t\t\tonChange={ updateImage }\n\t\t\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\t\t\tdefaultValue={ DEFAULT_MEDIA_SIZE_SLUG }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</ToolsPanel>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ showOverlayControls && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t\tclearable: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ ! hasSelectedStyleState && (\n\t\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tattributes?.style?.dimensions?.aspectRatio\n\t\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t\t: minHeight\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tminHeight: newMinHeight,\n\t\t\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\t\t\t\t\tdimensions: {\n\t\t\t\t\t\t\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\t\t\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAwB;AACxB,wBAUO;AACP,qBAA8B;AAC9B,0BAQO;AACP,kBAAmB;AACnB,kBAA0B;AAC1B,uBAAmC;AACnC,gBAAqB;AAKrB,oBAAgD;AAChD,yBAAuB;AACvB,mBAA+C;AAC/C,uBAAwC;AACxC,0BAAwB;AA0CtB;AAxCF,IAAM,EAAE,kBAAkB,gBAAgB,mBAAmB,QAAI;AAAA,EAChE,oBAAAA;AACD;AAEA,SAAS,iBAAkB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,QAAQ;AACT,GAAI;AACH,QAAM,iBAAa,8BAAe,kBAAAC,yBAAY;AAC9C,QAAM,UAAU,4BAA6B,UAAW;AACxD,QAAM,OAAO,SAAS;AAEtB,QAAM,CAAE,cAAe,QAAI,iCAAa,eAAgB;AACxD,QAAM,YAAQ,kBAAAC,8BAAgB;AAAA,IAC7B,gBAAgB,kBAAkB,CAAE,MAAM,MAAM,OAAO,MAAM,IAAK;AAAA,IAClE,eAAe,EAAE,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,IAAI,GA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QACtC;AAAA;AAAA,IACD,GACD;AAAA,KACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorPrivateApis", "UnitControl", "useCustomUnits", "parseQuantityAndUnitFromRawValue", "blockEditorStore", "coreStore", "useMultipleOriginColorsAndGradients", "ToolsPanel", "ToolsPanelItem", "PosterImage", "ColorGradientSettingsDropdown"]
|
|
7
7
|
}
|
package/build/image/image.cjs
CHANGED
|
@@ -311,9 +311,15 @@ function Image({
|
|
|
311
311
|
[clientId]
|
|
312
312
|
);
|
|
313
313
|
const { getBlock, getSettings } = (0, import_data.useSelect)(import_block_editor.store);
|
|
314
|
+
const cropButtonRef = (0, import_element.useRef)();
|
|
315
|
+
const handleMediaEditorModalClose = (0, import_element.useCallback)(
|
|
316
|
+
() => cropButtonRef.current?.focus(),
|
|
317
|
+
[]
|
|
318
|
+
);
|
|
314
319
|
const openImageMediaEditorModal = (0, import_use_open_image_media_editor_modal.useOpenImageMediaEditorModal)({
|
|
315
320
|
attributes,
|
|
316
|
-
setAttributes
|
|
321
|
+
setAttributes,
|
|
322
|
+
onClose: handleMediaEditorModalClose
|
|
317
323
|
});
|
|
318
324
|
const {
|
|
319
325
|
replaceBlocks,
|
|
@@ -560,12 +566,14 @@ function Image({
|
|
|
560
566
|
lockAltControlsMessage,
|
|
561
567
|
lockTitleControls = false,
|
|
562
568
|
lockTitleControlsMessage,
|
|
563
|
-
hideCaptionControls = false
|
|
569
|
+
hideCaptionControls = false,
|
|
570
|
+
hasSelectedStyleState = false
|
|
564
571
|
} = (0, import_data.useSelect)(
|
|
565
572
|
(select) => {
|
|
566
573
|
if (!isSingleSelected) {
|
|
567
574
|
return {};
|
|
568
575
|
}
|
|
576
|
+
const { hasSelectedStyleState: hasSelectedBlockStyleState } = (0, import_lock_unlock.unlock)(select(import_block_editor.store));
|
|
569
577
|
const {
|
|
570
578
|
url: urlBinding,
|
|
571
579
|
alt: altBinding,
|
|
@@ -583,6 +591,7 @@ function Image({
|
|
|
583
591
|
titleBinding?.source
|
|
584
592
|
);
|
|
585
593
|
return {
|
|
594
|
+
hasSelectedStyleState: hasSelectedBlockStyleState(clientId),
|
|
586
595
|
lockUrlControls: !!urlBinding && !urlBindingSource?.canUserEditValue?.({
|
|
587
596
|
select,
|
|
588
597
|
context,
|
|
@@ -618,6 +627,7 @@ function Image({
|
|
|
618
627
|
},
|
|
619
628
|
[
|
|
620
629
|
arePatternOverridesEnabled,
|
|
630
|
+
clientId,
|
|
621
631
|
context,
|
|
622
632
|
isSingleSelected,
|
|
623
633
|
metadata?.bindings
|
|
@@ -664,6 +674,7 @@ function Image({
|
|
|
664
674
|
allowCrop && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
665
675
|
import_components.ToolbarButton,
|
|
666
676
|
{
|
|
677
|
+
ref: cropButtonRef,
|
|
667
678
|
onClick: openImageMediaEditorModal ? openImageMediaEditorModal : () => setIsEditingImage(true),
|
|
668
679
|
"aria-haspopup": openImageMediaEditorModal ? "dialog" : void 0,
|
|
669
680
|
icon: import_icons.crop,
|
|
@@ -791,7 +802,7 @@ function Image({
|
|
|
791
802
|
]
|
|
792
803
|
}
|
|
793
804
|
) }),
|
|
794
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
805
|
+
!hasSelectedStyleState && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
795
806
|
import_block_editor.InspectorControls,
|
|
796
807
|
{
|
|
797
808
|
group: "dimensions",
|