@wordpress/block-library 9.40.1 → 9.40.2-next.v.202602241322.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/build/icon/block.json +9 -1
- package/build/icon/components/custom-inserter/icon-grid.cjs +1 -1
- package/build/icon/components/custom-inserter/icon-grid.cjs.map +2 -2
- package/build/icon/components/custom-inserter/index.cjs +1 -1
- package/build/icon/components/custom-inserter/index.cjs.map +2 -2
- package/build/icon/edit.cjs +15 -7
- package/build/icon/edit.cjs.map +2 -2
- package/build/image/edit.cjs +1 -1
- package/build/image/edit.cjs.map +2 -2
- package/build/navigation-overlay-close/edit.cjs +2 -3
- package/build/navigation-overlay-close/edit.cjs.map +2 -2
- package/build/post-navigation-link/block.json +1 -3
- package/build/post-navigation-link/deprecated.cjs +100 -0
- package/build/post-navigation-link/deprecated.cjs.map +7 -0
- package/build/post-navigation-link/edit.cjs +2 -36
- package/build/post-navigation-link/edit.cjs.map +3 -3
- package/build/post-navigation-link/index.cjs +2 -0
- package/build/post-navigation-link/index.cjs.map +3 -3
- package/build/post-title/block.json +1 -3
- package/build/post-title/deprecated.cjs +82 -1
- package/build/post-title/deprecated.cjs.map +3 -3
- package/build/post-title/edit.cjs +10 -36
- package/build/post-title/edit.cjs.map +3 -3
- package/build/pullquote/deprecated.cjs +6 -6
- package/build/pullquote/deprecated.cjs.map +2 -2
- package/build/query/block.json +1 -2
- package/build/query-title/block.json +1 -3
- package/build/query-title/deprecated.cjs +70 -1
- package/build/query-title/deprecated.cjs.map +3 -3
- package/build/query-title/edit.cjs +17 -35
- package/build/query-title/edit.cjs.map +3 -3
- package/build/site-tagline/block.json +6 -4
- package/build/site-tagline/deprecated.cjs +66 -1
- package/build/site-tagline/deprecated.cjs.map +3 -3
- package/build/site-tagline/edit.cjs +14 -28
- package/build/site-tagline/edit.cjs.map +3 -3
- package/build/site-title/block.json +1 -3
- package/build/site-title/deprecated.cjs +79 -1
- package/build/site-title/deprecated.cjs.map +3 -3
- package/build/site-title/edit.cjs +14 -30
- package/build/site-title/edit.cjs.map +3 -3
- package/build/tabs-menu-item/block.json +1 -26
- package/build/tabs-menu-item/controls.cjs +2 -100
- package/build/tabs-menu-item/controls.cjs.map +3 -3
- package/build/tabs-menu-item/edit.cjs +6 -65
- package/build/tabs-menu-item/edit.cjs.map +2 -2
- package/build/tabs-menu-item/save.cjs +1 -15
- package/build/tabs-menu-item/save.cjs.map +2 -2
- package/build-module/icon/block.json +9 -1
- package/build-module/icon/components/custom-inserter/icon-grid.mjs +1 -1
- package/build-module/icon/components/custom-inserter/icon-grid.mjs.map +2 -2
- package/build-module/icon/components/custom-inserter/index.mjs +1 -1
- package/build-module/icon/components/custom-inserter/index.mjs.map +2 -2
- package/build-module/icon/edit.mjs +15 -7
- package/build-module/icon/edit.mjs.map +2 -2
- package/build-module/image/edit.mjs +1 -1
- package/build-module/image/edit.mjs.map +2 -2
- package/build-module/navigation-overlay-close/edit.mjs +2 -3
- package/build-module/navigation-overlay-close/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/block.json +1 -3
- package/build-module/post-navigation-link/deprecated.mjs +69 -0
- package/build-module/post-navigation-link/deprecated.mjs.map +7 -0
- package/build-module/post-navigation-link/edit.mjs +3 -30
- package/build-module/post-navigation-link/edit.mjs.map +2 -2
- package/build-module/post-navigation-link/index.mjs +2 -0
- package/build-module/post-navigation-link/index.mjs.map +2 -2
- package/build-module/post-title/block.json +1 -3
- package/build-module/post-title/deprecated.mjs +82 -1
- package/build-module/post-title/deprecated.mjs.map +2 -2
- package/build-module/post-title/edit.mjs +10 -27
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/pullquote/deprecated.mjs +6 -6
- package/build-module/pullquote/deprecated.mjs.map +2 -2
- package/build-module/query/block.json +1 -2
- package/build-module/query-title/block.json +1 -3
- package/build-module/query-title/deprecated.mjs +70 -1
- package/build-module/query-title/deprecated.mjs.map +2 -2
- package/build-module/query-title/edit.mjs +17 -36
- package/build-module/query-title/edit.mjs.map +2 -2
- package/build-module/site-tagline/block.json +6 -4
- package/build-module/site-tagline/deprecated.mjs +66 -1
- package/build-module/site-tagline/deprecated.mjs.map +2 -2
- package/build-module/site-tagline/edit.mjs +14 -29
- package/build-module/site-tagline/edit.mjs.map +2 -2
- package/build-module/site-title/block.json +1 -3
- package/build-module/site-title/deprecated.mjs +79 -1
- package/build-module/site-title/deprecated.mjs.map +2 -2
- package/build-module/site-title/edit.mjs +14 -31
- package/build-module/site-title/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/block.json +1 -26
- package/build-module/tabs-menu-item/controls.mjs +3 -104
- package/build-module/tabs-menu-item/controls.mjs.map +2 -2
- package/build-module/tabs-menu-item/edit.mjs +6 -66
- package/build-module/tabs-menu-item/edit.mjs.map +2 -2
- package/build-module/tabs-menu-item/save.mjs +1 -15
- package/build-module/tabs-menu-item/save.mjs.map +2 -2
- package/build-style/editor-rtl.css +0 -5
- package/build-style/editor.css +0 -5
- package/build-style/style-rtl.css +3 -12
- package/build-style/style.css +3 -12
- package/build-style/tabs-menu-item/editor-rtl.css +0 -5
- package/build-style/tabs-menu-item/editor.css +0 -5
- package/build-style/tabs-menu-item/style-rtl.css +3 -12
- package/build-style/tabs-menu-item/style.css +3 -12
- package/package.json +38 -38
- package/src/icon/block.json +9 -1
- package/src/icon/components/custom-inserter/icon-grid.js +1 -1
- package/src/icon/components/custom-inserter/index.js +1 -1
- package/src/icon/edit.js +20 -10
- package/src/icon/index.php +1 -3
- package/src/image/edit.js +1 -1
- package/src/image/index.php +1 -4
- package/src/navigation-overlay-close/edit.js +4 -3
- package/src/post-featured-image/index.php +2 -4
- package/src/post-navigation-link/block.json +1 -3
- package/src/post-navigation-link/deprecated.js +72 -0
- package/src/post-navigation-link/edit.js +2 -35
- package/src/post-navigation-link/index.js +2 -0
- package/src/post-title/block.json +1 -3
- package/src/post-title/deprecated.js +86 -1
- package/src/post-title/edit.js +2 -18
- package/src/pullquote/deprecated.js +3 -3
- package/src/query/block.json +1 -2
- package/src/query-title/block.json +1 -3
- package/src/query-title/deprecated.js +74 -1
- package/src/query-title/edit.js +11 -27
- package/src/site-tagline/block.json +6 -4
- package/src/site-tagline/deprecated.js +70 -1
- package/src/site-tagline/edit.js +9 -22
- package/src/site-title/block.json +1 -3
- package/src/site-title/deprecated.js +83 -1
- package/src/site-title/edit.js +9 -22
- package/src/tabs-menu-item/block.json +1 -26
- package/src/tabs-menu-item/controls.js +0 -108
- package/src/tabs-menu-item/edit.js +6 -79
- package/src/tabs-menu-item/editor.scss +0 -6
- package/src/tabs-menu-item/save.js +1 -26
- package/src/tabs-menu-item/style.scss +3 -14
|
@@ -1,5 +1,86 @@
|
|
|
1
1
|
// packages/block-library/src/post-title/deprecated.js
|
|
2
2
|
import migrateFontFamily from "../utils/migrate-font-family.mjs";
|
|
3
|
+
import migrateTextAlign from "../utils/migrate-text-align.mjs";
|
|
4
|
+
var v2 = {
|
|
5
|
+
attributes: {
|
|
6
|
+
textAlign: {
|
|
7
|
+
type: "string"
|
|
8
|
+
},
|
|
9
|
+
level: {
|
|
10
|
+
type: "number",
|
|
11
|
+
default: 2
|
|
12
|
+
},
|
|
13
|
+
levelOptions: {
|
|
14
|
+
type: "array"
|
|
15
|
+
},
|
|
16
|
+
isLink: {
|
|
17
|
+
type: "boolean",
|
|
18
|
+
default: false
|
|
19
|
+
},
|
|
20
|
+
rel: {
|
|
21
|
+
type: "string",
|
|
22
|
+
attribute: "rel",
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
linkTarget: {
|
|
26
|
+
type: "string",
|
|
27
|
+
default: "_self"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
supports: {
|
|
31
|
+
anchor: true,
|
|
32
|
+
align: ["wide", "full"],
|
|
33
|
+
html: false,
|
|
34
|
+
color: {
|
|
35
|
+
gradients: true,
|
|
36
|
+
link: true,
|
|
37
|
+
__experimentalDefaultControls: {
|
|
38
|
+
background: true,
|
|
39
|
+
text: true,
|
|
40
|
+
link: true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
spacing: {
|
|
44
|
+
padding: true,
|
|
45
|
+
margin: true
|
|
46
|
+
},
|
|
47
|
+
typography: {
|
|
48
|
+
fontSize: true,
|
|
49
|
+
lineHeight: true,
|
|
50
|
+
__experimentalFontFamily: true,
|
|
51
|
+
__experimentalTextTransform: true,
|
|
52
|
+
__experimentalTextDecoration: true,
|
|
53
|
+
__experimentalFontStyle: true,
|
|
54
|
+
__experimentalFontWeight: true,
|
|
55
|
+
__experimentalLetterSpacing: true,
|
|
56
|
+
__experimentalDefaultControls: {
|
|
57
|
+
fontSize: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
interactivity: {
|
|
61
|
+
clientNavigation: true
|
|
62
|
+
},
|
|
63
|
+
__experimentalBorder: {
|
|
64
|
+
radius: true,
|
|
65
|
+
color: true,
|
|
66
|
+
width: true,
|
|
67
|
+
style: true,
|
|
68
|
+
__experimentalDefaultControls: {
|
|
69
|
+
radius: true,
|
|
70
|
+
color: true,
|
|
71
|
+
width: true,
|
|
72
|
+
style: true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
migrate: migrateTextAlign,
|
|
77
|
+
isEligible(attributes) {
|
|
78
|
+
return !!attributes.textAlign || !!attributes.className?.match(
|
|
79
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
save: () => null
|
|
83
|
+
};
|
|
3
84
|
var v1 = {
|
|
4
85
|
attributes: {
|
|
5
86
|
textAlign: {
|
|
@@ -50,7 +131,7 @@ var v1 = {
|
|
|
50
131
|
return style?.typography?.fontFamily;
|
|
51
132
|
}
|
|
52
133
|
};
|
|
53
|
-
var deprecated_default = [v1];
|
|
134
|
+
var deprecated_default = [v2, v1];
|
|
54
135
|
export {
|
|
55
136
|
deprecated_default as default
|
|
56
137
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-title/deprecated.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2,\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\trel: {\n\t\t\ttype: 'string',\n\t\t\tattribute: 'rel',\n\t\t\tdefault: '',\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t},\n\tsupports: {\n\t\talign: [ 'wide', 'full' ],\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v1 ];\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v2 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2,\n\t\t},\n\t\tlevelOptions: {\n\t\t\ttype: 'array',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\trel: {\n\t\t\ttype: 'string',\n\t\t\tattribute: 'rel',\n\t\t\tdefault: '',\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\talign: [ 'wide', 'full' ],\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t\tlink: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tpadding: true,\n\t\t\tmargin: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tmigrate: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\t!! attributes.textAlign ||\n\t\t\t!! attributes.className?.match(\n\t\t\t\t/\\bhas-text-align-(left|center|right)\\b/\n\t\t\t)\n\t\t);\n\t},\n\tsave: () => null,\n};\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 2,\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\trel: {\n\t\t\ttype: 'string',\n\t\t\tattribute: 'rel',\n\t\t\tdefault: '',\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t},\n\tsupports: {\n\t\talign: [ 'wide', 'full' ],\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v2, v1 ];\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,uBAAuB;AAC9B,OAAO,sBAAsB;AAE7B,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,cAAc;AAAA,MACb,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,KAAK;AAAA,MACJ,MAAM;AAAA,MACN,WAAW;AAAA,MACX,SAAS;AA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AAA,IACV;AAAA,IACA,KAAK;AAAA,MACJ,MAAM;AAAA,MACN,WAAW;AAAA,MACX,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,OAAO,CAAE,QAAQ,MAAO;AAAA,IACxB,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,IACP;AAAA,IACA,SAAS;AAAA,MACR,QAAQ;AAAA,IACT;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,IAC9B;AAAA,EACD;AAAA,EACA,OAAO;AACN,WAAO;AAAA,EACR;AAAA,EACA,SAAS;AAAA,EACT,WAAY,EAAE,MAAM,GAAI;AACvB,WAAO,OAAO,YAAY;AAAA,EAC3B;AACD;AAUA,IAAO,qBAAQ,CAAE,IAAI,EAAG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// packages/block-library/src/post-title/edit.js
|
|
2
|
-
import clsx from "clsx";
|
|
3
2
|
import {
|
|
4
|
-
AlignmentControl,
|
|
5
3
|
BlockControls,
|
|
6
4
|
InspectorControls,
|
|
7
5
|
useBlockProps,
|
|
@@ -24,7 +22,7 @@ import { createInterpolateElement } from "@wordpress/element";
|
|
|
24
22
|
import { useToolsPanelDropdownMenuProps } from "../utils/hooks.mjs";
|
|
25
23
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
26
24
|
function PostTitleEdit({
|
|
27
|
-
attributes: { level, levelOptions,
|
|
25
|
+
attributes: { level, levelOptions, isLink, rel, linkTarget },
|
|
28
26
|
setAttributes,
|
|
29
27
|
context: { postType, postId, queryId },
|
|
30
28
|
insertBlocksAfter
|
|
@@ -54,11 +52,7 @@ function PostTitleEdit({
|
|
|
54
52
|
const onSplitAtEnd = () => {
|
|
55
53
|
insertBlocksAfter(createBlock(getDefaultBlockName()));
|
|
56
54
|
};
|
|
57
|
-
const blockProps = useBlockProps(
|
|
58
|
-
className: clsx({
|
|
59
|
-
[`has-text-align-${textAlign}`]: textAlign
|
|
60
|
-
})
|
|
61
|
-
});
|
|
55
|
+
const blockProps = useBlockProps();
|
|
62
56
|
const blockEditingMode = useBlockEditingMode();
|
|
63
57
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
64
58
|
let titleElement = /* @__PURE__ */ jsx(TagName, { ...blockProps, children: __("Title") });
|
|
@@ -113,25 +107,14 @@ function PostTitleEdit({
|
|
|
113
107
|
}
|
|
114
108
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
115
109
|
blockEditingMode === "default" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
),
|
|
125
|
-
/* @__PURE__ */ jsx(
|
|
126
|
-
AlignmentControl,
|
|
127
|
-
{
|
|
128
|
-
value: textAlign,
|
|
129
|
-
onChange: (nextAlign) => {
|
|
130
|
-
setAttributes({ textAlign: nextAlign });
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
] }),
|
|
110
|
+
/* @__PURE__ */ jsx(BlockControls, { group: "block", children: /* @__PURE__ */ jsx(
|
|
111
|
+
HeadingLevelDropdown,
|
|
112
|
+
{
|
|
113
|
+
value: level,
|
|
114
|
+
options: levelOptions,
|
|
115
|
+
onChange: (newLevel) => setAttributes({ level: newLevel })
|
|
116
|
+
}
|
|
117
|
+
) }),
|
|
135
118
|
/* @__PURE__ */ jsx(InspectorControls, { children: /* @__PURE__ */ jsxs(
|
|
136
119
|
ToolsPanel,
|
|
137
120
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-title/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";AAGA
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tPlainText,\n\tHeadingLevelDropdown,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tExternalLink,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { createBlock, getDefaultBlockName } from '@wordpress/blocks';\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function PostTitleEdit( {\n\tattributes: { level, levelOptions, isLink, rel, linkTarget },\n\tsetAttributes,\n\tcontext: { postType, postId, queryId },\n\tinsertBlocksAfter,\n} ) {\n\tconst TagName = level === 0 ? 'p' : `h${ level }`;\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst userCanEdit = useSelect(\n\t\t( select ) => {\n\t\t\t/**\n\t\t\t * useCanEditEntity may trigger an OPTIONS request to the REST API\n\t\t\t * via the canUser resolver. However, when the Post Title is a\n\t\t\t * descendant of a Query Loop block, the title cannot be edited. In\n\t\t\t * order to avoid these unnecessary requests, we call the hook\n\t\t\t * without the proper data, resulting in returning early without\n\t\t\t * making them.\n\t\t\t */\n\t\t\tif ( isDescendentOfQueryLoop ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t\tid: postId,\n\t\t\t} );\n\t\t},\n\t\t[ isDescendentOfQueryLoop, postType, postId ]\n\t);\n\tconst [ rawTitle = '', setTitle, fullTitle ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'title',\n\t\tpostId\n\t);\n\tconst [ link ] = useEntityProp( 'postType', postType, 'link', postId );\n\tconst onSplitAtEnd = () => {\n\t\tinsertBlocksAfter( createBlock( getDefaultBlockName() ) );\n\t};\n\tconst blockProps = useBlockProps();\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tlet titleElement = <TagName { ...blockProps }>{ __( 'Title' ) }</TagName>;\n\n\tif ( postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<PlainText\n\t\t\t\ttagName={ TagName }\n\t\t\t\tplaceholder={ __( '(no title)' ) }\n\t\t\t\tvalue={ rawTitle }\n\t\t\t\tonChange={ setTitle }\n\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t{ ...blockProps }\n\t\t\t/>\n\t\t) : (\n\t\t\t<TagName\n\t\t\t\t{ ...blockProps }\n\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isLink && postType && postId ) {\n\t\ttitleElement = userCanEdit ? (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<PlainText\n\t\t\t\t\ttagName=\"a\"\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t! rawTitle.length ? __( '(no title)' ) : null\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ rawTitle }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t__experimentalVersion={ 2 }\n\t\t\t\t\t__unstableOnSplitAtEnd={ onSplitAtEnd }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t) : (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<a\n\t\t\t\t\thref={ link }\n\t\t\t\t\ttarget={ linkTarget }\n\t\t\t\t\trel={ rel }\n\t\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t__html: fullTitle?.rendered || __( '(no title)' ),\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<HeadingLevelDropdown\n\t\t\t\t\t\t\tvalue={ level }\n\t\t\t\t\t\t\toptions={ levelOptions }\n\t\t\t\t\t\t\tonChange={ ( newLevel ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { level: newLevel } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<InspectorControls>\n\t\t\t\t\t\t<ToolsPanel\n\t\t\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\trel: '',\n\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\thasValue={ () => isLink }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: false } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Make title a link' ) }\n\t\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t{ isLink && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () =>\n\t\t\t\t\t\t\t\t\t\t\tlinkTarget === '_blank'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: '_self',\n\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\t\tlinkTarget: value\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? '_blank'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: '_self',\n\t\t\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t\t\t\thasValue={ () => !! rel }\n\t\t\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: '' } )\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\t\t<TextControl\n\t\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Link relation' ) }\n\t\t\t\t\t\t\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'\n\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://developer.mozilla.org/docs/Web/HTML/Attributes/rel\" />\n\t\t\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ rel }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ ( newRel ) =>\n\t\t\t\t\t\t\t\t\t\t\t\tsetAttributes( { rel: newRel } )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ToolsPanel>\n\t\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Q,GAAI,eAAgB;AAAA,sBAC5B,MAAO;AAAA,wBACN;AAAA,0BACC;AAAA,wBACD;AAAA,wBACA;AAAA,0BACC,GACC,oBAAC,gBAAa,MAAK,8DAA6D;AAAA,wBAElF;AAAA,sBACD;AAAA,sBACA,OAAQ;AAAA,sBACR,UAAW,CAAE,WACZ,cAAe,EAAE,KAAK,OAAO,CAAE;AAAA;AAAA,kBAEjC;AAAA;AAAA,cACD;AAAA,eACD;AAAA;AAAA;AAAA,MAEF,GACD;AAAA,OACD;AAAA,IAEC;AAAA,KACH;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -258,8 +258,8 @@ var v4 = {
|
|
|
258
258
|
backgroundColor: isSolidColorStyle ? mainColor : void 0,
|
|
259
259
|
borderColor: isSolidColorStyle ? void 0 : mainColor,
|
|
260
260
|
textAlign: isSolidColorStyle ? "left" : void 0,
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
...attributes,
|
|
262
|
+
style
|
|
263
263
|
};
|
|
264
264
|
}
|
|
265
265
|
};
|
|
@@ -383,8 +383,8 @@ var v3 = {
|
|
|
383
383
|
backgroundColor: isSolidColorStyle ? mainColor : void 0,
|
|
384
384
|
borderColor: isSolidColorStyle ? void 0 : mainColor,
|
|
385
385
|
textAlign: isSolidColorStyle ? "left" : void 0,
|
|
386
|
-
|
|
387
|
-
|
|
386
|
+
...attributes,
|
|
387
|
+
style
|
|
388
388
|
};
|
|
389
389
|
}
|
|
390
390
|
};
|
|
@@ -480,8 +480,8 @@ var v2 = {
|
|
|
480
480
|
backgroundColor: isSolidColorStyle ? mainColor : void 0,
|
|
481
481
|
borderColor: isSolidColorStyle ? void 0 : mainColor,
|
|
482
482
|
textAlign: isSolidColorStyle ? "left" : void 0,
|
|
483
|
-
|
|
484
|
-
|
|
483
|
+
...attributes,
|
|
484
|
+
style
|
|
485
485
|
};
|
|
486
486
|
}
|
|
487
487
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/pullquote/deprecated.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n\tRichText,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { select } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { SOLID_COLOR_CLASS } from './shared';\n\nconst blockAttributes = {\n\tvalue: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'blockquote',\n\t\tmultiline: 'p',\n\t},\n\tcitation: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'cite',\n\t\tdefault: '',\n\t},\n\tmainColor: {\n\t\ttype: 'string',\n\t},\n\tcustomMainColor: {\n\t\ttype: 'string',\n\t},\n\ttextColor: {\n\t\ttype: 'string',\n\t},\n\tcustomTextColor: {\n\t\ttype: 'string',\n\t},\n};\n\nfunction parseBorderColor( styleString ) {\n\tif ( ! styleString ) {\n\t\treturn;\n\t}\n\tconst matches = styleString.match( /border-color:([^;]+)[;]?/ );\n\tif ( matches && matches[ 1 ] ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n\nfunction multilineToInline( value ) {\n\tvalue = value || `<p></p>`;\n\tconst padded = `</p>${ value }<p>`;\n\tconst values = padded.split( `</p><p>` );\n\n\tvalues.shift();\n\tvalues.pop();\n\n\treturn values.join( '<br>' );\n}\n\n// Version 5 created in #43210 / c4b2ca7f3f. Supports match block.json at the time.\nconst v5 = {\n\tattributes: {\n\t\tvalue: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'blockquote',\n\t\t\tmultiline: 'p',\n\t\t\trole: 'content',\n\t\t},\n\t\tcitation: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'cite',\n\t\t\tdefault: '',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\talign: [ 'left', 'right', 'wide', 'full' ],\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tbackground: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t},\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t\tfontAppearance: true,\n\t\t\t},\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tcolor: true,\n\t\t\tradius: true,\n\t\t\tstyle: true,\n\t\t\twidth: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tcolor: true,\n\t\t\t\tradius: true,\n\t\t\t\tstyle: true,\n\t\t\t\twidth: true,\n\t\t\t},\n\t\t},\n\t\t__experimentalStyle: {\n\t\t\ttypography: {\n\t\t\t\tfontSize: '1.5em',\n\t\t\t\tlineHeight: '1.6',\n\t\t\t},\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { textAlign, citation, value } = attributes;\n\t\tconst shouldShowCitation = ! RichText.isEmpty( citation );\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\t{ ...useBlockProps.save( {\n\t\t\t\t\tclassName: clsx( {\n\t\t\t\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t\t\t} ),\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<blockquote>\n\t\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t\t) }\n\t\t\t\t</blockquote>\n\t\t\t</figure>\n\t\t);\n\t},\n\tmigrate( { value, ...attributes } ) {\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\n// TODO: this is ripe for a bit of a clean up according to the example in https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/#example\n\n// Version 4 created in #30951 / 92d36a4ea1. Supports match block.json at the time.\nconst v4 = {\n\tattributes: {\n\t\t...blockAttributes,\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\talign: [ 'left', 'right', 'wide', 'full' ],\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tbackground: true,\n\t\t\tlink: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tcolor: true,\n\t\t\tradius: true,\n\t\t\tstyle: true,\n\t\t\twidth: true,\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\tmainColor,\n\t\t\tcustomMainColor,\n\t\t\tcustomTextColor,\n\t\t\ttextColor,\n\t\t\tvalue,\n\t\t\tcitation,\n\t\t\tclassName,\n\t\t} = attributes;\n\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\n\t\tlet figureClasses, figureStyles;\n\n\t\t// Is solid color style\n\t\tif ( isSolidColorStyle ) {\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tmainColor\n\t\t\t);\n\n\t\t\tfigureClasses = clsx( {\n\t\t\t\t'has-background': backgroundClass || customMainColor,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tfigureStyles = {\n\t\t\t\tbackgroundColor: backgroundClass ? undefined : customMainColor,\n\t\t\t};\n\t\t\t// Is normal style and a custom color is being used ( we can set a style directly with its value)\n\t\t} else if ( customMainColor ) {\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor: customMainColor,\n\t\t\t};\n\t\t}\n\n\t\tconst blockquoteTextColorClass = getColorClassName(\n\t\t\t'color',\n\t\t\ttextColor\n\t\t);\n\t\tconst blockquoteClasses = clsx( {\n\t\t\t'has-text-color': textColor || customTextColor,\n\t\t\t[ blockquoteTextColorClass ]: blockquoteTextColorClass,\n\t\t} );\n\n\t\tconst blockquoteStyles = blockquoteTextColorClass\n\t\t\t? undefined\n\t\t\t: { color: customTextColor };\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\t{ ...useBlockProps.save( {\n\t\t\t\t\tclassName: figureClasses,\n\t\t\t\t\tstyle: figureStyles,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<blockquote\n\t\t\t\t\tclassName={ blockquoteClasses }\n\t\t\t\t\tstyle={ blockquoteStyles }\n\t\t\t\t>\n\t\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t\t) }\n\t\t\t\t</blockquote>\n\t\t\t</figure>\n\t\t);\n\t},\n\tmigrate( {\n\t\tvalue,\n\t\tclassName,\n\t\tmainColor,\n\t\tcustomMainColor,\n\t\tcustomTextColor,\n\t\t...attributes\n\t} ) {\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\t\tlet style;\n\n\t\tif ( customMainColor ) {\n\t\t\tif ( ! isSolidColorStyle ) {\n\t\t\t\t// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tborder: {\n\t\t\t\t\t\tcolor: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tcolor: {\n\t\t\t\t\t\tbackground: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.\n\t\tif ( customTextColor && style ) {\n\t\t\tstyle.color = {\n\t\t\t\t...style.color,\n\t\t\t\ttext: customTextColor,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\tclassName,\n\t\t\tbackgroundColor: isSolidColorStyle ? mainColor : undefined,\n\t\t\tborderColor: isSolidColorStyle ? undefined : mainColor,\n\t\t\ttextAlign: isSolidColorStyle ? 'left' : undefined,\n\t\t\tstyle,\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\nconst v3 = {\n\tattributes: {\n\t\t...blockAttributes,\n\t\t// figureStyle is an attribute that never existed.\n\t\t// We are using it as a way to access the styles previously applied to the figure.\n\t\tfigureStyle: {\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'figure',\n\t\t\tattribute: 'style',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\tmainColor,\n\t\t\tcustomMainColor,\n\t\t\ttextColor,\n\t\t\tcustomTextColor,\n\t\t\tvalue,\n\t\t\tcitation,\n\t\t\tclassName,\n\t\t\tfigureStyle,\n\t\t} = attributes;\n\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\n\t\tlet figureClasses, figureStyles;\n\n\t\t// Is solid color style\n\t\tif ( isSolidColorStyle ) {\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tmainColor\n\t\t\t);\n\n\t\t\tfigureClasses = clsx( {\n\t\t\t\t'has-background': backgroundClass || customMainColor,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tfigureStyles = {\n\t\t\t\tbackgroundColor: backgroundClass ? undefined : customMainColor,\n\t\t\t};\n\t\t\t// Is normal style and a custom color is being used ( we can set a style directly with its value)\n\t\t} else if ( customMainColor ) {\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor: customMainColor,\n\t\t\t};\n\t\t\t// If normal style and a named color are being used, we need to retrieve the color value to set the style,\n\t\t\t// as there is no expectation that themes create classes that set border colors.\n\t\t} else if ( mainColor ) {\n\t\t\t// Previously here we queried the color settings to know the color value\n\t\t\t// of a named color. This made the save function impure and the block was refactored,\n\t\t\t// because meanwhile a change in the editor made it impossible to query color settings in the save function.\n\t\t\t// Here instead of querying the color settings to know the color value, we retrieve the value\n\t\t\t// directly from the style previously serialized.\n\t\t\tconst borderColor = parseBorderColor( figureStyle );\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor,\n\t\t\t};\n\t\t}\n\n\t\tconst blockquoteTextColorClass = getColorClassName(\n\t\t\t'color',\n\t\t\ttextColor\n\t\t);\n\t\tconst blockquoteClasses =\n\t\t\t( textColor || customTextColor ) &&\n\t\t\tclsx( 'has-text-color', {\n\t\t\t\t[ blockquoteTextColorClass ]: blockquoteTextColorClass,\n\t\t\t} );\n\n\t\tconst blockquoteStyles = blockquoteTextColorClass\n\t\t\t? undefined\n\t\t\t: { color: customTextColor };\n\n\t\treturn (\n\t\t\t<figure className={ figureClasses } style={ figureStyles }>\n\t\t\t\t<blockquote\n\t\t\t\t\tclassName={ blockquoteClasses }\n\t\t\t\t\tstyle={ blockquoteStyles }\n\t\t\t\t>\n\t\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t\t) }\n\t\t\t\t</blockquote>\n\t\t\t</figure>\n\t\t);\n\t},\n\tmigrate( {\n\t\tvalue,\n\t\tclassName,\n\t\tfigureStyle,\n\t\tmainColor,\n\t\tcustomMainColor,\n\t\tcustomTextColor,\n\t\t...attributes\n\t} ) {\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\t\tlet style;\n\n\t\tif ( customMainColor ) {\n\t\t\tif ( ! isSolidColorStyle ) {\n\t\t\t\t// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tborder: {\n\t\t\t\t\t\tcolor: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tcolor: {\n\t\t\t\t\t\tbackground: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.\n\t\tif ( customTextColor && style ) {\n\t\t\tstyle.color = {\n\t\t\t\t...style.color,\n\t\t\t\ttext: customTextColor,\n\t\t\t};\n\t\t}\n\t\t// If is the default style, and a main color is set,\n\t\t// migrate the main color value into a custom border color.\n\t\t// The custom border color value is retrieved by parsing the figure styles.\n\t\tif ( ! isSolidColorStyle && mainColor && figureStyle ) {\n\t\t\tconst borderColor = parseBorderColor( figureStyle );\n\t\t\tif ( borderColor ) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: multilineToInline( value ),\n\t\t\t\t\t...attributes,\n\t\t\t\t\tclassName,\n\t\t\t\t\t// Block supports: Set style.border.color if a deprecated block has `mainColor`, inline border CSS and is not a solid color style.\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tborder: {\n\t\t\t\t\t\t\tcolor: borderColor,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\tclassName,\n\t\t\tbackgroundColor: isSolidColorStyle ? mainColor : undefined,\n\t\t\tborderColor: isSolidColorStyle ? undefined : mainColor,\n\t\t\ttextAlign: isSolidColorStyle ? 'left' : undefined,\n\t\t\tstyle,\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\nconst v2 = {\n\tattributes: blockAttributes,\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\tmainColor,\n\t\t\tcustomMainColor,\n\t\t\ttextColor,\n\t\t\tcustomTextColor,\n\t\t\tvalue,\n\t\t\tcitation,\n\t\t\tclassName,\n\t\t} = attributes;\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\n\t\tlet figureClass, figureStyles;\n\t\t// Is solid color style\n\t\tif ( isSolidColorStyle ) {\n\t\t\tfigureClass = getColorClassName( 'background-color', mainColor );\n\t\t\tif ( ! figureClass ) {\n\t\t\t\tfigureStyles = {\n\t\t\t\t\tbackgroundColor: customMainColor,\n\t\t\t\t};\n\t\t\t}\n\t\t\t// Is normal style and a custom color is being used ( we can set a style directly with its value)\n\t\t} else if ( customMainColor ) {\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor: customMainColor,\n\t\t\t};\n\t\t\t// Is normal style and a named color is being used, we need to retrieve the color value to set the style,\n\t\t\t// as there is no expectation that themes create classes that set border colors.\n\t\t} else if ( mainColor ) {\n\t\t\tconst colors =\n\t\t\t\tselect( blockEditorStore ).getSettings().colors ?? [];\n\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\tmainColor\n\t\t\t);\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor: colorObject.color,\n\t\t\t};\n\t\t}\n\n\t\tconst blockquoteTextColorClass = getColorClassName(\n\t\t\t'color',\n\t\t\ttextColor\n\t\t);\n\t\tconst blockquoteClasses =\n\t\t\ttextColor || customTextColor\n\t\t\t\t? clsx( 'has-text-color', {\n\t\t\t\t\t\t[ blockquoteTextColorClass ]: blockquoteTextColorClass,\n\t\t\t\t } )\n\t\t\t\t: undefined;\n\t\tconst blockquoteStyle = blockquoteTextColorClass\n\t\t\t? undefined\n\t\t\t: { color: customTextColor };\n\t\treturn (\n\t\t\t<figure className={ figureClass } style={ figureStyles }>\n\t\t\t\t<blockquote\n\t\t\t\t\tclassName={ blockquoteClasses }\n\t\t\t\t\tstyle={ blockquoteStyle }\n\t\t\t\t>\n\t\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t\t) }\n\t\t\t\t</blockquote>\n\t\t\t</figure>\n\t\t);\n\t},\n\tmigrate( {\n\t\tvalue,\n\t\tclassName,\n\t\tmainColor,\n\t\tcustomMainColor,\n\t\tcustomTextColor,\n\t\t...attributes\n\t} ) {\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\t\tlet style = {};\n\n\t\tif ( customMainColor ) {\n\t\t\tif ( ! isSolidColorStyle ) {\n\t\t\t\t// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tborder: {\n\t\t\t\t\t\tcolor: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tcolor: {\n\t\t\t\t\t\tbackground: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.\n\t\tif ( customTextColor && style ) {\n\t\t\tstyle.color = {\n\t\t\t\t...style.color,\n\t\t\t\ttext: customTextColor,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\tclassName,\n\t\t\tbackgroundColor: isSolidColorStyle ? mainColor : undefined,\n\t\t\tborderColor: isSolidColorStyle ? undefined : mainColor,\n\t\t\ttextAlign: isSolidColorStyle ? 'left' : undefined,\n\t\t\tstyle,\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\t...blockAttributes,\n\t},\n\tsave( { attributes } ) {\n\t\tconst { value, citation } = attributes;\n\t\treturn (\n\t\t\t<blockquote>\n\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t) }\n\t\t\t</blockquote>\n\t\t);\n\t},\n\tmigrate( { value, ...attributes } ) {\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\nconst v0 = {\n\tattributes: {\n\t\t...blockAttributes,\n\t\tcitation: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'footer',\n\t\t},\n\t\talign: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'none',\n\t\t},\n\t},\n\n\tsave( { attributes } ) {\n\t\tconst { value, citation, align } = attributes;\n\n\t\treturn (\n\t\t\t<blockquote className={ `align${ align }` }>\n\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t<RichText.Content tagName=\"footer\" value={ citation } />\n\t\t\t\t) }\n\t\t\t</blockquote>\n\t\t);\n\t},\n\tmigrate( { value, ...attributes } ) {\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v5, v4, v3, v2, v1, v0 ];\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,cAAc;AAKvB,SAAS,yBAAyB;AAgI9B,SACC,KADD;AA9HJ,IAAM,kBAAkB;AAAA,EACvB,OAAO;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,WAAW;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,QAA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,SAAT,EAAiB,SAAQ,QAAO,OAAQ,UAAW;AAAA;AAAA;AAAA,QAEtD;AAAA;AAAA,IACD;AAAA,EAEF;AAAA,EACA,QAAS;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACJ,GAAI;AACH,UAAM,oBAAoB,WAAW,SAAU,iBAAkB;AACjE,QAAI;AAEJ,QAAK,iBAAkB;AACtB,UAAK,CAAE,mBAAoB;AAE1B,gBAAQ;AAAA,UACP,QAAQ;AAAA,YACP,OAAO;AAAA,UACR;AAAA,QACD;AAAA,MACD,OAAO;AAEN,gBAAQ;AAAA,UACP,OAAO;AAAA,YACN,YAAY;AAAA,UACb;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAGA,QAAK,mBAAmB,OAAQ;AAC/B,YAAM,QAAQ;AAAA,QACb,GAAG,MAAM;AAAA,QACT,MAAM;AAAA,MACP;AAAA,IACD;AAEA,WAAO;AAAA,MACN,OAAO,kBAAmB,KAAM;AAAA,MAChC;AAAA,MACA,iBAAiB,oBAAoB,YAAY;AAAA,MACjD,aAAa,oBAAoB,SAAY;AAAA,MAC7C,WAAW,oBAAoB,SAAS;AAAA,MACxC;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n\tRichText,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { select } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { SOLID_COLOR_CLASS } from './shared';\n\nconst blockAttributes = {\n\tvalue: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'blockquote',\n\t\tmultiline: 'p',\n\t},\n\tcitation: {\n\t\ttype: 'string',\n\t\tsource: 'html',\n\t\tselector: 'cite',\n\t\tdefault: '',\n\t},\n\tmainColor: {\n\t\ttype: 'string',\n\t},\n\tcustomMainColor: {\n\t\ttype: 'string',\n\t},\n\ttextColor: {\n\t\ttype: 'string',\n\t},\n\tcustomTextColor: {\n\t\ttype: 'string',\n\t},\n};\n\nfunction parseBorderColor( styleString ) {\n\tif ( ! styleString ) {\n\t\treturn;\n\t}\n\tconst matches = styleString.match( /border-color:([^;]+)[;]?/ );\n\tif ( matches && matches[ 1 ] ) {\n\t\treturn matches[ 1 ];\n\t}\n}\n\nfunction multilineToInline( value ) {\n\tvalue = value || `<p></p>`;\n\tconst padded = `</p>${ value }<p>`;\n\tconst values = padded.split( `</p><p>` );\n\n\tvalues.shift();\n\tvalues.pop();\n\n\treturn values.join( '<br>' );\n}\n\n// Version 5 created in #43210 / c4b2ca7f3f. Supports match block.json at the time.\nconst v5 = {\n\tattributes: {\n\t\tvalue: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'blockquote',\n\t\t\tmultiline: 'p',\n\t\t\trole: 'content',\n\t\t},\n\t\tcitation: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'cite',\n\t\t\tdefault: '',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\talign: [ 'left', 'right', 'wide', 'full' ],\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tbackground: true,\n\t\t\tlink: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t},\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t\tfontAppearance: true,\n\t\t\t},\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tcolor: true,\n\t\t\tradius: true,\n\t\t\tstyle: true,\n\t\t\twidth: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tcolor: true,\n\t\t\t\tradius: true,\n\t\t\t\tstyle: true,\n\t\t\t\twidth: true,\n\t\t\t},\n\t\t},\n\t\t__experimentalStyle: {\n\t\t\ttypography: {\n\t\t\t\tfontSize: '1.5em',\n\t\t\t\tlineHeight: '1.6',\n\t\t\t},\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { textAlign, citation, value } = attributes;\n\t\tconst shouldShowCitation = ! RichText.isEmpty( citation );\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\t{ ...useBlockProps.save( {\n\t\t\t\t\tclassName: clsx( {\n\t\t\t\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t\t\t} ),\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<blockquote>\n\t\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t\t) }\n\t\t\t\t</blockquote>\n\t\t\t</figure>\n\t\t);\n\t},\n\tmigrate( { value, ...attributes } ) {\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\n// TODO: this is ripe for a bit of a clean up according to the example in https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/#example\n\n// Version 4 created in #30951 / 92d36a4ea1. Supports match block.json at the time.\nconst v4 = {\n\tattributes: {\n\t\t...blockAttributes,\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\talign: [ 'left', 'right', 'wide', 'full' ],\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tbackground: true,\n\t\t\tlink: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tcolor: true,\n\t\t\tradius: true,\n\t\t\tstyle: true,\n\t\t\twidth: true,\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\tmainColor,\n\t\t\tcustomMainColor,\n\t\t\tcustomTextColor,\n\t\t\ttextColor,\n\t\t\tvalue,\n\t\t\tcitation,\n\t\t\tclassName,\n\t\t} = attributes;\n\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\n\t\tlet figureClasses, figureStyles;\n\n\t\t// Is solid color style\n\t\tif ( isSolidColorStyle ) {\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tmainColor\n\t\t\t);\n\n\t\t\tfigureClasses = clsx( {\n\t\t\t\t'has-background': backgroundClass || customMainColor,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tfigureStyles = {\n\t\t\t\tbackgroundColor: backgroundClass ? undefined : customMainColor,\n\t\t\t};\n\t\t\t// Is normal style and a custom color is being used ( we can set a style directly with its value)\n\t\t} else if ( customMainColor ) {\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor: customMainColor,\n\t\t\t};\n\t\t}\n\n\t\tconst blockquoteTextColorClass = getColorClassName(\n\t\t\t'color',\n\t\t\ttextColor\n\t\t);\n\t\tconst blockquoteClasses = clsx( {\n\t\t\t'has-text-color': textColor || customTextColor,\n\t\t\t[ blockquoteTextColorClass ]: blockquoteTextColorClass,\n\t\t} );\n\n\t\tconst blockquoteStyles = blockquoteTextColorClass\n\t\t\t? undefined\n\t\t\t: { color: customTextColor };\n\n\t\treturn (\n\t\t\t<figure\n\t\t\t\t{ ...useBlockProps.save( {\n\t\t\t\t\tclassName: figureClasses,\n\t\t\t\t\tstyle: figureStyles,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<blockquote\n\t\t\t\t\tclassName={ blockquoteClasses }\n\t\t\t\t\tstyle={ blockquoteStyles }\n\t\t\t\t>\n\t\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t\t) }\n\t\t\t\t</blockquote>\n\t\t\t</figure>\n\t\t);\n\t},\n\tmigrate( {\n\t\tvalue,\n\t\tclassName,\n\t\tmainColor,\n\t\tcustomMainColor,\n\t\tcustomTextColor,\n\t\t...attributes\n\t} ) {\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\t\tlet style;\n\n\t\tif ( customMainColor ) {\n\t\t\tif ( ! isSolidColorStyle ) {\n\t\t\t\t// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tborder: {\n\t\t\t\t\t\tcolor: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tcolor: {\n\t\t\t\t\t\tbackground: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.\n\t\tif ( customTextColor && style ) {\n\t\t\tstyle.color = {\n\t\t\t\t...style.color,\n\t\t\t\ttext: customTextColor,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\tclassName,\n\t\t\tbackgroundColor: isSolidColorStyle ? mainColor : undefined,\n\t\t\tborderColor: isSolidColorStyle ? undefined : mainColor,\n\t\t\ttextAlign: isSolidColorStyle ? 'left' : undefined,\n\t\t\t...attributes,\n\t\t\tstyle,\n\t\t};\n\t},\n};\n\nconst v3 = {\n\tattributes: {\n\t\t...blockAttributes,\n\t\t// figureStyle is an attribute that never existed.\n\t\t// We are using it as a way to access the styles previously applied to the figure.\n\t\tfigureStyle: {\n\t\t\tsource: 'attribute',\n\t\t\tselector: 'figure',\n\t\t\tattribute: 'style',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\tmainColor,\n\t\t\tcustomMainColor,\n\t\t\ttextColor,\n\t\t\tcustomTextColor,\n\t\t\tvalue,\n\t\t\tcitation,\n\t\t\tclassName,\n\t\t\tfigureStyle,\n\t\t} = attributes;\n\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\n\t\tlet figureClasses, figureStyles;\n\n\t\t// Is solid color style\n\t\tif ( isSolidColorStyle ) {\n\t\t\tconst backgroundClass = getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tmainColor\n\t\t\t);\n\n\t\t\tfigureClasses = clsx( {\n\t\t\t\t'has-background': backgroundClass || customMainColor,\n\t\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t} );\n\n\t\t\tfigureStyles = {\n\t\t\t\tbackgroundColor: backgroundClass ? undefined : customMainColor,\n\t\t\t};\n\t\t\t// Is normal style and a custom color is being used ( we can set a style directly with its value)\n\t\t} else if ( customMainColor ) {\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor: customMainColor,\n\t\t\t};\n\t\t\t// If normal style and a named color are being used, we need to retrieve the color value to set the style,\n\t\t\t// as there is no expectation that themes create classes that set border colors.\n\t\t} else if ( mainColor ) {\n\t\t\t// Previously here we queried the color settings to know the color value\n\t\t\t// of a named color. This made the save function impure and the block was refactored,\n\t\t\t// because meanwhile a change in the editor made it impossible to query color settings in the save function.\n\t\t\t// Here instead of querying the color settings to know the color value, we retrieve the value\n\t\t\t// directly from the style previously serialized.\n\t\t\tconst borderColor = parseBorderColor( figureStyle );\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor,\n\t\t\t};\n\t\t}\n\n\t\tconst blockquoteTextColorClass = getColorClassName(\n\t\t\t'color',\n\t\t\ttextColor\n\t\t);\n\t\tconst blockquoteClasses =\n\t\t\t( textColor || customTextColor ) &&\n\t\t\tclsx( 'has-text-color', {\n\t\t\t\t[ blockquoteTextColorClass ]: blockquoteTextColorClass,\n\t\t\t} );\n\n\t\tconst blockquoteStyles = blockquoteTextColorClass\n\t\t\t? undefined\n\t\t\t: { color: customTextColor };\n\n\t\treturn (\n\t\t\t<figure className={ figureClasses } style={ figureStyles }>\n\t\t\t\t<blockquote\n\t\t\t\t\tclassName={ blockquoteClasses }\n\t\t\t\t\tstyle={ blockquoteStyles }\n\t\t\t\t>\n\t\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t\t) }\n\t\t\t\t</blockquote>\n\t\t\t</figure>\n\t\t);\n\t},\n\tmigrate( {\n\t\tvalue,\n\t\tclassName,\n\t\tfigureStyle,\n\t\tmainColor,\n\t\tcustomMainColor,\n\t\tcustomTextColor,\n\t\t...attributes\n\t} ) {\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\t\tlet style;\n\n\t\tif ( customMainColor ) {\n\t\t\tif ( ! isSolidColorStyle ) {\n\t\t\t\t// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tborder: {\n\t\t\t\t\t\tcolor: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tcolor: {\n\t\t\t\t\t\tbackground: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.\n\t\tif ( customTextColor && style ) {\n\t\t\tstyle.color = {\n\t\t\t\t...style.color,\n\t\t\t\ttext: customTextColor,\n\t\t\t};\n\t\t}\n\t\t// If is the default style, and a main color is set,\n\t\t// migrate the main color value into a custom border color.\n\t\t// The custom border color value is retrieved by parsing the figure styles.\n\t\tif ( ! isSolidColorStyle && mainColor && figureStyle ) {\n\t\t\tconst borderColor = parseBorderColor( figureStyle );\n\t\t\tif ( borderColor ) {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: multilineToInline( value ),\n\t\t\t\t\t...attributes,\n\t\t\t\t\tclassName,\n\t\t\t\t\t// Block supports: Set style.border.color if a deprecated block has `mainColor`, inline border CSS and is not a solid color style.\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tborder: {\n\t\t\t\t\t\t\tcolor: borderColor,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\tclassName,\n\t\t\tbackgroundColor: isSolidColorStyle ? mainColor : undefined,\n\t\t\tborderColor: isSolidColorStyle ? undefined : mainColor,\n\t\t\ttextAlign: isSolidColorStyle ? 'left' : undefined,\n\t\t\t...attributes,\n\t\t\tstyle,\n\t\t};\n\t},\n};\n\nconst v2 = {\n\tattributes: blockAttributes,\n\tsave( { attributes } ) {\n\t\tconst {\n\t\t\tmainColor,\n\t\t\tcustomMainColor,\n\t\t\ttextColor,\n\t\t\tcustomTextColor,\n\t\t\tvalue,\n\t\t\tcitation,\n\t\t\tclassName,\n\t\t} = attributes;\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\n\t\tlet figureClass, figureStyles;\n\t\t// Is solid color style\n\t\tif ( isSolidColorStyle ) {\n\t\t\tfigureClass = getColorClassName( 'background-color', mainColor );\n\t\t\tif ( ! figureClass ) {\n\t\t\t\tfigureStyles = {\n\t\t\t\t\tbackgroundColor: customMainColor,\n\t\t\t\t};\n\t\t\t}\n\t\t\t// Is normal style and a custom color is being used ( we can set a style directly with its value)\n\t\t} else if ( customMainColor ) {\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor: customMainColor,\n\t\t\t};\n\t\t\t// Is normal style and a named color is being used, we need to retrieve the color value to set the style,\n\t\t\t// as there is no expectation that themes create classes that set border colors.\n\t\t} else if ( mainColor ) {\n\t\t\tconst colors =\n\t\t\t\tselect( blockEditorStore ).getSettings().colors ?? [];\n\t\t\tconst colorObject = getColorObjectByAttributeValues(\n\t\t\t\tcolors,\n\t\t\t\tmainColor\n\t\t\t);\n\t\t\tfigureStyles = {\n\t\t\t\tborderColor: colorObject.color,\n\t\t\t};\n\t\t}\n\n\t\tconst blockquoteTextColorClass = getColorClassName(\n\t\t\t'color',\n\t\t\ttextColor\n\t\t);\n\t\tconst blockquoteClasses =\n\t\t\ttextColor || customTextColor\n\t\t\t\t? clsx( 'has-text-color', {\n\t\t\t\t\t\t[ blockquoteTextColorClass ]: blockquoteTextColorClass,\n\t\t\t\t } )\n\t\t\t\t: undefined;\n\t\tconst blockquoteStyle = blockquoteTextColorClass\n\t\t\t? undefined\n\t\t\t: { color: customTextColor };\n\t\treturn (\n\t\t\t<figure className={ figureClass } style={ figureStyles }>\n\t\t\t\t<blockquote\n\t\t\t\t\tclassName={ blockquoteClasses }\n\t\t\t\t\tstyle={ blockquoteStyle }\n\t\t\t\t>\n\t\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t\t) }\n\t\t\t\t</blockquote>\n\t\t\t</figure>\n\t\t);\n\t},\n\tmigrate( {\n\t\tvalue,\n\t\tclassName,\n\t\tmainColor,\n\t\tcustomMainColor,\n\t\tcustomTextColor,\n\t\t...attributes\n\t} ) {\n\t\tconst isSolidColorStyle = className?.includes( SOLID_COLOR_CLASS );\n\t\tlet style = {};\n\n\t\tif ( customMainColor ) {\n\t\t\tif ( ! isSolidColorStyle ) {\n\t\t\t\t// Block supports: Set style.border.color if a deprecated block has a default style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tborder: {\n\t\t\t\t\t\tcolor: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\t// Block supports: Set style.color.background if a deprecated block has a solid style and a `customMainColor` attribute.\n\t\t\t\tstyle = {\n\t\t\t\t\tcolor: {\n\t\t\t\t\t\tbackground: customMainColor,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Block supports: Set style.color.text if a deprecated block has a `customTextColor` attribute.\n\t\tif ( customTextColor && style ) {\n\t\t\tstyle.color = {\n\t\t\t\t...style.color,\n\t\t\t\ttext: customTextColor,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\tclassName,\n\t\t\tbackgroundColor: isSolidColorStyle ? mainColor : undefined,\n\t\t\tborderColor: isSolidColorStyle ? undefined : mainColor,\n\t\t\ttextAlign: isSolidColorStyle ? 'left' : undefined,\n\t\t\t...attributes,\n\t\t\tstyle,\n\t\t};\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\t...blockAttributes,\n\t},\n\tsave( { attributes } ) {\n\t\tconst { value, citation } = attributes;\n\t\treturn (\n\t\t\t<blockquote>\n\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t<RichText.Content tagName=\"cite\" value={ citation } />\n\t\t\t\t) }\n\t\t\t</blockquote>\n\t\t);\n\t},\n\tmigrate( { value, ...attributes } ) {\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\nconst v0 = {\n\tattributes: {\n\t\t...blockAttributes,\n\t\tcitation: {\n\t\t\ttype: 'string',\n\t\t\tsource: 'html',\n\t\t\tselector: 'footer',\n\t\t},\n\t\talign: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'none',\n\t\t},\n\t},\n\n\tsave( { attributes } ) {\n\t\tconst { value, citation, align } = attributes;\n\n\t\treturn (\n\t\t\t<blockquote className={ `align${ align }` }>\n\t\t\t\t<RichText.Content value={ value } multiline />\n\t\t\t\t{ ! RichText.isEmpty( citation ) && (\n\t\t\t\t\t<RichText.Content tagName=\"footer\" value={ citation } />\n\t\t\t\t) }\n\t\t\t</blockquote>\n\t\t);\n\t},\n\tmigrate( { value, ...attributes } ) {\n\t\treturn {\n\t\t\tvalue: multilineToInline( value ),\n\t\t\t...attributes,\n\t\t};\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v5, v4, v3, v2, v1, v0 ];\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,cAAc;AAKvB,SAAS,yBAAyB;AAgI9B,SACC,KADD;AA9HJ,IAAM,kBAAkB;AAAA,EACvB,OAAO;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,WAAW;AAAA,EACZ;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,EACV;AAAA,EACA,WAAW;AAAA,IACV,MAAM;AAAA,EACP;AAAA,EACA,iBAAiB;AAAA,IAChB,MAAM;AAAA,EACP;AAAA,EACA,WAAW;AAAA,IACV,MAAM;AAAA,EACP;AAAA,EACA,iBAAiB;AAAA,IAChB,MAAM;AAAA,EACP;AACD;AAEA,SAAS,iBAAkB,aAAc;AACxC,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AACA,QAAM,UAAU,YAAY,MAAO,0BAA2B;AAC9D,MAAK,WAAW,QAAS,CAAE,GAAI;AAC9B,WAAO,QAAS,CAAE;AAAA,EACnB;AACD;AAEA,SAAS,kBAAmB,OAAQ;AACnC,UAAQ,SAAS;AACjB,QAAM,SAAS,OAAQ,KAAM;AAC7B,QAAM,SAAS,OAAO,MAA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,IACX,GAAG;AAAA,IACH,UAAU;AAAA,MACT,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,UAAU;AAAA,IACX;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EAEA,KAAM,EAAE,WAAW,GAAI;AACtB,UAAM,EAAE,OAAO,UAAU,MAAM,IAAI;AAEnC,WACC,qBAAC,gBAAW,WAAY,QAAS,KAAM,IACtC;AAAA,0BAAC,SAAS,SAAT,EAAiB,OAAgB,WAAS,MAAC;AAAA,MAC1C,CAAE,SAAS,QAAS,QAAS,KAC9B,oBAAC,SAAS,SAAT,EAAiB,SAAQ,UAAS,OAAQ,UAAW;AAAA,OAExD;AAAA,EAEF;AAAA,EACA,QAAS,EAAE,OAAO,GAAG,WAAW,GAAI;AACnC,WAAO;AAAA,MACN,OAAO,kBAAmB,KAAM;AAAA,MAChC,GAAG;AAAA,IACJ;AAAA,EACD;AACD;AAUA,IAAO,qBAAQ,CAAE,IAAI,IAAI,IAAI,IAAI,IAAI,EAAG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,9 +10,6 @@
|
|
|
10
10
|
"type": {
|
|
11
11
|
"type": "string"
|
|
12
12
|
},
|
|
13
|
-
"textAlign": {
|
|
14
|
-
"type": "string"
|
|
15
|
-
},
|
|
16
13
|
"level": {
|
|
17
14
|
"type": "number",
|
|
18
15
|
"default": 1
|
|
@@ -53,6 +50,7 @@
|
|
|
53
50
|
"typography": {
|
|
54
51
|
"fontSize": true,
|
|
55
52
|
"lineHeight": true,
|
|
53
|
+
"textAlign": true,
|
|
56
54
|
"__experimentalFontFamily": true,
|
|
57
55
|
"__experimentalFontStyle": true,
|
|
58
56
|
"__experimentalFontWeight": true,
|
|
@@ -1,5 +1,74 @@
|
|
|
1
1
|
// packages/block-library/src/query-title/deprecated.js
|
|
2
2
|
import migrateFontFamily from "../utils/migrate-font-family.mjs";
|
|
3
|
+
import migrateTextAlign from "../utils/migrate-text-align.mjs";
|
|
4
|
+
var v2 = {
|
|
5
|
+
attributes: {
|
|
6
|
+
type: {
|
|
7
|
+
type: "string"
|
|
8
|
+
},
|
|
9
|
+
textAlign: {
|
|
10
|
+
type: "string"
|
|
11
|
+
},
|
|
12
|
+
level: {
|
|
13
|
+
type: "number",
|
|
14
|
+
default: 1
|
|
15
|
+
},
|
|
16
|
+
levelOptions: {
|
|
17
|
+
type: "array"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
supports: {
|
|
21
|
+
anchor: true,
|
|
22
|
+
align: ["wide", "full"],
|
|
23
|
+
html: false,
|
|
24
|
+
color: {
|
|
25
|
+
gradients: true,
|
|
26
|
+
__experimentalDefaultControls: {
|
|
27
|
+
background: true,
|
|
28
|
+
text: true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
spacing: {
|
|
32
|
+
padding: true,
|
|
33
|
+
margin: true
|
|
34
|
+
},
|
|
35
|
+
typography: {
|
|
36
|
+
fontSize: true,
|
|
37
|
+
lineHeight: true,
|
|
38
|
+
__experimentalFontFamily: true,
|
|
39
|
+
__experimentalTextTransform: true,
|
|
40
|
+
__experimentalTextDecoration: true,
|
|
41
|
+
__experimentalFontStyle: true,
|
|
42
|
+
__experimentalFontWeight: true,
|
|
43
|
+
__experimentalLetterSpacing: true,
|
|
44
|
+
__experimentalDefaultControls: {
|
|
45
|
+
fontSize: true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
interactivity: {
|
|
49
|
+
clientNavigation: true
|
|
50
|
+
},
|
|
51
|
+
__experimentalBorder: {
|
|
52
|
+
radius: true,
|
|
53
|
+
color: true,
|
|
54
|
+
width: true,
|
|
55
|
+
style: true,
|
|
56
|
+
__experimentalDefaultControls: {
|
|
57
|
+
radius: true,
|
|
58
|
+
color: true,
|
|
59
|
+
width: true,
|
|
60
|
+
style: true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
migrate: migrateTextAlign,
|
|
65
|
+
isEligible(attributes) {
|
|
66
|
+
return !!attributes.textAlign || !!attributes.className?.match(
|
|
67
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
68
|
+
);
|
|
69
|
+
},
|
|
70
|
+
save: () => null
|
|
71
|
+
};
|
|
3
72
|
var v1 = {
|
|
4
73
|
attributes: {
|
|
5
74
|
type: {
|
|
@@ -36,7 +105,7 @@ var v1 = {
|
|
|
36
105
|
return style?.typography?.fontFamily;
|
|
37
106
|
}
|
|
38
107
|
};
|
|
39
|
-
var deprecated_default = [v1];
|
|
108
|
+
var deprecated_default = [v2, v1];
|
|
40
109
|
export {
|
|
41
110
|
deprecated_default as default
|
|
42
111
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/query-title/deprecated.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\n\nconst v1 = {\n\tattributes: {\n\t\ttype: {\n\t\t\ttype: 'string',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 1,\n\t\t},\n\t},\n\tsupports: {\n\t\talign: [ 'wide', 'full' ],\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v1 ];\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v2 = {\n\tattributes: {\n\t\ttype: {\n\t\t\ttype: 'string',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 1,\n\t\t},\n\t\tlevelOptions: {\n\t\t\ttype: 'array',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\n\t\talign: [ 'wide', 'full' ],\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tbackground: true,\n\t\t\t\ttext: true,\n\t\t\t},\n\t\t},\n\t\tspacing: {\n\t\t\tpadding: true,\n\t\t\tmargin: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tfontSize: true,\n\t\t\t},\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t\t__experimentalDefaultControls: {\n\t\t\t\tradius: true,\n\t\t\t\tcolor: true,\n\t\t\t\twidth: true,\n\t\t\t\tstyle: true,\n\t\t\t},\n\t\t},\n\t},\n\tmigrate: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\t!! attributes.textAlign ||\n\t\t\t!! attributes.className?.match(\n\t\t\t\t/\\bhas-text-align-(left|center|right)\\b/\n\t\t\t)\n\t\t);\n\t},\n\tsave: () => null,\n};\n\nconst v1 = {\n\tattributes: {\n\t\ttype: {\n\t\t\ttype: 'string',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tlevel: {\n\t\t\ttype: 'number',\n\t\t\tdefault: 1,\n\t\t},\n\t},\n\tsupports: {\n\t\talign: [ 'wide', 'full' ],\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t},\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v2, v1 ];\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,uBAAuB;AAC9B,OAAO,sBAAsB;AAE7B,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,MAAM;AAAA,MACL,MAAM;AAAA,IACP;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,cAAc;AAAA,MACb,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,QAAQ;AAAA,IACR,OAAO,CAAE,QAAQ,MAAO;AAAA,IACxB,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,+BAA+B;AAAA,QAC9B,YAAY;AAAA,QACZ,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR,SAAS;AAAA,MACT,QAAQ;AAAA,IACT;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,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,IAAI,EAAG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// packages/block-library/src/query-title/edit.js
|
|
2
|
-
import clsx from "clsx";
|
|
3
2
|
import {
|
|
4
|
-
AlignmentControl,
|
|
5
3
|
BlockControls,
|
|
6
4
|
InspectorControls,
|
|
7
5
|
useBlockProps,
|
|
@@ -17,28 +15,22 @@ import { __, _x, sprintf } from "@wordpress/i18n";
|
|
|
17
15
|
import { useArchiveLabel } from "./use-archive-label.mjs";
|
|
18
16
|
import { usePostTypeLabel } from "./use-post-type-label.mjs";
|
|
19
17
|
import { useToolsPanelDropdownMenuProps } from "../utils/hooks.mjs";
|
|
18
|
+
import useDeprecatedTextAlign from "../utils/deprecated-text-align-attributes.mjs";
|
|
20
19
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
20
|
var SUPPORTED_TYPES = ["archive", "search", "post-type"];
|
|
22
|
-
function QueryTitleEdit({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
level,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
showSearchTerm
|
|
30
|
-
},
|
|
31
|
-
setAttributes,
|
|
32
|
-
context: { query }
|
|
33
|
-
}) {
|
|
21
|
+
function QueryTitleEdit(props) {
|
|
22
|
+
useDeprecatedTextAlign(props);
|
|
23
|
+
const {
|
|
24
|
+
attributes: { type, level, levelOptions, showPrefix, showSearchTerm },
|
|
25
|
+
setAttributes,
|
|
26
|
+
context: { query }
|
|
27
|
+
} = props;
|
|
34
28
|
const { archiveTypeLabel, archiveNameLabel } = useArchiveLabel();
|
|
35
29
|
const { postTypeLabel } = usePostTypeLabel(query?.postType);
|
|
36
30
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
37
31
|
const TagName = level === 0 ? "p" : `h${level}`;
|
|
38
32
|
const blockProps = useBlockProps({
|
|
39
|
-
className:
|
|
40
|
-
[`has-text-align-${textAlign}`]: textAlign
|
|
41
|
-
})
|
|
33
|
+
className: "wp-block-query-title__placeholder"
|
|
42
34
|
});
|
|
43
35
|
if (!SUPPORTED_TYPES.includes(type)) {
|
|
44
36
|
return /* @__PURE__ */ jsx("div", { ...blockProps, children: /* @__PURE__ */ jsx(Warning, { children: __("Provided type is not supported.") }) });
|
|
@@ -190,25 +182,14 @@ function QueryTitleEdit({
|
|
|
190
182
|
] });
|
|
191
183
|
}
|
|
192
184
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
),
|
|
202
|
-
/* @__PURE__ */ jsx(
|
|
203
|
-
AlignmentControl,
|
|
204
|
-
{
|
|
205
|
-
value: textAlign,
|
|
206
|
-
onChange: (nextAlign) => {
|
|
207
|
-
setAttributes({ textAlign: nextAlign });
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
)
|
|
211
|
-
] }),
|
|
185
|
+
/* @__PURE__ */ jsx(BlockControls, { group: "block", children: /* @__PURE__ */ jsx(
|
|
186
|
+
HeadingLevelDropdown,
|
|
187
|
+
{
|
|
188
|
+
value: level,
|
|
189
|
+
options: levelOptions,
|
|
190
|
+
onChange: (newLevel) => setAttributes({ level: newLevel })
|
|
191
|
+
}
|
|
192
|
+
) }),
|
|
212
193
|
titleElement
|
|
213
194
|
] });
|
|
214
195
|
}
|