@wordpress/block-library 9.35.0 → 9.35.1-next.16d95556a.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/pullquote/block.json +3 -2
- package/build/pullquote/transforms.js +0 -31
- package/build/pullquote/transforms.js.map +2 -2
- package/build/quote/transforms.js +0 -20
- package/build/quote/transforms.js.map +2 -2
- package/build-module/pullquote/block.json +3 -2
- package/build-module/pullquote/transforms.js +0 -31
- package/build-module/pullquote/transforms.js.map +2 -2
- package/build-module/quote/transforms.js +0 -20
- package/build-module/quote/transforms.js.map +2 -2
- package/package.json +37 -37
- package/src/heading/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/heading/test/transforms.native.js +1 -5
- package/src/paragraph/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/paragraph/test/transforms.native.js +0 -1
- package/src/pullquote/block.json +3 -2
- package/src/pullquote/test/__snapshots__/transforms.native.js.snap +5 -5
- package/src/pullquote/test/transforms.native.js +1 -1
- package/src/pullquote/transforms.js +0 -31
- package/src/quote/test/__snapshots__/transforms.native.js.snap +0 -6
- package/src/quote/test/transforms.native.js +1 -5
- package/src/quote/transforms.js +0 -25
- package/src/utils/transformation-categories.native.js +0 -1
- package/src/pullquote/test/edit.native.js +0 -73
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/pullquote",
|
|
5
|
-
"title": "Pullquote",
|
|
5
|
+
"title": "Pullquote (deprecated)",
|
|
6
6
|
"category": "text",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "This block is deprecated. Please use the Quote block instead.",
|
|
8
8
|
"textdomain": "default",
|
|
9
9
|
"attributes": {
|
|
10
10
|
"value": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"minHeight": false
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
+
"inserter": false,
|
|
51
52
|
"spacing": {
|
|
52
53
|
"margin": true,
|
|
53
54
|
"padding": true
|
|
@@ -24,38 +24,7 @@ __export(transforms_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(transforms_exports);
|
|
26
26
|
var import_blocks = require("@wordpress/blocks");
|
|
27
|
-
var import_rich_text = require("@wordpress/rich-text");
|
|
28
27
|
var transforms = {
|
|
29
|
-
from: [
|
|
30
|
-
{
|
|
31
|
-
type: "block",
|
|
32
|
-
isMultiBlock: true,
|
|
33
|
-
blocks: ["core/paragraph"],
|
|
34
|
-
transform: (attributes) => {
|
|
35
|
-
return (0, import_blocks.createBlock)("core/pullquote", {
|
|
36
|
-
value: (0, import_rich_text.toHTMLString)({
|
|
37
|
-
value: (0, import_rich_text.join)(
|
|
38
|
-
attributes.map(
|
|
39
|
-
({ content }) => (0, import_rich_text.create)({ html: content })
|
|
40
|
-
),
|
|
41
|
-
"\n"
|
|
42
|
-
)
|
|
43
|
-
}),
|
|
44
|
-
anchor: attributes.anchor
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: "block",
|
|
50
|
-
blocks: ["core/heading"],
|
|
51
|
-
transform: ({ content, anchor }) => {
|
|
52
|
-
return (0, import_blocks.createBlock)("core/pullquote", {
|
|
53
|
-
value: content,
|
|
54
|
-
anchor
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
],
|
|
59
28
|
to: [
|
|
60
29
|
{
|
|
61
30
|
type: "block",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/pullquote/transforms.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA4B;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { value, citation } ) => {\n\t\t\t\tconst paragraphs = [];\n\t\t\t\tif ( value ) {\n\t\t\t\t\tparagraphs.push(\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( citation ) {\n\t\t\t\t\tparagraphs.push(\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( paragraphs.length === 0 ) {\n\t\t\t\t\treturn createBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn paragraphs;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/heading' ],\n\t\t\ttransform: ( { value, citation } ) => {\n\t\t\t\t// If there is no pullquote content, use the citation as the\n\t\t\t\t// content of the resulting heading. A nonexistent citation\n\t\t\t\t// will result in an empty heading.\n\t\t\t\tif ( ! value ) {\n\t\t\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\tconst headingBlock = createBlock( 'core/heading', {\n\t\t\t\t\tcontent: value,\n\t\t\t\t} );\n\t\t\t\tif ( ! citation ) {\n\t\t\t\t\treturn headingBlock;\n\t\t\t\t}\n\t\t\t\treturn [\n\t\t\t\t\theadingBlock,\n\t\t\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA4B;AAE5B,IAAM,aAAa;AAAA,EAClB,IAAI;AAAA,IACH;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE,EAAE,OAAO,SAAS,MAAO;AACrC,cAAM,aAAa,CAAC;AACpB,YAAK,OAAQ;AACZ,qBAAW;AAAA,gBACV,2BAAa,kBAAkB;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AAAA,UACH;AAAA,QACD;AACA,YAAK,UAAW;AACf,qBAAW;AAAA,gBACV,2BAAa,kBAAkB;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AAAA,UACH;AAAA,QACD;AACA,YAAK,WAAW,WAAW,GAAI;AAC9B,qBAAO,2BAAa,kBAAkB;AAAA,YACrC,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AACA,eAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,cAAe;AAAA,MACzB,WAAW,CAAE,EAAE,OAAO,SAAS,MAAO;AAIrC,YAAK,CAAE,OAAQ;AACd,qBAAO,2BAAa,gBAAgB;AAAA,YACnC,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AACA,cAAM,mBAAe,2BAAa,gBAAgB;AAAA,UACjD,SAAS;AAAA,QACV,CAAE;AACF,YAAK,CAAE,UAAW;AACjB,iBAAO;AAAA,QACR;AACA,eAAO;AAAA,UACN;AAAA,cACA,2BAAa,gBAAgB;AAAA,YAC5B,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -111,26 +111,6 @@ var transforms = {
|
|
|
111
111
|
}
|
|
112
112
|
],
|
|
113
113
|
to: [
|
|
114
|
-
{
|
|
115
|
-
type: "block",
|
|
116
|
-
blocks: ["core/pullquote"],
|
|
117
|
-
isMatch: ({}, block) => {
|
|
118
|
-
return block.innerBlocks.every(
|
|
119
|
-
({ name }) => name === "core/paragraph"
|
|
120
|
-
);
|
|
121
|
-
},
|
|
122
|
-
transform: ({ align, citation, anchor, fontSize, style }, innerBlocks) => {
|
|
123
|
-
const value = innerBlocks.map(({ attributes }) => `${attributes.content}`).join("<br>");
|
|
124
|
-
return (0, import_blocks.createBlock)("core/pullquote", {
|
|
125
|
-
value,
|
|
126
|
-
align,
|
|
127
|
-
citation,
|
|
128
|
-
anchor,
|
|
129
|
-
fontSize,
|
|
130
|
-
style
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
114
|
{
|
|
135
115
|
type: "block",
|
|
136
116
|
blocks: ["core/paragraph"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/quote/transforms.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\ttransform: ( {\n\t\t\t\tvalue,\n\t\t\t\talign,\n\t\t\t\tcitation,\n\t\t\t\tanchor,\n\t\t\t\tfontSize,\n\t\t\t\tstyle,\n\t\t\t} ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tcitation,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t},\n\t\t\t\t\t[ createBlock( 'core/paragraph', { content: value } ) ]\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'prefix',\n\t\t\tprefix: '>',\n\t\t\ttransform: ( content ) =>\n\t\t\t\tcreateBlock( 'core/quote', {}, [\n\t\t\t\t\tcreateBlock( 'core/paragraph', { content } ),\n\t\t\t\t] ),\n\t\t},\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tschema: () => ( {\n\t\t\t\tblockquote: {\n\t\t\t\t\tchildren: '*',\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tselector: 'blockquote',\n\t\t\ttransform: ( node, handler ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t// Don't try to parse any `cite` out of this content.\n\t\t\t\t\t// * There may be more than one cite.\n\t\t\t\t\t// * There may be more attribution text than just the cite.\n\t\t\t\t\t// * If the cite is nested in the quoted text, it's wrong to\n\t\t\t\t\t// remove it.\n\t\t\t\t\t{},\n\t\t\t\t\thandler( {\n\t\t\t\t\t\tHTML: node.innerHTML,\n\t\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ '*' ],\n\t\t\tisMatch: ( {}, blocks ) => {\n\t\t\t\t// When a single block is selected make the transformation\n\t\t\t\t// available only to specific blocks that make sense.\n\t\t\t\tif ( blocks.length === 1 ) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t'core/heading',\n\t\t\t\t\t\t'core/list',\n\t\t\t\t\t\t'core/pullquote',\n\t\t\t\t\t].includes( blocks[ 0 ].name );\n\t\t\t\t}\n\t\t\t\treturn ! blocks.some( ( { name } ) => name === 'core/quote' );\n\t\t\t},\n\t\t\t__experimentalConvert: ( blocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{},\n\t\t\t\t\tblocks.map( ( block ) =>\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\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,MAAM;AAAA,MACN,cAAc;AAAA,MACd,QAAQ,CAAE,GAAI;AAAA,MACd,SAAS,CAAE,CAAC,GAAG,WAAY;AAG1B,YAAK,OAAO,WAAW,GAAI;AAC1B,iBAAO;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD,EAAE,SAAU,OAAQ,CAAE,EAAE,IAAK;AAAA,QAC9B;AACA,eAAO,CAAE,OAAO,KAAM,CAAE,EAAE,KAAK,MAAO,SAAS,YAAa;AAAA,MAC7D;AAAA,MACA,uBAAuB,CAAE,eACxB;AAAA,QACC;AAAA,QACA,CAAC;AAAA,QACD,OAAO;AAAA,UAAK,CAAE,cACb;AAAA,YACC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,MAAM;AAAA,UACP;AAAA,QACD;AAAA,MACD;AAAA,IACF;AAAA,EACD;AAAA,EACA,IAAI;AAAA,IACH;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\ttransform: ( {\n\t\t\t\tvalue,\n\t\t\t\talign,\n\t\t\t\tcitation,\n\t\t\t\tanchor,\n\t\t\t\tfontSize,\n\t\t\t\tstyle,\n\t\t\t} ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tcitation,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t},\n\t\t\t\t\t[ createBlock( 'core/paragraph', { content: value } ) ]\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'prefix',\n\t\t\tprefix: '>',\n\t\t\ttransform: ( content ) =>\n\t\t\t\tcreateBlock( 'core/quote', {}, [\n\t\t\t\t\tcreateBlock( 'core/paragraph', { content } ),\n\t\t\t\t] ),\n\t\t},\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tschema: () => ( {\n\t\t\t\tblockquote: {\n\t\t\t\t\tchildren: '*',\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tselector: 'blockquote',\n\t\t\ttransform: ( node, handler ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t// Don't try to parse any `cite` out of this content.\n\t\t\t\t\t// * There may be more than one cite.\n\t\t\t\t\t// * There may be more attribution text than just the cite.\n\t\t\t\t\t// * If the cite is nested in the quoted text, it's wrong to\n\t\t\t\t\t// remove it.\n\t\t\t\t\t{},\n\t\t\t\t\thandler( {\n\t\t\t\t\t\tHTML: node.innerHTML,\n\t\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ '*' ],\n\t\t\tisMatch: ( {}, blocks ) => {\n\t\t\t\t// When a single block is selected make the transformation\n\t\t\t\t// available only to specific blocks that make sense.\n\t\t\t\tif ( blocks.length === 1 ) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t'core/heading',\n\t\t\t\t\t\t'core/list',\n\t\t\t\t\t\t'core/pullquote',\n\t\t\t\t\t].includes( blocks[ 0 ].name );\n\t\t\t\t}\n\t\t\t\treturn ! blocks.some( ( { name } ) => name === 'core/quote' );\n\t\t\t},\n\t\t\t__experimentalConvert: ( blocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{},\n\t\t\t\t\tblocks.map( ( block ) =>\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { citation }, innerBlocks ) =>\n\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t? innerBlocks\n\t\t\t\t\t: [\n\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t ],\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( { citation, anchor }, innerBlocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{ anchor },\n\t\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t\t? innerBlocks\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t ]\n\t\t\t\t),\n\t\t},\n\t],\n\tungroup: ( { citation }, innerBlocks ) =>\n\t\tRichText.isEmpty( citation )\n\t\t\t? innerBlocks\n\t\t\t: [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t ],\n};\n\nexport default transforms;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAyB;AACzB,oBAA4B;AAE5B,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,IACL;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAA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AAC;AAAA,QACD,OAAO;AAAA,UAAK,CAAE,cACb;AAAA,YACC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,MAAM;AAAA,UACP;AAAA,QACD;AAAA,MACD;AAAA,IACF;AAAA,EACD;AAAA,EACA,IAAI;AAAA,IACH;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE,EAAE,SAAS,GAAG,gBAC1B,6BAAS,QAAS,QAAS,IACxB,cACA;AAAA,QACA,GAAG;AAAA,YACH,2BAAa,kBAAkB;AAAA,UAC9B,SAAS;AAAA,QACV,CAAE;AAAA,MACF;AAAA,IACL;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,YAAa;AAAA,MACvB,WAAW,CAAE,EAAE,UAAU,OAAO,GAAG,oBAClC;AAAA,QACC;AAAA,QACA,EAAE,OAAO;AAAA,QACT,6BAAS,QAAS,QAAS,IACxB,cACA;AAAA,UACA,GAAG;AAAA,cACH,2BAAa,kBAAkB;AAAA,YAC9B,SAAS;AAAA,UACV,CAAE;AAAA,QACF;AAAA,MACJ;AAAA,IACF;AAAA,EACD;AAAA,EACA,SAAS,CAAE,EAAE,SAAS,GAAG,gBACxB,6BAAS,QAAS,QAAS,IACxB,cACA;AAAA,IACA,GAAG;AAAA,QACH,2BAAa,kBAAkB;AAAA,MAC9B,SAAS;AAAA,IACV,CAAE;AAAA,EACF;AACL;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/pullquote",
|
|
5
|
-
"title": "Pullquote",
|
|
5
|
+
"title": "Pullquote (deprecated)",
|
|
6
6
|
"category": "text",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "This block is deprecated. Please use the Quote block instead.",
|
|
8
8
|
"textdomain": "default",
|
|
9
9
|
"attributes": {
|
|
10
10
|
"value": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"minHeight": false
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
+
"inserter": false,
|
|
51
52
|
"spacing": {
|
|
52
53
|
"margin": true,
|
|
53
54
|
"padding": true
|
|
@@ -1,37 +1,6 @@
|
|
|
1
1
|
// packages/block-library/src/pullquote/transforms.js
|
|
2
2
|
import { createBlock } from "@wordpress/blocks";
|
|
3
|
-
import { create, join, toHTMLString } from "@wordpress/rich-text";
|
|
4
3
|
var transforms = {
|
|
5
|
-
from: [
|
|
6
|
-
{
|
|
7
|
-
type: "block",
|
|
8
|
-
isMultiBlock: true,
|
|
9
|
-
blocks: ["core/paragraph"],
|
|
10
|
-
transform: (attributes) => {
|
|
11
|
-
return createBlock("core/pullquote", {
|
|
12
|
-
value: toHTMLString({
|
|
13
|
-
value: join(
|
|
14
|
-
attributes.map(
|
|
15
|
-
({ content }) => create({ html: content })
|
|
16
|
-
),
|
|
17
|
-
"\n"
|
|
18
|
-
)
|
|
19
|
-
}),
|
|
20
|
-
anchor: attributes.anchor
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: "block",
|
|
26
|
-
blocks: ["core/heading"],
|
|
27
|
-
transform: ({ content, anchor }) => {
|
|
28
|
-
return createBlock("core/pullquote", {
|
|
29
|
-
value: content,
|
|
30
|
-
anchor
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
4
|
to: [
|
|
36
5
|
{
|
|
37
6
|
type: "block",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/pullquote/transforms.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\
|
|
5
|
-
"mappings": ";AAGA,SAAS,mBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { value, citation } ) => {\n\t\t\t\tconst paragraphs = [];\n\t\t\t\tif ( value ) {\n\t\t\t\t\tparagraphs.push(\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: value,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( citation ) {\n\t\t\t\t\tparagraphs.push(\n\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif ( paragraphs.length === 0 ) {\n\t\t\t\t\treturn createBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: '',\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn paragraphs;\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/heading' ],\n\t\t\ttransform: ( { value, citation } ) => {\n\t\t\t\t// If there is no pullquote content, use the citation as the\n\t\t\t\t// content of the resulting heading. A nonexistent citation\n\t\t\t\t// will result in an empty heading.\n\t\t\t\tif ( ! value ) {\n\t\t\t\t\treturn createBlock( 'core/heading', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\tconst headingBlock = createBlock( 'core/heading', {\n\t\t\t\t\tcontent: value,\n\t\t\t\t} );\n\t\t\t\tif ( ! citation ) {\n\t\t\t\t\treturn headingBlock;\n\t\t\t\t}\n\t\t\t\treturn [\n\t\t\t\t\theadingBlock,\n\t\t\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t\t];\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,mBAAmB;AAE5B,IAAM,aAAa;AAAA,EAClB,IAAI;AAAA,IACH;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE,EAAE,OAAO,SAAS,MAAO;AACrC,cAAM,aAAa,CAAC;AACpB,YAAK,OAAQ;AACZ,qBAAW;AAAA,YACV,YAAa,kBAAkB;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AAAA,UACH;AAAA,QACD;AACA,YAAK,UAAW;AACf,qBAAW;AAAA,YACV,YAAa,kBAAkB;AAAA,cAC9B,SAAS;AAAA,YACV,CAAE;AAAA,UACH;AAAA,QACD;AACA,YAAK,WAAW,WAAW,GAAI;AAC9B,iBAAO,YAAa,kBAAkB;AAAA,YACrC,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AACA,eAAO;AAAA,MACR;AAAA,IACD;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,cAAe;AAAA,MACzB,WAAW,CAAE,EAAE,OAAO,SAAS,MAAO;AAIrC,YAAK,CAAE,OAAQ;AACd,iBAAO,YAAa,gBAAgB;AAAA,YACnC,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AACA,cAAM,eAAe,YAAa,gBAAgB;AAAA,UACjD,SAAS;AAAA,QACV,CAAE;AACF,YAAK,CAAE,UAAW;AACjB,iBAAO;AAAA,QACR;AACA,eAAO;AAAA,UACN;AAAA,UACA,YAAa,gBAAgB;AAAA,YAC5B,SAAS;AAAA,UACV,CAAE;AAAA,QACH;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -87,26 +87,6 @@ var transforms = {
|
|
|
87
87
|
}
|
|
88
88
|
],
|
|
89
89
|
to: [
|
|
90
|
-
{
|
|
91
|
-
type: "block",
|
|
92
|
-
blocks: ["core/pullquote"],
|
|
93
|
-
isMatch: ({}, block) => {
|
|
94
|
-
return block.innerBlocks.every(
|
|
95
|
-
({ name }) => name === "core/paragraph"
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
transform: ({ align, citation, anchor, fontSize, style }, innerBlocks) => {
|
|
99
|
-
const value = innerBlocks.map(({ attributes }) => `${attributes.content}`).join("<br>");
|
|
100
|
-
return createBlock("core/pullquote", {
|
|
101
|
-
value,
|
|
102
|
-
align,
|
|
103
|
-
citation,
|
|
104
|
-
anchor,
|
|
105
|
-
fontSize,
|
|
106
|
-
style
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
90
|
{
|
|
111
91
|
type: "block",
|
|
112
92
|
blocks: ["core/paragraph"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/quote/transforms.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\ttransform: ( {\n\t\t\t\tvalue,\n\t\t\t\talign,\n\t\t\t\tcitation,\n\t\t\t\tanchor,\n\t\t\t\tfontSize,\n\t\t\t\tstyle,\n\t\t\t} ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tcitation,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t},\n\t\t\t\t\t[ createBlock( 'core/paragraph', { content: value } ) ]\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'prefix',\n\t\t\tprefix: '>',\n\t\t\ttransform: ( content ) =>\n\t\t\t\tcreateBlock( 'core/quote', {}, [\n\t\t\t\t\tcreateBlock( 'core/paragraph', { content } ),\n\t\t\t\t] ),\n\t\t},\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tschema: () => ( {\n\t\t\t\tblockquote: {\n\t\t\t\t\tchildren: '*',\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tselector: 'blockquote',\n\t\t\ttransform: ( node, handler ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t// Don't try to parse any `cite` out of this content.\n\t\t\t\t\t// * There may be more than one cite.\n\t\t\t\t\t// * There may be more attribution text than just the cite.\n\t\t\t\t\t// * If the cite is nested in the quoted text, it's wrong to\n\t\t\t\t\t// remove it.\n\t\t\t\t\t{},\n\t\t\t\t\thandler( {\n\t\t\t\t\t\tHTML: node.innerHTML,\n\t\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ '*' ],\n\t\t\tisMatch: ( {}, blocks ) => {\n\t\t\t\t// When a single block is selected make the transformation\n\t\t\t\t// available only to specific blocks that make sense.\n\t\t\t\tif ( blocks.length === 1 ) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t'core/heading',\n\t\t\t\t\t\t'core/list',\n\t\t\t\t\t\t'core/pullquote',\n\t\t\t\t\t].includes( blocks[ 0 ].name );\n\t\t\t\t}\n\t\t\t\treturn ! blocks.some( ( { name } ) => name === 'core/quote' );\n\t\t\t},\n\t\t\t__experimentalConvert: ( blocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{},\n\t\t\t\t\tblocks.map( ( block ) =>\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\t\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K,OAAO,WAAW,GAAI;AAC1B,iBAAO;AAAA,YACN;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD,EAAE,SAAU,OAAQ,CAAE,EAAE,IAAK;AAAA,QAC9B;AACA,eAAO,CAAE,OAAO,KAAM,CAAE,EAAE,KAAK,MAAO,SAAS,YAAa;AAAA,MAC7D;AAAA,MACA,uBAAuB,CAAE,WACxB;AAAA,QACC;AAAA,QACA,CAAC;AAAA,QACD,OAAO;AAAA,UAAK,CAAE,UACb;AAAA,YACC,MAAM;AAAA,YACN,MAAM;AAAA,YACN,MAAM;AAAA,UACP;AAAA,QACD;AAAA,MACD;AAAA,IACF;AAAA,EACD;AAAA,EACA,IAAI;AAAA,IACH;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { RichText } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/pullquote' ],\n\t\t\ttransform: ( {\n\t\t\t\tvalue,\n\t\t\t\talign,\n\t\t\t\tcitation,\n\t\t\t\tanchor,\n\t\t\t\tfontSize,\n\t\t\t\tstyle,\n\t\t\t} ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{\n\t\t\t\t\t\talign,\n\t\t\t\t\t\tcitation,\n\t\t\t\t\t\tanchor,\n\t\t\t\t\t\tfontSize,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t},\n\t\t\t\t\t[ createBlock( 'core/paragraph', { content: value } ) ]\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'prefix',\n\t\t\tprefix: '>',\n\t\t\ttransform: ( content ) =>\n\t\t\t\tcreateBlock( 'core/quote', {}, [\n\t\t\t\t\tcreateBlock( 'core/paragraph', { content } ),\n\t\t\t\t] ),\n\t\t},\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tschema: () => ( {\n\t\t\t\tblockquote: {\n\t\t\t\t\tchildren: '*',\n\t\t\t\t},\n\t\t\t} ),\n\t\t\tselector: 'blockquote',\n\t\t\ttransform: ( node, handler ) => {\n\t\t\t\treturn createBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t// Don't try to parse any `cite` out of this content.\n\t\t\t\t\t// * There may be more than one cite.\n\t\t\t\t\t// * There may be more attribution text than just the cite.\n\t\t\t\t\t// * If the cite is nested in the quoted text, it's wrong to\n\t\t\t\t\t// remove it.\n\t\t\t\t\t{},\n\t\t\t\t\thandler( {\n\t\t\t\t\t\tHTML: node.innerHTML,\n\t\t\t\t\t\tmode: 'BLOCKS',\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tisMultiBlock: true,\n\t\t\tblocks: [ '*' ],\n\t\t\tisMatch: ( {}, blocks ) => {\n\t\t\t\t// When a single block is selected make the transformation\n\t\t\t\t// available only to specific blocks that make sense.\n\t\t\t\tif ( blocks.length === 1 ) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t'core/paragraph',\n\t\t\t\t\t\t'core/heading',\n\t\t\t\t\t\t'core/list',\n\t\t\t\t\t\t'core/pullquote',\n\t\t\t\t\t].includes( blocks[ 0 ].name );\n\t\t\t\t}\n\t\t\t\treturn ! blocks.some( ( { name } ) => name === 'core/quote' );\n\t\t\t},\n\t\t\t__experimentalConvert: ( blocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/quote',\n\t\t\t\t\t{},\n\t\t\t\t\tblocks.map( ( block ) =>\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t},\n\t],\n\tto: [\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/paragraph' ],\n\t\t\ttransform: ( { citation }, innerBlocks ) =>\n\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t? innerBlocks\n\t\t\t\t\t: [\n\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t ],\n\t\t},\n\t\t{\n\t\t\ttype: 'block',\n\t\t\tblocks: [ 'core/group' ],\n\t\t\ttransform: ( { citation, anchor }, innerBlocks ) =>\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{ anchor },\n\t\t\t\t\tRichText.isEmpty( citation )\n\t\t\t\t\t\t? innerBlocks\n\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t...innerBlocks,\n\t\t\t\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t ]\n\t\t\t\t),\n\t\t},\n\t],\n\tungroup: ( { citation }, innerBlocks ) =>\n\t\tRichText.isEmpty( citation )\n\t\t\t? innerBlocks\n\t\t\t: [\n\t\t\t\t\t...innerBlocks,\n\t\t\t\t\tcreateBlock( 'core/paragraph', {\n\t\t\t\t\t\tcontent: citation,\n\t\t\t\t\t} ),\n\t\t\t ],\n};\n\nexport default transforms;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAE5B,IAAM,aAAa;AAAA,EAClB,MAAM;AAAA,IACL;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACD,MAAO;AACN,eAAO;AAAA,UACN;AAAA,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,EACA,IAAI;AAAA,IACH;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,gBAAiB;AAAA,MAC3B,WAAW,CAAE,EAAE,SAAS,GAAG,gBAC1B,SAAS,QAAS,QAAS,IACxB,cACA;AAAA,QACA,GAAG;AAAA,QACH,YAAa,kBAAkB;AAAA,UAC9B,SAAS;AAAA,QACV,CAAE;AAAA,MACF;AAAA,IACL;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,QAAQ,CAAE,YAAa;AAAA,MACvB,WAAW,CAAE,EAAE,UAAU,OAAO,GAAG,gBAClC;AAAA,QACC;AAAA,QACA,EAAE,OAAO;AAAA,QACT,SAAS,QAAS,QAAS,IACxB,cACA;AAAA,UACA,GAAG;AAAA,UACH,YAAa,kBAAkB;AAAA,YAC9B,SAAS;AAAA,UACV,CAAE;AAAA,QACF;AAAA,MACJ;AAAA,IACF;AAAA,EACD;AAAA,EACA,SAAS,CAAE,EAAE,SAAS,GAAG,gBACxB,SAAS,QAAS,QAAS,IACxB,cACA;AAAA,IACA,GAAG;AAAA,IACH,YAAa,kBAAkB;AAAA,MAC9B,SAAS;AAAA,IACV,CAAE;AAAA,EACF;AACL;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.35.0",
|
|
3
|
+
"version": "9.35.1-next.16d95556a.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -82,41 +82,41 @@
|
|
|
82
82
|
"{src,build,build-module}/*/init.js"
|
|
83
83
|
],
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@wordpress/a11y": "^4.35.0",
|
|
86
|
-
"@wordpress/api-fetch": "^7.35.0",
|
|
87
|
-
"@wordpress/autop": "^4.35.0",
|
|
88
|
-
"@wordpress/base-styles": "^6.11.0",
|
|
89
|
-
"@wordpress/blob": "^4.35.0",
|
|
90
|
-
"@wordpress/block-editor": "^15.8.0",
|
|
91
|
-
"@wordpress/blocks": "^15.8.0",
|
|
92
|
-
"@wordpress/components": "^30.8.0",
|
|
93
|
-
"@wordpress/compose": "^7.35.0",
|
|
94
|
-
"@wordpress/core-data": "^7.35.0",
|
|
95
|
-
"@wordpress/data": "^10.35.0",
|
|
96
|
-
"@wordpress/date": "^5.35.0",
|
|
97
|
-
"@wordpress/deprecated": "^4.35.0",
|
|
98
|
-
"@wordpress/dom": "^4.35.0",
|
|
99
|
-
"@wordpress/element": "^6.35.0",
|
|
100
|
-
"@wordpress/escape-html": "^3.35.0",
|
|
101
|
-
"@wordpress/hooks": "^4.35.0",
|
|
102
|
-
"@wordpress/html-entities": "^4.35.0",
|
|
103
|
-
"@wordpress/i18n": "^6.8.0",
|
|
104
|
-
"@wordpress/icons": "^11.2.0",
|
|
105
|
-
"@wordpress/interactivity": "^6.35.0",
|
|
106
|
-
"@wordpress/interactivity-router": "^2.35.0",
|
|
107
|
-
"@wordpress/keyboard-shortcuts": "^5.35.0",
|
|
108
|
-
"@wordpress/keycodes": "^4.35.0",
|
|
109
|
-
"@wordpress/latex-to-mathml": "^1.3.0",
|
|
110
|
-
"@wordpress/notices": "^5.35.0",
|
|
111
|
-
"@wordpress/patterns": "^2.35.0",
|
|
112
|
-
"@wordpress/primitives": "^4.35.0",
|
|
113
|
-
"@wordpress/private-apis": "^1.35.0",
|
|
114
|
-
"@wordpress/reusable-blocks": "^5.35.0",
|
|
115
|
-
"@wordpress/rich-text": "^7.35.0",
|
|
116
|
-
"@wordpress/server-side-render": "^6.11.0",
|
|
117
|
-
"@wordpress/url": "^4.35.0",
|
|
118
|
-
"@wordpress/viewport": "^6.35.0",
|
|
119
|
-
"@wordpress/wordcount": "^4.35.0",
|
|
85
|
+
"@wordpress/a11y": "^4.35.1-next.16d95556a.0",
|
|
86
|
+
"@wordpress/api-fetch": "^7.35.1-next.16d95556a.0",
|
|
87
|
+
"@wordpress/autop": "^4.35.1-next.16d95556a.0",
|
|
88
|
+
"@wordpress/base-styles": "^6.11.1-next.16d95556a.0",
|
|
89
|
+
"@wordpress/blob": "^4.35.1-next.16d95556a.0",
|
|
90
|
+
"@wordpress/block-editor": "^15.8.1-next.16d95556a.0",
|
|
91
|
+
"@wordpress/blocks": "^15.8.1-next.16d95556a.0",
|
|
92
|
+
"@wordpress/components": "^30.8.1-next.16d95556a.0",
|
|
93
|
+
"@wordpress/compose": "^7.35.1-next.16d95556a.0",
|
|
94
|
+
"@wordpress/core-data": "^7.35.1-next.16d95556a.0",
|
|
95
|
+
"@wordpress/data": "^10.35.1-next.16d95556a.0",
|
|
96
|
+
"@wordpress/date": "^5.35.1-next.16d95556a.0",
|
|
97
|
+
"@wordpress/deprecated": "^4.35.1-next.16d95556a.0",
|
|
98
|
+
"@wordpress/dom": "^4.35.1-next.16d95556a.0",
|
|
99
|
+
"@wordpress/element": "^6.35.1-next.16d95556a.0",
|
|
100
|
+
"@wordpress/escape-html": "^3.35.1-next.16d95556a.0",
|
|
101
|
+
"@wordpress/hooks": "^4.35.1-next.16d95556a.0",
|
|
102
|
+
"@wordpress/html-entities": "^4.35.1-next.16d95556a.0",
|
|
103
|
+
"@wordpress/i18n": "^6.8.1-next.16d95556a.0",
|
|
104
|
+
"@wordpress/icons": "^11.2.1-next.16d95556a.0",
|
|
105
|
+
"@wordpress/interactivity": "^6.35.1-next.16d95556a.0",
|
|
106
|
+
"@wordpress/interactivity-router": "^2.35.1-next.16d95556a.0",
|
|
107
|
+
"@wordpress/keyboard-shortcuts": "^5.35.1-next.16d95556a.0",
|
|
108
|
+
"@wordpress/keycodes": "^4.35.1-next.16d95556a.0",
|
|
109
|
+
"@wordpress/latex-to-mathml": "^1.3.1-next.16d95556a.0",
|
|
110
|
+
"@wordpress/notices": "^5.35.1-next.16d95556a.0",
|
|
111
|
+
"@wordpress/patterns": "^2.35.1-next.16d95556a.0",
|
|
112
|
+
"@wordpress/primitives": "^4.35.1-next.16d95556a.0",
|
|
113
|
+
"@wordpress/private-apis": "^1.35.1-next.16d95556a.0",
|
|
114
|
+
"@wordpress/reusable-blocks": "^5.35.1-next.16d95556a.0",
|
|
115
|
+
"@wordpress/rich-text": "^7.35.1-next.16d95556a.0",
|
|
116
|
+
"@wordpress/server-side-render": "^6.11.1-next.16d95556a.0",
|
|
117
|
+
"@wordpress/url": "^4.35.1-next.16d95556a.0",
|
|
118
|
+
"@wordpress/viewport": "^6.35.1-next.16d95556a.0",
|
|
119
|
+
"@wordpress/wordcount": "^4.35.1-next.16d95556a.0",
|
|
120
120
|
"change-case": "^4.1.2",
|
|
121
121
|
"clsx": "^2.1.1",
|
|
122
122
|
"colord": "^2.7.0",
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
"publishConfig": {
|
|
135
135
|
"access": "public"
|
|
136
136
|
},
|
|
137
|
-
"gitHead": "
|
|
137
|
+
"gitHead": "59a9383612bbe16e21af84d13b035bfbca7fe833"
|
|
138
138
|
}
|
|
@@ -32,12 +32,6 @@ exports[`Heading block transforms to Paragraph block 1`] = `
|
|
|
32
32
|
<!-- /wp:paragraph -->"
|
|
33
33
|
`;
|
|
34
34
|
|
|
35
|
-
exports[`Heading block transforms to Pullquote block 1`] = `
|
|
36
|
-
"<!-- wp:pullquote -->
|
|
37
|
-
<figure class="wp-block-pullquote"><blockquote><p>Example text</p></blockquote></figure>
|
|
38
|
-
<!-- /wp:pullquote -->"
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
35
|
exports[`Heading block transforms to Quote block 1`] = `
|
|
42
36
|
"<!-- wp:quote -->
|
|
43
37
|
<blockquote class="wp-block-quote"><!-- wp:heading -->
|
|
@@ -16,11 +16,7 @@ const initialHtml = `
|
|
|
16
16
|
<!-- /wp:heading -->`;
|
|
17
17
|
|
|
18
18
|
const transformsWithInnerBlocks = [ 'List', 'Quote', 'Columns', 'Group' ];
|
|
19
|
-
const blockTransforms = [
|
|
20
|
-
'Paragraph',
|
|
21
|
-
'Pullquote',
|
|
22
|
-
...transformsWithInnerBlocks,
|
|
23
|
-
];
|
|
19
|
+
const blockTransforms = [ 'Paragraph', ...transformsWithInnerBlocks ];
|
|
24
20
|
|
|
25
21
|
setupCoreBlocks();
|
|
26
22
|
|
|
@@ -44,12 +44,6 @@ exports[`Paragraph block transforms to Preformatted block 1`] = `
|
|
|
44
44
|
<!-- /wp:preformatted -->"
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
|
-
exports[`Paragraph block transforms to Pullquote block 1`] = `
|
|
48
|
-
"<!-- wp:pullquote -->
|
|
49
|
-
<figure class="wp-block-pullquote"><blockquote><p>Example text</p></blockquote></figure>
|
|
50
|
-
<!-- /wp:pullquote -->"
|
|
51
|
-
`;
|
|
52
|
-
|
|
53
47
|
exports[`Paragraph block transforms to Quote block 1`] = `
|
|
54
48
|
"<!-- wp:quote -->
|
|
55
49
|
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
package/src/pullquote/block.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/pullquote",
|
|
5
|
-
"title": "Pullquote",
|
|
5
|
+
"title": "Pullquote (deprecated)",
|
|
6
6
|
"category": "text",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "This block is deprecated. Please use the Quote block instead.",
|
|
8
8
|
"textdomain": "default",
|
|
9
9
|
"attributes": {
|
|
10
10
|
"value": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"minHeight": false
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
|
+
"inserter": false,
|
|
51
52
|
"spacing": {
|
|
52
53
|
"margin": true,
|
|
53
54
|
"padding": true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Pullquote block transforms to Columns block 1`] = `
|
|
3
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Columns block 1`] = `
|
|
4
4
|
"<!-- wp:columns -->
|
|
5
5
|
<div class="wp-block-columns"><!-- wp:column {"width":"100%"} -->
|
|
6
6
|
<div class="wp-block-column" style="flex-basis:100%"><!-- wp:pullquote -->
|
|
@@ -10,7 +10,7 @@ exports[`Pullquote block transforms to Columns block 1`] = `
|
|
|
10
10
|
<!-- /wp:columns -->"
|
|
11
11
|
`;
|
|
12
12
|
|
|
13
|
-
exports[`Pullquote block transforms to Group block 1`] = `
|
|
13
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Group block 1`] = `
|
|
14
14
|
"<!-- wp:group {"layout":{"type":"constrained"}} -->
|
|
15
15
|
<div class="wp-block-group"><!-- wp:pullquote -->
|
|
16
16
|
<figure class="wp-block-pullquote"><blockquote><p>One of the hardest things to do in technology is disrupt yourself.</p><cite>Matt Mullenweg</cite></blockquote></figure>
|
|
@@ -18,7 +18,7 @@ exports[`Pullquote block transforms to Group block 1`] = `
|
|
|
18
18
|
<!-- /wp:group -->"
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
|
-
exports[`Pullquote block transforms to Heading block 1`] = `
|
|
21
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Heading block 1`] = `
|
|
22
22
|
"<!-- wp:heading -->
|
|
23
23
|
<h2 class="wp-block-heading">One of the hardest things to do in technology is disrupt yourself.</h2>
|
|
24
24
|
<!-- /wp:heading -->
|
|
@@ -28,7 +28,7 @@ exports[`Pullquote block transforms to Heading block 1`] = `
|
|
|
28
28
|
<!-- /wp:heading -->"
|
|
29
29
|
`;
|
|
30
30
|
|
|
31
|
-
exports[`Pullquote block transforms to Paragraph block 1`] = `
|
|
31
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Paragraph block 1`] = `
|
|
32
32
|
"<!-- wp:paragraph -->
|
|
33
33
|
<p>One of the hardest things to do in technology is disrupt yourself.</p>
|
|
34
34
|
<!-- /wp:paragraph -->
|
|
@@ -38,7 +38,7 @@ exports[`Pullquote block transforms to Paragraph block 1`] = `
|
|
|
38
38
|
<!-- /wp:paragraph -->"
|
|
39
39
|
`;
|
|
40
40
|
|
|
41
|
-
exports[`Pullquote block transforms to Quote block 1`] = `
|
|
41
|
+
exports[`Pullquote \\(deprecated\\) block transforms to Quote block 1`] = `
|
|
42
42
|
"<!-- wp:quote -->
|
|
43
43
|
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
|
44
44
|
<p>One of the hardest things to do in technology is disrupt yourself.</p>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getBlockTransformOptions,
|
|
10
10
|
} from 'test/helpers';
|
|
11
11
|
|
|
12
|
-
const block = 'Pullquote';
|
|
12
|
+
const block = 'Pullquote \\(deprecated\\)';
|
|
13
13
|
const initialHtml = `
|
|
14
14
|
<!-- wp:pullquote -->
|
|
15
15
|
<figure class="wp-block-pullquote"><blockquote><p>One of the hardest things to do in technology is disrupt yourself.</p><cite>Matt Mullenweg</cite></blockquote></figure>
|
|
@@ -2,39 +2,8 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { createBlock } from '@wordpress/blocks';
|
|
5
|
-
import { create, join, toHTMLString } from '@wordpress/rich-text';
|
|
6
5
|
|
|
7
6
|
const transforms = {
|
|
8
|
-
from: [
|
|
9
|
-
{
|
|
10
|
-
type: 'block',
|
|
11
|
-
isMultiBlock: true,
|
|
12
|
-
blocks: [ 'core/paragraph' ],
|
|
13
|
-
transform: ( attributes ) => {
|
|
14
|
-
return createBlock( 'core/pullquote', {
|
|
15
|
-
value: toHTMLString( {
|
|
16
|
-
value: join(
|
|
17
|
-
attributes.map( ( { content } ) =>
|
|
18
|
-
create( { html: content } )
|
|
19
|
-
),
|
|
20
|
-
'\n'
|
|
21
|
-
),
|
|
22
|
-
} ),
|
|
23
|
-
anchor: attributes.anchor,
|
|
24
|
-
} );
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'block',
|
|
29
|
-
blocks: [ 'core/heading' ],
|
|
30
|
-
transform: ( { content, anchor } ) => {
|
|
31
|
-
return createBlock( 'core/pullquote', {
|
|
32
|
-
value: content,
|
|
33
|
-
anchor,
|
|
34
|
-
} );
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
7
|
to: [
|
|
39
8
|
{
|
|
40
9
|
type: 'block',
|
|
@@ -32,12 +32,6 @@ exports[`Quote block transforms to Paragraph block 1`] = `
|
|
|
32
32
|
<!-- /wp:paragraph -->"
|
|
33
33
|
`;
|
|
34
34
|
|
|
35
|
-
exports[`Quote block transforms to Pullquote block 1`] = `
|
|
36
|
-
"<!-- wp:pullquote -->
|
|
37
|
-
<figure class="wp-block-pullquote"><blockquote><p>"This will make running your own blog a viable alternative again."</p><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote></figure>
|
|
38
|
-
<!-- /wp:pullquote -->"
|
|
39
|
-
`;
|
|
40
|
-
|
|
41
35
|
exports[`Quote block transforms ungroups block 1`] = `
|
|
42
36
|
"<!-- wp:paragraph -->
|
|
43
37
|
<p>"This will make running your own blog a viable alternative again."</p>
|
|
@@ -21,11 +21,7 @@ const initialHtml = `
|
|
|
21
21
|
<!-- /wp:quote -->`;
|
|
22
22
|
|
|
23
23
|
const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
|
|
24
|
-
const blockTransforms = [
|
|
25
|
-
'Pullquote',
|
|
26
|
-
'Paragraph',
|
|
27
|
-
...transformsWithInnerBlocks,
|
|
28
|
-
];
|
|
24
|
+
const blockTransforms = [ 'Paragraph', ...transformsWithInnerBlocks ];
|
|
29
25
|
|
|
30
26
|
setupCoreBlocks();
|
|
31
27
|
|
package/src/quote/transforms.js
CHANGED
|
@@ -94,31 +94,6 @@ const transforms = {
|
|
|
94
94
|
},
|
|
95
95
|
],
|
|
96
96
|
to: [
|
|
97
|
-
{
|
|
98
|
-
type: 'block',
|
|
99
|
-
blocks: [ 'core/pullquote' ],
|
|
100
|
-
isMatch: ( {}, block ) => {
|
|
101
|
-
return block.innerBlocks.every(
|
|
102
|
-
( { name } ) => name === 'core/paragraph'
|
|
103
|
-
);
|
|
104
|
-
},
|
|
105
|
-
transform: (
|
|
106
|
-
{ align, citation, anchor, fontSize, style },
|
|
107
|
-
innerBlocks
|
|
108
|
-
) => {
|
|
109
|
-
const value = innerBlocks
|
|
110
|
-
.map( ( { attributes } ) => `${ attributes.content }` )
|
|
111
|
-
.join( '<br>' );
|
|
112
|
-
return createBlock( 'core/pullquote', {
|
|
113
|
-
value,
|
|
114
|
-
align,
|
|
115
|
-
citation,
|
|
116
|
-
anchor,
|
|
117
|
-
fontSize,
|
|
118
|
-
style,
|
|
119
|
-
} );
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
97
|
{
|
|
123
98
|
type: 'block',
|
|
124
99
|
blocks: [ 'core/paragraph' ],
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
addBlock,
|
|
6
|
-
getBlock,
|
|
7
|
-
initializeEditor,
|
|
8
|
-
selectRangeInRichText,
|
|
9
|
-
setupCoreBlocks,
|
|
10
|
-
getEditorHtml,
|
|
11
|
-
fireEvent,
|
|
12
|
-
within,
|
|
13
|
-
waitFor,
|
|
14
|
-
typeInRichText,
|
|
15
|
-
} from 'test/helpers';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* WordPress dependencies
|
|
19
|
-
*/
|
|
20
|
-
import { ENTER } from '@wordpress/keycodes';
|
|
21
|
-
|
|
22
|
-
setupCoreBlocks();
|
|
23
|
-
|
|
24
|
-
describe( 'Pullquote', () => {
|
|
25
|
-
it( 'should produce expected markup for multiline text', async () => {
|
|
26
|
-
// Arrange
|
|
27
|
-
const screen = await initializeEditor();
|
|
28
|
-
await addBlock( screen, 'Pullquote' );
|
|
29
|
-
// Await inner blocks to be rendered
|
|
30
|
-
const citationBlock = await waitFor( () =>
|
|
31
|
-
screen.getByPlaceholderText( 'Add citation' )
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
// Act
|
|
35
|
-
const pullquoteBlock = getBlock( screen, 'Pullquote' );
|
|
36
|
-
fireEvent.press( pullquoteBlock );
|
|
37
|
-
const pullquoteTextInput =
|
|
38
|
-
within( pullquoteBlock ).getByPlaceholderText( 'Add quote' );
|
|
39
|
-
typeInRichText( pullquoteTextInput, 'A great statement.' );
|
|
40
|
-
fireEvent( pullquoteTextInput, 'onKeyDown', {
|
|
41
|
-
nativeEvent: {},
|
|
42
|
-
preventDefault() {},
|
|
43
|
-
keyCode: ENTER,
|
|
44
|
-
} );
|
|
45
|
-
typeInRichText( pullquoteTextInput, 'Again' );
|
|
46
|
-
|
|
47
|
-
const citationTextInput =
|
|
48
|
-
within( citationBlock ).getByPlaceholderText( 'Add citation' );
|
|
49
|
-
typeInRichText( citationTextInput, 'A person' );
|
|
50
|
-
fireEvent( citationTextInput, 'onKeyDown', {
|
|
51
|
-
nativeEvent: {},
|
|
52
|
-
preventDefault() {},
|
|
53
|
-
keyCode: ENTER,
|
|
54
|
-
} );
|
|
55
|
-
selectRangeInRichText( citationTextInput, 2 );
|
|
56
|
-
fireEvent( citationTextInput, 'onKeyDown', {
|
|
57
|
-
nativeEvent: {},
|
|
58
|
-
preventDefault() {},
|
|
59
|
-
keyCode: ENTER,
|
|
60
|
-
} );
|
|
61
|
-
|
|
62
|
-
// Assert
|
|
63
|
-
expect( getEditorHtml() ).toMatchInlineSnapshot( `
|
|
64
|
-
"<!-- wp:pullquote -->
|
|
65
|
-
<figure class="wp-block-pullquote"><blockquote><p>A great statement.<br>Again</p><cite>A <br>person</cite></blockquote></figure>
|
|
66
|
-
<!-- /wp:pullquote -->
|
|
67
|
-
|
|
68
|
-
<!-- wp:paragraph -->
|
|
69
|
-
<p></p>
|
|
70
|
-
<!-- /wp:paragraph -->"
|
|
71
|
-
` );
|
|
72
|
-
} );
|
|
73
|
-
} );
|