@wordpress/block-library 9.41.1-next.v.202603161435.0 → 9.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/html/modal.cjs +151 -229
- package/build/html/modal.cjs.map +2 -2
- package/build/post-date/block.json +1 -3
- package/build/post-date/deprecated.cjs +82 -6
- package/build/post-date/deprecated.cjs.map +3 -3
- package/build/post-date/edit.cjs +49 -62
- package/build/post-date/edit.cjs.map +3 -3
- package/build/site-title/index.cjs +5 -1
- package/build/site-title/index.cjs.map +2 -2
- package/build-module/html/modal.mjs +151 -229
- package/build-module/html/modal.mjs.map +2 -2
- package/build-module/post-date/block.json +1 -3
- package/build-module/post-date/deprecated.mjs +82 -6
- package/build-module/post-date/deprecated.mjs.map +2 -2
- package/build-module/post-date/edit.mjs +49 -63
- package/build-module/post-date/edit.mjs.map +2 -2
- package/build-module/site-title/index.mjs +5 -1
- package/build-module/site-title/index.mjs.map +2 -2
- package/package.json +38 -38
- package/src/html/modal.js +6 -77
- package/src/navigation/index.php +24 -6
- package/src/post-date/block.json +1 -3
- package/src/post-date/deprecated.js +86 -6
- package/src/post-date/edit.js +65 -82
- package/src/site-title/index.js +5 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-date/deprecated.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\n\nconst v3 = {\n\tattributes: {\n\t\tdatetime: {\n\t\t\ttype: 'string',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t},\n\tsupports: {\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\tmargin: true,\n\t\t\tpadding: 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\t__experimentalTextDecoration: 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\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( {\n\t\tmetadata: {\n\t\t\tbindings: {\n\t\t\t\tdatetime: {\n\t\t\t\t\tsource,\n\t\t\t\t\targs: { key, ...otherArgs },\n\t\t\t\t},\n\t\t\t\t...otherBindings\n\t\t\t},\n\t\t\t...otherMetadata\n\t\t},\n\t\t...otherAttributes\n\t} ) {\n\t\t// Change the block bindings source argument name from \"key\" to \"field\".\n\t\treturn {\n\t\t\tmetadata: {\n\t\t\t\tbindings: {\n\t\t\t\t\tdatetime: {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\targs: { field: key, ...otherArgs },\n\t\t\t\t\t},\n\t\t\t\t\t...otherBindings,\n\t\t\t\t},\n\t\t\t\t...otherMetadata,\n\t\t\t},\n\t\t\t...otherAttributes,\n\t\t};\n\t},\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\tattributes?.metadata?.bindings?.datetime?.source ===\n\t\t\t\t'core/post-data' &&\n\t\t\t!! attributes?.metadata?.bindings?.datetime?.args?.key\n\t\t);\n\t},\n};\n\nconst v2 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t\tdisplayType: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'date',\n\t\t},\n\t},\n\tsupports: {\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\tmargin: true,\n\t\t\tpadding: 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\t__experimentalTextDecoration: 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\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( { className, displayType, metadata, ...otherAttributes } ) {\n\t\tif ( displayType === 'date' || displayType === 'modified' ) {\n\t\t\tif ( displayType === 'modified' ) {\n\t\t\t\tclassName = clsx(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'wp-block-post-date__modified-date'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...otherAttributes,\n\t\t\t\tclassName,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...metadata,\n\t\t\t\t\tbindings: {\n\t\t\t\t\t\tdatetime: {\n\t\t\t\t\t\t\tsource: 'core/post-data',\n\t\t\t\t\t\t\targs: { field: displayType },\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},\n\tisEligible( attributes ) {\n\t\t// If there's neither an explicit `datetime` attribute nor a block binding for that attribute,\n\t\t// then we're dealing with an old version of the block.\n\t\treturn (\n\t\t\t! attributes.datetime && ! attributes?.metadata?.bindings?.datetime\n\t\t);\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: 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\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v4 = {\n\tattributes: {\n\t\tdatetime: {\n\t\t\ttype: 'string',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t},\n\tsupports: {\n\t\tanchor: true,\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\tmargin: true,\n\t\t\tpadding: 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\t__experimentalTextDecoration: 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\tsave() {\n\t\treturn null;\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};\n\nconst v3 = {\n\tattributes: {\n\t\tdatetime: {\n\t\t\ttype: 'string',\n\t\t\trole: 'content',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t},\n\tsupports: {\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\tmargin: true,\n\t\t\tpadding: 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\t__experimentalTextDecoration: 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\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( {\n\t\tmetadata: {\n\t\t\tbindings: {\n\t\t\t\tdatetime: {\n\t\t\t\t\tsource,\n\t\t\t\t\targs: { key, ...otherArgs },\n\t\t\t\t},\n\t\t\t\t...otherBindings\n\t\t\t},\n\t\t\t...otherMetadata\n\t\t},\n\t\t...otherAttributes\n\t} ) {\n\t\t// Change the block bindings source argument name from \"key\" to \"field\".\n\t\treturn migrateTextAlign( {\n\t\t\tmetadata: {\n\t\t\t\tbindings: {\n\t\t\t\t\tdatetime: {\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\targs: { field: key, ...otherArgs },\n\t\t\t\t\t},\n\t\t\t\t\t...otherBindings,\n\t\t\t\t},\n\t\t\t\t...otherMetadata,\n\t\t\t},\n\t\t\t...otherAttributes,\n\t\t} );\n\t},\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\tattributes?.metadata?.bindings?.datetime?.source ===\n\t\t\t\t'core/post-data' &&\n\t\t\t!! attributes?.metadata?.bindings?.datetime?.args?.key\n\t\t);\n\t},\n};\n\nconst v2 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\trole: 'content',\n\t\t},\n\t\tdisplayType: {\n\t\t\ttype: 'string',\n\t\t\tdefault: 'date',\n\t\t},\n\t},\n\tsupports: {\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\tmargin: true,\n\t\t\tpadding: 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\t__experimentalTextDecoration: 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\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( { className, displayType, metadata, ...otherAttributes } ) {\n\t\tif ( displayType === 'date' || displayType === 'modified' ) {\n\t\t\tif ( displayType === 'modified' ) {\n\t\t\t\tclassName = clsx(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'wp-block-post-date__modified-date'\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn migrateTextAlign( {\n\t\t\t\t...otherAttributes,\n\t\t\t\tclassName,\n\t\t\t\tmetadata: {\n\t\t\t\t\t...metadata,\n\t\t\t\t\tbindings: {\n\t\t\t\t\t\tdatetime: {\n\t\t\t\t\t\t\tsource: 'core/post-data',\n\t\t\t\t\t\t\targs: { field: displayType },\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},\n\tisEligible( attributes ) {\n\t\t// If there's neither an explicit `datetime` attribute nor a block binding for that attribute,\n\t\t// then we're dealing with an old version of the block.\n\t\treturn (\n\t\t\t! attributes.datetime && ! attributes?.metadata?.bindings?.datetime\n\t\t);\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tformat: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: 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\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate( attributes ) {\n\t\treturn migrateTextAlign( migrateFontFamily( attributes ) );\n\t},\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 [ v4, v3, v2, v1 ];\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,OAAO,uBAAuB;AAC9B,OAAO,sBAAsB;AAE7B,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,UAAU;AAAA,MACT,MAAM;AAAA,MACN,MAAM;AAAA,IACP;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,MACT,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,MACN,+BAA+B;AAAA,QAC9B,YAAY;AAAA,QACZ,MAAM;AAAA,QACN,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR,QAAQ;AAAA,MACR,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,MAC7B,8BAA8B;AAAA,MAC9B,6BAA6B;AAAA,MAC7B,+BAA+B;AAAA,QAC9B,UAAU;AAAA,MACX;AAAA,IACD;AAAA,IACA,eA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;AAAA,IACX,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,IACP;AAAA,IACA,YAAY;AAAA,MACX,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,0BAA0B;AAAA,MAC1B,0BAA0B;AAAA,MAC1B,yBAAyB;AAAA,MACzB,6BAA6B;AAAA,MAC7B,6BAA6B;AAAA,IAC9B;AAAA,EACD;AAAA,EACA,OAAO;AACN,WAAO;AAAA,EACR;AAAA,EACA,QAAS,YAAa;AACrB,WAAO,iBAAkB,kBAAmB,UAAW,CAAE;AAAA,EAC1D;AAAA,EACA,WAAY,EAAE,MAAM,GAAI;AACvB,WAAO,OAAO,YAAY;AAAA,EAC3B;AACD;AAUA,IAAO,qBAAQ,CAAE,IAAI,IAAI,IAAI,EAAG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// packages/block-library/src/post-date/edit.js
|
|
2
|
-
import clsx from "clsx";
|
|
3
2
|
import { store as coreStore } from "@wordpress/core-data";
|
|
4
3
|
import { useEffect, useMemo, useState } from "@wordpress/element";
|
|
5
4
|
import {
|
|
@@ -8,7 +7,6 @@ import {
|
|
|
8
7
|
getSettings as getDateSettings
|
|
9
8
|
} from "@wordpress/date";
|
|
10
9
|
import {
|
|
11
|
-
AlignmentControl,
|
|
12
10
|
BlockControls,
|
|
13
11
|
InspectorControls,
|
|
14
12
|
store as blockEditorStore,
|
|
@@ -31,19 +29,18 @@ import { DOWN } from "@wordpress/keycodes";
|
|
|
31
29
|
import { useSelect, useDispatch } from "@wordpress/data";
|
|
32
30
|
import { store as blocksStore } from "@wordpress/blocks";
|
|
33
31
|
import { useToolsPanelDropdownMenuProps } from "../utils/hooks.mjs";
|
|
32
|
+
import useDeprecatedTextAlign from "../utils/deprecated-text-align-attributes.mjs";
|
|
34
33
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
-
function PostDateEdit({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
});
|
|
34
|
+
function PostDateEdit(props) {
|
|
35
|
+
const {
|
|
36
|
+
attributes,
|
|
37
|
+
context: { postType: postTypeSlug, queryId },
|
|
38
|
+
setAttributes,
|
|
39
|
+
name
|
|
40
|
+
} = props;
|
|
41
|
+
useDeprecatedTextAlign(props);
|
|
42
|
+
const { datetime, format, isLink } = attributes;
|
|
43
|
+
const blockProps = useBlockProps();
|
|
47
44
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
48
45
|
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
49
46
|
const popoverProps = useMemo(
|
|
@@ -92,59 +89,48 @@ function PostDateEdit({
|
|
|
92
89
|
);
|
|
93
90
|
}
|
|
94
91
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
95
|
-
(blockEditingMode === "default" || !isDescendentOfQueryLoop) && /* @__PURE__ */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
(blockEditingMode === "default" || !isDescendentOfQueryLoop) && activeBlockVariationName !== "post-date-modified" && (!isDescendentOfQueryLoop || !activeBlockVariationName) && /* @__PURE__ */ jsx(BlockControls, { group: "block", children: /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(
|
|
93
|
+
Dropdown,
|
|
94
|
+
{
|
|
95
|
+
popoverProps,
|
|
96
|
+
renderContent: ({ onClose }) => /* @__PURE__ */ jsx(
|
|
97
|
+
PublishDateTimePicker,
|
|
98
|
+
{
|
|
99
|
+
title: activeBlockVariationName === "post-date" ? __("Publish Date") : __("Date"),
|
|
100
|
+
currentDate: datetime,
|
|
101
|
+
onChange: (newDatetime) => setAttributes({
|
|
102
|
+
datetime: newDatetime
|
|
103
|
+
}),
|
|
104
|
+
is12Hour: is12HourFormat(
|
|
105
|
+
siteTimeFormat
|
|
106
|
+
),
|
|
107
|
+
onClose,
|
|
108
|
+
dateOrder: (
|
|
109
|
+
/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
|
|
110
|
+
_x("dmy", "date order")
|
|
111
|
+
)
|
|
102
112
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
),
|
|
114
|
+
renderToggle: ({ isOpen, onToggle }) => {
|
|
115
|
+
const openOnArrowDown = (event) => {
|
|
116
|
+
if (!isOpen && event.keyCode === DOWN) {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
onToggle();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return /* @__PURE__ */ jsx(
|
|
122
|
+
ToolbarButton,
|
|
111
123
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
is12Hour: is12HourFormat(
|
|
118
|
-
siteTimeFormat
|
|
119
|
-
),
|
|
120
|
-
onClose,
|
|
121
|
-
dateOrder: (
|
|
122
|
-
/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */
|
|
123
|
-
_x("dmy", "date order")
|
|
124
|
-
)
|
|
124
|
+
"aria-expanded": isOpen,
|
|
125
|
+
icon: pencil,
|
|
126
|
+
title: __("Change Date"),
|
|
127
|
+
onClick: onToggle,
|
|
128
|
+
onKeyDown: openOnArrowDown
|
|
125
129
|
}
|
|
126
|
-
)
|
|
127
|
-
renderToggle: ({ isOpen, onToggle }) => {
|
|
128
|
-
const openOnArrowDown = (event) => {
|
|
129
|
-
if (!isOpen && event.keyCode === DOWN) {
|
|
130
|
-
event.preventDefault();
|
|
131
|
-
onToggle();
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
return /* @__PURE__ */ jsx(
|
|
135
|
-
ToolbarButton,
|
|
136
|
-
{
|
|
137
|
-
"aria-expanded": isOpen,
|
|
138
|
-
icon: pencil,
|
|
139
|
-
title: __("Change Date"),
|
|
140
|
-
onClick: onToggle,
|
|
141
|
-
onKeyDown: openOnArrowDown
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
}
|
|
130
|
+
);
|
|
145
131
|
}
|
|
146
|
-
|
|
147
|
-
|
|
132
|
+
}
|
|
133
|
+
) }) }),
|
|
148
134
|
/* @__PURE__ */ jsx(InspectorControls, { children: /* @__PURE__ */ jsxs(
|
|
149
135
|
ToolsPanel,
|
|
150
136
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/post-date/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\nimport {\n\tdateI18n,\n\thumanTimeDiff,\n\tgetSettings as getDateSettings,\n} from '@wordpress/date';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n\tuseBlockEditingMode,\n\t__experimentalDateFormatPicker as DateFormatPicker,\n\t__experimentalPublishDateTimePicker as PublishDateTimePicker,\n} from '@wordpress/block-editor';\nimport {\n\tDropdown,\n\tToolbarGroup,\n\tToolbarButton,\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { DOWN } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\nexport default function PostDateEdit( props ) {\n\tconst {\n\t\tattributes,\n\t\tcontext: { postType: postTypeSlug, queryId },\n\t\tsetAttributes,\n\t\tname,\n\t} = props;\n\tuseDeprecatedTextAlign( props );\n\tconst { datetime, format, isLink } = attributes;\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( { anchor: popoverAnchor } ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// We need to set the datetime to a default value upon first loading\n\t// to discern the block from its legacy version (which would default\n\t// to the containing post's publish date).\n\tuseEffect( () => {\n\t\tif ( datetime === undefined ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { datetime: new Date() } );\n\t\t}\n\t}, [ datetime ] );\n\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst dateSettings = getDateSettings();\n\n\tconst {\n\t\tpostType,\n\t\tsiteFormat = dateSettings.formats.date,\n\t\tsiteTimeFormat = dateSettings.formats.time,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, getEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\treturn {\n\t\t\t\tsiteFormat: siteSettings?.date_format,\n\t\t\t\tsiteTimeFormat: siteSettings?.time_format,\n\t\t\t\tpostType: postTypeSlug ? getPostType( postTypeSlug ) : null,\n\t\t\t};\n\t\t},\n\t\t[ postTypeSlug ]\n\t);\n\tconst activeBlockVariationName = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blocksStore ).getActiveBlockVariation( name, attributes )\n\t\t\t\t?.name,\n\t\t[ name, attributes ]\n\t);\n\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tlet postDate = (\n\t\t<time dateTime={ dateI18n( 'c', datetime ) } ref={ setPopoverAnchor }>\n\t\t\t{ format === 'human-diff'\n\t\t\t\t? humanTimeDiff( datetime )\n\t\t\t\t: dateI18n( format || siteFormat, datetime ) }\n\t\t</time>\n\t);\n\n\tif ( isLink && datetime ) {\n\t\tpostDate = (\n\t\t\t<a\n\t\t\t\thref=\"#post-date-pseudo-link\"\n\t\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t\t>\n\t\t\t\t{ postDate }\n\t\t\t</a>\n\t\t);\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ ( blockEditingMode === 'default' || ! isDescendentOfQueryLoop ) &&\n\t\t\t\tactiveBlockVariationName !== 'post-date-modified' &&\n\t\t\t\t( ! isDescendentOfQueryLoop || ! activeBlockVariationName ) && (\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t\t<PublishDateTimePicker\n\t\t\t\t\t\t\t\t\t\ttitle={\n\t\t\t\t\t\t\t\t\t\t\tactiveBlockVariationName ===\n\t\t\t\t\t\t\t\t\t\t\t'post-date'\n\t\t\t\t\t\t\t\t\t\t\t\t? __( 'Publish Date' )\n\t\t\t\t\t\t\t\t\t\t\t\t: __( 'Date' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcurrentDate={ datetime }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( newDatetime ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tdatetime: newDatetime,\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\tis12Hour={ is12HourFormat(\n\t\t\t\t\t\t\t\t\t\t\tsiteTimeFormat\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\tdateOrder={\n\t\t\t\t\t\t\t\t\t\t\t/* translators: Order of day, month, and year. Available formats are 'dmy', 'mdy', and 'ymd'. */\n\t\t\t\t\t\t\t\t\t\t\t_x( 'dmy', 'date order' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => {\n\t\t\t\t\t\t\t\t\tconst openOnArrowDown = ( event ) => {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t! isOpen &&\n\t\t\t\t\t\t\t\t\t\t\tevent.keyCode === DOWN\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\t\tonToggle();\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\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t\t\t\t\t\t\ttitle={ __( 'Change Date' ) }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\t\t\t\tonKeyDown={ openOnArrowDown }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tdatetime: undefined,\n\t\t\t\t\t\t\tformat: undefined,\n\t\t\t\t\t\t\tisLink: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! format }\n\t\t\t\t\t\tlabel={ __( 'Date Format' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { format: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<DateFormatPicker\n\t\t\t\t\t\t\tformat={ format }\n\t\t\t\t\t\t\tdefaultFormat={ siteFormat }\n\t\t\t\t\t\t\tonChange={ ( nextFormat ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { format: nextFormat } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => isLink !== false }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name.toLowerCase()\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonDeselect={ () => setAttributes( { isLink: false } ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tpostType?.labels.singular_name\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\t\t\t\t\tpostType.labels.singular_name.toLowerCase()\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __( 'Link to post' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { isLink: ! isLink } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\n\t\t\t<div { ...blockProps }>{ postDate }</div>\n\t\t</>\n\t);\n}\n\nexport function is12HourFormat( format ) {\n\t// To know if the time format is a 12 hour time, look for any of the 12 hour\n\t// format characters: 'a', 'A', 'g', and 'h'. The character must be\n\t// unescaped, i.e. not preceded by a '\\'. Coincidentally, 'aAgh' is how I\n\t// feel when working with regular expressions.\n\t// https://www.php.net/manual/en/datetime.format.php\n\treturn /(?:^|[^\\\\])[aAgh]/.test( format );\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,SAAS,iBAAiB;AACnC,SAAS,WAAW,SAAS,gBAAgB;AAC7C;AAAA,EACC;AAAA,EACA;AAAA,EACA,eAAe;AAAA,OACT;AACP;AAAA,EACC;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,kCAAkC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V,cAAe,EAAE,QAAQ,CAAE,OAAO,CAAE;AAAA,kBAErC,SAAU;AAAA;AAAA,cACX;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IAEA,oBAAC,SAAM,GAAG,YAAe,oBAAU;AAAA,KACpC;AAEF;AAEO,SAAS,eAAgB,QAAS;AAMxC,SAAO,oBAAoB,KAAM,MAAO;AACzC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/site-title/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { mapMarker as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tviewportWidth: 350,\n\t\tattributes: {\n\t\t\ttextAlign: 'center',\n\t\t},\n\t},\n\tedit,\n\ttransforms,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,aAAa,YAAY;AAKlC,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAGV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,eAAe;AAAA,IACf,YAAY;AAAA,MACX,WAAW;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { mapMarker as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport deprecated from './deprecated';\nimport transforms from './transforms';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tviewportWidth: 350,\n\t\tattributes: {\n\t\t\tstyle: {\n\t\t\t\ttypography: {\n\t\t\t\t\ttextAlign: 'center',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tedit,\n\ttransforms,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,YAAY;AAKlC,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,gBAAgB;AAEvB,IAAM,EAAE,KAAK,IAAI;AAGV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,eAAe;AAAA,IACf,YAAY;AAAA,MACX,OAAO;AAAA,QACN,YAAY;AAAA,UACX,WAAW;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.42.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -95,42 +95,42 @@
|
|
|
95
95
|
],
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@arraypress/waveform-player": "1.2.1",
|
|
98
|
-
"@wordpress/a11y": "^4.
|
|
99
|
-
"@wordpress/api-fetch": "^7.
|
|
100
|
-
"@wordpress/autop": "^4.
|
|
101
|
-
"@wordpress/base-styles": "^6.
|
|
102
|
-
"@wordpress/blob": "^4.
|
|
103
|
-
"@wordpress/block-editor": "^15.
|
|
104
|
-
"@wordpress/blocks": "^15.
|
|
105
|
-
"@wordpress/components": "^32.4.
|
|
106
|
-
"@wordpress/compose": "^7.
|
|
107
|
-
"@wordpress/core-data": "^7.
|
|
108
|
-
"@wordpress/data": "^10.
|
|
109
|
-
"@wordpress/date": "^5.
|
|
110
|
-
"@wordpress/deprecated": "^4.
|
|
111
|
-
"@wordpress/dom": "^4.
|
|
112
|
-
"@wordpress/element": "^6.
|
|
113
|
-
"@wordpress/escape-html": "^3.
|
|
114
|
-
"@wordpress/hooks": "^4.
|
|
115
|
-
"@wordpress/html-entities": "^4.
|
|
116
|
-
"@wordpress/i18n": "^6.
|
|
117
|
-
"@wordpress/icons": "^12.0.
|
|
118
|
-
"@wordpress/interactivity": "^6.
|
|
119
|
-
"@wordpress/interactivity-router": "^2.
|
|
120
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
121
|
-
"@wordpress/keycodes": "^4.
|
|
122
|
-
"@wordpress/latex-to-mathml": "^1.
|
|
123
|
-
"@wordpress/notices": "^5.
|
|
124
|
-
"@wordpress/patterns": "^2.
|
|
125
|
-
"@wordpress/primitives": "^4.
|
|
126
|
-
"@wordpress/private-apis": "^1.
|
|
127
|
-
"@wordpress/reusable-blocks": "^5.
|
|
128
|
-
"@wordpress/rich-text": "^7.
|
|
129
|
-
"@wordpress/server-side-render": "^6.
|
|
130
|
-
"@wordpress/upload-media": "^0.
|
|
131
|
-
"@wordpress/url": "^4.
|
|
132
|
-
"@wordpress/viewport": "^6.
|
|
133
|
-
"@wordpress/wordcount": "^4.
|
|
98
|
+
"@wordpress/a11y": "^4.42.0",
|
|
99
|
+
"@wordpress/api-fetch": "^7.42.0",
|
|
100
|
+
"@wordpress/autop": "^4.42.0",
|
|
101
|
+
"@wordpress/base-styles": "^6.18.0",
|
|
102
|
+
"@wordpress/blob": "^4.42.0",
|
|
103
|
+
"@wordpress/block-editor": "^15.15.0",
|
|
104
|
+
"@wordpress/blocks": "^15.15.0",
|
|
105
|
+
"@wordpress/components": "^32.4.0",
|
|
106
|
+
"@wordpress/compose": "^7.42.0",
|
|
107
|
+
"@wordpress/core-data": "^7.42.0",
|
|
108
|
+
"@wordpress/data": "^10.42.0",
|
|
109
|
+
"@wordpress/date": "^5.42.0",
|
|
110
|
+
"@wordpress/deprecated": "^4.42.0",
|
|
111
|
+
"@wordpress/dom": "^4.42.0",
|
|
112
|
+
"@wordpress/element": "^6.42.0",
|
|
113
|
+
"@wordpress/escape-html": "^3.42.0",
|
|
114
|
+
"@wordpress/hooks": "^4.42.0",
|
|
115
|
+
"@wordpress/html-entities": "^4.42.0",
|
|
116
|
+
"@wordpress/i18n": "^6.15.0",
|
|
117
|
+
"@wordpress/icons": "^12.0.0",
|
|
118
|
+
"@wordpress/interactivity": "^6.42.0",
|
|
119
|
+
"@wordpress/interactivity-router": "^2.42.0",
|
|
120
|
+
"@wordpress/keyboard-shortcuts": "^5.42.0",
|
|
121
|
+
"@wordpress/keycodes": "^4.42.0",
|
|
122
|
+
"@wordpress/latex-to-mathml": "^1.10.0",
|
|
123
|
+
"@wordpress/notices": "^5.42.0",
|
|
124
|
+
"@wordpress/patterns": "^2.42.0",
|
|
125
|
+
"@wordpress/primitives": "^4.42.0",
|
|
126
|
+
"@wordpress/private-apis": "^1.42.0",
|
|
127
|
+
"@wordpress/reusable-blocks": "^5.42.0",
|
|
128
|
+
"@wordpress/rich-text": "^7.42.0",
|
|
129
|
+
"@wordpress/server-side-render": "^6.18.0",
|
|
130
|
+
"@wordpress/upload-media": "^0.27.0",
|
|
131
|
+
"@wordpress/url": "^4.42.0",
|
|
132
|
+
"@wordpress/viewport": "^6.42.0",
|
|
133
|
+
"@wordpress/wordcount": "^4.42.0",
|
|
134
134
|
"change-case": "^4.1.2",
|
|
135
135
|
"clsx": "^2.1.1",
|
|
136
136
|
"colord": "^2.7.0",
|
|
@@ -151,5 +151,5 @@
|
|
|
151
151
|
"publishConfig": {
|
|
152
152
|
"access": "public"
|
|
153
153
|
},
|
|
154
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "c20787b1778ae64c2db65643b1c236309d68e6ba"
|
|
155
155
|
}
|
package/src/html/modal.js
CHANGED
|
@@ -37,8 +37,6 @@ export default function HTMLEditModal( {
|
|
|
37
37
|
const [ editedHtml, setEditedHtml ] = useState( html );
|
|
38
38
|
const [ editedCss, setEditedCss ] = useState( css );
|
|
39
39
|
const [ editedJs, setEditedJs ] = useState( js );
|
|
40
|
-
const [ isDirty, setIsDirty ] = useState( false );
|
|
41
|
-
const [ showUnsavedWarning, setShowUnsavedWarning ] = useState( false );
|
|
42
40
|
const [ isFullscreen, setIsFullscreen ] = useState( false );
|
|
43
41
|
|
|
44
42
|
const isMobileViewport = useViewportMatch( 'small', '<' );
|
|
@@ -60,18 +58,6 @@ export default function HTMLEditModal( {
|
|
|
60
58
|
return null;
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
const handleHtmlChange = ( value ) => {
|
|
64
|
-
setEditedHtml( value );
|
|
65
|
-
setIsDirty( true );
|
|
66
|
-
};
|
|
67
|
-
const handleCssChange = ( value ) => {
|
|
68
|
-
setEditedCss( value );
|
|
69
|
-
setIsDirty( true );
|
|
70
|
-
};
|
|
71
|
-
const handleJsChange = ( value ) => {
|
|
72
|
-
setEditedJs( value );
|
|
73
|
-
setIsDirty( true );
|
|
74
|
-
};
|
|
75
61
|
const handleUpdate = () => {
|
|
76
62
|
// For users without unfiltered_html capability, strip CSS and JS content
|
|
77
63
|
// to prevent kses from leaving broken content
|
|
@@ -82,25 +68,6 @@ export default function HTMLEditModal( {
|
|
|
82
68
|
js: canUserUseUnfilteredHTML ? editedJs : '',
|
|
83
69
|
} ),
|
|
84
70
|
} );
|
|
85
|
-
setIsDirty( false );
|
|
86
|
-
};
|
|
87
|
-
const handleCancel = () => {
|
|
88
|
-
setIsDirty( false );
|
|
89
|
-
onRequestClose();
|
|
90
|
-
};
|
|
91
|
-
const handleRequestClose = () => {
|
|
92
|
-
if ( isDirty ) {
|
|
93
|
-
setShowUnsavedWarning( true );
|
|
94
|
-
} else {
|
|
95
|
-
onRequestClose();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
const handleDiscardChanges = () => {
|
|
99
|
-
setShowUnsavedWarning( false );
|
|
100
|
-
onRequestClose();
|
|
101
|
-
};
|
|
102
|
-
const handleContinueEditing = () => {
|
|
103
|
-
setShowUnsavedWarning( false );
|
|
104
71
|
};
|
|
105
72
|
const handleUpdateAndClose = () => {
|
|
106
73
|
handleUpdate();
|
|
@@ -114,12 +81,11 @@ export default function HTMLEditModal( {
|
|
|
114
81
|
<>
|
|
115
82
|
<Modal
|
|
116
83
|
title={ __( 'Edit HTML' ) }
|
|
117
|
-
onRequestClose={
|
|
84
|
+
onRequestClose={ onRequestClose }
|
|
118
85
|
className="block-library-html__modal"
|
|
119
86
|
size="large"
|
|
120
87
|
isDismissible={ false }
|
|
121
|
-
shouldCloseOnClickOutside={
|
|
122
|
-
shouldCloseOnEsc={ ! isDirty }
|
|
88
|
+
shouldCloseOnClickOutside={ false }
|
|
123
89
|
isFullScreen={ isFullscreen }
|
|
124
90
|
__experimentalHideHeader
|
|
125
91
|
>
|
|
@@ -183,7 +149,7 @@ export default function HTMLEditModal( {
|
|
|
183
149
|
>
|
|
184
150
|
<PlainText
|
|
185
151
|
value={ editedHtml }
|
|
186
|
-
onChange={
|
|
152
|
+
onChange={ setEditedHtml }
|
|
187
153
|
placeholder={ __( 'Write HTML…' ) }
|
|
188
154
|
aria-label={ __( 'HTML' ) }
|
|
189
155
|
className="block-library-html__modal-editor"
|
|
@@ -197,7 +163,7 @@ export default function HTMLEditModal( {
|
|
|
197
163
|
>
|
|
198
164
|
<PlainText
|
|
199
165
|
value={ editedCss }
|
|
200
|
-
onChange={
|
|
166
|
+
onChange={ setEditedCss }
|
|
201
167
|
placeholder={ __( 'Write CSS…' ) }
|
|
202
168
|
aria-label={ __( 'CSS' ) }
|
|
203
169
|
className="block-library-html__modal-editor"
|
|
@@ -212,7 +178,7 @@ export default function HTMLEditModal( {
|
|
|
212
178
|
>
|
|
213
179
|
<PlainText
|
|
214
180
|
value={ editedJs }
|
|
215
|
-
onChange={
|
|
181
|
+
onChange={ setEditedJs }
|
|
216
182
|
placeholder={ __(
|
|
217
183
|
'Write JavaScript…'
|
|
218
184
|
) }
|
|
@@ -241,7 +207,7 @@ export default function HTMLEditModal( {
|
|
|
241
207
|
<Button
|
|
242
208
|
__next40pxDefaultSize
|
|
243
209
|
variant="tertiary"
|
|
244
|
-
onClick={
|
|
210
|
+
onClick={ onRequestClose }
|
|
245
211
|
>
|
|
246
212
|
{ __( 'Cancel' ) }
|
|
247
213
|
</Button>
|
|
@@ -256,43 +222,6 @@ export default function HTMLEditModal( {
|
|
|
256
222
|
</VStack>
|
|
257
223
|
</Tabs>
|
|
258
224
|
</Modal>
|
|
259
|
-
|
|
260
|
-
{ showUnsavedWarning && (
|
|
261
|
-
<Modal
|
|
262
|
-
title={ __( 'Unsaved changes' ) }
|
|
263
|
-
onRequestClose={ handleContinueEditing }
|
|
264
|
-
size="medium"
|
|
265
|
-
>
|
|
266
|
-
<p>
|
|
267
|
-
{ __(
|
|
268
|
-
'You have unsaved changes. What would you like to do?'
|
|
269
|
-
) }
|
|
270
|
-
</p>
|
|
271
|
-
<Flex direction="row" justify="flex-end" gap={ 2 }>
|
|
272
|
-
<Button
|
|
273
|
-
__next40pxDefaultSize
|
|
274
|
-
variant="secondary"
|
|
275
|
-
onClick={ handleDiscardChanges }
|
|
276
|
-
>
|
|
277
|
-
{ __( 'Discard unsaved changes' ) }
|
|
278
|
-
</Button>
|
|
279
|
-
<Button
|
|
280
|
-
__next40pxDefaultSize
|
|
281
|
-
variant="secondary"
|
|
282
|
-
onClick={ handleContinueEditing }
|
|
283
|
-
>
|
|
284
|
-
{ __( 'Continue editing' ) }
|
|
285
|
-
</Button>
|
|
286
|
-
<Button
|
|
287
|
-
__next40pxDefaultSize
|
|
288
|
-
variant="primary"
|
|
289
|
-
onClick={ handleUpdateAndClose }
|
|
290
|
-
>
|
|
291
|
-
{ __( 'Update and close' ) }
|
|
292
|
-
</Button>
|
|
293
|
-
</Flex>
|
|
294
|
-
</Modal>
|
|
295
|
-
) }
|
|
296
225
|
</>
|
|
297
226
|
);
|
|
298
227
|
}
|
package/src/navigation/index.php
CHANGED
|
@@ -697,14 +697,10 @@ class WP_Navigation_Block_Renderer {
|
|
|
697
697
|
if ( ! empty( $attributes['overlay'] ) ) {
|
|
698
698
|
// Get blocks from the overlay template part.
|
|
699
699
|
$overlay_blocks = static::get_overlay_blocks_from_template_part( $attributes['overlay'], $attributes );
|
|
700
|
-
// Check if overlay contains a navigation-overlay-close block.
|
|
701
|
-
$has_custom_overlay_close_block = block_core_navigation_block_tree_has_block_type(
|
|
702
|
-
$overlay_blocks,
|
|
703
|
-
'core/navigation-overlay-close',
|
|
704
|
-
array( 'core/navigation' ) // Skip navigation blocks, as they cannot contain an overlay close block
|
|
705
|
-
);
|
|
706
700
|
// Render template part blocks directly without navigation container wrapper.
|
|
707
701
|
$overlay_blocks_html = static::get_template_part_blocks_html( $overlay_blocks );
|
|
702
|
+
// Check if overlay contains a navigation-overlay-close block (detect in rendered HTML so it works with patterns).
|
|
703
|
+
$has_custom_overlay_close_block = block_core_navigation_overlay_html_has_close_block( $overlay_blocks_html );
|
|
708
704
|
// Add Interactivity API directives to the overlay close block if present.
|
|
709
705
|
if ( $has_custom_overlay_close_block && $is_interactive ) {
|
|
710
706
|
$tags = new WP_HTML_Tag_Processor( $overlay_blocks_html );
|
|
@@ -1094,6 +1090,28 @@ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
|
|
1094
1090
|
}
|
|
1095
1091
|
}
|
|
1096
1092
|
|
|
1093
|
+
/**
|
|
1094
|
+
* Checks if the overlay HTML contains a navigation-overlay-close block.
|
|
1095
|
+
*
|
|
1096
|
+
* Uses WP_HTML_Tag_Processor to detect the close button in rendered output,
|
|
1097
|
+
* so it works when the overlay uses patterns (pattern content is rendered at
|
|
1098
|
+
* output time, not in the block tree).
|
|
1099
|
+
*
|
|
1100
|
+
* @since 7.0.0
|
|
1101
|
+
*
|
|
1102
|
+
* @param string $html The rendered overlay HTML.
|
|
1103
|
+
* @return bool True if a close button element is found.
|
|
1104
|
+
*/
|
|
1105
|
+
function block_core_navigation_overlay_html_has_close_block( $html ) {
|
|
1106
|
+
$tags = new WP_HTML_Tag_Processor( $html );
|
|
1107
|
+
return $tags->next_tag(
|
|
1108
|
+
array(
|
|
1109
|
+
'tag_name' => 'BUTTON',
|
|
1110
|
+
'class_name' => 'wp-block-navigation-overlay-close',
|
|
1111
|
+
)
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1097
1115
|
/**
|
|
1098
1116
|
* Add Interactivity API directives to the navigation-overlay-close block
|
|
1099
1117
|
* markup using the Tag Processor.
|
package/src/post-date/block.json
CHANGED
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"type": "string",
|
|
12
12
|
"role": "content"
|
|
13
13
|
},
|
|
14
|
-
"textAlign": {
|
|
15
|
-
"type": "string"
|
|
16
|
-
},
|
|
17
14
|
"format": {
|
|
18
15
|
"type": "string"
|
|
19
16
|
},
|
|
@@ -46,6 +43,7 @@
|
|
|
46
43
|
"typography": {
|
|
47
44
|
"fontSize": true,
|
|
48
45
|
"lineHeight": true,
|
|
46
|
+
"textAlign": true,
|
|
49
47
|
"__experimentalFontFamily": true,
|
|
50
48
|
"__experimentalFontWeight": true,
|
|
51
49
|
"__experimentalFontStyle": true,
|