@wordpress/block-library 7.15.0 → 7.16.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 +3 -0
- package/build/code/utils.js +3 -3
- package/build/code/utils.js.map +1 -1
- package/build/comments-pagination-numbers/index.js +7 -0
- package/build/comments-pagination-numbers/index.js.map +1 -1
- package/build/gallery/gallery.js +2 -28
- package/build/gallery/gallery.js.map +1 -1
- package/build/group/edit.js +1 -1
- package/build/group/edit.js.map +1 -1
- package/build/navigation/edit/index.js +12 -12
- package/build/navigation/edit/index.js.map +1 -1
- package/build/paragraph/deprecated.js +49 -10
- package/build/paragraph/deprecated.js.map +1 -1
- package/build/paragraph/drop-zone.js +99 -0
- package/build/paragraph/drop-zone.js.map +1 -0
- package/build/paragraph/edit.js +30 -6
- package/build/paragraph/edit.js.map +1 -1
- package/build/paragraph/save.js +3 -1
- package/build/paragraph/save.js.map +1 -1
- package/build/post-author/edit.js +20 -2
- package/build/post-author/edit.js.map +1 -1
- package/build/post-author/index.js +8 -0
- package/build/post-author/index.js.map +1 -1
- package/build/post-content/edit.js +6 -1
- package/build/post-content/edit.js.map +1 -1
- package/build/post-featured-image/index.js +1 -1
- package/build/post-featured-image/overlay.js +2 -2
- package/build/post-featured-image/overlay.js.map +1 -1
- package/build/post-terms/index.js +4 -0
- package/build/post-terms/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +2 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +1 -1
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +2 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/utils.js +1 -1
- package/build/query/utils.js.map +1 -1
- package/build/quote/index.js +0 -1
- package/build/quote/index.js.map +1 -1
- package/build/site-title/index.js +2 -1
- package/build/site-title/index.js.map +1 -1
- package/build/template-part/index.js +2 -2
- package/build/template-part/index.js.map +1 -1
- package/build/video/edit.js +13 -1
- package/build/video/edit.js.map +1 -1
- package/build-module/code/utils.js +3 -3
- package/build-module/code/utils.js.map +1 -1
- package/build-module/comments-pagination-numbers/index.js +7 -0
- package/build-module/comments-pagination-numbers/index.js.map +1 -1
- package/build-module/gallery/gallery.js +2 -29
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/group/edit.js +1 -1
- package/build-module/group/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +12 -12
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/paragraph/deprecated.js +49 -11
- package/build-module/paragraph/deprecated.js.map +1 -1
- package/build-module/paragraph/drop-zone.js +88 -0
- package/build-module/paragraph/drop-zone.js.map +1 -0
- package/build-module/paragraph/edit.js +29 -6
- package/build-module/paragraph/edit.js.map +1 -1
- package/build-module/paragraph/save.js +2 -1
- package/build-module/paragraph/save.js.map +1 -1
- package/build-module/post-author/edit.js +21 -2
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-author/index.js +8 -0
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-content/edit.js +6 -1
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-featured-image/index.js +1 -1
- package/build-module/post-featured-image/overlay.js +2 -2
- package/build-module/post-featured-image/overlay.js.map +1 -1
- package/build-module/post-terms/index.js +4 -0
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +2 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +1 -1
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +2 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/utils.js +1 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/quote/index.js +0 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/site-title/index.js +2 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/template-part/index.js +2 -2
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/video/edit.js +15 -3
- package/build-module/video/edit.js.map +1 -1
- package/build-style/classic-rtl.css +85 -0
- package/build-style/classic.css +85 -0
- package/build-style/code/style-rtl.css +3 -0
- package/build-style/code/style.css +3 -0
- package/build-style/editor-rtl.css +110 -31
- package/build-style/editor.css +110 -31
- package/build-style/group/editor-rtl.css +11 -1
- package/build-style/group/editor.css +11 -1
- package/build-style/image/editor-rtl.css +3 -0
- package/build-style/image/editor.css +3 -0
- package/build-style/navigation/editor-rtl.css +15 -1
- package/build-style/navigation/editor.css +15 -1
- package/build-style/navigation/style-rtl.css +3 -0
- package/build-style/navigation/style.css +3 -0
- package/build-style/paragraph/editor-rtl.css +16 -0
- package/build-style/paragraph/editor.css +16 -0
- package/build-style/paragraph/style-rtl.css +5 -0
- package/build-style/paragraph/style.css +5 -0
- package/build-style/post-featured-image/editor-rtl.css +39 -29
- package/build-style/post-featured-image/editor.css +39 -29
- package/build-style/post-terms/style-rtl.css +4 -1
- package/build-style/post-terms/style.css +4 -1
- package/build-style/site-title/editor-rtl.css +4 -0
- package/build-style/site-title/editor.css +4 -0
- package/build-style/site-title/style-rtl.css +79 -0
- package/build-style/site-title/style.css +79 -0
- package/build-style/style-rtl.css +19 -1
- package/build-style/style.css +19 -1
- package/build-style/video/editor-rtl.css +22 -0
- package/build-style/video/editor.css +22 -0
- package/package.json +28 -28
- package/src/archives/index.php +4 -7
- package/src/categories/index.php +1 -1
- package/src/classic.scss +15 -0
- package/src/code/style.scss +12 -7
- package/src/code/utils.js +3 -3
- package/src/comment-author-name/index.php +1 -1
- package/src/comment-reply-link/index.php +1 -1
- package/src/comment-template/index.php +18 -9
- package/src/comments-pagination-numbers/block.json +7 -0
- package/src/cover/index.php +1 -1
- package/src/gallery/gallery.js +1 -31
- package/src/group/edit.js +1 -1
- package/src/image/editor.scss +4 -0
- package/src/latest-posts/index.php +1 -1
- package/src/navigation/edit/index.js +12 -10
- package/src/navigation/editor.scss +6 -0
- package/src/navigation/style.scss +8 -0
- package/src/navigation-submenu/index.php +11 -2
- package/src/page-list/index.php +3 -3
- package/src/paragraph/deprecated.js +36 -0
- package/src/paragraph/drop-zone.js +105 -0
- package/src/paragraph/edit.js +37 -9
- package/src/paragraph/editor.scss +20 -0
- package/src/paragraph/save.js +5 -1
- package/src/paragraph/style.scss +5 -0
- package/src/post-author/block.json +8 -0
- package/src/post-author/edit.js +29 -3
- package/src/post-author/index.php +7 -1
- package/src/post-content/edit.js +3 -1
- package/src/post-featured-image/block.json +1 -1
- package/src/post-featured-image/editor.scss +79 -72
- package/src/post-featured-image/index.php +18 -24
- package/src/post-featured-image/overlay.js +17 -14
- package/src/post-terms/block.json +4 -0
- package/src/post-terms/style.scss +7 -2
- package/src/query/edit/inspector-controls/author-control.js +1 -0
- package/src/query/edit/inspector-controls/index.js +1 -4
- package/src/query/edit/inspector-controls/parent-control.js +1 -0
- package/src/query/edit/inspector-controls/taxonomy-controls.js +1 -0
- package/src/query/utils.js +1 -1
- package/src/quote/block.json +0 -1
- package/src/site-title/block.json +2 -1
- package/src/site-title/editor.scss +6 -0
- package/src/site-title/style.scss +5 -0
- package/src/style.scss +1 -0
- package/src/tag-cloud/index.php +1 -8
- package/src/template-part/index.js +2 -2
- package/src/video/edit.js +19 -0
- package/src/video/editor.scss +37 -0
- package/build/navigation-submenu/view.js +0 -56
- package/build/navigation-submenu/view.js.map +0 -1
- package/build-module/navigation-submenu/view.js +0 -54
- package/build-module/navigation-submenu/view.js.map +0 -1
- package/src/navigation-submenu/view.js +0 -67
|
@@ -13,6 +13,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _blockEditor = require("@wordpress/block-editor");
|
|
15
15
|
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* External dependencies
|
|
18
20
|
*/
|
|
@@ -98,7 +100,8 @@ const {
|
|
|
98
100
|
style,
|
|
99
101
|
...restBlockAttributes
|
|
100
102
|
} = blockAttributes;
|
|
101
|
-
const deprecated = [
|
|
103
|
+
const deprecated = [// Version without drop cap on aligned text.
|
|
104
|
+
{
|
|
102
105
|
supports,
|
|
103
106
|
attributes: { ...restBlockAttributes,
|
|
104
107
|
customTextColor: {
|
|
@@ -111,12 +114,48 @@ const deprecated = [{
|
|
|
111
114
|
type: 'number'
|
|
112
115
|
}
|
|
113
116
|
},
|
|
114
|
-
migrate: migrateCustomColorsAndFontSizes,
|
|
115
117
|
|
|
116
118
|
save(_ref) {
|
|
117
119
|
let {
|
|
118
120
|
attributes
|
|
119
121
|
} = _ref;
|
|
122
|
+
const {
|
|
123
|
+
align,
|
|
124
|
+
content,
|
|
125
|
+
dropCap,
|
|
126
|
+
direction
|
|
127
|
+
} = attributes;
|
|
128
|
+
const className = (0, _classnames.default)({
|
|
129
|
+
'has-drop-cap': align === ((0, _i18n.isRTL)() ? 'left' : 'right') || align === 'center' ? false : dropCap,
|
|
130
|
+
[`has-text-align-${align}`]: align
|
|
131
|
+
});
|
|
132
|
+
return (0, _element.createElement)("p", _blockEditor.useBlockProps.save({
|
|
133
|
+
className,
|
|
134
|
+
dir: direction
|
|
135
|
+
}), (0, _element.createElement)(_blockEditor.RichText.Content, {
|
|
136
|
+
value: content
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
}, {
|
|
141
|
+
supports,
|
|
142
|
+
attributes: { ...restBlockAttributes,
|
|
143
|
+
customTextColor: {
|
|
144
|
+
type: 'string'
|
|
145
|
+
},
|
|
146
|
+
customBackgroundColor: {
|
|
147
|
+
type: 'string'
|
|
148
|
+
},
|
|
149
|
+
customFontSize: {
|
|
150
|
+
type: 'number'
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
migrate: migrateCustomColorsAndFontSizes,
|
|
154
|
+
|
|
155
|
+
save(_ref2) {
|
|
156
|
+
let {
|
|
157
|
+
attributes
|
|
158
|
+
} = _ref2;
|
|
120
159
|
const {
|
|
121
160
|
align,
|
|
122
161
|
content,
|
|
@@ -170,10 +209,10 @@ const deprecated = [{
|
|
|
170
209
|
},
|
|
171
210
|
migrate: migrateCustomColorsAndFontSizes,
|
|
172
211
|
|
|
173
|
-
save(
|
|
212
|
+
save(_ref3) {
|
|
174
213
|
let {
|
|
175
214
|
attributes
|
|
176
|
-
} =
|
|
215
|
+
} = _ref3;
|
|
177
216
|
const {
|
|
178
217
|
align,
|
|
179
218
|
content,
|
|
@@ -230,10 +269,10 @@ const deprecated = [{
|
|
|
230
269
|
},
|
|
231
270
|
migrate: migrateCustomColorsAndFontSizes,
|
|
232
271
|
|
|
233
|
-
save(
|
|
272
|
+
save(_ref4) {
|
|
234
273
|
let {
|
|
235
274
|
attributes
|
|
236
|
-
} =
|
|
275
|
+
} = _ref4;
|
|
237
276
|
const {
|
|
238
277
|
width,
|
|
239
278
|
align,
|
|
@@ -279,10 +318,10 @@ const deprecated = [{
|
|
|
279
318
|
}
|
|
280
319
|
},
|
|
281
320
|
|
|
282
|
-
save(
|
|
321
|
+
save(_ref5) {
|
|
283
322
|
let {
|
|
284
323
|
attributes
|
|
285
|
-
} =
|
|
324
|
+
} = _ref5;
|
|
286
325
|
const {
|
|
287
326
|
width,
|
|
288
327
|
align,
|
|
@@ -327,10 +366,10 @@ const deprecated = [{
|
|
|
327
366
|
}
|
|
328
367
|
},
|
|
329
368
|
|
|
330
|
-
save(
|
|
369
|
+
save(_ref6) {
|
|
331
370
|
let {
|
|
332
371
|
attributes
|
|
333
|
-
} =
|
|
372
|
+
} = _ref6;
|
|
334
373
|
return (0, _element.createElement)(_element.RawHTML, null, attributes.content);
|
|
335
374
|
},
|
|
336
375
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/paragraph/deprecated.js"],"names":["supports","className","blockAttributes","align","type","content","source","selector","default","dropCap","placeholder","textColor","backgroundColor","fontSize","direction","enum","style","migrateCustomColorsAndFontSizes","attributes","customTextColor","customBackgroundColor","customFontSize","color","text","background","typography","restAttributes","restBlockAttributes","deprecated","migrate","save","textClass","backgroundClass","fontSizeClass","styles","undefined","textAlign","width","Number","isFinite"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAQA,MAAMA,QAAQ,GAAG;AAChBC,EAAAA,SAAS,EAAE;AADK,CAAjB;AAIA,MAAMC,eAAe,GAAG;AACvBC,EAAAA,KAAK,EAAE;AACNC,IAAAA,IAAI,EAAE;AADA,GADgB;AAIvBC,EAAAA,OAAO,EAAE;AACRD,IAAAA,IAAI,EAAE,QADE;AAERE,IAAAA,MAAM,EAAE,MAFA;AAGRC,IAAAA,QAAQ,EAAE,GAHF;AAIRC,IAAAA,OAAO,EAAE;AAJD,GAJc;AAUvBC,EAAAA,OAAO,EAAE;AACRL,IAAAA,IAAI,EAAE,SADE;AAERI,IAAAA,OAAO,EAAE;AAFD,GAVc;AAcvBE,EAAAA,WAAW,EAAE;AACZN,IAAAA,IAAI,EAAE;AADM,GAdU;AAiBvBO,EAAAA,SAAS,EAAE;AACVP,IAAAA,IAAI,EAAE;AADI,GAjBY;AAoBvBQ,EAAAA,eAAe,EAAE;AAChBR,IAAAA,IAAI,EAAE;AADU,GApBM;AAuBvBS,EAAAA,QAAQ,EAAE;AACTT,IAAAA,IAAI,EAAE;AADG,GAvBa;AA0BvBU,EAAAA,SAAS,EAAE;AACVV,IAAAA,IAAI,EAAE,QADI;AAEVW,IAAAA,IAAI,EAAE,CAAE,KAAF,EAAS,KAAT;AAFI,GA1BY;AA8BvBC,EAAAA,KAAK,EAAE;AACNZ,IAAAA,IAAI,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AACA;;AAfF,CA/PkB,CAAnB;eAkReU,U","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { RawHTML } from '@wordpress/element';\nimport {\n\tgetColorClassName,\n\tgetFontSizeClass,\n\tRichText,\n} from '@wordpress/block-editor';\n\nconst supports = {\n\tclassName: false,\n};\n\nconst blockAttributes = {\n\talign: {\n\t\ttype: 'string',\n\t},\n\tcontent: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'p',\n\t\tdefault: '',\n\t},\n\tdropCap: {\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t},\n\tplaceholder: {\n\t\ttype: 'string',\n\t},\n\ttextColor: {\n\t\ttype: 'string',\n\t},\n\tbackgroundColor: {\n\t\ttype: 'string',\n\t},\n\tfontSize: {\n\t\ttype: 'string',\n\t},\n\tdirection: {\n\t\ttype: 'string',\n\t\tenum: [ 'ltr', 'rtl' ],\n\t},\n\tstyle: {\n\t\ttype: 'object',\n\t},\n};\n\nconst migrateCustomColorsAndFontSizes = ( attributes ) => {\n\tif (\n\t\t! attributes.customTextColor &&\n\t\t! attributes.customBackgroundColor &&\n\t\t! attributes.customFontSize\n\t) {\n\t\treturn attributes;\n\t}\n\tconst style = {};\n\tif ( attributes.customTextColor || attributes.customBackgroundColor ) {\n\t\tstyle.color = {};\n\t}\n\tif ( attributes.customTextColor ) {\n\t\tstyle.color.text = attributes.customTextColor;\n\t}\n\tif ( attributes.customBackgroundColor ) {\n\t\tstyle.color.background = attributes.customBackgroundColor;\n\t}\n\tif ( attributes.customFontSize ) {\n\t\tstyle.typography = { fontSize: attributes.customFontSize };\n\t}\n\n\tconst {\n\t\tcustomTextColor,\n\t\tcustomBackgroundColor,\n\t\tcustomFontSize,\n\t\t...restAttributes\n\t} = attributes;\n\n\treturn {\n\t\t...restAttributes,\n\t\tstyle,\n\t};\n};\n\nconst { style, ...restBlockAttributes } = blockAttributes;\n\nconst deprecated = [\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tcustomTextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomFontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t},\n\t\tmigrate: migrateCustomColorsAndFontSizes,\n\t\tsave( { attributes } ) {\n\t\t\tconst {\n\t\t\t\talign,\n\t\t\t\tcontent,\n\t\t\t\tdropCap,\n\t\t\t\tbackgroundColor,\n\t\t\t\ttextColor,\n\t\t\t\tcustomBackgroundColor,\n\t\t\t\tcustomTextColor,\n\t\t\t\tfontSize,\n\t\t\t\tcustomFontSize,\n\t\t\t\tdirection,\n\t\t\t} = attributes;\n\n\t\t\tconst textClass = getColorClassName( 'color', textColor );\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t);\n\t\t\tconst fontSizeClass = getFontSizeClass( fontSize );\n\n\t\t\tconst className = classnames( {\n\t\t\t\t'has-text-color': textColor || customTextColor,\n\t\t\t\t'has-background': backgroundColor || customBackgroundColor,\n\t\t\t\t'has-drop-cap': dropCap,\n\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t[ fontSizeClass ]: fontSizeClass,\n\t\t\t\t[ textClass ]: textClass,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tconst styles = {\n\t\t\t\tbackgroundColor: backgroundClass\n\t\t\t\t\t? undefined\n\t\t\t\t\t: customBackgroundColor,\n\t\t\t\tcolor: textClass ? undefined : customTextColor,\n\t\t\t\tfontSize: fontSizeClass ? undefined : customFontSize,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\tstyle={ styles }\n\t\t\t\t\tclassName={ className ? className : undefined }\n\t\t\t\t\tvalue={ content }\n\t\t\t\t\tdir={ direction }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tcustomTextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomFontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t},\n\t\tmigrate: migrateCustomColorsAndFontSizes,\n\t\tsave( { attributes } ) {\n\t\t\tconst {\n\t\t\t\talign,\n\t\t\t\tcontent,\n\t\t\t\tdropCap,\n\t\t\t\tbackgroundColor,\n\t\t\t\ttextColor,\n\t\t\t\tcustomBackgroundColor,\n\t\t\t\tcustomTextColor,\n\t\t\t\tfontSize,\n\t\t\t\tcustomFontSize,\n\t\t\t\tdirection,\n\t\t\t} = attributes;\n\n\t\t\tconst textClass = getColorClassName( 'color', textColor );\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t);\n\t\t\tconst fontSizeClass = getFontSizeClass( fontSize );\n\n\t\t\tconst className = classnames( {\n\t\t\t\t'has-text-color': textColor || customTextColor,\n\t\t\t\t'has-background': backgroundColor || customBackgroundColor,\n\t\t\t\t'has-drop-cap': dropCap,\n\t\t\t\t[ fontSizeClass ]: fontSizeClass,\n\t\t\t\t[ textClass ]: textClass,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tconst styles = {\n\t\t\t\tbackgroundColor: backgroundClass\n\t\t\t\t\t? undefined\n\t\t\t\t\t: customBackgroundColor,\n\t\t\t\tcolor: textClass ? undefined : customTextColor,\n\t\t\t\tfontSize: fontSizeClass ? undefined : customFontSize,\n\t\t\t\ttextAlign: align,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\tstyle={ styles }\n\t\t\t\t\tclassName={ className ? className : undefined }\n\t\t\t\t\tvalue={ content }\n\t\t\t\t\tdir={ direction }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tcustomTextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomFontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\twidth: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tmigrate: migrateCustomColorsAndFontSizes,\n\t\tsave( { attributes } ) {\n\t\t\tconst {\n\t\t\t\twidth,\n\t\t\t\talign,\n\t\t\t\tcontent,\n\t\t\t\tdropCap,\n\t\t\t\tbackgroundColor,\n\t\t\t\ttextColor,\n\t\t\t\tcustomBackgroundColor,\n\t\t\t\tcustomTextColor,\n\t\t\t\tfontSize,\n\t\t\t\tcustomFontSize,\n\t\t\t} = attributes;\n\n\t\t\tconst textClass = getColorClassName( 'color', textColor );\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t);\n\t\t\tconst fontSizeClass = fontSize && `is-${ fontSize }-text`;\n\n\t\t\tconst className = classnames( {\n\t\t\t\t[ `align${ width }` ]: width,\n\t\t\t\t'has-background': backgroundColor || customBackgroundColor,\n\t\t\t\t'has-drop-cap': dropCap,\n\t\t\t\t[ fontSizeClass ]: fontSizeClass,\n\t\t\t\t[ textClass ]: textClass,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tconst styles = {\n\t\t\t\tbackgroundColor: backgroundClass\n\t\t\t\t\t? undefined\n\t\t\t\t\t: customBackgroundColor,\n\t\t\t\tcolor: textClass ? undefined : customTextColor,\n\t\t\t\tfontSize: fontSizeClass ? undefined : customFontSize,\n\t\t\t\ttextAlign: align,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\tstyle={ styles }\n\t\t\t\t\tclassName={ className ? className : undefined }\n\t\t\t\t\tvalue={ content }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tfontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t},\n\t\tsave( { attributes } ) {\n\t\t\tconst {\n\t\t\t\twidth,\n\t\t\t\talign,\n\t\t\t\tcontent,\n\t\t\t\tdropCap,\n\t\t\t\tbackgroundColor,\n\t\t\t\ttextColor,\n\t\t\t\tfontSize,\n\t\t\t} = attributes;\n\t\t\tconst className = classnames( {\n\t\t\t\t[ `align${ width }` ]: width,\n\t\t\t\t'has-background': backgroundColor,\n\t\t\t\t'has-drop-cap': dropCap,\n\t\t\t} );\n\t\t\tconst styles = {\n\t\t\t\tbackgroundColor,\n\t\t\t\tcolor: textColor,\n\t\t\t\tfontSize,\n\t\t\t\ttextAlign: align,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<p\n\t\t\t\t\tstyle={ styles }\n\t\t\t\t\tclassName={ className ? className : undefined }\n\t\t\t\t>\n\t\t\t\t\t{ content }\n\t\t\t\t</p>\n\t\t\t);\n\t\t},\n\t\tmigrate( attributes ) {\n\t\t\treturn migrateCustomColorsAndFontSizes( {\n\t\t\t\t...attributes,\n\t\t\t\tcustomFontSize: Number.isFinite( attributes.fontSize )\n\t\t\t\t\t? attributes.fontSize\n\t\t\t\t\t: undefined,\n\t\t\t\tcustomTextColor:\n\t\t\t\t\tattributes.textColor && '#' === attributes.textColor[ 0 ]\n\t\t\t\t\t\t? attributes.textColor\n\t\t\t\t\t\t: undefined,\n\t\t\t\tcustomBackgroundColor:\n\t\t\t\t\tattributes.backgroundColor &&\n\t\t\t\t\t'#' === attributes.backgroundColor[ 0 ]\n\t\t\t\t\t\t? attributes.backgroundColor\n\t\t\t\t\t\t: undefined,\n\t\t\t} );\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...blockAttributes,\n\t\t\tcontent: {\n\t\t\t\ttype: 'string',\n\t\t\t\tsource: 'html',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t},\n\t\tsave( { attributes } ) {\n\t\t\treturn <RawHTML>{ attributes.content }</RawHTML>;\n\t\t},\n\t\tmigrate( attributes ) {\n\t\t\treturn attributes;\n\t\t},\n\t},\n];\n\nexport default deprecated;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/paragraph/deprecated.js"],"names":["supports","className","blockAttributes","align","type","content","source","selector","default","dropCap","placeholder","textColor","backgroundColor","fontSize","direction","enum","style","migrateCustomColorsAndFontSizes","attributes","customTextColor","customBackgroundColor","customFontSize","color","text","background","typography","restAttributes","restBlockAttributes","deprecated","save","useBlockProps","dir","migrate","textClass","backgroundClass","fontSizeClass","styles","undefined","textAlign","width","Number","isFinite"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAOA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;AAWA,MAAMA,QAAQ,GAAG;AAChBC,EAAAA,SAAS,EAAE;AADK,CAAjB;AAIA,MAAMC,eAAe,GAAG;AACvBC,EAAAA,KAAK,EAAE;AACNC,IAAAA,IAAI,EAAE;AADA,GADgB;AAIvBC,EAAAA,OAAO,EAAE;AACRD,IAAAA,IAAI,EAAE,QADE;AAERE,IAAAA,MAAM,EAAE,MAFA;AAGRC,IAAAA,QAAQ,EAAE,GAHF;AAIRC,IAAAA,OAAO,EAAE;AAJD,GAJc;AAUvBC,EAAAA,OAAO,EAAE;AACRL,IAAAA,IAAI,EAAE,SADE;AAERI,IAAAA,OAAO,EAAE;AAFD,GAVc;AAcvBE,EAAAA,WAAW,EAAE;AACZN,IAAAA,IAAI,EAAE;AADM,GAdU;AAiBvBO,EAAAA,SAAS,EAAE;AACVP,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;;AAfF,CAhSkB,CAAnB;eAmTeU,U","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { RawHTML } from '@wordpress/element';\nimport {\n\tgetColorClassName,\n\tgetFontSizeClass,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\n\nimport { isRTL } from '@wordpress/i18n';\n\nconst supports = {\n\tclassName: false,\n};\n\nconst blockAttributes = {\n\talign: {\n\t\ttype: 'string',\n\t},\n\tcontent: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'p',\n\t\tdefault: '',\n\t},\n\tdropCap: {\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t},\n\tplaceholder: {\n\t\ttype: 'string',\n\t},\n\ttextColor: {\n\t\ttype: 'string',\n\t},\n\tbackgroundColor: {\n\t\ttype: 'string',\n\t},\n\tfontSize: {\n\t\ttype: 'string',\n\t},\n\tdirection: {\n\t\ttype: 'string',\n\t\tenum: [ 'ltr', 'rtl' ],\n\t},\n\tstyle: {\n\t\ttype: 'object',\n\t},\n};\n\nconst migrateCustomColorsAndFontSizes = ( attributes ) => {\n\tif (\n\t\t! attributes.customTextColor &&\n\t\t! attributes.customBackgroundColor &&\n\t\t! attributes.customFontSize\n\t) {\n\t\treturn attributes;\n\t}\n\tconst style = {};\n\tif ( attributes.customTextColor || attributes.customBackgroundColor ) {\n\t\tstyle.color = {};\n\t}\n\tif ( attributes.customTextColor ) {\n\t\tstyle.color.text = attributes.customTextColor;\n\t}\n\tif ( attributes.customBackgroundColor ) {\n\t\tstyle.color.background = attributes.customBackgroundColor;\n\t}\n\tif ( attributes.customFontSize ) {\n\t\tstyle.typography = { fontSize: attributes.customFontSize };\n\t}\n\n\tconst {\n\t\tcustomTextColor,\n\t\tcustomBackgroundColor,\n\t\tcustomFontSize,\n\t\t...restAttributes\n\t} = attributes;\n\n\treturn {\n\t\t...restAttributes,\n\t\tstyle,\n\t};\n};\n\nconst { style, ...restBlockAttributes } = blockAttributes;\n\nconst deprecated = [\n\t// Version without drop cap on aligned text.\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tcustomTextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomFontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t},\n\t\tsave( { attributes } ) {\n\t\t\tconst { align, content, dropCap, direction } = attributes;\n\t\t\tconst className = classnames( {\n\t\t\t\t'has-drop-cap':\n\t\t\t\t\talign === ( isRTL() ? 'left' : 'right' ) ||\n\t\t\t\t\talign === 'center'\n\t\t\t\t\t\t? false\n\t\t\t\t\t\t: dropCap,\n\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t} );\n\n\t\t\treturn (\n\t\t\t\t<p { ...useBlockProps.save( { className, dir: direction } ) }>\n\t\t\t\t\t<RichText.Content value={ content } />\n\t\t\t\t</p>\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tcustomTextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomFontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t},\n\t\tmigrate: migrateCustomColorsAndFontSizes,\n\t\tsave( { attributes } ) {\n\t\t\tconst {\n\t\t\t\talign,\n\t\t\t\tcontent,\n\t\t\t\tdropCap,\n\t\t\t\tbackgroundColor,\n\t\t\t\ttextColor,\n\t\t\t\tcustomBackgroundColor,\n\t\t\t\tcustomTextColor,\n\t\t\t\tfontSize,\n\t\t\t\tcustomFontSize,\n\t\t\t\tdirection,\n\t\t\t} = attributes;\n\n\t\t\tconst textClass = getColorClassName( 'color', textColor );\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t);\n\t\t\tconst fontSizeClass = getFontSizeClass( fontSize );\n\n\t\t\tconst className = classnames( {\n\t\t\t\t'has-text-color': textColor || customTextColor,\n\t\t\t\t'has-background': backgroundColor || customBackgroundColor,\n\t\t\t\t'has-drop-cap': dropCap,\n\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t[ fontSizeClass ]: fontSizeClass,\n\t\t\t\t[ textClass ]: textClass,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tconst styles = {\n\t\t\t\tbackgroundColor: backgroundClass\n\t\t\t\t\t? undefined\n\t\t\t\t\t: customBackgroundColor,\n\t\t\t\tcolor: textClass ? undefined : customTextColor,\n\t\t\t\tfontSize: fontSizeClass ? undefined : customFontSize,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\tstyle={ styles }\n\t\t\t\t\tclassName={ className ? className : undefined }\n\t\t\t\t\tvalue={ content }\n\t\t\t\t\tdir={ direction }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tcustomTextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomFontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t},\n\t\tmigrate: migrateCustomColorsAndFontSizes,\n\t\tsave( { attributes } ) {\n\t\t\tconst {\n\t\t\t\talign,\n\t\t\t\tcontent,\n\t\t\t\tdropCap,\n\t\t\t\tbackgroundColor,\n\t\t\t\ttextColor,\n\t\t\t\tcustomBackgroundColor,\n\t\t\t\tcustomTextColor,\n\t\t\t\tfontSize,\n\t\t\t\tcustomFontSize,\n\t\t\t\tdirection,\n\t\t\t} = attributes;\n\n\t\t\tconst textClass = getColorClassName( 'color', textColor );\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t);\n\t\t\tconst fontSizeClass = getFontSizeClass( fontSize );\n\n\t\t\tconst className = classnames( {\n\t\t\t\t'has-text-color': textColor || customTextColor,\n\t\t\t\t'has-background': backgroundColor || customBackgroundColor,\n\t\t\t\t'has-drop-cap': dropCap,\n\t\t\t\t[ fontSizeClass ]: fontSizeClass,\n\t\t\t\t[ textClass ]: textClass,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tconst styles = {\n\t\t\t\tbackgroundColor: backgroundClass\n\t\t\t\t\t? undefined\n\t\t\t\t\t: customBackgroundColor,\n\t\t\t\tcolor: textClass ? undefined : customTextColor,\n\t\t\t\tfontSize: fontSizeClass ? undefined : customFontSize,\n\t\t\t\ttextAlign: align,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\tstyle={ styles }\n\t\t\t\t\tclassName={ className ? className : undefined }\n\t\t\t\t\tvalue={ content }\n\t\t\t\t\tdir={ direction }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tcustomTextColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomBackgroundColor: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t\tcustomFontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t\twidth: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t},\n\t\tmigrate: migrateCustomColorsAndFontSizes,\n\t\tsave( { attributes } ) {\n\t\t\tconst {\n\t\t\t\twidth,\n\t\t\t\talign,\n\t\t\t\tcontent,\n\t\t\t\tdropCap,\n\t\t\t\tbackgroundColor,\n\t\t\t\ttextColor,\n\t\t\t\tcustomBackgroundColor,\n\t\t\t\tcustomTextColor,\n\t\t\t\tfontSize,\n\t\t\t\tcustomFontSize,\n\t\t\t} = attributes;\n\n\t\t\tconst textClass = getColorClassName( 'color', textColor );\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tbackgroundColor\n\t\t\t);\n\t\t\tconst fontSizeClass = fontSize && `is-${ fontSize }-text`;\n\n\t\t\tconst className = classnames( {\n\t\t\t\t[ `align${ width }` ]: width,\n\t\t\t\t'has-background': backgroundColor || customBackgroundColor,\n\t\t\t\t'has-drop-cap': dropCap,\n\t\t\t\t[ fontSizeClass ]: fontSizeClass,\n\t\t\t\t[ textClass ]: textClass,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tconst styles = {\n\t\t\t\tbackgroundColor: backgroundClass\n\t\t\t\t\t? undefined\n\t\t\t\t\t: customBackgroundColor,\n\t\t\t\tcolor: textClass ? undefined : customTextColor,\n\t\t\t\tfontSize: fontSizeClass ? undefined : customFontSize,\n\t\t\t\ttextAlign: align,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"p\"\n\t\t\t\t\tstyle={ styles }\n\t\t\t\t\tclassName={ className ? className : undefined }\n\t\t\t\t\tvalue={ content }\n\t\t\t\t/>\n\t\t\t);\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...restBlockAttributes,\n\t\t\tfontSize: {\n\t\t\t\ttype: 'number',\n\t\t\t},\n\t\t},\n\t\tsave( { attributes } ) {\n\t\t\tconst {\n\t\t\t\twidth,\n\t\t\t\talign,\n\t\t\t\tcontent,\n\t\t\t\tdropCap,\n\t\t\t\tbackgroundColor,\n\t\t\t\ttextColor,\n\t\t\t\tfontSize,\n\t\t\t} = attributes;\n\t\t\tconst className = classnames( {\n\t\t\t\t[ `align${ width }` ]: width,\n\t\t\t\t'has-background': backgroundColor,\n\t\t\t\t'has-drop-cap': dropCap,\n\t\t\t} );\n\t\t\tconst styles = {\n\t\t\t\tbackgroundColor,\n\t\t\t\tcolor: textColor,\n\t\t\t\tfontSize,\n\t\t\t\ttextAlign: align,\n\t\t\t};\n\n\t\t\treturn (\n\t\t\t\t<p\n\t\t\t\t\tstyle={ styles }\n\t\t\t\t\tclassName={ className ? className : undefined }\n\t\t\t\t>\n\t\t\t\t\t{ content }\n\t\t\t\t</p>\n\t\t\t);\n\t\t},\n\t\tmigrate( attributes ) {\n\t\t\treturn migrateCustomColorsAndFontSizes( {\n\t\t\t\t...attributes,\n\t\t\t\tcustomFontSize: Number.isFinite( attributes.fontSize )\n\t\t\t\t\t? attributes.fontSize\n\t\t\t\t\t: undefined,\n\t\t\t\tcustomTextColor:\n\t\t\t\t\tattributes.textColor && '#' === attributes.textColor[ 0 ]\n\t\t\t\t\t\t? attributes.textColor\n\t\t\t\t\t\t: undefined,\n\t\t\t\tcustomBackgroundColor:\n\t\t\t\t\tattributes.backgroundColor &&\n\t\t\t\t\t'#' === attributes.backgroundColor[ 0 ]\n\t\t\t\t\t\t? attributes.backgroundColor\n\t\t\t\t\t\t: undefined,\n\t\t\t} );\n\t\t},\n\t},\n\t{\n\t\tsupports,\n\t\tattributes: {\n\t\t\t...blockAttributes,\n\t\t\tcontent: {\n\t\t\t\ttype: 'string',\n\t\t\t\tsource: 'html',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t},\n\t\tsave( { attributes } ) {\n\t\t\treturn <RawHTML>{ attributes.content }</RawHTML>;\n\t\t},\n\t\tmigrate( attributes ) {\n\t\t\treturn attributes;\n\t\t},\n\t},\n];\n\nexport default deprecated;\n"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = DropZone;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _data = require("@wordpress/data");
|
|
11
|
+
|
|
12
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
13
|
+
|
|
14
|
+
var _compose = require("@wordpress/compose");
|
|
15
|
+
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
const animateVariants = {
|
|
22
|
+
hide: {
|
|
23
|
+
opacity: 0,
|
|
24
|
+
scaleY: 0.75
|
|
25
|
+
},
|
|
26
|
+
show: {
|
|
27
|
+
opacity: 1,
|
|
28
|
+
scaleY: 1
|
|
29
|
+
},
|
|
30
|
+
exit: {
|
|
31
|
+
opacity: 0,
|
|
32
|
+
scaleY: 0.9
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function DropZone(_ref) {
|
|
37
|
+
let {
|
|
38
|
+
paragraphElement,
|
|
39
|
+
clientId
|
|
40
|
+
} = _ref;
|
|
41
|
+
const {
|
|
42
|
+
rootClientId,
|
|
43
|
+
blockIndex
|
|
44
|
+
} = (0, _data.useSelect)(select => {
|
|
45
|
+
const selectors = select(_blockEditor.store);
|
|
46
|
+
return {
|
|
47
|
+
rootClientId: selectors.getBlockRootClientId(clientId),
|
|
48
|
+
blockIndex: selectors.getBlockIndex(clientId)
|
|
49
|
+
};
|
|
50
|
+
}, [clientId]);
|
|
51
|
+
const onBlockDrop = (0, _blockEditor.__experimentalUseOnBlockDrop)(rootClientId, blockIndex, {
|
|
52
|
+
action: 'replace'
|
|
53
|
+
});
|
|
54
|
+
const [isDragging, setIsDragging] = (0, _element.useState)(false);
|
|
55
|
+
const [isVisible, setIsVisible] = (0, _element.useState)(false);
|
|
56
|
+
const popoverRef = (0, _compose.__experimentalUseDropZone)({
|
|
57
|
+
onDragStart: () => {
|
|
58
|
+
setIsDragging(true);
|
|
59
|
+
},
|
|
60
|
+
onDragEnd: () => {
|
|
61
|
+
setIsDragging(false);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const dropZoneRef = (0, _compose.__experimentalUseDropZone)({
|
|
65
|
+
onDrop: onBlockDrop,
|
|
66
|
+
onDragEnter: () => {
|
|
67
|
+
setIsVisible(true);
|
|
68
|
+
},
|
|
69
|
+
onDragLeave: () => {
|
|
70
|
+
setIsVisible(false);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const reducedMotion = (0, _compose.useReducedMotion)();
|
|
74
|
+
return (0, _element.createElement)(_components.Popover, {
|
|
75
|
+
anchor: paragraphElement,
|
|
76
|
+
animate: false,
|
|
77
|
+
placement: "top-start",
|
|
78
|
+
focusOnMount: false,
|
|
79
|
+
flip: false,
|
|
80
|
+
resize: false,
|
|
81
|
+
className: "wp-block-paragraph__drop-zone",
|
|
82
|
+
ref: popoverRef
|
|
83
|
+
}, isDragging ? (0, _element.createElement)("div", {
|
|
84
|
+
className: "wp-block-paragraph__drop-zone-backdrop",
|
|
85
|
+
ref: dropZoneRef,
|
|
86
|
+
style: {
|
|
87
|
+
width: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetWidth,
|
|
88
|
+
height: paragraphElement === null || paragraphElement === void 0 ? void 0 : paragraphElement.offsetHeight
|
|
89
|
+
}
|
|
90
|
+
}, (0, _element.createElement)(_components.__unstableAnimatePresence, null, isVisible ? (0, _element.createElement)(_components.__unstableMotion.div, {
|
|
91
|
+
key: "drop-zone-foreground",
|
|
92
|
+
"data-testid": "empty-paragraph-drop-zone",
|
|
93
|
+
initial: reducedMotion ? animateVariants.show : animateVariants.hide,
|
|
94
|
+
animate: animateVariants.show,
|
|
95
|
+
exit: reducedMotion ? animateVariants.show : animateVariants.exit,
|
|
96
|
+
className: "wp-block-paragraph__drop-zone-foreground"
|
|
97
|
+
}) : null)) : null);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=drop-zone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/paragraph/drop-zone.js"],"names":["animateVariants","hide","opacity","scaleY","show","exit","DropZone","paragraphElement","clientId","rootClientId","blockIndex","select","selectors","blockEditorStore","getBlockRootClientId","getBlockIndex","onBlockDrop","action","isDragging","setIsDragging","isVisible","setIsVisible","popoverRef","onDragStart","onDragEnd","dropZoneRef","onDrop","onDragEnter","onDragLeave","reducedMotion","width","offsetWidth","height","offsetHeight"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AAIA;;AAIA;;AAbA;AACA;AACA;AAiBA,MAAMA,eAAe,GAAG;AACvBC,EAAAA,IAAI,EAAE;AAAEC,IAAAA,OAAO,EAAE,CAAX;AAAcC,IAAAA,MAAM,EAAE;AAAtB,GADiB;AAEvBC,EAAAA,IAAI,EAAE;AAAEF,IAAAA,OAAO,EAAE,CAAX;AAAcC,IAAAA,MAAM,EAAE;AAAtB,GAFiB;AAGvBE,EAAAA,IAAI,EAAE;AAAEH,IAAAA,OAAO,EAAE,CAAX;AAAcC,IAAAA,MAAM,EAAE;AAAtB;AAHiB,CAAxB;;AAMe,SAASG,QAAT,OAAoD;AAAA,MAAjC;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAAiC;AAClE,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MAA+B,qBAClCC,MAAF,IAAc;AACb,UAAMC,SAAS,GAAGD,MAAM,CAAEE,kBAAF,CAAxB;AACA,WAAO;AACNJ,MAAAA,YAAY,EAAEG,SAAS,CAACE,oBAAV,CAAgCN,QAAhC,CADR;AAENE,MAAAA,UAAU,EAAEE,SAAS,CAACG,aAAV,CAAyBP,QAAzB;AAFN,KAAP;AAIA,GAPmC,EAQpC,CAAEA,QAAF,CARoC,CAArC;AAUA,QAAMQ,WAAW,GAAG,+CAAgBP,YAAhB,EAA8BC,UAA9B,EAA0C;AAC7DO,IAAAA,MAAM,EAAE;AADqD,GAA1C,CAApB;AAGA,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC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BAFb;AAGC,IAAA,OAAO,EACNS,aAAa,GACV7B,eAAe,CAACI,IADN,GAEVJ,eAAe,CAACC,IANrB;AAQC,IAAA,OAAO,EAAGD,eAAe,CAACI,IAR3B;AASC,IAAA,IAAI,EACHyB,aAAa,GACV7B,eAAe,CAACI,IADN,GAEVJ,eAAe,CAACK,IAZrB;AAcC,IAAA,SAAS,EAAC;AAdX,IADU,GAiBP,IAlBL,CARD,CADW,GA8BR,IAxCL,CADD;AA4CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalUseOnBlockDrop as useOnBlockDrop,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\nimport {\n\tPopover,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '@wordpress/components';\n\nconst animateVariants = {\n\thide: { opacity: 0, scaleY: 0.75 },\n\tshow: { opacity: 1, scaleY: 1 },\n\texit: { opacity: 0, scaleY: 0.9 },\n};\n\nexport default function DropZone( { paragraphElement, clientId } ) {\n\tconst { rootClientId, blockIndex } = useSelect(\n\t\t( select ) => {\n\t\t\tconst selectors = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\trootClientId: selectors.getBlockRootClientId( clientId ),\n\t\t\t\tblockIndex: selectors.getBlockIndex( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst onBlockDrop = useOnBlockDrop( rootClientId, blockIndex, {\n\t\taction: 'replace',\n\t} );\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\tconst popoverRef = useDropZone( {\n\t\tonDragStart: () => {\n\t\t\tsetIsDragging( true );\n\t\t},\n\t\tonDragEnd: () => {\n\t\t\tsetIsDragging( false );\n\t\t},\n\t} );\n\tconst dropZoneRef = useDropZone( {\n\t\tonDrop: onBlockDrop,\n\t\tonDragEnter: () => {\n\t\t\tsetIsVisible( true );\n\t\t},\n\t\tonDragLeave: () => {\n\t\t\tsetIsVisible( false );\n\t\t},\n\t} );\n\tconst reducedMotion = useReducedMotion();\n\n\treturn (\n\t\t<Popover\n\t\t\tanchor={ paragraphElement }\n\t\t\tanimate={ false }\n\t\t\tplacement=\"top-start\"\n\t\t\tfocusOnMount={ false }\n\t\t\tflip={ false }\n\t\t\tresize={ false }\n\t\t\tclassName=\"wp-block-paragraph__drop-zone\"\n\t\t\tref={ popoverRef }\n\t\t>\n\t\t\t{ isDragging ? (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-backdrop\"\n\t\t\t\t\tref={ dropZoneRef }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\twidth: paragraphElement?.offsetWidth,\n\t\t\t\t\t\theight: paragraphElement?.offsetHeight,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t{ isVisible ? (\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tkey=\"drop-zone-foreground\"\n\t\t\t\t\t\t\t\tdata-testid=\"empty-paragraph-drop-zone\"\n\t\t\t\t\t\t\t\tinitial={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.hide\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tanimate={ animateVariants.show }\n\t\t\t\t\t\t\t\texit={\n\t\t\t\t\t\t\t\t\treducedMotion\n\t\t\t\t\t\t\t\t\t\t? animateVariants.show\n\t\t\t\t\t\t\t\t\t\t: animateVariants.exit\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tclassName=\"wp-block-paragraph__drop-zone-foreground\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null }\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t</div>\n\t\t\t) : null }\n\t\t</Popover>\n\t);\n}\n"]}
|
package/build/paragraph/edit.js
CHANGED
|
@@ -19,12 +19,16 @@ var _components = require("@wordpress/components");
|
|
|
19
19
|
|
|
20
20
|
var _blockEditor = require("@wordpress/block-editor");
|
|
21
21
|
|
|
22
|
+
var _compose = require("@wordpress/compose");
|
|
23
|
+
|
|
22
24
|
var _blocks = require("@wordpress/blocks");
|
|
23
25
|
|
|
24
26
|
var _icons = require("@wordpress/icons");
|
|
25
27
|
|
|
26
28
|
var _useEnter = require("./use-enter");
|
|
27
29
|
|
|
30
|
+
var _dropZone = _interopRequireDefault(require("./drop-zone"));
|
|
31
|
+
|
|
28
32
|
/**
|
|
29
33
|
* External dependencies
|
|
30
34
|
*/
|
|
@@ -53,6 +57,10 @@ function ParagraphRTLControl(_ref) {
|
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
function hasDropCapDisabled(align) {
|
|
61
|
+
return align === ((0, _i18n.isRTL)() ? 'left' : 'right') || align === 'center';
|
|
62
|
+
}
|
|
63
|
+
|
|
56
64
|
function ParagraphBlock(_ref2) {
|
|
57
65
|
let {
|
|
58
66
|
attributes,
|
|
@@ -70,25 +78,37 @@ function ParagraphBlock(_ref2) {
|
|
|
70
78
|
placeholder
|
|
71
79
|
} = attributes;
|
|
72
80
|
const isDropCapFeatureEnabled = (0, _blockEditor.useSetting)('typography.dropCap');
|
|
81
|
+
const [paragraphElement, setParagraphElement] = (0, _element.useState)(null);
|
|
73
82
|
const blockProps = (0, _blockEditor.useBlockProps)({
|
|
74
|
-
ref: (0, _useEnter.useOnEnter)({
|
|
83
|
+
ref: (0, _compose.useMergeRefs)([(0, _useEnter.useOnEnter)({
|
|
75
84
|
clientId,
|
|
76
85
|
content
|
|
77
|
-
}),
|
|
86
|
+
}), setParagraphElement]),
|
|
78
87
|
className: (0, _classnames.default)({
|
|
79
|
-
'has-drop-cap': dropCap,
|
|
88
|
+
'has-drop-cap': hasDropCapDisabled(align) ? false : dropCap,
|
|
80
89
|
[`has-text-align-${align}`]: align
|
|
81
90
|
}),
|
|
82
91
|
style: {
|
|
83
92
|
direction
|
|
84
93
|
}
|
|
85
94
|
});
|
|
95
|
+
let helpText;
|
|
96
|
+
|
|
97
|
+
if (hasDropCapDisabled(align)) {
|
|
98
|
+
helpText = (0, _i18n.__)('Not available for aligned text.');
|
|
99
|
+
} else if (dropCap) {
|
|
100
|
+
helpText = (0, _i18n.__)('Showing large initial letter.');
|
|
101
|
+
} else {
|
|
102
|
+
helpText = (0, _i18n.__)('Toggle to show a large initial letter.');
|
|
103
|
+
}
|
|
104
|
+
|
|
86
105
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockControls, {
|
|
87
106
|
group: "block"
|
|
88
107
|
}, (0, _element.createElement)(_blockEditor.AlignmentControl, {
|
|
89
108
|
value: align,
|
|
90
109
|
onChange: newAlign => setAttributes({
|
|
91
|
-
align: newAlign
|
|
110
|
+
align: newAlign,
|
|
111
|
+
dropCap: hasDropCapDisabled(newAlign) ? false : dropCap
|
|
92
112
|
})
|
|
93
113
|
}), (0, _element.createElement)(ParagraphRTLControl, {
|
|
94
114
|
direction: direction,
|
|
@@ -113,8 +133,12 @@ function ParagraphBlock(_ref2) {
|
|
|
113
133
|
onChange: () => setAttributes({
|
|
114
134
|
dropCap: !dropCap
|
|
115
135
|
}),
|
|
116
|
-
help:
|
|
117
|
-
|
|
136
|
+
help: helpText,
|
|
137
|
+
disabled: hasDropCapDisabled(align) ? true : false
|
|
138
|
+
}))), !content && (0, _element.createElement)(_dropZone.default, {
|
|
139
|
+
clientId: clientId,
|
|
140
|
+
paragraphElement: paragraphElement
|
|
141
|
+
}), (0, _element.createElement)(_blockEditor.RichText, (0, _extends2.default)({
|
|
118
142
|
identifier: "content",
|
|
119
143
|
tagName: "p"
|
|
120
144
|
}, blockProps, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/paragraph/edit.js"],"names":["name","ParagraphRTLControl","direction","setDirection","formatLtr","undefined","ParagraphBlock","attributes","mergeBlocks","onReplace","onRemove","setAttributes","clientId","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/paragraph/edit.js"],"names":["name","ParagraphRTLControl","direction","setDirection","formatLtr","undefined","hasDropCapDisabled","align","ParagraphBlock","attributes","mergeBlocks","onReplace","onRemove","setAttributes","clientId","content","dropCap","placeholder","isDropCapFeatureEnabled","paragraphElement","setParagraphElement","blockProps","ref","className","style","helpText","newAlign","newDirection","newContent","value","isOriginal","newAttributes","block"],"mappings":";;;;;;;;;AAQA;;;;AALA;;AAMA;;AACA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAoBA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,gBAAb;;AAEA,SAASC,mBAAT,OAA4D;AAAA,MAA9B;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAA8B;AAC3D,SACC,sBACC,4BAAC,yBAAD;AACC,IAAA,IAAI,EAAGC,gBADR;AAEC,IAAA,KAAK,EAAG,cAAI,eAAJ,EAAqB,eAArB,CAFT;AAGC,IAAA,QAAQ,EAAGF,SAAS,KAAK,KAH1B;AAIC,IAAA,OAAO,EAAG,MAAM;AACfC,MAAAA,YAAY,CAAED,SAAS,KAAK,KAAd,GAAsBG,SAAtB,GAAkC,KAApC,CAAZ;AACA;AANF,IAFF;AAYA;;AAED,SAASC,kBAAT,CAA6BC,KAA7B,EAAqC;AACpC,SAAOA,KAAK,MAAO,qBAAU,MAAV,GAAmB,OAA1B,CAAL,IAA4CA,KAAK,KAAK,QAA7D;AACA;;AAED,SAASC,cAAT,QAOI;AAAA,MAPqB;AACxBC,IAAAA,UADwB;AAExBC,IAAAA,WAFwB;AAGxBC,IAAAA,SAHwB;AAIxBC,IAAAA,QAJwB;AAKxBC,IAAAA,aALwB;AAMxBC,I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G,CAAEC,KAAF,EAASC,UAAT,KAAyB;AAClC,UAAIC,aAAJ;;AAEA,UAAKD,UAAU,IAAID,KAAnB,EAA2B;AAC1BE,QAAAA,aAAa,GAAG,EACf,GAAGtB,UADY;AAEfM,UAAAA,OAAO,EAAEc;AAFM,SAAhB;AAIA;;AAED,YAAMG,KAAK,GAAG,yBAAahC,IAAb,EAAmB+B,aAAnB,CAAd;;AAEA,UAAKD,UAAL,EAAkB;AACjBE,QAAAA,KAAK,CAAClB,QAAN,GAAiBA,QAAjB;AACA;;AAED,aAAOkB,KAAP;AACA,KAzBF;AA0BC,IAAA,OAAO,EAAGtB,WA1BX;AA2BC,IAAA,SAAS,EAAGC,SA3Bb;AA4BC,IAAA,QAAQ,EAAGC,QA5BZ;AA6BC,kBACCG,OAAO,GACJ,cAAI,iBAAJ,CADI,GAEJ,cACA,oEADA,CAhCL;AAoCC,kBAAaA,OAAO,GAAG,KAAH,GAAW,IApChC;AAqCC,IAAA,WAAW,EAAGE,WAAW,IAAI,cAAI,0BAAJ,CArC9B;AAsCC,+BAA0BA,WAAW,GAAG,IAAH,GAAUZ,SAtChD;AAuCC,IAAA,yBAAyB,MAvC1B;AAwCC,IAAA,oCAAoC;AAxCrC,KAnDD,CADD;AAgGA;;eAEcG,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __, _x, isRTL } from '@wordpress/i18n';\nimport {\n\tToolbarButton,\n\tToggleControl,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tuseSetting,\n} from '@wordpress/block-editor';\nimport { useMergeRefs } from '@wordpress/compose';\nimport { createBlock } from '@wordpress/blocks';\nimport { formatLtr } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useOnEnter } from './use-enter';\nimport DropZone from './drop-zone';\n\nconst name = 'core/paragraph';\n\nfunction ParagraphRTLControl( { direction, setDirection } ) {\n\treturn (\n\t\tisRTL() && (\n\t\t\t<ToolbarButton\n\t\t\t\ticon={ formatLtr }\n\t\t\t\ttitle={ _x( 'Left to right', 'editor button' ) }\n\t\t\t\tisActive={ direction === 'ltr' }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetDirection( direction === 'ltr' ? undefined : 'ltr' );\n\t\t\t\t} }\n\t\t\t/>\n\t\t)\n\t);\n}\n\nfunction hasDropCapDisabled( align ) {\n\treturn align === ( isRTL() ? 'left' : 'right' ) || align === 'center';\n}\n\nfunction ParagraphBlock( {\n\tattributes,\n\tmergeBlocks,\n\tonReplace,\n\tonRemove,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { align, content, direction, dropCap, placeholder } = attributes;\n\tconst isDropCapFeatureEnabled = useSetting( 'typography.dropCap' );\n\tconst [ paragraphElement, setParagraphElement ] = useState( null );\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [\n\t\t\tuseOnEnter( { clientId, content } ),\n\t\t\tsetParagraphElement,\n\t\t] ),\n\t\tclassName: classnames( {\n\t\t\t'has-drop-cap': hasDropCapDisabled( align ) ? false : dropCap,\n\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t} ),\n\t\tstyle: { direction },\n\t} );\n\n\tlet helpText;\n\tif ( hasDropCapDisabled( align ) ) {\n\t\thelpText = __( 'Not available for aligned text.' );\n\t} else if ( dropCap ) {\n\t\thelpText = __( 'Showing large initial letter.' );\n\t} else {\n\t\thelpText = __( 'Toggle to show a large initial letter.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ align }\n\t\t\t\t\tonChange={ ( newAlign ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\talign: newAlign,\n\t\t\t\t\t\t\tdropCap: hasDropCapDisabled( newAlign )\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dropCap,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ParagraphRTLControl\n\t\t\t\t\tdirection={ direction }\n\t\t\t\t\tsetDirection={ ( newDirection ) =>\n\t\t\t\t\t\tsetAttributes( { direction: newDirection } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t{ isDropCapFeatureEnabled && (\n\t\t\t\t<InspectorControls __experimentalGroup=\"typography\">\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! dropCap }\n\t\t\t\t\t\tlabel={ __( 'Drop cap' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { dropCap: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresetAllFilter={ () => ( { dropCap: undefined } ) }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Drop cap' ) }\n\t\t\t\t\t\t\tchecked={ !! dropCap }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { dropCap: ! dropCap } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\thelp={ helpText }\n\t\t\t\t\t\t\tdisabled={\n\t\t\t\t\t\t\t\thasDropCapDisabled( align ) ? true : false\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{ ! content && (\n\t\t\t\t<DropZone\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tparagraphElement={ paragraphElement }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<RichText\n\t\t\t\tidentifier=\"content\"\n\t\t\t\ttagName=\"p\"\n\t\t\t\t{ ...blockProps }\n\t\t\t\tvalue={ content }\n\t\t\t\tonChange={ ( newContent ) =>\n\t\t\t\t\tsetAttributes( { content: newContent } )\n\t\t\t\t}\n\t\t\t\tonSplit={ ( value, isOriginal ) => {\n\t\t\t\t\tlet newAttributes;\n\n\t\t\t\t\tif ( isOriginal || value ) {\n\t\t\t\t\t\tnewAttributes = {\n\t\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\tconst block = createBlock( name, newAttributes );\n\n\t\t\t\t\tif ( isOriginal ) {\n\t\t\t\t\t\tblock.clientId = clientId;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn block;\n\t\t\t\t} }\n\t\t\t\tonMerge={ mergeBlocks }\n\t\t\t\tonReplace={ onReplace }\n\t\t\t\tonRemove={ onRemove }\n\t\t\t\taria-label={\n\t\t\t\t\tcontent\n\t\t\t\t\t\t? __( 'Paragraph block' )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'Empty block; start writing or type forward slash to choose a block'\n\t\t\t\t\t\t )\n\t\t\t\t}\n\t\t\t\tdata-empty={ content ? false : true }\n\t\t\t\tplaceholder={ placeholder || __( 'Type / to choose a block' ) }\n\t\t\t\tdata-custom-placeholder={ placeholder ? true : undefined }\n\t\t\t\t__unstableEmbedURLOnPaste\n\t\t\t\t__unstableAllowPrefixTransformations\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ParagraphBlock;\n"]}
|
package/build/paragraph/save.js
CHANGED
|
@@ -13,6 +13,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
|
|
14
14
|
var _blockEditor = require("@wordpress/block-editor");
|
|
15
15
|
|
|
16
|
+
var _i18n = require("@wordpress/i18n");
|
|
17
|
+
|
|
16
18
|
/**
|
|
17
19
|
* External dependencies
|
|
18
20
|
*/
|
|
@@ -31,7 +33,7 @@ function save(_ref) {
|
|
|
31
33
|
direction
|
|
32
34
|
} = attributes;
|
|
33
35
|
const className = (0, _classnames.default)({
|
|
34
|
-
'has-drop-cap': dropCap,
|
|
36
|
+
'has-drop-cap': align === ((0, _i18n.isRTL)() ? 'left' : 'right') || align === 'center' ? false : dropCap,
|
|
35
37
|
[`has-text-align-${align}`]: align
|
|
36
38
|
});
|
|
37
39
|
return (0, _element.createElement)("p", _blockEditor.useBlockProps.save({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/paragraph/save.js"],"names":["save","attributes","align","content","dropCap","direction","className","useBlockProps","dir"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/paragraph/save.js"],"names":["save","attributes","align","content","dropCap","direction","className","useBlockProps","dir"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,IAAT,OAAgC;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AAC9C,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA,OAAT;AAAkBC,IAAAA,OAAlB;AAA2BC,IAAAA;AAA3B,MAAyCJ,UAA/C;AACA,QAAMK,SAAS,GAAG,yBAAY;AAC7B,oBACCJ,KAAK,MAAO,qBAAU,MAAV,GAAmB,OAA1B,CAAL,IAA4CA,KAAK,KAAK,QAAtD,GACG,KADH,GAEGE,OAJyB;AAK7B,KAAG,kBAAkBF,KAAO,EAA5B,GAAiCA;AALJ,GAAZ,CAAlB;AAQA,SACC,iCAAQK,2BAAcP,IAAd,CAAoB;AAAEM,IAAAA,SAAF;AAAaE,IAAAA,GAAG,EAAEH;AAAlB,GAApB,CAAR,EACC,4BAAC,qBAAD,CAAU,OAAV;AAAkB,IAAA,KAAK,EAAGF;AAA1B,IADD,CADD;AAKA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { RichText, useBlockProps } from '@wordpress/block-editor';\nimport { isRTL } from '@wordpress/i18n';\n\nexport default function save( { attributes } ) {\n\tconst { align, content, dropCap, direction } = attributes;\n\tconst className = classnames( {\n\t\t'has-drop-cap':\n\t\t\talign === ( isRTL() ? 'left' : 'right' ) || align === 'center'\n\t\t\t\t? false\n\t\t\t\t: dropCap,\n\t\t[ `has-text-align-${ align }` ]: align,\n\t} );\n\n\treturn (\n\t\t<p { ...useBlockProps.save( { className, dir: direction } ) }>\n\t\t\t<RichText.Content value={ content } />\n\t\t</p>\n\t);\n}\n"]}
|
|
@@ -70,9 +70,12 @@ function PostAuthorEdit(_ref) {
|
|
|
70
70
|
textAlign,
|
|
71
71
|
showAvatar,
|
|
72
72
|
showBio,
|
|
73
|
-
byline
|
|
73
|
+
byline,
|
|
74
|
+
isLink,
|
|
75
|
+
linkTarget
|
|
74
76
|
} = attributes;
|
|
75
77
|
const avatarSizes = [];
|
|
78
|
+
const authorName = (authorDetails === null || authorDetails === void 0 ? void 0 : authorDetails.name) || (0, _i18n.__)('Post Author');
|
|
76
79
|
|
|
77
80
|
if (authorDetails) {
|
|
78
81
|
Object.keys(authorDetails.avatar_urls).forEach(size => {
|
|
@@ -129,6 +132,18 @@ function PostAuthorEdit(_ref) {
|
|
|
129
132
|
onChange: () => setAttributes({
|
|
130
133
|
showBio: !showBio
|
|
131
134
|
})
|
|
135
|
+
}), (0, _element.createElement)(_components.ToggleControl, {
|
|
136
|
+
label: (0, _i18n.__)('Link author name to author page'),
|
|
137
|
+
checked: isLink,
|
|
138
|
+
onChange: () => setAttributes({
|
|
139
|
+
isLink: !isLink
|
|
140
|
+
})
|
|
141
|
+
}), isLink && (0, _element.createElement)(_components.ToggleControl, {
|
|
142
|
+
label: (0, _i18n.__)('Open in new tab'),
|
|
143
|
+
onChange: value => setAttributes({
|
|
144
|
+
linkTarget: value ? '_blank' : '_self'
|
|
145
|
+
}),
|
|
146
|
+
checked: linkTarget === '_blank'
|
|
132
147
|
}))), (0, _element.createElement)(_blockEditor.BlockControls, {
|
|
133
148
|
group: "block"
|
|
134
149
|
}, (0, _element.createElement)(_blockEditor.AlignmentControl, {
|
|
@@ -157,7 +172,10 @@ function PostAuthorEdit(_ref) {
|
|
|
157
172
|
})
|
|
158
173
|
}), (0, _element.createElement)("p", {
|
|
159
174
|
className: "wp-block-post-author__name"
|
|
160
|
-
},
|
|
175
|
+
}, isLink ? (0, _element.createElement)("a", {
|
|
176
|
+
href: "#post-author-pseudo-link",
|
|
177
|
+
onClick: event => event.preventDefault()
|
|
178
|
+
}, authorName) : authorName), showBio && (0, _element.createElement)("p", {
|
|
161
179
|
className: "wp-block-post-author__bio",
|
|
162
180
|
dangerouslySetInnerHTML: {
|
|
163
181
|
__html: authorDetails === null || authorDetails === void 0 ? void 0 : authorDetails.description
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-author/edit.js"],"names":["PostAuthorEdit","isSelected","context","postType","postId","queryId","attributes","setAttributes","isDescendentOfQueryLoop","Number","isFinite","authorId","authorDetails","authors","select","getEditedEntityRecord","getUser","getUsers","coreStore","_authorId","author","who","editEntityRecord","textAlign","showAvatar","showBio","byline","avatarSizes","Object","keys","avatar_urls","forEach","size","push","value","label","blockProps","className","length","map","id","name","nextAuthorId","avatarSize","nextAlign","RichText","isEmpty","__html","description"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;AAaA,SAASA,cAAT,OAKI;AAAA,MALqB;AACxBC,IAAAA,UADwB;AAExBC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,MAAZ;AAAoBC,MAAAA;AAApB,KAFe;AAGxBC,IAAAA,UAHwB;AAIxBC,IAAAA;AAJwB,GAKrB;AACH,QAAMC,uBAAuB,GAAGC,MAAM,CAACC,QAAP,CAAiBL,OAAjB,CAAhC;AACA,QAAM;AAAEM,IAAAA,QAAF;AAAYC,IAAAA,aAAZ;AAA2BC,IAA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BADX;AAEC,IAAA,uBAAuB,EAAG;AACzBsB,MAAAA,MAAM,EAAEnC,aAAF,aAAEA,aAAF,uBAAEA,aAAa,CAAEoC;AADE;AAF3B,IAjBF,CAdD,CAjED,CADD;AA4GA;;eAEchD,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, SelectControl, ToggleControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nfunction PostAuthorEdit( {\n\tisSelected,\n\tcontext: { postType, postId, queryId },\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst { authorId, authorDetails, authors } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser, getUsers } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _authorId = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t)?.author;\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthorDetails: _authorId ? getUser( _authorId ) : null,\n\t\t\t\tauthors: getUsers( { who: 'authors' } ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst { textAlign, showAvatar, showBio, byline } = attributes;\n\n\tconst avatarSizes = [];\n\tif ( authorDetails ) {\n\t\tObject.keys( authorDetails.avatar_urls ).forEach( ( size ) => {\n\t\t\tavatarSizes.push( {\n\t\t\t\tvalue: size,\n\t\t\t\tlabel: `${ size } x ${ size }`,\n\t\t\t} );\n\t\t} );\n\t}\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\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ !! postId &&\n\t\t\t\t\t\t! isDescendentOfQueryLoop &&\n\t\t\t\t\t\t!! authors?.length && (\n\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\t\toptions={ authors.map( ( { id, name } ) => {\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\t\t\t\t\tlabel: name,\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\tonChange={ ( nextAuthorId ) => {\n\t\t\t\t\t\t\t\t\teditEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\t\t\t\tpostId,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tauthor: nextAuthorId,\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) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\tchecked={ showAvatar }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showAvatar: ! showAvatar } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ showAvatar && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\tvalue={ attributes.avatarSize }\n\t\t\t\t\t\t\toptions={ avatarSizes }\n\t\t\t\t\t\t\tonChange={ ( size ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tavatarSize: Number( size ),\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) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\tchecked={ showBio }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showBio: ! showBio } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ showAvatar && authorDetails && (\n\t\t\t\t\t<div className=\"wp-block-post-author__avatar\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\twidth={ attributes.avatarSize }\n\t\t\t\t\t\t\tsrc={\n\t\t\t\t\t\t\t\tauthorDetails.avatar_urls[\n\t\t\t\t\t\t\t\t\tattributes.avatarSize\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\talt={ authorDetails.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"wp-block-post-author__content\">\n\t\t\t\t\t{ ( ! RichText.isEmpty( byline ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__byline\"\n\t\t\t\t\t\t\tmultiline={ false }\n\t\t\t\t\t\t\taria-label={ __( 'Post author byline text' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Write byline…' ) }\n\t\t\t\t\t\t\tvalue={ byline }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { byline: value } )\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<p className=\"wp-block-post-author__name\">\n\t\t\t\t\t\t{ authorDetails?.name || __( 'Post Author' ) }\n\t\t\t\t\t</p>\n\t\t\t\t\t{ showBio && (\n\t\t\t\t\t\t<p\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__bio\"\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: authorDetails?.description,\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</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default PostAuthorEdit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-author/edit.js"],"names":["PostAuthorEdit","isSelected","context","postType","postId","queryId","attributes","setAttributes","isDescendentOfQueryLoop","Number","isFinite","authorId","authorDetails","authors","select","getEditedEntityRecord","getUser","getUsers","coreStore","_authorId","author","who","editEntityRecord","textAlign","showAvatar","showBio","byline","isLink","linkTarget","avatarSizes","authorName","name","Object","keys","avatar_urls","forEach","size","push","value","label","blockProps","className","length","map","id","nextAuthorId","avatarSize","nextAlign","RichText","isEmpty","event","preventDefault","__html","description"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AAOA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;AAaA,SAASA,cAAT,OAKI;AAAA,MALqB;AACxBC,IAAAA,UADwB;AAExBC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,MAAZ;AAAoBC,MAAAA;AAApB,KAFe;AAGxBC,IAAAA,UAHwB;AAIxBC,IAAAA;AAJwB,GAKrB;AACH,QAAMC,uBAAuB,GAAG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EC,IAAA,GAAG,EACFlC,aAAa,CAACsB,WAAd,CACC5B,UAAU,CAACwC,UADZ,CAHF;AAOC,IAAA,GAAG,EAAGlC,aAAa,CAACmB;AAPrB,IADD,CAFF,EAcC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,CAAE,CAAEiB,sBAASC,OAAT,CAAkBvB,MAAlB,CAAF,IAAgCzB,UAAlC,KACD,4BAAC,qBAAD;AACC,IAAA,SAAS,EAAC,8BADX;AAEC,IAAA,SAAS,EAAG,KAFb;AAGC,kBAAa,cAAI,yBAAJ,CAHd;AAIC,IAAA,WAAW,EAAG,cAAI,eAAJ,CAJf;AAKC,IAAA,KAAK,EAAGyB,MALT;AAMC,IAAA,QAAQ,EAAKY,KAAF,IACV/B,aAAa,CAAE;AAAEmB,MAAAA,MAAM,EAAEY;AAAV,KAAF;AAPf,IAFF,EAaC;AAAG,IAAA,SAAS,EAAC;AAAb,KACGX,MAAM,GACP;AACC,IAAA,IAAI,EAAC,0BADN;AAEC,IAAA,OAAO,EAAKuB,KAAF,IAAaA,KAAK,CAACC,cAAN;AAFxB,KAIGrB,UAJH,CADO,GAQPA,UATF,CAbD,EAyBGL,OAAO,IACR;AACC,IAAA,SAAS,EAAC,2BADX;AAEC,IAAA,uBAAuB,EAAG;AACzB2B,MAAAA,MAAM,EAAExC,aAAF,aAAEA,aAAF,uBAAEA,aAAa,CAAEyC;AADE;AAF3B,IA1BF,CAdD,CAjFD,CADD;AAqIA;;eAEcrD,c","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, SelectControl, ToggleControl } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nfunction PostAuthorEdit( {\n\tisSelected,\n\tcontext: { postType, postId, queryId },\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst { authorId, authorDetails, authors } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getUser, getUsers } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _authorId = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t)?.author;\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthorDetails: _authorId ? getUser( _authorId ) : null,\n\t\t\t\tauthors: getUsers( { who: 'authors' } ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst { textAlign, showAvatar, showBio, byline, isLink, linkTarget } =\n\t\tattributes;\n\tconst avatarSizes = [];\n\tconst authorName = authorDetails?.name || __( 'Post Author' );\n\tif ( authorDetails ) {\n\t\tObject.keys( authorDetails.avatar_urls ).forEach( ( size ) => {\n\t\t\tavatarSizes.push( {\n\t\t\t\tvalue: size,\n\t\t\t\tlabel: `${ size } x ${ size }`,\n\t\t\t} );\n\t\t} );\n\t}\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\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ !! postId &&\n\t\t\t\t\t\t! isDescendentOfQueryLoop &&\n\t\t\t\t\t\t!! authors?.length && (\n\t\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Author' ) }\n\t\t\t\t\t\t\t\tvalue={ authorId }\n\t\t\t\t\t\t\t\toptions={ authors.map( ( { id, name } ) => {\n\t\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\t\t\t\t\tlabel: name,\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\tonChange={ ( nextAuthorId ) => {\n\t\t\t\t\t\t\t\t\teditEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\tpostType,\n\t\t\t\t\t\t\t\t\t\tpostId,\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tauthor: nextAuthorId,\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) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show avatar' ) }\n\t\t\t\t\t\tchecked={ showAvatar }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showAvatar: ! showAvatar } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{ showAvatar && (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tlabel={ __( 'Avatar size' ) }\n\t\t\t\t\t\t\tvalue={ attributes.avatarSize }\n\t\t\t\t\t\t\toptions={ avatarSizes }\n\t\t\t\t\t\t\tonChange={ ( size ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tavatarSize: Number( size ),\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) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show bio' ) }\n\t\t\t\t\t\tchecked={ showBio }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showBio: ! showBio } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link author name to author page' ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ showAvatar && authorDetails && (\n\t\t\t\t\t<div className=\"wp-block-post-author__avatar\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\twidth={ attributes.avatarSize }\n\t\t\t\t\t\t\tsrc={\n\t\t\t\t\t\t\t\tauthorDetails.avatar_urls[\n\t\t\t\t\t\t\t\t\tattributes.avatarSize\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\talt={ authorDetails.name }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"wp-block-post-author__content\">\n\t\t\t\t\t{ ( ! RichText.isEmpty( byline ) || isSelected ) && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__byline\"\n\t\t\t\t\t\t\tmultiline={ false }\n\t\t\t\t\t\t\taria-label={ __( 'Post author byline text' ) }\n\t\t\t\t\t\t\tplaceholder={ __( 'Write byline…' ) }\n\t\t\t\t\t\t\tvalue={ byline }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { byline: value } )\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<p className=\"wp-block-post-author__name\">\n\t\t\t\t\t\t{ isLink ? (\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\thref=\"#post-author-pseudo-link\"\n\t\t\t\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ authorName }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\tauthorName\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t{ showBio && (\n\t\t\t\t\t\t<p\n\t\t\t\t\t\t\tclassName=\"wp-block-post-author__bio\"\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: authorDetails?.description,\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</div>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n\nexport default PostAuthorEdit;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/post-author/index.js"],"names":["name","metadata","settings","icon","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/post-author/index.js"],"names":["name","metadata","settings","icon","edit","init"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,iBADuB;AAEvBC,EAAAA,IAAI,EAAJA;AAFuB,CAAjB;;;AAKA,MAAMC,IAAI,GAAG,MAAM,wBAAW;AAAEL,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA;AAAlB,CAAX,CAAnB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { postAuthor 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';\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"]}
|
|
@@ -61,7 +61,12 @@ function EditableContent(_ref2) {
|
|
|
61
61
|
return (_getSettings = getSettings()) === null || _getSettings === void 0 ? void 0 : _getSettings.supportsLayout;
|
|
62
62
|
}, []);
|
|
63
63
|
const defaultLayout = (0, _blockEditor.useSetting)('layout') || {};
|
|
64
|
-
const usedLayout =
|
|
64
|
+
const usedLayout = !(layout !== null && layout !== void 0 && layout.type) ? { ...defaultLayout,
|
|
65
|
+
...layout,
|
|
66
|
+
type: 'default'
|
|
67
|
+
} : { ...defaultLayout,
|
|
68
|
+
...layout
|
|
69
|
+
};
|
|
65
70
|
const [blocks, onInput, onChange] = (0, _coreData.useEntityBlockEditor)('postType', postType, {
|
|
66
71
|
id: postId
|
|
67
72
|
});
|