@wordpress/block-library 9.35.1-next.16d95556a.0 → 9.36.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/accordion/view.js +46 -4
- package/build/accordion/view.js.map +2 -2
- package/build/accordion-heading/block.json +1 -1
- package/build/accordion-heading/deprecated.js +1 -1
- package/build/accordion-heading/deprecated.js.map +2 -2
- package/build/accordion-panel/block.json +1 -1
- package/build/audio/index.js +29 -0
- package/build/audio/index.js.map +3 -3
- package/build/breadcrumbs/edit.js +1 -1
- package/build/breadcrumbs/edit.js.map +2 -2
- package/build/button/index.js +25 -0
- package/build/button/index.js.map +3 -3
- package/build/code/index.js +15 -0
- package/build/code/index.js.map +3 -3
- package/build/cover/edit/block-controls.js +37 -3
- package/build/cover/edit/block-controls.js.map +3 -3
- package/build/cover/edit/cover-placeholder.js +0 -1
- package/build/cover/edit/cover-placeholder.js.map +2 -2
- package/build/cover/edit/embed-video-url-input.js +83 -0
- package/build/cover/edit/embed-video-url-input.js.map +7 -0
- package/build/cover/edit/index.js +60 -0
- package/build/cover/edit/index.js.map +2 -2
- package/build/cover/embed-video-utils.js +151 -0
- package/build/cover/embed-video-utils.js.map +7 -0
- package/build/cover/index.js +28 -0
- package/build/cover/index.js.map +3 -3
- package/build/cover/save.js +12 -0
- package/build/cover/save.js.map +2 -2
- package/build/cover/shared.js +3 -0
- package/build/cover/shared.js.map +2 -2
- package/build/details/index.js +15 -0
- package/build/details/index.js.map +3 -3
- package/build/file/index.js +33 -0
- package/build/file/index.js.map +3 -3
- package/build/freeform/block.json +1 -1
- package/build/gallery/edit.js +0 -2
- package/build/gallery/edit.js.map +2 -2
- package/build/heading/index.js +15 -0
- package/build/heading/index.js.map +3 -3
- package/build/html/modal.js +139 -148
- package/build/html/modal.js.map +3 -3
- package/build/image/edit.js +0 -1
- package/build/image/edit.js.map +2 -2
- package/build/image/image.js +0 -1
- package/build/image/image.js.map +2 -2
- package/build/image/index.js +46 -0
- package/build/image/index.js.map +3 -3
- package/build/list-item/index.js +15 -0
- package/build/list-item/index.js.map +3 -3
- package/build/math/block.json +28 -1
- package/build/math/edit.js +4 -1
- package/build/math/edit.js.map +2 -2
- package/build/media-text/index.js +35 -0
- package/build/media-text/index.js.map +3 -3
- package/build/media-text/media-container.js +0 -2
- package/build/media-text/media-container.js.map +2 -2
- package/build/missing/block.json +1 -1
- package/build/missing/edit.js +2 -2
- package/build/missing/edit.js.map +1 -1
- package/build/more/index.js +16 -0
- package/build/more/index.js.map +3 -3
- package/build/navigation/block.json +2 -2
- package/build/navigation-link/block.json +2 -1
- package/build/navigation-link/edit.js +42 -11
- package/build/navigation-link/edit.js.map +2 -2
- package/build/navigation-link/index.js +25 -0
- package/build/navigation-link/index.js.map +3 -3
- package/build/navigation-link/shared/controls.js +15 -19
- package/build/navigation-link/shared/controls.js.map +2 -2
- package/build/navigation-link/shared/index.js +4 -0
- package/build/navigation-link/shared/index.js.map +2 -2
- package/build/navigation-link/shared/use-entity-binding.js +3 -2
- package/build/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build/navigation-submenu/block.json +2 -1
- package/build/navigation-submenu/index.js +25 -0
- package/build/navigation-submenu/index.js.map +3 -3
- package/build/paragraph/deprecated-attributes.js +68 -0
- package/build/paragraph/deprecated-attributes.js.map +7 -0
- package/build/paragraph/edit.js +2 -0
- package/build/paragraph/edit.js.map +3 -3
- package/build/paragraph/index.js +15 -0
- package/build/paragraph/index.js.map +3 -3
- package/build/pattern/block.json +1 -1
- package/build/post-comments-count/edit.js +1 -2
- package/build/post-comments-count/edit.js.map +2 -2
- package/build/post-comments-link/edit.js +10 -7
- package/build/post-comments-link/edit.js.map +2 -2
- package/build/preformatted/index.js +15 -0
- package/build/preformatted/index.js.map +3 -3
- package/build/pullquote/index.js +20 -0
- package/build/pullquote/index.js.map +3 -3
- package/build/search/index.js +26 -0
- package/build/search/index.js.map +3 -3
- package/build/social-link/index.js +25 -0
- package/build/social-link/index.js.map +3 -3
- package/build/social-links/edit.js +1 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/tabs/view.js +17 -4
- package/build/tabs/view.js.map +2 -2
- package/build/template-part/edit/index.js +37 -7
- package/build/template-part/edit/index.js.map +2 -2
- package/build/template-part/edit/utils/hooks.js +2 -3
- package/build/template-part/edit/utils/hooks.js.map +2 -2
- package/build/term-count/index.js +1 -0
- package/build/term-count/index.js.map +2 -2
- package/build/term-name/index.js +1 -0
- package/build/term-name/index.js.map +2 -2
- package/build/verse/index.js +15 -0
- package/build/verse/index.js.map +3 -3
- package/build/video/index.js +30 -0
- package/build/video/index.js.map +3 -3
- package/build-module/accordion/view.js +46 -4
- package/build-module/accordion/view.js.map +2 -2
- package/build-module/accordion-heading/block.json +1 -1
- package/build-module/accordion-heading/deprecated.js +1 -1
- package/build-module/accordion-heading/deprecated.js.map +2 -2
- package/build-module/accordion-panel/block.json +1 -1
- package/build-module/audio/index.js +29 -0
- package/build-module/audio/index.js.map +2 -2
- package/build-module/breadcrumbs/edit.js +1 -1
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +25 -0
- package/build-module/button/index.js.map +2 -2
- package/build-module/code/index.js +15 -0
- package/build-module/code/index.js.map +2 -2
- package/build-module/cover/edit/block-controls.js +27 -3
- package/build-module/cover/edit/block-controls.js.map +2 -2
- package/build-module/cover/edit/cover-placeholder.js +0 -1
- package/build-module/cover/edit/cover-placeholder.js.map +2 -2
- package/build-module/cover/edit/embed-video-url-input.js +67 -0
- package/build-module/cover/edit/embed-video-url-input.js.map +7 -0
- package/build-module/cover/edit/index.js +61 -0
- package/build-module/cover/edit/index.js.map +2 -2
- package/build-module/cover/embed-video-utils.js +122 -0
- package/build-module/cover/embed-video-utils.js.map +7 -0
- package/build-module/cover/index.js +28 -0
- package/build-module/cover/index.js.map +2 -2
- package/build-module/cover/save.js +13 -0
- package/build-module/cover/save.js.map +2 -2
- package/build-module/cover/shared.js +2 -0
- package/build-module/cover/shared.js.map +2 -2
- package/build-module/details/index.js +15 -0
- package/build-module/details/index.js.map +2 -2
- package/build-module/file/index.js +34 -1
- package/build-module/file/index.js.map +2 -2
- package/build-module/freeform/block.json +1 -1
- package/build-module/gallery/edit.js +0 -2
- package/build-module/gallery/edit.js.map +2 -2
- package/build-module/heading/index.js +15 -0
- package/build-module/heading/index.js.map +2 -2
- package/build-module/html/modal.js +141 -150
- package/build-module/html/modal.js.map +2 -2
- package/build-module/image/edit.js +0 -1
- package/build-module/image/edit.js.map +2 -2
- package/build-module/image/image.js +0 -1
- package/build-module/image/image.js.map +2 -2
- package/build-module/image/index.js +46 -0
- package/build-module/image/index.js.map +2 -2
- package/build-module/list-item/index.js +15 -0
- package/build-module/list-item/index.js.map +2 -2
- package/build-module/math/block.json +28 -1
- package/build-module/math/edit.js +4 -1
- package/build-module/math/edit.js.map +2 -2
- package/build-module/media-text/index.js +35 -0
- package/build-module/media-text/index.js.map +2 -2
- package/build-module/media-text/media-container.js +0 -2
- package/build-module/media-text/media-container.js.map +2 -2
- package/build-module/missing/block.json +1 -1
- package/build-module/missing/edit.js +2 -2
- package/build-module/missing/edit.js.map +1 -1
- package/build-module/more/index.js +16 -0
- package/build-module/more/index.js.map +2 -2
- package/build-module/navigation/block.json +2 -2
- package/build-module/navigation-link/block.json +2 -1
- package/build-module/navigation-link/edit.js +56 -15
- package/build-module/navigation-link/edit.js.map +2 -2
- package/build-module/navigation-link/index.js +26 -1
- package/build-module/navigation-link/index.js.map +2 -2
- package/build-module/navigation-link/shared/controls.js +12 -18
- package/build-module/navigation-link/shared/controls.js.map +2 -2
- package/build-module/navigation-link/shared/index.js +3 -1
- package/build-module/navigation-link/shared/index.js.map +2 -2
- package/build-module/navigation-link/shared/use-entity-binding.js +3 -2
- package/build-module/navigation-link/shared/use-entity-binding.js.map +2 -2
- package/build-module/navigation-submenu/block.json +2 -1
- package/build-module/navigation-submenu/index.js +26 -1
- package/build-module/navigation-submenu/index.js.map +2 -2
- package/build-module/paragraph/deprecated-attributes.js +37 -0
- package/build-module/paragraph/deprecated-attributes.js.map +7 -0
- package/build-module/paragraph/edit.js +2 -0
- package/build-module/paragraph/edit.js.map +2 -2
- package/build-module/paragraph/index.js +15 -0
- package/build-module/paragraph/index.js.map +2 -2
- package/build-module/pattern/block.json +1 -1
- package/build-module/post-comments-count/edit.js +1 -3
- package/build-module/post-comments-count/edit.js.map +2 -2
- package/build-module/post-comments-link/edit.js +10 -8
- package/build-module/post-comments-link/edit.js.map +2 -2
- package/build-module/preformatted/index.js +15 -0
- package/build-module/preformatted/index.js.map +2 -2
- package/build-module/pullquote/index.js +20 -0
- package/build-module/pullquote/index.js.map +2 -2
- package/build-module/search/index.js +26 -0
- package/build-module/search/index.js.map +2 -2
- package/build-module/social-link/index.js +25 -0
- package/build-module/social-link/index.js.map +2 -2
- package/build-module/social-links/edit.js +1 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/tabs/view.js +17 -4
- package/build-module/tabs/view.js.map +2 -2
- package/build-module/template-part/edit/index.js +37 -7
- package/build-module/template-part/edit/index.js.map +2 -2
- package/build-module/template-part/edit/utils/hooks.js +2 -3
- package/build-module/template-part/edit/utils/hooks.js.map +2 -2
- package/build-module/term-count/index.js +1 -0
- package/build-module/term-count/index.js.map +2 -2
- package/build-module/term-name/index.js +1 -0
- package/build-module/term-name/index.js.map +2 -2
- package/build-module/verse/index.js +15 -0
- package/build-module/verse/index.js.map +2 -2
- package/build-module/video/index.js +30 -0
- package/build-module/video/index.js.map +2 -2
- package/build-style/accordion/style-rtl.css +3 -0
- package/build-style/accordion/style.css +3 -0
- package/build-style/accordion-heading/style-rtl.css +1 -2
- package/build-style/accordion-heading/style.css +1 -2
- package/build-style/accordion-item/style-rtl.css +0 -7
- package/build-style/accordion-item/style.css +0 -7
- package/build-style/accordion-panel/style-rtl.css +1 -4
- package/build-style/accordion-panel/style.css +1 -4
- package/build-style/cover/style-rtl.css +47 -0
- package/build-style/cover/style.css +47 -0
- package/build-style/editor-rtl.css +11 -13
- package/build-style/editor.css +11 -13
- package/build-style/html/editor-rtl.css +11 -13
- package/build-style/html/editor.css +11 -13
- package/build-style/style-rtl.css +52 -12
- package/build-style/style.css +52 -12
- package/package.json +37 -37
- package/src/accordion/style.scss +4 -0
- package/src/accordion/view.js +60 -3
- package/src/accordion-heading/block.json +1 -1
- package/src/accordion-heading/deprecated.js +1 -1
- package/src/accordion-heading/style.scss +1 -9
- package/src/accordion-item/index.php +1 -0
- package/src/accordion-item/style.scss +2 -9
- package/src/accordion-panel/block.json +1 -1
- package/src/accordion-panel/style.scss +1 -5
- package/src/audio/index.js +31 -0
- package/src/breadcrumbs/edit.js +4 -2
- package/src/breadcrumbs/index.php +171 -100
- package/src/button/index.js +27 -0
- package/src/code/index.js +17 -0
- package/src/cover/edit/block-controls.js +26 -2
- package/src/cover/edit/cover-placeholder.js +0 -1
- package/src/cover/edit/embed-video-url-input.js +74 -0
- package/src/cover/edit/index.js +81 -0
- package/src/cover/embed-video-utils.js +196 -0
- package/src/cover/index.js +30 -0
- package/src/cover/index.php +106 -0
- package/src/cover/save.js +14 -0
- package/src/cover/shared.js +1 -0
- package/src/cover/style.scss +47 -0
- package/src/details/index.js +17 -0
- package/src/file/index.js +36 -1
- package/src/freeform/block.json +1 -1
- package/src/gallery/edit.js +0 -2
- package/src/heading/index.js +17 -0
- package/src/html/editor.scss +10 -15
- package/src/html/modal.js +23 -38
- package/src/image/edit.js +0 -1
- package/src/image/image.js +0 -1
- package/src/image/index.js +48 -0
- package/src/image/index.php +1 -0
- package/src/list-item/index.js +17 -0
- package/src/math/block.json +28 -1
- package/src/math/edit.js +4 -1
- package/src/media-text/index.js +37 -0
- package/src/media-text/media-container.js +0 -2
- package/src/missing/block.json +1 -1
- package/src/missing/edit.js +2 -2
- package/src/more/index.js +18 -0
- package/src/navigation/block.json +2 -2
- package/src/navigation-link/block.json +2 -1
- package/src/navigation-link/edit.js +98 -29
- package/src/navigation-link/index.js +28 -1
- package/src/navigation-link/shared/controls.js +13 -17
- package/src/navigation-link/shared/index.js +1 -1
- package/src/navigation-link/shared/use-entity-binding.js +5 -2
- package/src/navigation-submenu/block.json +2 -1
- package/src/navigation-submenu/index.js +28 -1
- package/src/paragraph/deprecated-attributes.js +45 -0
- package/src/paragraph/edit.js +2 -0
- package/src/paragraph/index.js +17 -0
- package/src/pattern/block.json +1 -1
- package/src/post-comments-count/edit.js +1 -9
- package/src/post-comments-link/edit.js +8 -18
- package/src/preformatted/index.js +17 -0
- package/src/pullquote/index.js +22 -0
- package/src/search/index.js +28 -0
- package/src/social-link/index.js +27 -0
- package/src/social-links/edit.js +1 -1
- package/src/style.scss +1 -0
- package/src/tabs/view.js +19 -4
- package/src/template-part/edit/index.js +44 -6
- package/src/template-part/edit/utils/hooks.js +2 -4
- package/src/term-count/index.js +1 -0
- package/src/term-name/index.js +1 -0
- package/src/verse/index.js +17 -0
- package/src/video/index.js +32 -0
|
@@ -38,11 +38,14 @@ __export(preformatted_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(preformatted_exports);
|
|
39
39
|
var import_i18n = require("@wordpress/i18n");
|
|
40
40
|
var import_icons = require("@wordpress/icons");
|
|
41
|
+
var import_blocks = require("@wordpress/blocks");
|
|
41
42
|
var import_init_block = __toESM(require("../utils/init-block"));
|
|
42
43
|
var import_edit = __toESM(require("./edit"));
|
|
43
44
|
var import_block = __toESM(require("./block.json"));
|
|
44
45
|
var import_save = __toESM(require("./save"));
|
|
45
46
|
var import_transforms = __toESM(require("./transforms"));
|
|
47
|
+
var import_lock_unlock = require("../lock-unlock");
|
|
48
|
+
var { fieldsKey, formKey } = (0, import_lock_unlock.unlock)(import_blocks.privateApis);
|
|
46
49
|
var { name } = import_block.default;
|
|
47
50
|
var settings = {
|
|
48
51
|
icon: import_icons.preformatted,
|
|
@@ -65,6 +68,18 @@ var settings = {
|
|
|
65
68
|
};
|
|
66
69
|
}
|
|
67
70
|
};
|
|
71
|
+
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
72
|
+
settings[fieldsKey] = [
|
|
73
|
+
{
|
|
74
|
+
id: "content",
|
|
75
|
+
label: (0, import_i18n.__)("Content"),
|
|
76
|
+
type: "richtext"
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
settings[formKey] = {
|
|
80
|
+
fields: ["content"]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
68
83
|
var init = () => (0, import_init_block.default)({ name, metadata: import_block.default, settings });
|
|
69
84
|
// Annotate the CommonJS export names for ESM import in node:
|
|
70
85
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/preformatted/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { preformatted as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\\nWindow, very small in the distance, illuminated.\\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAqC;
|
|
6
|
-
"names": ["metadata", "icon", "transforms", "edit", "save", "initBlock", "metadata"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { preformatted as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\t/* eslint-disable @wordpress/i18n-no-collapsible-whitespace */\n\t\t\t// translators: Sample content for the Preformatted block. Can be replaced with a more locale-adequate work.\n\t\t\tcontent: __(\n\t\t\t\t'EXT. XANADU - FAINT DAWN - 1940 (MINIATURE)\\nWindow, very small in the distance, illuminated.\\nAll around this is an almost totally black screen. Now, as the camera moves slowly towards the window which is almost a postage stamp in the frame, other forms appear;'\n\t\t\t),\n\t\t\t/* eslint-enable @wordpress/i18n-no-collapsible-whitespace */\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tmerge( attributes, attributesToMerge ) {\n\t\treturn {\n\t\t\tcontent: attributes.content + '\\n\\n' + attributesToMerge.content,\n\t\t};\n\t},\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'content',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'content' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAqC;AACrC,oBAAiD;AAKjD,wBAAsB;AACtB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA;AAAA;AAAA,MAGX,aAAS;AAAA,QACR;AAAA,MACD;AAAA;AAAA,IAED;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,MAAO,YAAY,mBAAoB;AACtC,WAAO;AAAA,MACN,SAAS,WAAW,UAAU,SAAS,kBAAkB;AAAA,IAC1D;AAAA,EACD;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,SAAU;AAAA,EACrB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "blocksPrivateApis", "icon", "transforms", "edit", "save", "initBlock", "metadata"]
|
|
7
7
|
}
|
package/build/pullquote/index.js
CHANGED
|
@@ -38,12 +38,15 @@ __export(pullquote_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(pullquote_exports);
|
|
39
39
|
var import_i18n = require("@wordpress/i18n");
|
|
40
40
|
var import_icons = require("@wordpress/icons");
|
|
41
|
+
var import_blocks = require("@wordpress/blocks");
|
|
41
42
|
var import_init_block = __toESM(require("../utils/init-block"));
|
|
42
43
|
var import_deprecated = __toESM(require("./deprecated"));
|
|
43
44
|
var import_edit = __toESM(require("./edit"));
|
|
44
45
|
var import_block = __toESM(require("./block.json"));
|
|
45
46
|
var import_save = __toESM(require("./save"));
|
|
46
47
|
var import_transforms = __toESM(require("./transforms"));
|
|
48
|
+
var import_lock_unlock = require("../lock-unlock");
|
|
49
|
+
var { fieldsKey, formKey } = (0, import_lock_unlock.unlock)(import_blocks.privateApis);
|
|
47
50
|
var { name } = import_block.default;
|
|
48
51
|
var settings = {
|
|
49
52
|
icon: import_icons.pullquote,
|
|
@@ -63,6 +66,23 @@ var settings = {
|
|
|
63
66
|
save: import_save.default,
|
|
64
67
|
deprecated: import_deprecated.default
|
|
65
68
|
};
|
|
69
|
+
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
70
|
+
settings[fieldsKey] = [
|
|
71
|
+
{
|
|
72
|
+
id: "value",
|
|
73
|
+
label: (0, import_i18n.__)("Content"),
|
|
74
|
+
type: "richtext"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "citation",
|
|
78
|
+
label: (0, import_i18n.__)("Citation"),
|
|
79
|
+
type: "richtext"
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
settings[formKey] = {
|
|
83
|
+
fields: ["value"]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
66
86
|
var init = () => (0, import_init_block.default)({ name, metadata: import_block.default, settings });
|
|
67
87
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
88
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/pullquote/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { pullquote as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tvalue:\n\t\t\t\t// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.\n\t\t\t\t__(\n\t\t\t\t\t'One of the hardest things to do in technology is disrupt yourself.'\n\t\t\t\t),\n\t\t\tcitation: __( 'Matt Mullenweg' ),\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAkC;
|
|
6
|
-
"names": ["metadata", "icon", "transforms", "edit", "save", "deprecated", "initBlock", "metadata"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { pullquote as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tvalue:\n\t\t\t\t// translators: Quote serving as example for the Pullquote block. Attributed to Matt Mullenweg.\n\t\t\t\t__(\n\t\t\t\t\t'One of the hardest things to do in technology is disrupt yourself.'\n\t\t\t\t),\n\t\t\tcitation: __( 'Matt Mullenweg' ),\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'value',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'citation',\n\t\t\tlabel: __( 'Citation' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'value' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAAkC;AAClC,oBAAiD;AAKjD,wBAAsB;AACtB,wBAAuB;AACvB,kBAAiB;AACjB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX;AAAA;AAAA,YAEC;AAAA,UACC;AAAA,QACD;AAAA;AAAA,MACD,cAAU,gBAAI,gBAAiB;AAAA,IAChC;AAAA,EACD;AAAA,EACA,8BAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,8BAAAC;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,UAAW;AAAA,MACtB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,OAAQ;AAAA,EACnB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "blocksPrivateApis", "icon", "transforms", "edit", "save", "deprecated", "initBlock", "metadata"]
|
|
7
7
|
}
|
package/build/search/index.js
CHANGED
|
@@ -38,10 +38,13 @@ __export(search_exports, {
|
|
|
38
38
|
module.exports = __toCommonJS(search_exports);
|
|
39
39
|
var import_i18n = require("@wordpress/i18n");
|
|
40
40
|
var import_icons = require("@wordpress/icons");
|
|
41
|
+
var import_blocks = require("@wordpress/blocks");
|
|
41
42
|
var import_init_block = __toESM(require("../utils/init-block"));
|
|
42
43
|
var import_block = __toESM(require("./block.json"));
|
|
43
44
|
var import_edit = __toESM(require("./edit"));
|
|
44
45
|
var import_variations = __toESM(require("./variations"));
|
|
46
|
+
var import_lock_unlock = require("../lock-unlock");
|
|
47
|
+
var { fieldsKey, formKey } = (0, import_lock_unlock.unlock)(import_blocks.privateApis);
|
|
45
48
|
var { name } = import_block.default;
|
|
46
49
|
var settings = {
|
|
47
50
|
icon: import_icons.search,
|
|
@@ -52,6 +55,29 @@ var settings = {
|
|
|
52
55
|
variations: import_variations.default,
|
|
53
56
|
edit: import_edit.default
|
|
54
57
|
};
|
|
58
|
+
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
59
|
+
settings[fieldsKey] = [
|
|
60
|
+
{
|
|
61
|
+
id: "label",
|
|
62
|
+
label: (0, import_i18n.__)("Label"),
|
|
63
|
+
type: "richtext",
|
|
64
|
+
shownByDefault: true
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "buttonText",
|
|
68
|
+
label: (0, import_i18n.__)("Button text"),
|
|
69
|
+
type: "richtext"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: "placeholder",
|
|
73
|
+
label: (0, import_i18n.__)("Placeholder"),
|
|
74
|
+
type: "richtext"
|
|
75
|
+
}
|
|
76
|
+
];
|
|
77
|
+
settings[formKey] = {
|
|
78
|
+
fields: ["label"]
|
|
79
|
+
};
|
|
80
|
+
}
|
|
55
81
|
var init = () => (0, import_init_block.default)({ name, metadata: import_block.default, settings });
|
|
56
82
|
// Annotate the CommonJS export names for ESM import in node:
|
|
57
83
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/search/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { search 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 variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: { buttonText: __( 'Search' ), label: __( 'Search' ) },\n\t\tviewportWidth: 400,\n\t},\n\tvariations,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA+B;
|
|
6
|
-
"names": ["metadata", "icon", "variations", "edit", "initBlock", "metadata"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { search as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: { buttonText: __( 'Search' ), label: __( 'Search' ) },\n\t\tviewportWidth: 400,\n\t},\n\tvariations,\n\tedit,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'label',\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'richtext',\n\t\t\tshownByDefault: true,\n\t\t},\n\t\t{\n\t\t\tid: 'buttonText',\n\t\t\tlabel: __( 'Button text' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'placeholder',\n\t\t\tlabel: __( 'Placeholder' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'label' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA+B;AAC/B,oBAAiD;AAKjD,wBAAsB;AACtB,mBAAqB;AACrB,kBAAiB;AACjB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,SAAS;AAAA,IACR,YAAY,EAAE,gBAAY,gBAAI,QAAS,GAAG,WAAO,gBAAI,QAAS,EAAE;AAAA,IAChE,eAAe;AAAA,EAChB;AAAA,EACA,8BAAAC;AAAA,EACA,kBAAAC;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,MACN,gBAAgB;AAAA,IACjB;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,aAAc;AAAA,MACzB,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,aAAc;AAAA,MACzB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,OAAQ;AAAA,EACnB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "blocksPrivateApis", "icon", "variations", "edit", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -36,17 +36,42 @@ __export(social_link_exports, {
|
|
|
36
36
|
settings: () => settings
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(social_link_exports);
|
|
39
|
+
var import_i18n = require("@wordpress/i18n");
|
|
39
40
|
var import_icons = require("@wordpress/icons");
|
|
41
|
+
var import_blocks = require("@wordpress/blocks");
|
|
40
42
|
var import_init_block = __toESM(require("../utils/init-block"));
|
|
41
43
|
var import_edit = __toESM(require("./edit"));
|
|
42
44
|
var import_block = __toESM(require("./block.json"));
|
|
43
45
|
var import_variations = __toESM(require("./variations"));
|
|
46
|
+
var import_lock_unlock = require("../lock-unlock");
|
|
47
|
+
var { fieldsKey, formKey } = (0, import_lock_unlock.unlock)(import_blocks.privateApis);
|
|
44
48
|
var { name } = import_block.default;
|
|
45
49
|
var settings = {
|
|
46
50
|
icon: import_icons.share,
|
|
47
51
|
edit: import_edit.default,
|
|
48
52
|
variations: import_variations.default
|
|
49
53
|
};
|
|
54
|
+
if (window.__experimentalContentOnlyPatternInsertion) {
|
|
55
|
+
settings[fieldsKey] = [
|
|
56
|
+
{
|
|
57
|
+
id: "link",
|
|
58
|
+
label: (0, import_i18n.__)("Link"),
|
|
59
|
+
type: "link",
|
|
60
|
+
mapping: {
|
|
61
|
+
href: "url",
|
|
62
|
+
rel: "rel"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "label",
|
|
67
|
+
label: (0, import_i18n.__)("Label"),
|
|
68
|
+
type: "richtext"
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
settings[formKey] = {
|
|
72
|
+
fields: ["link"]
|
|
73
|
+
};
|
|
74
|
+
}
|
|
50
75
|
var init = () => (0, import_init_block.default)({ name, metadata: import_block.default, settings });
|
|
51
76
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
77
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/social-link/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { share as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,mBAA8B;
|
|
6
|
-
"names": ["metadata", "icon", "edit", "variations", "initBlock", "metadata"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { share as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport variations from './variations';\nimport { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tvariations,\n};\n\nif ( window.__experimentalContentOnlyPatternInsertion ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\thref: 'url',\n\t\t\t\trel: 'rel',\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tid: 'label',\n\t\t\tlabel: __( 'Label' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'link' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,mBAA8B;AAC9B,oBAAiD;AAKjD,wBAAsB;AACtB,kBAAiB;AACjB,mBAAqB;AACrB,wBAAuB;AACvB,yBAAuB;AAEvB,IAAM,EAAE,WAAW,QAAQ,QAAI,2BAAQ,cAAAC,WAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI,aAAAD;AAIV,IAAM,WAAW;AAAA,EACvB,mBAAAE;AAAA,EACA,kBAAAC;AAAA,EACA,8BAAAC;AACD;AAEA,IAAK,OAAO,2CAA4C;AACvD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,MAAO;AAAA,MAClB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,MAAM;AAAA,QACN,KAAK;AAAA,MACN;AAAA,IACD;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,WAAO,gBAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,IACP;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,MAAO;AAAA,EAClB;AACD;AAEO,IAAM,OAAO,UAAM,kBAAAC,SAAW,EAAE,MAAM,uBAAAC,SAAU,SAAS,CAAE;",
|
|
6
|
+
"names": ["metadata", "blocksPrivateApis", "icon", "edit", "variations", "initBlock", "metadata"]
|
|
7
7
|
}
|
|
@@ -171,7 +171,7 @@ function SocialLinksEdit(props) {
|
|
|
171
171
|
{
|
|
172
172
|
__next40pxDefaultSize: true,
|
|
173
173
|
__nextHasNoMarginBottom: true,
|
|
174
|
-
label: (0, import_i18n.__)("Icon
|
|
174
|
+
label: (0, import_i18n.__)("Icon size"),
|
|
175
175
|
onChange: (newSize) => {
|
|
176
176
|
setAttributes({
|
|
177
177
|
size: newSize === "" ? void 0 : newSize
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/social-links/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ label: __( 'Default' ), value: '' },\n\t{ label: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ label: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ label: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ label: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst { hasSocialIcons, hasSelectedChild } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\thasSocialIcons: getBlockCount( clientId ) > 0,\n\t\t\t\thasSelectedChild: hasSelectedInnerBlock( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tlet restore;\n\t\t\tsetAttributes( ( prev ) => {\n\t\t\t\trestore = {\n\t\t\t\t\ticonBackgroundColor: prev.iconBackgroundColor,\n\t\t\t\t\ticonBackgroundColorValue: prev.iconBackgroundColorValue,\n\t\t\t\t\tcustomIconBackgroundColor: prev.customIconBackgroundColor,\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn () => setAttributes( { ...restore } );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender:\n\t\t\t! hasSocialIcons || hasAnySelected\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: undefined,\n\t} );\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\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\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t\tsize: undefined,\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\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! size }\n\t\t\t\t\t\tlabel={ __( 'Icon size' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { size: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Icon
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tSelectControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ label: __( 'Default' ), value: '' },\n\t{ label: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ label: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ label: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ label: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst { hasSocialIcons, hasSelectedChild } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\thasSocialIcons: getBlockCount( clientId ) > 0,\n\t\t\t\thasSelectedChild: hasSelectedInnerBlock( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tlet restore;\n\t\t\tsetAttributes( ( prev ) => {\n\t\t\t\trestore = {\n\t\t\t\t\ticonBackgroundColor: prev.iconBackgroundColor,\n\t\t\t\t\ticonBackgroundColorValue: prev.iconBackgroundColorValue,\n\t\t\t\t\tcustomIconBackgroundColor: prev.customIconBackgroundColor,\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn () => setAttributes( { ...restore } );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender:\n\t\t\t! hasSocialIcons || hasAnySelected\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: undefined,\n\t} );\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\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\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t\tsize: undefined,\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\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! size }\n\t\t\t\t\t\tlabel={ __( 'Icon size' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { size: undefined } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Icon size' ) }\n\t\t\t\t\t\t\tonChange={ ( newSize ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tsize: newSize === '' ? undefined : newSize,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ size ?? '' }\n\t\t\t\t\t\t\toptions={ sizeOptions }\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\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\thasValue={ () => !! showLabels }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\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\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenInNewTab: ! openInNewTab,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t\t\tclearable: true,\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\tpanelId={ clientId }\n\t\t\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t) }\n\t\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAA0B;AAC1B,0BAUO;AACP,wBAKO;AACP,kBAAmB;AACnB,kBAA0B;AAK1B,mBAA+C;AAiI7C;AA/HF,IAAM,cAAc;AAAA,EACnB,EAAE,WAAO,gBAAI,SAAU,GAAG,OAAO,GAAG;AAAA,EACpC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,uBAAwB;AAAA,kBACpC,SAAU;AAAA,kBACV,UAAW,MACV,cAAe;AAAA,oBACd,cAAc,CAAE;AAAA,kBACjB,CAAE;AAAA;AAAA,cAEJ;AAAA;AAAA,UACD;AAAA;AAAA;AAAA,IACD,GACD;AAAA,IACE,sBAAsB,wBACvB,6CAAC,yCAAkB,OAAM,SACtB;AAAA,oBAAc;AAAA,QACf,CAAE,EAAE,UAAU,OAAO,OAAO,eAAe,MAC1C;AAAA,UAAC,oBAAAC;AAAA,UAAA;AAAA,YAEA,mCAAiC;AAAA,YACjC,UAAW;AAAA,cACV;AAAA,gBACC,YAAY;AAAA,gBACZ;AAAA,gBACA,eAAe;AAAA,gBACf,kBAAkB;AAAA,gBAClB;AAAA,gBACA,aAAa;AAAA,gBACb,WAAW;AAAA,cACZ;AAAA,YACD;AAAA,YACA,SAAU;AAAA,YACR,GAAG;AAAA;AAAA,UAdC,sBAAuB,KAAM;AAAA,QAepC;AAAA,MAEF;AAAA,MACE,CAAE,aACH;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,YACJ,WAAW;AAAA,YACX,iBAAiB;AAAA,UAClB;AAAA,UACA,aAAc;AAAA;AAAA,MACf;AAAA,OAEF;AAAA,IAED,4CAAC,QAAK,GAAG,kBAAmB;AAAA,KAC7B;AAEF;AAEA,IAAM,sBAAsB;AAAA,EAC3B,WAAW;AAAA,EACX,qBAAqB;AACtB;AAEA,IAAO,mBAAQ,gCAAY,mBAAoB,EAAG,eAAgB;",
|
|
6
6
|
"names": ["blockEditorStore", "clsx", "useMultipleOriginColorsAndGradients", "ToolsPanel", "ToolsPanelItem", "ColorGradientSettingsDropdown"]
|
|
7
7
|
}
|
package/build/tabs/view.js
CHANGED
|
@@ -3,8 +3,23 @@
|
|
|
3
3
|
// packages/block-library/src/tabs/view.js
|
|
4
4
|
var import_interactivity = require("@wordpress/interactivity");
|
|
5
5
|
function createReadOnlyProxy(obj) {
|
|
6
|
+
const arrayMutationMethods = /* @__PURE__ */ new Set([
|
|
7
|
+
"push",
|
|
8
|
+
"pop",
|
|
9
|
+
"shift",
|
|
10
|
+
"unshift",
|
|
11
|
+
"splice",
|
|
12
|
+
"sort",
|
|
13
|
+
"reverse",
|
|
14
|
+
"copyWithin",
|
|
15
|
+
"fill"
|
|
16
|
+
]);
|
|
6
17
|
return new Proxy(obj, {
|
|
7
18
|
get(target, prop) {
|
|
19
|
+
if (Array.isArray(target) && arrayMutationMethods.has(prop)) {
|
|
20
|
+
return () => {
|
|
21
|
+
};
|
|
22
|
+
}
|
|
8
23
|
const value = target[prop];
|
|
9
24
|
if (typeof value === "object" && value !== null) {
|
|
10
25
|
return createReadOnlyProxy(value);
|
|
@@ -173,21 +188,19 @@ var { actions: privateActions, state: privateState } = (0, import_interactivity.
|
|
|
173
188
|
/**
|
|
174
189
|
* Gets the index of the active tab element whether it
|
|
175
190
|
* is a tab label or tab panel.
|
|
176
|
-
* Public API for third-party access.
|
|
177
191
|
*
|
|
178
192
|
* @type {number|null}
|
|
179
193
|
*/
|
|
180
194
|
get tabIndex() {
|
|
181
|
-
return
|
|
195
|
+
return privateState.tabIndex;
|
|
182
196
|
},
|
|
183
197
|
/**
|
|
184
198
|
* Whether the tab panel or tab label is the active tab.
|
|
185
|
-
* Public API for third-party access.
|
|
186
199
|
*
|
|
187
200
|
* @type {boolean}
|
|
188
201
|
*/
|
|
189
202
|
get isActiveTab() {
|
|
190
|
-
return
|
|
203
|
+
return privateState.isActiveTab;
|
|
191
204
|
}
|
|
192
205
|
},
|
|
193
206
|
actions: {
|
package/build/tabs/view.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/tabs/view.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tstore,\n\tgetContext,\n\tgetElement,\n\twithSyncEvent,\n} from '@wordpress/interactivity';\n\nfunction createReadOnlyProxy( obj ) {\n\treturn new Proxy( obj, {\n\t\tget( target, prop ) {\n\t\t\tconst value = target[ prop ];\n\t\t\tif ( typeof value === 'object' && value !== null ) {\n\t\t\t\treturn createReadOnlyProxy( value );\n\t\t\t}\n\t\t\treturn value;\n\t\t},\n\t\tset() {\n\t\t\treturn false;\n\t\t},\n\t\tdeleteProperty() {\n\t\t\treturn false;\n\t\t},\n\t} );\n}\n\n// Private store for internal tabs functionality and security.\nconst { actions: privateActions, state: privateState } = store(\n\t'core/tabs/private',\n\t{\n\t\tstate: {\n\t\t\t/**\n\t\t\t * Gets a contextually aware list of tabs for the current tabs block.\n\t\t\t *\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tget tabsList() {\n\t\t\t\tconst context = getContext();\n\t\t\t\tconst tabsId = context?.tabsId;\n\t\t\t\tconst tabsList = privateState[ tabsId ];\n\t\t\t\treturn tabsList;\n\t\t\t},\n\t\t\t/**\n\t\t\t * Gets the index of the active tab element whether it\n\t\t\t * is a tab label or tab panel.\n\t\t\t *\n\t\t\t * @type {number|null}\n\t\t\t */\n\t\t\tget tabIndex() {\n\t\t\t\tconst { attributes } = getElement();\n\t\t\t\tconst tabId = attributes?.id?.replace( 'tab__', '' ) || null;\n\t\t\t\tif ( ! tabId ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tconst { tabsList } = privateState;\n\t\t\t\tconst tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );\n\t\t\t\treturn tabIndex;\n\t\t\t},\n\t\t\t/**\n\t\t\t * Whether the tab panel or tab label is the active tab.\n\t\t\t *\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tget isActiveTab() {\n\t\t\t\tconst { activeTabIndex } = getContext();\n\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\treturn activeTabIndex === tabIndex;\n\t\t\t},\n\t\t\t/**\n\t\t\t * The value of the tabindex attribute.\n\t\t\t *\n\t\t\t * @type {false|string}\n\t\t\t */\n\t\t\tget tabIndexAttribute() {\n\t\t\t\treturn privateState.isActiveTab ? -1 : 0;\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\t/**\n\t\t\t * Handles the keydown events for the tab label and tabs controller.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t\t */\n\t\t\thandleTabKeyDown: withSyncEvent( ( event ) => {\n\t\t\t\t// If this is the enter key then lets get the tab index from context and set the active tab to that index.\n\t\t\t\tconst { isVertical } = getContext();\n\t\t\t\tif ( event.key === 'Enter' ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowRight' && ! isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex + 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowLeft' && ! isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex - 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowDown' && isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex + 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowUp' && isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex - 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ),\n\t\t\t/**\n\t\t\t * Handles the click event for the tab label.\n\t\t\t *\n\t\t\t * @param {MouseEvent} event The click event.\n\t\t\t */\n\t\t\thandleTabClick: withSyncEvent( ( event ) => {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\tprivateActions.setActiveTab( tabIndex );\n\t\t\t\t}\n\t\t\t} ),\n\t\t\t/**\n\t\t\t * Sets the active tab index (internal implementation).\n\t\t\t *\n\t\t\t * @param {number} tabIndex The index of the active tab.\n\t\t\t * @param {boolean} scrollToTab Whether to scroll to the tab element.\n\t\t\t */\n\t\t\tsetActiveTab: ( tabIndex, scrollToTab = false ) => {\n\t\t\t\tconst context = getContext();\n\t\t\t\tcontext.activeTabIndex = tabIndex;\n\t\t\t\tif ( scrollToTab ) {\n\t\t\t\t\tconst tabId = privateState.tabsList[ tabIndex ].id;\n\t\t\t\t\tconst tabElement = document.getElementById( tabId );\n\t\t\t\t\tif ( tabElement ) {\n\t\t\t\t\t\tsetTimeout( () => {\n\t\t\t\t\t\t\ttabElement.scrollIntoView( { behavior: 'smooth' } );\n\t\t\t\t\t\t}, 100 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\t/**\n\t\t\t * When the tabs are initialized, we need to check if there is a hash in the url and if so if it exists in the current tabsList, set the active tab to that index.\n\t\t\t *\n\t\t\t */\n\t\t\tonTabsInit: () => {\n\t\t\t\tconst { tabsList } = privateState;\n\t\t\t\tif ( tabsList.length === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst { hash } = window.location;\n\t\t\t\tconst tabId = hash.replace( '#', '' );\n\t\t\t\tconst tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );\n\t\t\t\t// Check if tabIndex is a positive number and if so we'll auto activate that tab.\n\t\t\t\tif ( tabIndex >= 0 ) {\n\t\t\t\t\tprivateActions.setActiveTab( tabIndex, true );\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tlock: true,\n\t}\n);\n\n// Public store for third-party extensibility.\nstore( 'core/tabs', {\n\tstate: {\n\t\t/**\n\t\t * Gets a contextually aware list of tabs for the current tabs block.\n\t\t * Public API for third-party access.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tget tabsList() {\n\t\t\treturn createReadOnlyProxy( privateState.tabsList );\n\t\t},\n\t\t/**\n\t\t * Gets the index of the active tab element whether it\n\t\t * is a tab label or tab panel.\n\t\t
|
|
5
|
-
"mappings": ";;;AAGA,2BAKO;AAEP,SAAS,oBAAqB,KAAM;AACnC,SAAO,IAAI,MAAO,KAAK;AAAA,IACtB,IAAK,QAAQ,MAAO;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tstore,\n\tgetContext,\n\tgetElement,\n\twithSyncEvent,\n} from '@wordpress/interactivity';\n\nfunction createReadOnlyProxy( obj ) {\n\tconst arrayMutationMethods = new Set( [\n\t\t'push',\n\t\t'pop',\n\t\t'shift',\n\t\t'unshift',\n\t\t'splice',\n\t\t'sort',\n\t\t'reverse',\n\t\t'copyWithin',\n\t\t'fill',\n\t] );\n\n\treturn new Proxy( obj, {\n\t\tget( target, prop ) {\n\t\t\t// If accessing an array mutation method, return a no-op function.\n\t\t\tif ( Array.isArray( target ) && arrayMutationMethods.has( prop ) ) {\n\t\t\t\treturn () => {};\n\t\t\t}\n\n\t\t\tconst value = target[ prop ];\n\t\t\tif ( typeof value === 'object' && value !== null ) {\n\t\t\t\treturn createReadOnlyProxy( value );\n\t\t\t}\n\t\t\treturn value;\n\t\t},\n\t\tset() {\n\t\t\treturn false;\n\t\t},\n\t\tdeleteProperty() {\n\t\t\treturn false;\n\t\t},\n\t} );\n}\n\n// Private store for internal tabs functionality and security.\nconst { actions: privateActions, state: privateState } = store(\n\t'core/tabs/private',\n\t{\n\t\tstate: {\n\t\t\t/**\n\t\t\t * Gets a contextually aware list of tabs for the current tabs block.\n\t\t\t *\n\t\t\t * @type {Array}\n\t\t\t */\n\t\t\tget tabsList() {\n\t\t\t\tconst context = getContext();\n\t\t\t\tconst tabsId = context?.tabsId;\n\t\t\t\tconst tabsList = privateState[ tabsId ];\n\t\t\t\treturn tabsList;\n\t\t\t},\n\t\t\t/**\n\t\t\t * Gets the index of the active tab element whether it\n\t\t\t * is a tab label or tab panel.\n\t\t\t *\n\t\t\t * @type {number|null}\n\t\t\t */\n\t\t\tget tabIndex() {\n\t\t\t\tconst { attributes } = getElement();\n\t\t\t\tconst tabId = attributes?.id?.replace( 'tab__', '' ) || null;\n\t\t\t\tif ( ! tabId ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tconst { tabsList } = privateState;\n\t\t\t\tconst tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );\n\t\t\t\treturn tabIndex;\n\t\t\t},\n\t\t\t/**\n\t\t\t * Whether the tab panel or tab label is the active tab.\n\t\t\t *\n\t\t\t * @type {boolean}\n\t\t\t */\n\t\t\tget isActiveTab() {\n\t\t\t\tconst { activeTabIndex } = getContext();\n\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\treturn activeTabIndex === tabIndex;\n\t\t\t},\n\t\t\t/**\n\t\t\t * The value of the tabindex attribute.\n\t\t\t *\n\t\t\t * @type {false|string}\n\t\t\t */\n\t\t\tget tabIndexAttribute() {\n\t\t\t\treturn privateState.isActiveTab ? -1 : 0;\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\t/**\n\t\t\t * Handles the keydown events for the tab label and tabs controller.\n\t\t\t *\n\t\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t\t */\n\t\t\thandleTabKeyDown: withSyncEvent( ( event ) => {\n\t\t\t\t// If this is the enter key then lets get the tab index from context and set the active tab to that index.\n\t\t\t\tconst { isVertical } = getContext();\n\t\t\t\tif ( event.key === 'Enter' ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowRight' && ! isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex + 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowLeft' && ! isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex - 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowDown' && isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex + 1 );\n\t\t\t\t\t}\n\t\t\t\t} else if ( event.key === 'ArrowUp' && isVertical ) {\n\t\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\t\tprivateActions.setActiveTab( tabIndex - 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ),\n\t\t\t/**\n\t\t\t * Handles the click event for the tab label.\n\t\t\t *\n\t\t\t * @param {MouseEvent} event The click event.\n\t\t\t */\n\t\t\thandleTabClick: withSyncEvent( ( event ) => {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst { tabIndex } = privateState;\n\t\t\t\tif ( tabIndex !== null ) {\n\t\t\t\t\tprivateActions.setActiveTab( tabIndex );\n\t\t\t\t}\n\t\t\t} ),\n\t\t\t/**\n\t\t\t * Sets the active tab index (internal implementation).\n\t\t\t *\n\t\t\t * @param {number} tabIndex The index of the active tab.\n\t\t\t * @param {boolean} scrollToTab Whether to scroll to the tab element.\n\t\t\t */\n\t\t\tsetActiveTab: ( tabIndex, scrollToTab = false ) => {\n\t\t\t\tconst context = getContext();\n\t\t\t\tcontext.activeTabIndex = tabIndex;\n\t\t\t\tif ( scrollToTab ) {\n\t\t\t\t\tconst tabId = privateState.tabsList[ tabIndex ].id;\n\t\t\t\t\tconst tabElement = document.getElementById( tabId );\n\t\t\t\t\tif ( tabElement ) {\n\t\t\t\t\t\tsetTimeout( () => {\n\t\t\t\t\t\t\ttabElement.scrollIntoView( { behavior: 'smooth' } );\n\t\t\t\t\t\t}, 100 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\t/**\n\t\t\t * When the tabs are initialized, we need to check if there is a hash in the url and if so if it exists in the current tabsList, set the active tab to that index.\n\t\t\t *\n\t\t\t */\n\t\t\tonTabsInit: () => {\n\t\t\t\tconst { tabsList } = privateState;\n\t\t\t\tif ( tabsList.length === 0 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst { hash } = window.location;\n\t\t\t\tconst tabId = hash.replace( '#', '' );\n\t\t\t\tconst tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );\n\t\t\t\t// Check if tabIndex is a positive number and if so we'll auto activate that tab.\n\t\t\t\tif ( tabIndex >= 0 ) {\n\t\t\t\t\tprivateActions.setActiveTab( tabIndex, true );\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tlock: true,\n\t}\n);\n\n// Public store for third-party extensibility.\nstore( 'core/tabs', {\n\tstate: {\n\t\t/**\n\t\t * Gets a contextually aware list of tabs for the current tabs block.\n\t\t * Public API for third-party access.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tget tabsList() {\n\t\t\treturn createReadOnlyProxy( privateState.tabsList );\n\t\t},\n\t\t/**\n\t\t * Gets the index of the active tab element whether it\n\t\t * is a tab label or tab panel.\n\t\t *\n\t\t * @type {number|null}\n\t\t */\n\t\tget tabIndex() {\n\t\t\treturn privateState.tabIndex;\n\t\t},\n\t\t/**\n\t\t * Whether the tab panel or tab label is the active tab.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\tget isActiveTab() {\n\t\t\treturn privateState.isActiveTab;\n\t\t},\n\t},\n\tactions: {\n\t\t/**\n\t\t * Sets the active tab index.\n\t\t * Public API for third-party programmatic tab activation.\n\t\t *\n\t\t * @param {number} tabIndex The index of the active tab.\n\t\t * @param {boolean} scrollToTab Whether to scroll to the tab element.\n\t\t */\n\t\tsetActiveTab: ( tabIndex, scrollToTab = false ) => {\n\t\t\tprivateActions.setActiveTab( tabIndex, scrollToTab );\n\t\t},\n\t},\n} );\n"],
|
|
5
|
+
"mappings": ";;;AAGA,2BAKO;AAEP,SAAS,oBAAqB,KAAM;AACnC,QAAM,uBAAuB,oBAAI,IAAK;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AAEF,SAAO,IAAI,MAAO,KAAK;AAAA,IACtB,IAAK,QAAQ,MAAO;AAEnB,UAAK,MAAM,QAAS,MAAO,KAAK,qBAAqB,IAAK,IAAK,GAAI;AAClE,eAAO,MAAM;AAAA,QAAC;AAAA,MACf;AAEA,YAAM,QAAQ,OAAQ,IAAK;AAC3B,UAAK,OAAO,UAAU,YAAY,UAAU,MAAO;AAClD,eAAO,oBAAqB,KAAM;AAAA,MACnC;AACA,aAAO;AAAA,IACR;AAAA,IACA,MAAM;AACL,aAAO;AAAA,IACR;AAAA,IACA,iBAAiB;AAChB,aAAO;AAAA,IACR;AAAA,EACD,CAAE;AACH;AAGA,IAAM,EAAE,SAAS,gBAAgB,OAAO,aAAa,QAAI;AAAA,EACxD;AAAA,EACA;AAAA,IACC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMN,IAAI,WAAW;AACd,cAAM,cAAU,iCAAW;AAC3B,cAAM,SAAS,SAAS;AACxB,cAAM,WAAW,aAAc,MAAO;AACtC,eAAO;AAAA,MACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOA,IAAI,WAAW;AACd,cAAM,EAAE,WAAW,QAAI,iCAAW;AAClC,cAAM,QAAQ,YAAY,IAAI,QAAS,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AAAA;AAAA;AAAA;AAAA;AAAA,IAOA,IAAI,WAAW;AACd,aAAO,aAAa;AAAA,IACrB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMA,IAAI,cAAc;AACjB,aAAO,aAAa;AAAA,IACrB;AAAA,EACD;AAAA,EACA,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQR,cAAc,CAAE,UAAU,cAAc,UAAW;AAClD,qBAAe,aAAc,UAAU,WAAY;AAAA,IACpD;AAAA,EACD;AACD,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -47,7 +47,14 @@ var import_advanced_controls = require("./advanced-controls");
|
|
|
47
47
|
var import_inner_blocks = __toESM(require("./inner-blocks"));
|
|
48
48
|
var import_create_template_part_id = require("./utils/create-template-part-id");
|
|
49
49
|
var import_hooks = require("./utils/hooks");
|
|
50
|
+
var import_lock_unlock = require("../../lock-unlock");
|
|
50
51
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
+
function getTemplatePartEditButtonTitle(clientId, editedContentOnlySection) {
|
|
53
|
+
if (!window?.__experimentalContentOnlyPatternInsertion) {
|
|
54
|
+
return (0, import_i18n.__)("Edit");
|
|
55
|
+
}
|
|
56
|
+
return editedContentOnlySection === clientId ? (0, import_i18n.__)("Exit section") : (0, import_i18n.__)("Edit section");
|
|
57
|
+
}
|
|
51
58
|
function ReplaceButton({
|
|
52
59
|
isEntityAvailable,
|
|
53
60
|
area,
|
|
@@ -99,8 +106,18 @@ function TemplatePartEdit({
|
|
|
99
106
|
}) {
|
|
100
107
|
const { createSuccessNotice } = (0, import_data.useDispatch)(import_notices.store);
|
|
101
108
|
const { editEntityRecord } = (0, import_data.useDispatch)(import_core_data.store);
|
|
102
|
-
const
|
|
103
|
-
(
|
|
109
|
+
const { editContentOnlySection, stopEditingContentOnlySection } = (0, import_lock_unlock.unlock)(
|
|
110
|
+
(0, import_data.useDispatch)(import_block_editor.store)
|
|
111
|
+
);
|
|
112
|
+
const { currentTheme, editedContentOnlySection } = (0, import_data.useSelect)(
|
|
113
|
+
(select) => {
|
|
114
|
+
return {
|
|
115
|
+
currentTheme: select(import_core_data.store).getCurrentTheme()?.stylesheet,
|
|
116
|
+
editedContentOnlySection: (0, import_lock_unlock.unlock)(
|
|
117
|
+
select(import_block_editor.store)
|
|
118
|
+
).getEditedContentOnlySection()
|
|
119
|
+
};
|
|
120
|
+
},
|
|
104
121
|
[]
|
|
105
122
|
);
|
|
106
123
|
const { slug, theme = currentTheme, tagName, layout = {} } = attributes;
|
|
@@ -190,11 +207,24 @@ function TemplatePartEdit({
|
|
|
190
207
|
isEntityAvailable && onNavigateToEntityRecord && canUserEdit && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockControls, { group: "other", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
191
208
|
import_components.ToolbarButton,
|
|
192
209
|
{
|
|
193
|
-
onClick: () =>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
210
|
+
onClick: () => {
|
|
211
|
+
if (window?.__experimentalContentOnlyPatternInsertion) {
|
|
212
|
+
if (editedContentOnlySection !== clientId) {
|
|
213
|
+
editContentOnlySection(clientId);
|
|
214
|
+
} else {
|
|
215
|
+
stopEditingContentOnlySection();
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
onNavigateToEntityRecord({
|
|
220
|
+
postId: templatePartId,
|
|
221
|
+
postType: "wp_template_part"
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
children: getTemplatePartEditButtonTitle(
|
|
225
|
+
clientId,
|
|
226
|
+
editedContentOnlySection
|
|
227
|
+
)
|
|
198
228
|
}
|
|
199
229
|
) }),
|
|
200
230
|
canUserEdit && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InspectorControls, { group: "advanced", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/template-part/edit/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { serialize } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tInspectorControls,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSpinner,\n\tModal,\n\tMenuItem,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nfunction ReplaceButton( {\n\tisEntityAvailable,\n\tarea,\n\ttemplatePartId,\n\tisTemplatePartSelectionOpen,\n\tsetIsTemplatePartSelectionOpen,\n} ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst hasReplacements = !! templateParts.length;\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t} }\n\t\t\taria-expanded={ isTemplatePartSelectionOpen }\n\t\t\taria-haspopup=\"dialog\"\n\t\t>\n\t\t\t{ __( 'Replace' ) }\n\t\t</MenuItem>\n\t);\n}\n\nfunction TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\t!! blockPatterns.length &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Design' ) }>\n\t\t\t<BlockPatternsList\n\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tonClickPattern={ onSelect }\n\t\t\t\tshowTitlesAsTooltip\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\tconst {\n\t\tisResolved,\n\t\thasInnerBlocks,\n\t\tisMissing,\n\t\tarea,\n\t\tonNavigateToEntityRecord,\n\t\ttitle,\n\t\tcanUserEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlockCount, getSettings } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\tconst _canUserEdit = hasResolvedEntity\n\t\t\t\t? select( coreStore ).canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t\t\tid: templatePartId,\n\t\t\t\t } )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: getBlockCount( clientId ) > 0,\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\ttitle: entityRecord?.title,\n\t\t\t\tcanUserEdit: !! _canUserEdit,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst onPatternSelect = async ( pattern ) => {\n\t\tawait editEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttemplatePartId,\n\t\t\t{\n\t\t\t\tblocks: pattern.blocks,\n\t\t\t\tcontent: serialize( pattern.blocks ),\n\t\t\t}\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" updated.' ),\n\t\t\t\ttitle || slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t};\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\t! hasInnerBlocks &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t{ isEntityAvailable &&\n\t\t\t\t\tonNavigateToEntityRecord &&\n\t\t\t\t\tcanUserEdit && (\n\t\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: templatePartId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\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\t\t{ __( 'Edit' ) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t) }\n\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t) }\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ReplaceButton\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tisEntityAvailable,\n\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\ttemplatePartId,\n\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\tonSelect={ ( pattern ) => onPatternSelect( pattern ) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA0B;AAC1B,kBAAuC;AACvC,0BAUO;AACP,wBAMO;AACP,kBAA4B;AAC5B,uBAAmC;AACnC,qBAAyB;AACzB,qBAAsC;AAKtC,yBAAoC;AACpC,6BAAuC;AACvC,+BAA6C;AAC7C,0BAAoC;AACpC,qCAAqC;AACrC,mBAIO;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { serialize } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tInspectorControls,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport {\n\tPanelBody,\n\tSpinner,\n\tModal,\n\tMenuItem,\n\tToolbarButton,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\nimport { unlock } from '../../lock-unlock';\n\nfunction getTemplatePartEditButtonTitle( clientId, editedContentOnlySection ) {\n\tif ( ! window?.__experimentalContentOnlyPatternInsertion ) {\n\t\treturn __( 'Edit' );\n\t}\n\n\treturn editedContentOnlySection === clientId\n\t\t? __( 'Exit section' )\n\t\t: __( 'Edit section' );\n}\n\nfunction ReplaceButton( {\n\tisEntityAvailable,\n\tarea,\n\ttemplatePartId,\n\tisTemplatePartSelectionOpen,\n\tsetIsTemplatePartSelectionOpen,\n} ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst hasReplacements = !! templateParts.length;\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t} }\n\t\t\taria-expanded={ isTemplatePartSelectionOpen }\n\t\t\taria-haspopup=\"dialog\"\n\t\t>\n\t\t\t{ __( 'Replace' ) }\n\t\t</MenuItem>\n\t);\n}\n\nfunction TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {\n\t// This hook fetches patterns, so don't run it unconditionally in the main\n\t// edit function!\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\t!! blockPatterns.length &&\n\t\t( area === 'header' || area === 'footer' );\n\n\tif ( ! canReplace ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Design' ) }>\n\t\t\t<BlockPatternsList\n\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\tblockPatterns={ blockPatterns }\n\t\t\t\tonClickPattern={ onSelect }\n\t\t\t\tshowTitlesAsTooltip\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { editContentOnlySection, stopEditingContentOnlySection } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\tconst { currentTheme, editedContentOnlySection } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tcurrentTheme: select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t\t\teditedContentOnlySection: unlock(\n\t\t\t\t\tselect( blockEditorStore )\n\t\t\t\t).getEditedContentOnlySection(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\tconst {\n\t\tisResolved,\n\t\thasInnerBlocks,\n\t\tisMissing,\n\t\tarea,\n\t\tonNavigateToEntityRecord,\n\t\ttitle,\n\t\tcanUserEdit,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlockCount, getSettings } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\tconst _canUserEdit = hasResolvedEntity\n\t\t\t\t? select( coreStore ).canUser( 'update', {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t\t\tid: templatePartId,\n\t\t\t\t } )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\thasInnerBlocks: getBlockCount( clientId ) > 0,\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\ttitle: entityRecord?.title,\n\t\t\t\tcanUserEdit: !! _canUserEdit,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst onPatternSelect = async ( pattern ) => {\n\t\tawait editEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\ttemplatePartId,\n\t\t\t{\n\t\t\t\tblocks: pattern.blocks,\n\t\t\t\tcontent: serialize( pattern.blocks ),\n\t\t\t}\n\t\t);\n\t\tcreateSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: template part title. */\n\t\t\t\t__( 'Template Part \"%s\" updated.' ),\n\t\t\t\ttitle || slug\n\t\t\t),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t}\n\t\t);\n\t};\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\t! hasInnerBlocks &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug. */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t{ isEntityAvailable &&\n\t\t\t\t\tonNavigateToEntityRecord &&\n\t\t\t\t\tcanUserEdit && (\n\t\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\twindow?.__experimentalContentOnlyPatternInsertion\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\teditedContentOnlySection !==\n\t\t\t\t\t\t\t\t\t\t\tclientId\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\teditContentOnlySection( clientId );\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tstopEditingContentOnlySection();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tonNavigateToEntityRecord( {\n\t\t\t\t\t\t\t\t\t\tpostId: templatePartId,\n\t\t\t\t\t\t\t\t\t\tpostType: 'wp_template_part',\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\t\t{ getTemplatePartEditButtonTitle(\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\teditedContentOnlySection\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t\t</BlockControls>\n\t\t\t\t\t) }\n\t\t\t\t{ canUserEdit && (\n\t\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InspectorControls>\n\t\t\t\t) }\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<ReplaceButton\n\t\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\t\tisEntityAvailable,\n\t\t\t\t\t\t\t\t\tarea,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\ttemplatePartId,\n\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\t\tonSelect={ ( pattern ) => onPatternSelect( pattern ) }\n\t\t\t\t\t/>\n\t\t\t\t</InspectorControls>\n\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ hasInnerBlocks }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA0B;AAC1B,kBAAuC;AACvC,0BAUO;AACP,wBAMO;AACP,kBAA4B;AAC5B,uBAAmC;AACnC,qBAAyB;AACzB,qBAAsC;AAKtC,yBAAoC;AACpC,6BAAuC;AACvC,+B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B,4CAAC,WAAU,GAAG,YACb,sDAAC,6BAAQ,GACV;AAAA,OAEF;AAAA,IACE,+BACD;AAAA,MAAC;AAAA;AAAA,QACA,kBAAiB;AAAA,QACjB,WAAQ;AAAA;AAAA,cAEP,gBAAI,aAAc;AAAA,UAClB,WAAW,MAAM,YAAY;AAAA,QAC9B;AAAA,QACA,gBAAiB,MAChB,+BAAgC,KAAM;AAAA,QAEvC,cAAY;AAAA,QAEZ;AAAA,UAAC,uBAAAC;AAAA,UAAA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAU,MACT,+BAAgC,KAAM;AAAA;AAAA,QAExC;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": ["BlockPatternsList", "noticesStore", "coreStore", "blockEditorStore", "TemplatePartPlaceholder", "TemplatePartInnerBlocks", "TemplatePartSelectionModal"]
|
|
7
7
|
}
|
|
@@ -71,9 +71,8 @@ function useAlternativeBlockPatterns(area, clientId) {
|
|
|
71
71
|
return (0, import_data.useSelect)(
|
|
72
72
|
(select) => {
|
|
73
73
|
const blockNameWithArea = area ? `core/template-part/${area}` : "core/template-part";
|
|
74
|
-
const {
|
|
75
|
-
|
|
76
|
-
return getPatternsByBlockTypes(blockNameWithArea, rootClientId);
|
|
74
|
+
const { getPatternsByBlockTypes } = select(import_block_editor.store);
|
|
75
|
+
return getPatternsByBlockTypes(blockNameWithArea, clientId);
|
|
77
76
|
},
|
|
78
77
|
[area, clientId]
|
|
79
78
|
);
|