@wordpress/block-library 8.6.0 → 8.7.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/buttons/index.js +1 -0
- package/build/buttons/index.js.map +1 -1
- package/build/buttons/transforms.js +1 -0
- package/build/buttons/transforms.js.map +1 -1
- package/build/columns/edit.js +4 -2
- package/build/columns/edit.js.map +1 -1
- package/build/columns/index.js +4 -0
- package/build/columns/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +2 -2
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/gallery/edit.js +8 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/use-image-sizes.js +1 -1
- package/build/gallery/use-image-sizes.js.map +1 -1
- package/build/group/deprecated.js +4 -2
- package/build/group/deprecated.js.map +1 -1
- package/build/group/edit.js +22 -5
- package/build/group/edit.js.map +1 -1
- package/build/group/placeholder.js +11 -1
- package/build/group/placeholder.js.map +1 -1
- package/build/group/variations.js +23 -3
- package/build/group/variations.js.map +1 -1
- package/build/image/edit.js +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +8 -6
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +7 -2
- package/build/image/index.js.map +1 -1
- package/build/latest-posts/edit.js +1 -0
- package/build/latest-posts/edit.js.map +1 -1
- package/build/media-text/deprecated.js +228 -18
- package/build/media-text/deprecated.js.map +1 -1
- package/build/media-text/edit.js +3 -3
- package/build/media-text/edit.js.map +1 -1
- package/build/media-text/index.js +1 -1
- package/build/navigation/edit/index.js +1 -12
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +1 -4
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/post-date/edit.js +2 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-date/index.js +4 -1
- package/build/post-date/index.js.map +1 -1
- package/build/post-date/variations.js +28 -0
- package/build/post-date/variations.js.map +1 -0
- package/build/post-excerpt/edit.js +39 -10
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +2 -2
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/post-time-to-read/index.js +17 -1
- package/build/post-time-to-read/index.js.map +1 -1
- package/build/quote/index.js +1 -0
- package/build/quote/index.js.map +1 -1
- package/build/spacer/edit.js +16 -6
- package/build/spacer/edit.js.map +1 -1
- package/build-module/buttons/index.js +1 -0
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/buttons/transforms.js +1 -0
- package/build-module/buttons/transforms.js.map +1 -1
- package/build-module/columns/edit.js +4 -2
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/index.js +4 -0
- package/build-module/columns/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +2 -2
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/gallery/edit.js +8 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/use-image-sizes.js +1 -1
- package/build-module/gallery/use-image-sizes.js.map +1 -1
- package/build-module/group/deprecated.js +4 -2
- package/build-module/group/deprecated.js.map +1 -1
- package/build-module/group/edit.js +21 -5
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/placeholder.js +11 -1
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/group/variations.js +24 -1
- package/build-module/group/variations.js.map +1 -1
- package/build-module/image/edit.js +1 -1
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +8 -6
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +7 -2
- package/build-module/image/index.js.map +1 -1
- package/build-module/latest-posts/edit.js +1 -0
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/media-text/deprecated.js +227 -18
- package/build-module/media-text/deprecated.js.map +1 -1
- package/build-module/media-text/edit.js +3 -3
- package/build-module/media-text/edit.js.map +1 -1
- package/build-module/media-text/index.js +1 -1
- package/build-module/navigation/edit/index.js +1 -12
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +1 -4
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/post-date/edit.js +2 -1
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-date/index.js +3 -1
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-date/variations.js +18 -0
- package/build-module/post-date/variations.js.map +1 -0
- package/build-module/post-excerpt/edit.js +38 -11
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +2 -2
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/post-time-to-read/index.js +17 -1
- package/build-module/post-time-to-read/index.js.map +1 -1
- package/build-module/quote/index.js +1 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/spacer/edit.js +16 -6
- package/build-module/spacer/edit.js.map +1 -1
- package/build-style/categories/editor-rtl.css +5 -0
- package/build-style/categories/editor.css +5 -0
- package/build-style/categories/style-rtl.css +4 -0
- package/build-style/categories/style.css +4 -0
- package/build-style/editor-rtl.css +6 -0
- package/build-style/editor.css +6 -0
- package/build-style/navigation/style-rtl.css +2 -0
- package/build-style/navigation/style.css +2 -0
- package/build-style/post-featured-image/editor-rtl.css +1 -0
- package/build-style/post-featured-image/editor.css +1 -0
- package/build-style/post-template/style-rtl.css +1 -1
- package/build-style/post-template/style.css +1 -1
- package/build-style/post-time-to-read/style-rtl.css +91 -0
- package/build-style/post-time-to-read/style.css +91 -0
- package/build-style/search/style-rtl.css +8 -7
- package/build-style/search/style.css +8 -7
- package/build-style/style-rtl.css +19 -8
- package/build-style/style.css +19 -8
- package/package.json +31 -31
- package/src/buttons/block.json +1 -0
- package/src/categories/editor.scss +5 -0
- package/src/categories/style.scss +4 -0
- package/src/columns/block.json +4 -0
- package/src/columns/edit.js +2 -1
- package/src/comments/index.php +1 -0
- package/src/cover/edit/inspector-controls.js +4 -5
- package/src/cover/test/__snapshots__/transforms.native.js.snap +2 -2
- package/src/cover/test/edit.js +324 -0
- package/src/gallery/edit.js +5 -2
- package/src/gallery/use-image-sizes.js +1 -1
- package/src/group/deprecated.js +4 -2
- package/src/group/edit.js +27 -9
- package/src/group/placeholder.js +13 -1
- package/src/group/variations.js +14 -1
- package/src/home-link/index.php +2 -2
- package/src/image/block.json +7 -2
- package/src/image/edit.js +1 -1
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +15 -7
- package/src/image/index.php +7 -2
- package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
- package/src/latest-comments/style.scss +1 -1
- package/src/latest-posts/edit.js +3 -0
- package/src/media-text/block.json +1 -1
- package/src/media-text/deprecated.js +235 -3
- package/src/media-text/edit.js +7 -6
- package/src/media-text/test/__snapshots__/transforms.native.js.snap +4 -4
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/index.js +0 -13
- package/src/navigation/edit/inner-blocks.js +0 -3
- package/src/navigation/style.scss +6 -4
- package/src/navigation-link/index.php +2 -1
- package/src/navigation-submenu/index.php +30 -76
- package/src/post-author/index.php +1 -1
- package/src/post-date/edit.js +4 -1
- package/src/post-date/index.js +2 -0
- package/src/post-date/variations.js +20 -0
- package/src/post-excerpt/edit.js +48 -16
- package/src/post-featured-image/dimension-controls.js +2 -2
- package/src/post-featured-image/editor.scss +1 -0
- package/src/post-template/block.json +1 -1
- package/src/post-template/style.scss +1 -1
- package/src/post-time-to-read/block.json +17 -1
- package/src/post-time-to-read/style.scss +4 -0
- package/src/query-title/index.php +2 -5
- package/src/quote/block.json +1 -0
- package/src/search/style.scss +16 -12
- package/src/spacer/edit.js +18 -5
- package/src/style.scss +1 -0
- package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/cover/test/block-controls.js +0 -62
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-date/index.js"],"names":["postDate","icon","initBlock","edit","deprecated","name","metadata","settings","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,IAArB,QAAiC,kBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-date/index.js"],"names":["postDate","icon","initBlock","edit","deprecated","variations","name","metadata","settings","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,IAAIC,IAArB,QAAiC,kBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBP,EAAAA,IADuB;AAEvBE,EAAAA,IAFuB;AAGvBC,EAAAA,UAHuB;AAIvBC,EAAAA;AAJuB,CAAjB;AAOP,OAAO,MAAMI,IAAI,GAAG,MAAMP,SAAS,CAAE;AAAEI,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAF,CAA5B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postDate as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\nimport variations from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tdeprecated,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { postDate } from '@wordpress/icons';
|
|
6
|
+
const variations = [{
|
|
7
|
+
name: 'post-date-modified',
|
|
8
|
+
title: __('Post Modified Date'),
|
|
9
|
+
description: __("Display a post's last updated date."),
|
|
10
|
+
attributes: {
|
|
11
|
+
displayType: 'modified'
|
|
12
|
+
},
|
|
13
|
+
scope: ['block', 'inserter'],
|
|
14
|
+
isActive: blockAttributes => blockAttributes.displayType === 'modified',
|
|
15
|
+
icon: postDate
|
|
16
|
+
}];
|
|
17
|
+
export default variations;
|
|
18
|
+
//# sourceMappingURL=variations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-date/variations.js"],"names":["__","postDate","variations","name","title","description","attributes","displayType","scope","isActive","blockAttributes","icon"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AAEA,MAAMC,UAAU,GAAG,CAClB;AACCC,EAAAA,IAAI,EAAE,oBADP;AAECC,EAAAA,KAAK,EAAEJ,EAAE,CAAE,oBAAF,CAFV;AAGCK,EAAAA,WAAW,EAAEL,EAAE,CAAE,qCAAF,CAHhB;AAICM,EAAAA,UAAU,EAAE;AAAEC,IAAAA,WAAW,EAAE;AAAf,GAJb;AAKCC,EAAAA,KAAK,EAAE,CAAE,OAAF,EAAW,UAAX,CALR;AAMCC,EAAAA,QAAQ,EAAIC,eAAF,IACTA,eAAe,CAACH,WAAhB,KAAgC,UAPlC;AAQCI,EAAAA,IAAI,EAAEV;AARP,CADkB,CAAnB;AAaA,eAAeC,UAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { postDate } from '@wordpress/icons';\n\nconst variations = [\n\t{\n\t\tname: 'post-date-modified',\n\t\ttitle: __( 'Post Modified Date' ),\n\t\tdescription: __( \"Display a post's last updated date.\" ),\n\t\tattributes: { displayType: 'modified' },\n\t\tscope: [ 'block', 'inserter' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\tblockAttributes.displayType === 'modified',\n\t\ticon: postDate,\n\t},\n];\n\nexport default variations;\n"]}
|
|
@@ -8,16 +8,18 @@ import classnames from 'classnames';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { useEntityProp } from '@wordpress/core-data';
|
|
11
|
+
import { useEntityProp, store as coreStore } from '@wordpress/core-data';
|
|
12
12
|
import { useMemo } from '@wordpress/element';
|
|
13
13
|
import { AlignmentToolbar, BlockControls, InspectorControls, RichText, Warning, useBlockProps } from '@wordpress/block-editor';
|
|
14
14
|
import { PanelBody, ToggleControl, RangeControl } from '@wordpress/components';
|
|
15
15
|
import { __, _x } from '@wordpress/i18n';
|
|
16
|
+
import { useSelect } from '@wordpress/data';
|
|
16
17
|
/**
|
|
17
18
|
* Internal dependencies
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
import { useCanEditEntity } from '../utils/hooks';
|
|
22
|
+
const ELLIPSIS = '…';
|
|
21
23
|
export default function PostExcerptEditor(_ref) {
|
|
22
24
|
let {
|
|
23
25
|
attributes: {
|
|
@@ -36,11 +38,37 @@ export default function PostExcerptEditor(_ref) {
|
|
|
36
38
|
} = _ref;
|
|
37
39
|
const isDescendentOfQueryLoop = Number.isFinite(queryId);
|
|
38
40
|
const userCanEdit = useCanEditEntity('postType', postType, postId);
|
|
39
|
-
const isEditable = userCanEdit && !isDescendentOfQueryLoop;
|
|
40
41
|
const [rawExcerpt, setExcerpt, {
|
|
41
42
|
rendered: renderedExcerpt,
|
|
42
43
|
protected: isProtected
|
|
43
44
|
} = {}] = useEntityProp('postType', postType, 'excerpt', postId);
|
|
45
|
+
/**
|
|
46
|
+
* Check if the post type supports excerpts.
|
|
47
|
+
* Add an exception and return early for the "page" post type,
|
|
48
|
+
* which is registered without support for the excerpt UI,
|
|
49
|
+
* but supports saving the excerpt to the database.
|
|
50
|
+
* See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65
|
|
51
|
+
* Without this exception, users that have excerpts saved to the database will
|
|
52
|
+
* not be able to edit the excerpts.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
const postTypeSupportsExcerpts = useSelect(select => {
|
|
56
|
+
var _select$getPostType;
|
|
57
|
+
|
|
58
|
+
if (postType === 'page') {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return !!((_select$getPostType = select(coreStore).getPostType(postType)) !== null && _select$getPostType !== void 0 && _select$getPostType.supports.excerpt);
|
|
63
|
+
}, [postType]);
|
|
64
|
+
/**
|
|
65
|
+
* The excerpt is editable if:
|
|
66
|
+
* - The user can edit the post
|
|
67
|
+
* - It is not a descendent of a Query Loop block
|
|
68
|
+
* - The post type supports excerpts
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
const isEditable = userCanEdit && !isDescendentOfQueryLoop && postTypeSupportsExcerpts;
|
|
44
72
|
const blockProps = useBlockProps({
|
|
45
73
|
className: classnames({
|
|
46
74
|
[`has-text-align-${textAlign}`]: textAlign
|
|
@@ -98,11 +126,11 @@ export default function PostExcerptEditor(_ref) {
|
|
|
98
126
|
* the raw and the rendered excerpt depending on which is being used.
|
|
99
127
|
*/
|
|
100
128
|
|
|
101
|
-
const rawOrRenderedExcerpt =
|
|
129
|
+
const rawOrRenderedExcerpt = (rawExcerpt || strippedRenderedExcerpt).trim();
|
|
102
130
|
let trimmedExcerpt = '';
|
|
103
131
|
|
|
104
132
|
if (wordCountType === 'words') {
|
|
105
|
-
trimmedExcerpt = rawOrRenderedExcerpt.
|
|
133
|
+
trimmedExcerpt = rawOrRenderedExcerpt.split(' ', excerptLength).join(' ');
|
|
106
134
|
} else if (wordCountType === 'characters_excluding_spaces') {
|
|
107
135
|
/*
|
|
108
136
|
* 1. Split the excerpt at the character limit,
|
|
@@ -112,23 +140,23 @@ export default function PostExcerptEditor(_ref) {
|
|
|
112
140
|
* 3. Add the number to the length of the visible excerpt,
|
|
113
141
|
* so that the spaces are excluded from the word count.
|
|
114
142
|
*/
|
|
115
|
-
const excerptWithSpaces = rawOrRenderedExcerpt.
|
|
143
|
+
const excerptWithSpaces = rawOrRenderedExcerpt.split('', excerptLength).join('');
|
|
116
144
|
const numberOfSpaces = excerptWithSpaces.length - excerptWithSpaces.replaceAll(' ', '').length;
|
|
117
|
-
trimmedExcerpt = rawOrRenderedExcerpt.
|
|
145
|
+
trimmedExcerpt = rawOrRenderedExcerpt.split('', excerptLength + numberOfSpaces).join('');
|
|
118
146
|
} else if (wordCountType === 'characters_including_spaces') {
|
|
119
|
-
trimmedExcerpt = rawOrRenderedExcerpt.
|
|
147
|
+
trimmedExcerpt = rawOrRenderedExcerpt.split('', excerptLength).join('');
|
|
120
148
|
}
|
|
121
149
|
|
|
122
|
-
|
|
150
|
+
const isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;
|
|
123
151
|
const excerptContent = isEditable ? createElement(RichText, {
|
|
124
152
|
className: excerptClassName,
|
|
125
153
|
"aria-label": __('Post excerpt text'),
|
|
126
|
-
value: isSelected ? rawOrRenderedExcerpt : (
|
|
154
|
+
value: isSelected ? rawOrRenderedExcerpt : (!isTrimmed ? rawOrRenderedExcerpt : trimmedExcerpt + ELLIPSIS) || __('No post excerpt found'),
|
|
127
155
|
onChange: setExcerpt,
|
|
128
156
|
tagName: "p"
|
|
129
157
|
}) : createElement("p", {
|
|
130
158
|
className: excerptClassName
|
|
131
|
-
},
|
|
159
|
+
}, !isTrimmed ? rawOrRenderedExcerpt || __('No post excerpt found') : trimmedExcerpt + ELLIPSIS);
|
|
132
160
|
return createElement(Fragment, null, createElement(BlockControls, null, createElement(AlignmentToolbar, {
|
|
133
161
|
value: textAlign,
|
|
134
162
|
onChange: newAlign => setAttributes({
|
|
@@ -150,7 +178,6 @@ export default function PostExcerptEditor(_ref) {
|
|
|
150
178
|
setAttributes({
|
|
151
179
|
excerptLength: value
|
|
152
180
|
});
|
|
153
|
-
setExcerpt();
|
|
154
181
|
},
|
|
155
182
|
min: "10",
|
|
156
183
|
max: "100"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-excerpt/edit.js"],"names":["classnames","useEntityProp","useMemo","AlignmentToolbar","BlockControls","InspectorControls","RichText","Warning","useBlockProps","PanelBody","ToggleControl","RangeControl","__","_x","useCanEditEntity","PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","excerptLength","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","isEditable","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","blockProps","className","wordCountType","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","newAlign","readMoreLink","newMoreText","excerptClassName","rawOrRenderedExcerpt","trimmedExcerpt","trim","split","join","excerptWithSpaces","numberOfSpaces","length","replaceAll","excerptContent","newShowMoreOnNewLine","value"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACCC,gBADD,E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AKlBA,YARF,CAjCD,CADD;AA+CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl, RangeControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine, excerptLength },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst isEditable = userCanEdit && ! isDescendentOfQueryLoop;\n\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\t/**\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\tif ( ! postType || ! postId ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<AlignmentToolbar\n\t\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This is the Post Excerpt block, it will display the excerpt from single posts.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'There is no excerpt because this is a protected post.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '“Read more” link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\n\t/**\n\t * The excerpt length setting needs to be applied to both\n\t * the raw and the rendered excerpt depending on which is being used.\n\t */\n\tconst rawOrRenderedExcerpt = !! renderedExcerpt\n\t\t? strippedRenderedExcerpt\n\t\t: rawExcerpt;\n\n\tlet trimmedExcerpt = '';\n\tif ( wordCountType === 'words' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.trim()\n\t\t\t.split( ' ', excerptLength )\n\t\t\t.join( ' ' );\n\t} else if ( wordCountType === 'characters_excluding_spaces' ) {\n\t\t/*\n\t\t * 1. Split the excerpt at the character limit,\n\t\t * then join the substrings back into one string.\n\t\t * 2. Count the number of spaces in the excerpt\n\t\t * by comparing the lengths of the string with and without spaces.\n\t\t * 3. Add the number to the length of the visible excerpt,\n\t\t * so that the spaces are excluded from the word count.\n\t\t */\n\t\tconst excerptWithSpaces = rawOrRenderedExcerpt\n\t\t\t.trim()\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\n\t\tconst numberOfSpaces =\n\t\t\texcerptWithSpaces.length -\n\t\t\texcerptWithSpaces.replaceAll( ' ', '' ).length;\n\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.trim()\n\t\t\t.split( '', excerptLength + numberOfSpaces )\n\t\t\t.join( '' );\n\t} else if ( wordCountType === 'characters_including_spaces' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt.trim().split( '', excerptLength );\n\t}\n\n\ttrimmedExcerpt = trimmedExcerpt + '...';\n\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Post excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\tisSelected\n\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t: ( trimmedExcerpt !== '...' ? trimmedExcerpt : '' ) ||\n\t\t\t\t\t __( 'No post excerpt found' )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ trimmedExcerpt !== '...'\n\t\t\t\t? trimmedExcerpt\n\t\t\t\t: __( 'No post excerpt found' ) }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\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\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } );\n\t\t\t\t\t\t\tsetExcerpt();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin=\"10\"\n\t\t\t\t\t\tmax=\"100\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-excerpt/edit.js"],"names":["classnames","useEntityProp","store","coreStore","useMemo","AlignmentToolbar","BlockControls","InspectorControls","RichText","Warning","useBlockProps","PanelBody","ToggleControl","RangeControl","__","_x","useSelect","useCanEditEntity","ELLIPSIS","PostExcerptEditor","attributes","textAlign","moreText","showMoreOnNewLine","excerptLength","setAttributes","isSelected","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","userCanEdit","rawExcerpt","setExcerpt","rendered","renderedExcerpt","protected","isProtected","postTypeSupportsExcerpts","select","getPostType","supports","excerpt","isEditable","blockProps","className","wordCountType","strippedRenderedExcerpt","document","window","DOMParser","parseFromString","body","textContent","innerText","newAlign","readMoreLink","newMoreText","excerptClassName","rawOrRenderedExcerpt","trim","trimmedExcerpt","split","join","excerptWithSpaces","numberOfSpaces","length","replaceAll","isTrimmed","excerptContent","newShowMoreOnNewLine","value"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,KAAK,IAAIC,SAAjC,QAAkD,sBAAlD;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SACCC,gBADD,EAECC,aAFD,EAGCC,iBAHD,EAICC,QAJD,EAKCC,OALD,EAMCC,aAND,QAOO,yBAPP;AAQA,SAASC,SAAT,EAAoBC,aAApB,EAAmCC,YAAnC,QAAuD,uBAAvD;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,QAAiC,gBAAjC;AAEA,MAAMC,QAAQ,GAAG,GAAjB;AAEA,eAAe,SAASC,iBAAT,OAKX;AAAA,MALuC;AAC1CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,SAAF;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AAC;AAAb,KACGoC,YADH,CADkB,GAKlBA,YARF,CAhCD,CADD;AA8CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tAlignmentToolbar,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tWarning,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, ToggleControl, RangeControl } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useCanEditEntity } from '../utils/hooks';\n\nconst ELLIPSIS = '…';\n\nexport default function PostExcerptEditor( {\n\tattributes: { textAlign, moreText, showMoreOnNewLine, excerptLength },\n\tsetAttributes,\n\tisSelected,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useCanEditEntity( 'postType', postType, postId );\n\tconst [\n\t\trawExcerpt,\n\t\tsetExcerpt,\n\t\t{ rendered: renderedExcerpt, protected: isProtected } = {},\n\t] = useEntityProp( 'postType', postType, 'excerpt', postId );\n\n\t/**\n\t * Check if the post type supports excerpts.\n\t * Add an exception and return early for the \"page\" post type,\n\t * which is registered without support for the excerpt UI,\n\t * but supports saving the excerpt to the database.\n\t * See: https://core.trac.wordpress.org/browser/branches/6.1/src/wp-includes/post.php#L65\n\t * Without this exception, users that have excerpts saved to the database will\n\t * not be able to edit the excerpts.\n\t */\n\tconst postTypeSupportsExcerpts = useSelect(\n\t\t( select ) => {\n\t\t\tif ( postType === 'page' ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn !! select( coreStore ).getPostType( postType )?.supports\n\t\t\t\t.excerpt;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t/**\n\t * The excerpt is editable if:\n\t * - The user can edit the post\n\t * - It is not a descendent of a Query Loop block\n\t * - The post type supports excerpts\n\t */\n\tconst isEditable =\n\t\tuserCanEdit && ! isDescendentOfQueryLoop && postTypeSupportsExcerpts;\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\n\t/**\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\t/**\n\t * When excerpt is editable, strip the html tags from\n\t * rendered excerpt. This will be used if the entity's\n\t * excerpt has been produced from the content.\n\t */\n\tconst strippedRenderedExcerpt = useMemo( () => {\n\t\tif ( ! renderedExcerpt ) return '';\n\t\tconst document = new window.DOMParser().parseFromString(\n\t\t\trenderedExcerpt,\n\t\t\t'text/html'\n\t\t);\n\t\treturn document.body.textContent || document.body.innerText || '';\n\t}, [ renderedExcerpt ] );\n\n\tif ( ! postType || ! postId ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<AlignmentToolbar\n\t\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This is the Post Excerpt block, it will display the excerpt from single posts.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'If there are any Custom Post Types with support for excerpts, the Post Excerpt block can display the excerpts of those entries as well.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</>\n\t\t);\n\t}\n\tif ( isProtected && ! userCanEdit ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'There is no excerpt because this is a protected post.'\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</div>\n\t\t);\n\t}\n\tconst readMoreLink = (\n\t\t<RichText\n\t\t\tclassName=\"wp-block-post-excerpt__more-link\"\n\t\t\ttagName=\"a\"\n\t\t\taria-label={ __( '“Read more” link text' ) }\n\t\t\tplaceholder={ __( 'Add \"read more\" link text' ) }\n\t\t\tvalue={ moreText }\n\t\t\tonChange={ ( newMoreText ) =>\n\t\t\t\tsetAttributes( { moreText: newMoreText } )\n\t\t\t}\n\t\t\twithoutInteractiveFormatting={ true }\n\t\t/>\n\t);\n\tconst excerptClassName = classnames( 'wp-block-post-excerpt__excerpt', {\n\t\t'is-inline': ! showMoreOnNewLine,\n\t} );\n\n\t/**\n\t * The excerpt length setting needs to be applied to both\n\t * the raw and the rendered excerpt depending on which is being used.\n\t */\n\tconst rawOrRenderedExcerpt = (\n\t\trawExcerpt || strippedRenderedExcerpt\n\t).trim();\n\n\tlet trimmedExcerpt = '';\n\tif ( wordCountType === 'words' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( ' ', excerptLength )\n\t\t\t.join( ' ' );\n\t} else if ( wordCountType === 'characters_excluding_spaces' ) {\n\t\t/*\n\t\t * 1. Split the excerpt at the character limit,\n\t\t * then join the substrings back into one string.\n\t\t * 2. Count the number of spaces in the excerpt\n\t\t * by comparing the lengths of the string with and without spaces.\n\t\t * 3. Add the number to the length of the visible excerpt,\n\t\t * so that the spaces are excluded from the word count.\n\t\t */\n\t\tconst excerptWithSpaces = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\n\t\tconst numberOfSpaces =\n\t\t\texcerptWithSpaces.length -\n\t\t\texcerptWithSpaces.replaceAll( ' ', '' ).length;\n\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength + numberOfSpaces )\n\t\t\t.join( '' );\n\t} else if ( wordCountType === 'characters_including_spaces' ) {\n\t\ttrimmedExcerpt = rawOrRenderedExcerpt\n\t\t\t.split( '', excerptLength )\n\t\t\t.join( '' );\n\t}\n\n\tconst isTrimmed = trimmedExcerpt !== rawOrRenderedExcerpt;\n\n\tconst excerptContent = isEditable ? (\n\t\t<RichText\n\t\t\tclassName={ excerptClassName }\n\t\t\taria-label={ __( 'Post excerpt text' ) }\n\t\t\tvalue={\n\t\t\t\tisSelected\n\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t: ( ! isTrimmed\n\t\t\t\t\t\t\t? rawOrRenderedExcerpt\n\t\t\t\t\t\t\t: trimmedExcerpt + ELLIPSIS ) ||\n\t\t\t\t\t __( 'No post excerpt found' )\n\t\t\t}\n\t\t\tonChange={ setExcerpt }\n\t\t\ttagName=\"p\"\n\t\t/>\n\t) : (\n\t\t<p className={ excerptClassName }>\n\t\t\t{ ! isTrimmed\n\t\t\t\t? rawOrRenderedExcerpt || __( 'No post excerpt found' )\n\t\t\t\t: trimmedExcerpt + ELLIPSIS }\n\t\t</p>\n\t);\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<AlignmentToolbar\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( { textAlign: newAlign } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Show link on new line' ) }\n\t\t\t\t\t\tchecked={ showMoreOnNewLine }\n\t\t\t\t\t\tonChange={ ( newShowMoreOnNewLine ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowMoreOnNewLine: newShowMoreOnNewLine,\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\t<RangeControl\n\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmin=\"10\"\n\t\t\t\t\t\tmax=\"100\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ excerptContent }\n\t\t\t\t{ ! showMoreOnNewLine && ' ' }\n\t\t\t\t{ showMoreOnNewLine ? (\n\t\t\t\t\t<p className=\"wp-block-post-excerpt__more-text\">\n\t\t\t\t\t\t{ readMoreLink }\n\t\t\t\t\t</p>\n\t\t\t\t) : (\n\t\t\t\t\treadMoreLink\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -164,7 +164,7 @@ const DimensionControls = _ref => {
|
|
|
164
164
|
isBlock: true
|
|
165
165
|
}, SCALE_OPTIONS)), !!imageSizeOptions.length && createElement(ToolsPanelItem, {
|
|
166
166
|
hasValue: () => !!sizeSlug,
|
|
167
|
-
label: __('
|
|
167
|
+
label: __('Resolution'),
|
|
168
168
|
onDeselect: () => setAttributes({
|
|
169
169
|
sizeSlug: undefined
|
|
170
170
|
}),
|
|
@@ -175,7 +175,7 @@ const DimensionControls = _ref => {
|
|
|
175
175
|
panelId: clientId
|
|
176
176
|
}, createElement(SelectControl, {
|
|
177
177
|
__nextHasNoMarginBottom: true,
|
|
178
|
-
label: __('
|
|
178
|
+
label: __('Resolution'),
|
|
179
179
|
value: sizeSlug || DEFAULT_SIZE,
|
|
180
180
|
options: imageSizeOptions,
|
|
181
181
|
onChange: nextSizeSlug => setAttributes({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-featured-image/dimension-controls.js"],"names":["__","_x","SelectControl","__experimentalUnitControl","UnitControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalUseCustomUnits","useCustomUnits","__experimentalToolsPanelItem","ToolsPanelItem","InspectorControls","useSetting","SCALE_OPTIONS","DEFAULT_SCALE","DEFAULT_SIZE","scaleHelp","cover","contain","fill","DimensionControls","clientId","attributes","aspectRatio","width","height","scale","sizeSlug","setAttributes","imageSizeOptions","defaultUnits","units","availableUnits","onDimensionChange","dimension","nextValue","parsedValue","parseFloat","isNaN","scaleLabel","undefined","label","value","nextAspectRatio","nextHeight","nextWidth","length","nextSizeSlug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SACCC,aADD,EAECC,yBAAyB,IAAIC,WAF9B,EAGCC,gCAAgC,IAAIC,kBAHrC,EAICC,sCAAsC,IAAIC,wBAJ3C,EAKCC,4BAA4B,IAAIC,cALjC,EAMCC,4BAA4B,IAAIC,cANjC,QAOO,uBAPP;AAQA,SAASC,iBAAT,EAA4BC,UAA5B,QAA8C,yBAA9C;AAEA,MAAMC,aAAa,GAClB,8BACC,cAAC,wBAAD;AACC,EAAA,KAAK,EAAC,OADP;AAEC,EAAA,KAAK,EAAGd,EAAE,CAAE,OAAF,EAAW,0CAAX;AAFX,EADD,EAKC,cAAC,wBAAD;AACC,EAAA,KAAK,EAAC,SADP;AAEC,EAAA,KAAK,EAAGA,EAAE,CACT,SADS,EAET,0CAFS;AAFX,EALD,EAYC,cAAC,wBAAD;AACC,EAAA,KAAK,EAAC,MADP;AAEC,EAAA,KAAK,EAAGA,EAAE,CAAE,MAAF,EAAU,0CAAV;AAFX,EAZD,CADD;AAoBA,MAAMe,aAAa,GAAG,OAAtB;AACA,MAAMC,YAAY,GAA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CANlB;AASC,IAAA,gBAAgB,EAAG,KATpB;AAUC,IAAA,OAAO,EAAGnB;AAVX,KAYC,cAAC,aAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGvB,EAAE,CAAE,YAAF,CAFX;AAGC,IAAA,KAAK,EAAG6B,QAAQ,IAAIZ,YAHrB;AAIC,IAAA,OAAO,EAAGc,gBAJX;AAKC,IAAA,QAAQ,EAAKkB,YAAF,IACVnB,aAAa,CAAE;AAAED,MAAAA,QAAQ,EAAEoB;AAAZ,KAAF,CANf;AAQC,IAAA,IAAI,EAAGjD,EAAE,CAAE,sCAAF;AARV,IAZD,CAnIF,CADD;AA8JA,CArLD;;AAuLA,eAAesB,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tSelectControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { InspectorControls, useSetting } from '@wordpress/block-editor';\n\nconst SCALE_OPTIONS = (\n\t<>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"cover\"\n\t\t\tlabel={ _x( 'Cover', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"contain\"\n\t\t\tlabel={ _x(\n\t\t\t\t'Contain',\n\t\t\t\t'Scale option for Image dimension control'\n\t\t\t) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"fill\"\n\t\t\tlabel={ _x( 'Fill', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t</>\n);\n\nconst DEFAULT_SCALE = 'cover';\nconst DEFAULT_SIZE = 'full';\n\nconst scaleHelp = {\n\tcover: __(\n\t\t'Image is scaled and cropped to fill the entire space without being distorted.'\n\t),\n\tcontain: __(\n\t\t'Image is scaled to fill the space without clipping nor distorting.'\n\t),\n\tfill: __(\n\t\t'Image will be stretched and distorted to completely fill the space.'\n\t),\n};\n\nconst DimensionControls = ( {\n\tclientId,\n\tattributes: { aspectRatio, width, height, scale, sizeSlug },\n\tsetAttributes,\n\timageSizeOptions = [],\n} ) => {\n\tconst defaultUnits = [ 'px', '%', 'vw', 'em', 'rem' ];\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || defaultUnits,\n\t} );\n\tconst onDimensionChange = ( dimension, nextValue ) => {\n\t\tconst parsedValue = parseFloat( nextValue );\n\t\t/**\n\t\t * If we have no value set and we change the unit,\n\t\t * we don't want to set the attribute, as it would\n\t\t * end up having the unit as value without any number.\n\t\t */\n\t\tif ( isNaN( parsedValue ) && nextValue ) return;\n\t\tsetAttributes( {\n\t\t\t[ dimension ]: parsedValue < 0 ? '0' : nextValue,\n\t\t} );\n\t};\n\tconst scaleLabel = _x( 'Scale', 'Image scaling options' );\n\treturn (\n\t\t<InspectorControls group=\"dimensions\">\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! aspectRatio }\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { aspectRatio: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\t\tvalue={ aspectRatio }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t// These should use the same values as AspectRatioDropdown in @wordpress/block-editor\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Original' ),\n\t\t\t\t\t\t\tvalue: 'auto',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Square' ),\n\t\t\t\t\t\t\tvalue: '1',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '16:9' ),\n\t\t\t\t\t\t\tvalue: '16/9',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '4:3' ),\n\t\t\t\t\t\t\tvalue: '4/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:2' ),\n\t\t\t\t\t\t\tvalue: '3/2',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '9:16' ),\n\t\t\t\t\t\t\tvalue: '9/16',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:4' ),\n\t\t\t\t\t\t\tvalue: '3/4',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '2:3' ),\n\t\t\t\t\t\t\tvalue: '2/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( nextAspectRatio ) =>\n\t\t\t\t\t\tsetAttributes( { aspectRatio: nextAspectRatio } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! height }\n\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { height: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\theight: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ height || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\tonDimensionChange( 'height', nextHeight )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! width }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\tonDimensionChange( 'width', nextWidth )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t{ ( height || aspectRatio ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! scale && scale !== DEFAULT_SCALE }\n\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tscale: DEFAULT_SCALE,\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\tscale: DEFAULT_SCALE,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\thelp={ scaleHelp[ scale ] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tscale: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t{ SCALE_OPTIONS }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ !! imageSizeOptions.length && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! sizeSlug }\n\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { sizeSlug: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tsizeSlug: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Image size' ) }\n\t\t\t\t\t\tvalue={ sizeSlug || DEFAULT_SIZE }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __( 'Select the size of the source image.' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n};\n\nexport default DimensionControls;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-featured-image/dimension-controls.js"],"names":["__","_x","SelectControl","__experimentalUnitControl","UnitControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalUseCustomUnits","useCustomUnits","__experimentalToolsPanelItem","ToolsPanelItem","InspectorControls","useSetting","SCALE_OPTIONS","DEFAULT_SCALE","DEFAULT_SIZE","scaleHelp","cover","contain","fill","DimensionControls","clientId","attributes","aspectRatio","width","height","scale","sizeSlug","setAttributes","imageSizeOptions","defaultUnits","units","availableUnits","onDimensionChange","dimension","nextValue","parsedValue","parseFloat","isNaN","scaleLabel","undefined","label","value","nextAspectRatio","nextHeight","nextWidth","length","nextSizeSlug"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SACCC,aADD,EAECC,yBAAyB,IAAIC,WAF9B,EAGCC,gCAAgC,IAAIC,kBAHrC,EAICC,sCAAsC,IAAIC,wBAJ3C,EAKCC,4BAA4B,IAAIC,cALjC,EAMCC,4BAA4B,IAAIC,cANjC,QAOO,uBAPP;AAQA,SAASC,iBAAT,EAA4BC,UAA5B,QAA8C,yBAA9C;AAEA,MAAMC,aAAa,GAClB,8BACC,cAAC,wBAAD;AACC,EAAA,KAAK,EAAC,OADP;AAEC,EAAA,KAAK,EAAGd,EAAE,CAAE,OAAF,EAAW,0CAAX;AAFX,EADD,EAKC,cAAC,wBAAD;AACC,EAAA,KAAK,EAAC,SADP;AAEC,EAAA,KAAK,EAAGA,EAAE,CACT,SADS,EAET,0CAFS;AAFX,EALD,EAYC,cAAC,wBAAD;AACC,EAAA,KAAK,EAAC,MADP;AAEC,EAAA,KAAK,EAAGA,EAAE,CAAE,MAAF,EAAU,0CAAV;AAFX,EAZD,CADD;AAoBA,MAAMe,aAAa,GAAG,OAAtB;AACA,MAAMC,YAAY,GAAG,MAArB;AAEA,MAAMC,SAAS,GAAG;AACjBC,EAAAA,KAAK,EAAEnB,EAAE,CACR,+EADQ,CADQ;AAIjBoB,EAAAA,OAAO,EAAEpB,EAAE,CACV,oEADU,CAJM;AAOjBqB,EAAAA,IAAI,EAAErB,EAAE,CACP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,EAAG6B,QAAQ,IAAIZ,YAHrB;AAIC,IAAA,OAAO,EAAGc,gBAJX;AAKC,IAAA,QAAQ,EAAKkB,YAAF,IACVnB,aAAa,CAAE;AAAED,MAAAA,QAAQ,EAAEoB;AAAZ,KAAF,CANf;AAQC,IAAA,IAAI,EAAGjD,EAAE,CAAE,sCAAF;AARV,IAZD,CAnIF,CADD;AA8JA,CArLD;;AAuLA,eAAesB,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tSelectControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { InspectorControls, useSetting } from '@wordpress/block-editor';\n\nconst SCALE_OPTIONS = (\n\t<>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"cover\"\n\t\t\tlabel={ _x( 'Cover', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"contain\"\n\t\t\tlabel={ _x(\n\t\t\t\t'Contain',\n\t\t\t\t'Scale option for Image dimension control'\n\t\t\t) }\n\t\t/>\n\t\t<ToggleGroupControlOption\n\t\t\tvalue=\"fill\"\n\t\t\tlabel={ _x( 'Fill', 'Scale option for Image dimension control' ) }\n\t\t/>\n\t</>\n);\n\nconst DEFAULT_SCALE = 'cover';\nconst DEFAULT_SIZE = 'full';\n\nconst scaleHelp = {\n\tcover: __(\n\t\t'Image is scaled and cropped to fill the entire space without being distorted.'\n\t),\n\tcontain: __(\n\t\t'Image is scaled to fill the space without clipping nor distorting.'\n\t),\n\tfill: __(\n\t\t'Image will be stretched and distorted to completely fill the space.'\n\t),\n};\n\nconst DimensionControls = ( {\n\tclientId,\n\tattributes: { aspectRatio, width, height, scale, sizeSlug },\n\tsetAttributes,\n\timageSizeOptions = [],\n} ) => {\n\tconst defaultUnits = [ 'px', '%', 'vw', 'em', 'rem' ];\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: useSetting( 'spacing.units' ) || defaultUnits,\n\t} );\n\tconst onDimensionChange = ( dimension, nextValue ) => {\n\t\tconst parsedValue = parseFloat( nextValue );\n\t\t/**\n\t\t * If we have no value set and we change the unit,\n\t\t * we don't want to set the attribute, as it would\n\t\t * end up having the unit as value without any number.\n\t\t */\n\t\tif ( isNaN( parsedValue ) && nextValue ) return;\n\t\tsetAttributes( {\n\t\t\t[ dimension ]: parsedValue < 0 ? '0' : nextValue,\n\t\t} );\n\t};\n\tconst scaleLabel = _x( 'Scale', 'Image scaling options' );\n\treturn (\n\t\t<InspectorControls group=\"dimensions\">\n\t\t\t<ToolsPanelItem\n\t\t\t\thasValue={ () => !! aspectRatio }\n\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { aspectRatio: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\taspectRatio: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Aspect ratio' ) }\n\t\t\t\t\tvalue={ aspectRatio }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t// These should use the same values as AspectRatioDropdown in @wordpress/block-editor\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Original' ),\n\t\t\t\t\t\t\tvalue: 'auto',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Square' ),\n\t\t\t\t\t\t\tvalue: '1',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '16:9' ),\n\t\t\t\t\t\t\tvalue: '16/9',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '4:3' ),\n\t\t\t\t\t\t\tvalue: '4/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:2' ),\n\t\t\t\t\t\t\tvalue: '3/2',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '9:16' ),\n\t\t\t\t\t\t\tvalue: '9/16',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '3:4' ),\n\t\t\t\t\t\t\tvalue: '3/4',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( '2:3' ),\n\t\t\t\t\t\t\tvalue: '2/3',\n\t\t\t\t\t\t},\n\t\t\t\t\t] }\n\t\t\t\t\tonChange={ ( nextAspectRatio ) =>\n\t\t\t\t\t\tsetAttributes( { aspectRatio: nextAspectRatio } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! height }\n\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { height: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\theight: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ height || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextHeight ) =>\n\t\t\t\t\t\tonDimensionChange( 'height', nextHeight )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t<ToolsPanelItem\n\t\t\t\tclassName=\"single-column\"\n\t\t\t\thasValue={ () => !! width }\n\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\tonDeselect={ () => setAttributes( { width: undefined } ) }\n\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\twidth: undefined,\n\t\t\t\t} ) }\n\t\t\t\tisShownByDefault={ true }\n\t\t\t\tpanelId={ clientId }\n\t\t\t>\n\t\t\t\t<UnitControl\n\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\tvalue={ width || '' }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ ( nextWidth ) =>\n\t\t\t\t\t\tonDimensionChange( 'width', nextWidth )\n\t\t\t\t\t}\n\t\t\t\t\tunits={ units }\n\t\t\t\t/>\n\t\t\t</ToolsPanelItem>\n\t\t\t{ ( height || aspectRatio ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! scale && scale !== DEFAULT_SCALE }\n\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tscale: DEFAULT_SCALE,\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\tscale: DEFAULT_SCALE,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ scaleLabel }\n\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\thelp={ scaleHelp[ scale ] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tscale: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t>\n\t\t\t\t\t\t{ SCALE_OPTIONS }\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ !! imageSizeOptions.length && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! sizeSlug }\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { sizeSlug: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tsizeSlug: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\t\tvalue={ sizeSlug || DEFAULT_SIZE }\n\t\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\t\tonChange={ ( nextSizeSlug ) =>\n\t\t\t\t\t\t\tsetAttributes( { sizeSlug: nextSizeSlug } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={ __( 'Select the size of the source image.' ) }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n};\n\nexport default DimensionControls;\n"]}
|
|
@@ -19,7 +19,23 @@ const metadata = {
|
|
|
19
19
|
},
|
|
20
20
|
supports: {
|
|
21
21
|
html: false,
|
|
22
|
-
|
|
22
|
+
spacing: {
|
|
23
|
+
margin: true,
|
|
24
|
+
padding: true
|
|
25
|
+
},
|
|
26
|
+
typography: {
|
|
27
|
+
fontSize: true,
|
|
28
|
+
lineHeight: true,
|
|
29
|
+
__experimentalFontFamily: true,
|
|
30
|
+
__experimentalFontWeight: true,
|
|
31
|
+
__experimentalFontStyle: true,
|
|
32
|
+
__experimentalTextTransform: true,
|
|
33
|
+
__experimentalTextDecoration: true,
|
|
34
|
+
__experimentalLetterSpacing: true,
|
|
35
|
+
__experimentalDefaultControls: {
|
|
36
|
+
fontSize: true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
23
39
|
}
|
|
24
40
|
};
|
|
25
41
|
import edit from './edit';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-time-to-read/index.js"],"names":["initBlock","edit","icon","name","metadata","settings","init"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,qBAAtB
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-time-to-read/index.js"],"names":["initBlock","edit","icon","name","metadata","settings","init"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,qBAAtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,IAAP,MAAiB,QAAjB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AACA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBH,EAAAA,IADuB;AAEvBD,EAAAA;AAFuB,CAAjB;AAKP,OAAO,MAAMK,IAAI,GAAG,MAAMN,SAAS,CAAE;AAAEG,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAF,CAA5B","sourcesContent":["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport icon from './icon';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/quote/index.js"],"names":["__","quote","icon","initBlock","deprecated","edit","save","transforms","name","metadata","settings","example","attributes","citation","innerBlocks","content","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,IAAlB,QAA8B,kBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,IAAP,MAAiB,QAAjB
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/quote/index.js"],"names":["__","quote","icon","initBlock","deprecated","edit","save","transforms","name","metadata","settings","example","attributes","citation","innerBlocks","content","init"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,IAAlB,QAA8B,kBAA9B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,qBAAtB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,IAAP,MAAiB,QAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AAEA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBR,EAAAA,IADuB;AAEvBS,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,QAAQ,EAAE;AADC,KADJ;AAIRC,IAAAA,WAAW,EAAE,CACZ;AACCN,MAAAA,IAAI,EAAE,gBADP;AAECI,MAAAA,UAAU,EAAE;AACXG,QAAAA,OAAO,EAAEf,EAAE,CAAE,uCAAF;AADA;AAFb,KADY;AAJL,GAFc;AAevBO,EAAAA,UAfuB;AAgBvBF,EAAAA,IAhBuB;AAiBvBC,EAAAA,IAjBuB;AAkBvBF,EAAAA;AAlBuB,CAAjB;AAqBP,OAAO,MAAMY,IAAI,GAAG,MAAMb,SAAS,CAAE;AAAEK,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAF,CAA5B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { quote 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\tcitation: 'Julio Cortázar',\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: __( 'In quoting others, we cite ourselves.' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"]}
|
|
@@ -79,11 +79,19 @@ const SpacerEdit = _ref2 => {
|
|
|
79
79
|
isSelected,
|
|
80
80
|
setAttributes,
|
|
81
81
|
toggleSelection,
|
|
82
|
-
context
|
|
82
|
+
context,
|
|
83
|
+
__unstableParentLayout: parentLayout
|
|
83
84
|
} = _ref2;
|
|
84
85
|
const {
|
|
85
86
|
orientation
|
|
86
87
|
} = context;
|
|
88
|
+
const {
|
|
89
|
+
orientation: parentOrientation,
|
|
90
|
+
type
|
|
91
|
+
} = parentLayout || {}; // If the spacer is inside a flex container, it should either inherit the orientation
|
|
92
|
+
// of the parent or use the flex default orientation.
|
|
93
|
+
|
|
94
|
+
const inheritedOrientation = !parentOrientation && type === 'flex' ? 'horizontal' : parentOrientation || orientation;
|
|
87
95
|
const {
|
|
88
96
|
height,
|
|
89
97
|
width
|
|
@@ -113,8 +121,10 @@ const SpacerEdit = _ref2 => {
|
|
|
113
121
|
};
|
|
114
122
|
|
|
115
123
|
const style = {
|
|
116
|
-
height:
|
|
117
|
-
width:
|
|
124
|
+
height: inheritedOrientation === 'horizontal' ? 24 : temporaryHeight || height || undefined,
|
|
125
|
+
width: inheritedOrientation === 'horizontal' ? temporaryWidth || width || undefined : undefined,
|
|
126
|
+
// In vertical flex containers, the spacer shrinks to nothing without a minimum width.
|
|
127
|
+
minWidth: inheritedOrientation === 'vertical' && type === 'flex' ? 48 : undefined
|
|
118
128
|
};
|
|
119
129
|
|
|
120
130
|
const resizableBoxWithOrientation = blockOrientation => {
|
|
@@ -164,7 +174,7 @@ const SpacerEdit = _ref2 => {
|
|
|
164
174
|
};
|
|
165
175
|
|
|
166
176
|
useEffect(() => {
|
|
167
|
-
if (
|
|
177
|
+
if (inheritedOrientation === 'horizontal' && !width) {
|
|
168
178
|
setAttributes({
|
|
169
179
|
height: '0px',
|
|
170
180
|
width: '72px'
|
|
@@ -173,11 +183,11 @@ const SpacerEdit = _ref2 => {
|
|
|
173
183
|
}, []);
|
|
174
184
|
return createElement(Fragment, null, createElement(View, useBlockProps({
|
|
175
185
|
style
|
|
176
|
-
}), resizableBoxWithOrientation(
|
|
186
|
+
}), resizableBoxWithOrientation(inheritedOrientation)), createElement(SpacerControls, {
|
|
177
187
|
setAttributes: setAttributes,
|
|
178
188
|
height: temporaryHeight || height,
|
|
179
189
|
width: temporaryWidth || width,
|
|
180
|
-
orientation:
|
|
190
|
+
orientation: inheritedOrientation,
|
|
181
191
|
isResizing: isResizing
|
|
182
192
|
}));
|
|
183
193
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/spacer/edit.js"],"names":["classnames","useBlockProps","ResizableBox","useState","useEffect","View","SpacerControls","MIN_SPACER_SIZE","ResizableSpacer","orientation","onResizeStart","onResize","onResizeStop","isSelected","isResizing","setIsResizing","props","getCurrentSize","elt","clientWidth","clientHeight","getNextVal","_event","_direction","nextVal","axis","position","isVisible","SpacerEdit","attributes","setAttributes","toggleSelection","context","height","width","temporaryHeight","setTemporaryHeight","temporaryWidth","setTemporaryWidth","handleOnVerticalResizeStop","newHeight","handleOnHorizontalResizeStop","newWidth","style","undefined","resizableBoxWithOrientation","blockOrientation","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SAASC,IAAT,QAAqB,uBAArB;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,YAA3B;AACA,SAASC,eAAT,QAAgC,aAAhC;;AAEA,MAAMC,eAAe,GAAG,QASjB;AAAA,MATmB;AACzBC,IAAAA,WADyB;AAEzBC,IAAAA,aAFyB;AAGzBC,IAAAA,QAHyB;AAIzBC,IAAAA,YAJyB;AAKzBC,IAAAA,UALyB;AAMzBC,IAAAA,UANyB;AAOzBC,IAAAA,aAPyB;AAQzB,OAAGC;AARsB,GASnB;;AACN,QAAMC,cAAc,GAAKC,GAAF,IAAW;AACjC,WAAOT,WAAW,KAAK,YAAhB,GACJS,GAAG,CAACC,WADA,GAEJD,GAAG,CAACE,YAFP;AAGA,GAJD;;AAMA,QAAMC,UAAU,GAAKH,GAAF,IAAW;AAC7B,WAAQ,GAAGD,cAAc,CAAEC,GAAF,CAAS,IAAlC;AACA,GAFD;;AAIA,SACC,cAAC,YAAD;AACC,IAAA,SAAS,EAAGlB,UAAU,CAAE,wCAAF,EAA4C;AACjE,2BAAqBS,WAAW,KAAK,YAD4B;AAEjE,qBAAeK,UAFkD;AAGjE,qBAAeD;AAHkD,KAA5C,CADvB;AAMC,IAAA,aAAa,EAAG,CAAES,MAAF,EAAUC,UAAV,EAAsBL,GAAtB,KAA+B;AAC9C,YAAMM,OAAO,GAAGH,UAAU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GAAF,CAAxB,EACGE,2BAA2B,CAAEpC,WAAF,CAD9B,CADD,EAIC,cAAC,cAAD;AACC,IAAA,aAAa,EAAGqB,aADjB;AAEC,IAAA,MAAM,EAAGK,eAAe,IAAIF,MAF7B;AAGC,IAAA,KAAK,EAAGI,cAAc,IAAIH,KAH3B;AAIC,IAAA,WAAW,EAAGzB,WAJf;AAKC,IAAA,UAAU,EAAGK;AALd,IAJD,CADD;AAcA,CApHD;;AAsHA,eAAec,UAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport SpacerControls from './controls';\nimport { MIN_SPACER_SIZE } from './constants';\n\nconst ResizableSpacer = ( {\n\torientation,\n\tonResizeStart,\n\tonResize,\n\tonResizeStop,\n\tisSelected,\n\tisResizing,\n\tsetIsResizing,\n\t...props\n} ) => {\n\tconst getCurrentSize = ( elt ) => {\n\t\treturn orientation === 'horizontal'\n\t\t\t? elt.clientWidth\n\t\t\t: elt.clientHeight;\n\t};\n\n\tconst getNextVal = ( elt ) => {\n\t\treturn `${ getCurrentSize( elt ) }px`;\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ classnames( 'block-library-spacer__resize-container', {\n\t\t\t\t'resize-horizontal': orientation === 'horizontal',\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tonResizeStart={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getNextVal( elt );\n\t\t\t\tonResizeStart( nextVal );\n\t\t\t\tonResize( nextVal );\n\t\t\t} }\n\t\t\tonResize={ ( _event, _direction, elt ) => {\n\t\t\t\tonResize( getNextVal( elt ) );\n\t\t\t\tif ( ! isResizing ) {\n\t\t\t\t\tsetIsResizing( true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonResizeStop={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getCurrentSize( elt );\n\t\t\t\tonResizeStop( `${ nextVal }px` );\n\t\t\t\tsetIsResizing( false );\n\t\t\t} }\n\t\t\t__experimentalShowTooltip={ true }\n\t\t\t__experimentalTooltipProps={ {\n\t\t\t\taxis: orientation === 'horizontal' ? 'x' : 'y',\n\t\t\t\tposition: 'corner',\n\t\t\t\tisVisible: isResizing,\n\t\t\t} }\n\t\t\tshowHandle={ isSelected }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n};\n\nconst SpacerEdit = ( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\ttoggleSelection,\n\tcontext,\n} ) => {\n\tconst { orientation } = context;\n\tconst { height, width } = attributes;\n\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ temporaryHeight, setTemporaryHeight ] = useState( null );\n\tconst [ temporaryWidth, setTemporaryWidth ] = useState( null );\n\n\tconst onResizeStart = () => toggleSelection( false );\n\tconst onResizeStop = () => toggleSelection( true );\n\n\tconst handleOnVerticalResizeStop = ( newHeight ) => {\n\t\tonResizeStop();\n\n\t\tsetAttributes( { height: newHeight } );\n\t\tsetTemporaryHeight( null );\n\t};\n\n\tconst handleOnHorizontalResizeStop = ( newWidth ) => {\n\t\tonResizeStop();\n\t\tsetAttributes( { width: newWidth } );\n\t\tsetTemporaryWidth( null );\n\t};\n\n\tconst style = {\n\t\theight:\n\t\t\torientation === 'horizontal'\n\t\t\t\t? 24\n\t\t\t\t: temporaryHeight || height || undefined,\n\t\twidth:\n\t\t\torientation === 'horizontal'\n\t\t\t\t? temporaryWidth || width || undefined\n\t\t\t\t: undefined,\n\t};\n\n\tconst resizableBoxWithOrientation = ( blockOrientation ) => {\n\t\tif ( blockOrientation === 'horizontal' ) {\n\t\t\treturn (\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminWidth={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: true,\n\t\t\t\t\t\tbottom: false,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryWidth }\n\t\t\t\t\tonResizeStop={ handleOnHorizontalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminHeight={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: false,\n\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryHeight }\n\t\t\t\t\tonResizeStop={ handleOnVerticalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tif ( orientation === 'horizontal' && ! width ) {\n\t\t\tsetAttributes( {\n\t\t\t\theight: '0px',\n\t\t\t\twidth: '72px',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<View { ...useBlockProps( { style } ) }>\n\t\t\t\t{ resizableBoxWithOrientation( orientation ) }\n\t\t\t</View>\n\t\t\t<SpacerControls\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\theight={ temporaryHeight || height }\n\t\t\t\twidth={ temporaryWidth || width }\n\t\t\t\torientation={ orientation }\n\t\t\t\tisResizing={ isResizing }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default SpacerEdit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/spacer/edit.js"],"names":["classnames","useBlockProps","ResizableBox","useState","useEffect","View","SpacerControls","MIN_SPACER_SIZE","ResizableSpacer","orientation","onResizeStart","onResize","onResizeStop","isSelected","isResizing","setIsResizing","props","getCurrentSize","elt","clientWidth","clientHeight","getNextVal","_event","_direction","nextVal","axis","position","isVisible","SpacerEdit","attributes","setAttributes","toggleSelection","context","__unstableParentLayout","parentLayout","parentOrientation","type","inheritedOrientation","height","width","temporaryHeight","setTemporaryHeight","temporaryWidth","setTemporaryWidth","handleOnVerticalResizeStop","newHeight","handleOnHorizontalResizeStop","newWidth","style","undefined","minWidth","resizableBoxWithOrientation","blockOrientation","top","right","bottom","left","topRight","bottomRight","bottomLeft","topLeft"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,yBAA9B;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AACA,SAASC,IAAT,QAAqB,uBAArB;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,YAA3B;AACA,SAASC,eAAT,QAAgC,aAAhC;;AAEA,MAAMC,eAAe,GAAG,QASjB;AAAA,MATmB;AACzBC,IAAAA,WADyB;AAEzBC,IAAAA,aAFyB;AAGzBC,IAAAA,QAHyB;AAIzBC,IAAAA,YAJyB;AAKzBC,IAAAA,UALyB;AAM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mIA,eAAec,UAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useBlockProps } from '@wordpress/block-editor';\nimport { ResizableBox } from '@wordpress/components';\nimport { useState, useEffect } from '@wordpress/element';\nimport { View } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport SpacerControls from './controls';\nimport { MIN_SPACER_SIZE } from './constants';\n\nconst ResizableSpacer = ( {\n\torientation,\n\tonResizeStart,\n\tonResize,\n\tonResizeStop,\n\tisSelected,\n\tisResizing,\n\tsetIsResizing,\n\t...props\n} ) => {\n\tconst getCurrentSize = ( elt ) => {\n\t\treturn orientation === 'horizontal'\n\t\t\t? elt.clientWidth\n\t\t\t: elt.clientHeight;\n\t};\n\n\tconst getNextVal = ( elt ) => {\n\t\treturn `${ getCurrentSize( elt ) }px`;\n\t};\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tclassName={ classnames( 'block-library-spacer__resize-container', {\n\t\t\t\t'resize-horizontal': orientation === 'horizontal',\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t\t'is-selected': isSelected,\n\t\t\t} ) }\n\t\t\tonResizeStart={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getNextVal( elt );\n\t\t\t\tonResizeStart( nextVal );\n\t\t\t\tonResize( nextVal );\n\t\t\t} }\n\t\t\tonResize={ ( _event, _direction, elt ) => {\n\t\t\t\tonResize( getNextVal( elt ) );\n\t\t\t\tif ( ! isResizing ) {\n\t\t\t\t\tsetIsResizing( true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonResizeStop={ ( _event, _direction, elt ) => {\n\t\t\t\tconst nextVal = getCurrentSize( elt );\n\t\t\t\tonResizeStop( `${ nextVal }px` );\n\t\t\t\tsetIsResizing( false );\n\t\t\t} }\n\t\t\t__experimentalShowTooltip={ true }\n\t\t\t__experimentalTooltipProps={ {\n\t\t\t\taxis: orientation === 'horizontal' ? 'x' : 'y',\n\t\t\t\tposition: 'corner',\n\t\t\t\tisVisible: isResizing,\n\t\t\t} }\n\t\t\tshowHandle={ isSelected }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n};\n\nconst SpacerEdit = ( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\ttoggleSelection,\n\tcontext,\n\t__unstableParentLayout: parentLayout,\n} ) => {\n\tconst { orientation } = context;\n\tconst { orientation: parentOrientation, type } = parentLayout || {};\n\t// If the spacer is inside a flex container, it should either inherit the orientation\n\t// of the parent or use the flex default orientation.\n\tconst inheritedOrientation =\n\t\t! parentOrientation && type === 'flex'\n\t\t\t? 'horizontal'\n\t\t\t: parentOrientation || orientation;\n\tconst { height, width } = attributes;\n\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ temporaryHeight, setTemporaryHeight ] = useState( null );\n\tconst [ temporaryWidth, setTemporaryWidth ] = useState( null );\n\n\tconst onResizeStart = () => toggleSelection( false );\n\tconst onResizeStop = () => toggleSelection( true );\n\n\tconst handleOnVerticalResizeStop = ( newHeight ) => {\n\t\tonResizeStop();\n\n\t\tsetAttributes( { height: newHeight } );\n\t\tsetTemporaryHeight( null );\n\t};\n\n\tconst handleOnHorizontalResizeStop = ( newWidth ) => {\n\t\tonResizeStop();\n\t\tsetAttributes( { width: newWidth } );\n\t\tsetTemporaryWidth( null );\n\t};\n\n\tconst style = {\n\t\theight:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? 24\n\t\t\t\t: temporaryHeight || height || undefined,\n\t\twidth:\n\t\t\tinheritedOrientation === 'horizontal'\n\t\t\t\t? temporaryWidth || width || undefined\n\t\t\t\t: undefined,\n\t\t// In vertical flex containers, the spacer shrinks to nothing without a minimum width.\n\t\tminWidth:\n\t\t\tinheritedOrientation === 'vertical' && type === 'flex'\n\t\t\t\t? 48\n\t\t\t\t: undefined,\n\t};\n\n\tconst resizableBoxWithOrientation = ( blockOrientation ) => {\n\t\tif ( blockOrientation === 'horizontal' ) {\n\t\t\treturn (\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminWidth={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: true,\n\t\t\t\t\t\tbottom: false,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryWidth }\n\t\t\t\t\tonResizeStop={ handleOnHorizontalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ResizableSpacer\n\t\t\t\t\tminHeight={ MIN_SPACER_SIZE }\n\t\t\t\t\tenable={ {\n\t\t\t\t\t\ttop: false,\n\t\t\t\t\t\tright: false,\n\t\t\t\t\t\tbottom: true,\n\t\t\t\t\t\tleft: false,\n\t\t\t\t\t\ttopRight: false,\n\t\t\t\t\t\tbottomRight: false,\n\t\t\t\t\t\tbottomLeft: false,\n\t\t\t\t\t\ttopLeft: false,\n\t\t\t\t\t} }\n\t\t\t\t\torientation={ blockOrientation }\n\t\t\t\t\tonResizeStart={ onResizeStart }\n\t\t\t\t\tonResize={ setTemporaryHeight }\n\t\t\t\t\tonResizeStop={ handleOnVerticalResizeStop }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tisResizing={ isResizing }\n\t\t\t\t\tsetIsResizing={ setIsResizing }\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t};\n\n\tuseEffect( () => {\n\t\tif ( inheritedOrientation === 'horizontal' && ! width ) {\n\t\t\tsetAttributes( {\n\t\t\t\theight: '0px',\n\t\t\t\twidth: '72px',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<View { ...useBlockProps( { style } ) }>\n\t\t\t\t{ resizableBoxWithOrientation( inheritedOrientation ) }\n\t\t\t</View>\n\t\t\t<SpacerControls\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\theight={ temporaryHeight || height }\n\t\t\t\twidth={ temporaryWidth || width }\n\t\t\t\torientation={ inheritedOrientation }\n\t\t\t\tisResizing={ isResizing }\n\t\t\t/>\n\t\t</>\n\t);\n};\n\nexport default SpacerEdit;\n"]}
|
|
@@ -88,10 +88,14 @@
|
|
|
88
88
|
*/
|
|
89
89
|
.wp-block-categories {
|
|
90
90
|
box-sizing: border-box;
|
|
91
|
+
/* Only apply the text align on dropdowns, not lists. */
|
|
91
92
|
}
|
|
92
93
|
.wp-block-categories.alignleft {
|
|
93
94
|
margin-right: 2em;
|
|
94
95
|
}
|
|
95
96
|
.wp-block-categories.alignright {
|
|
96
97
|
margin-left: 2em;
|
|
98
|
+
}
|
|
99
|
+
.wp-block-categories.wp-block-categories-dropdown.aligncenter {
|
|
100
|
+
text-align: center;
|
|
97
101
|
}
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
*/
|
|
89
89
|
.wp-block-categories {
|
|
90
90
|
box-sizing: border-box;
|
|
91
|
+
/* Only apply the text align on dropdowns, not lists. */
|
|
91
92
|
}
|
|
92
93
|
.wp-block-categories.alignleft {
|
|
93
94
|
/*rtl:ignore*/
|
|
@@ -96,4 +97,7 @@
|
|
|
96
97
|
.wp-block-categories.alignright {
|
|
97
98
|
/*rtl:ignore*/
|
|
98
99
|
margin-left: 2em;
|
|
100
|
+
}
|
|
101
|
+
.wp-block-categories.wp-block-categories-dropdown.aligncenter {
|
|
102
|
+
text-align: center;
|
|
99
103
|
}
|
|
@@ -289,6 +289,11 @@ div[data-type="core/button"] {
|
|
|
289
289
|
margin-top: 6px;
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
/* Center alignment for classic themes. */
|
|
293
|
+
[data-align=center] .wp-block-categories {
|
|
294
|
+
text-align: center;
|
|
295
|
+
}
|
|
296
|
+
|
|
292
297
|
.wp-block-code code {
|
|
293
298
|
background: none;
|
|
294
299
|
}
|
|
@@ -2861,6 +2866,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
2861
2866
|
justify-content: center;
|
|
2862
2867
|
align-items: center;
|
|
2863
2868
|
padding: 0;
|
|
2869
|
+
display: flex;
|
|
2864
2870
|
min-height: 200px;
|
|
2865
2871
|
}
|
|
2866
2872
|
.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload,
|
package/build-style/editor.css
CHANGED
|
@@ -290,6 +290,11 @@ div[data-type="core/button"] {
|
|
|
290
290
|
margin-top: 6px;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
/* Center alignment for classic themes. */
|
|
294
|
+
[data-align=center] .wp-block-categories {
|
|
295
|
+
text-align: center;
|
|
296
|
+
}
|
|
297
|
+
|
|
293
298
|
.wp-block-code code {
|
|
294
299
|
background: none;
|
|
295
300
|
}
|
|
@@ -2872,6 +2877,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
2872
2877
|
justify-content: center;
|
|
2873
2878
|
align-items: center;
|
|
2874
2879
|
padding: 0;
|
|
2880
|
+
display: flex;
|
|
2875
2881
|
min-height: 200px;
|
|
2876
2882
|
}
|
|
2877
2883
|
.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload,
|
|
@@ -564,6 +564,8 @@ button.wp-block-navigation-item__content {
|
|
|
564
564
|
|
|
565
565
|
.wp-block-navigation__responsive-close {
|
|
566
566
|
width: 100%;
|
|
567
|
+
}
|
|
568
|
+
.has-modal-open .wp-block-navigation__responsive-close {
|
|
567
569
|
max-width: var(--wp--style--global--wide-size, 100%);
|
|
568
570
|
margin-right: auto;
|
|
569
571
|
margin-left: auto;
|
|
@@ -564,6 +564,8 @@ button.wp-block-navigation-item__content {
|
|
|
564
564
|
|
|
565
565
|
.wp-block-navigation__responsive-close {
|
|
566
566
|
width: 100%;
|
|
567
|
+
}
|
|
568
|
+
.has-modal-open .wp-block-navigation__responsive-close {
|
|
567
569
|
max-width: var(--wp--style--global--wide-size, 100%);
|
|
568
570
|
margin-left: auto;
|
|
569
571
|
margin-right: auto;
|