@wordpress/edit-post 7.26.0 → 7.27.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.
Files changed (129) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/header/index.js +2 -2
  3. package/build/components/header/index.js.map +1 -1
  4. package/build/components/layout/index.native.js +1 -3
  5. package/build/components/layout/index.native.js.map +1 -1
  6. package/build/components/meta-boxes/index.js +3 -2
  7. package/build/components/meta-boxes/index.js.map +1 -1
  8. package/build/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -2
  9. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -0
  10. package/build/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +11 -2
  11. package/build/components/preferences-modal/enable-panel.js.map +1 -0
  12. package/build/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +11 -2
  13. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  14. package/build/components/preferences-modal/index.js +31 -149
  15. package/build/components/preferences-modal/index.js.map +1 -1
  16. package/build/components/preferences-modal/meta-boxes-section.js +11 -5
  17. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  18. package/build/components/sidebar/plugin-document-setting-panel/index.js +5 -2
  19. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  20. package/build/editor.js +3 -26
  21. package/build/editor.js.map +1 -1
  22. package/build/editor.native.js +4 -28
  23. package/build/editor.native.js.map +1 -1
  24. package/build/hooks/commands/use-common-commands.js +48 -8
  25. package/build/hooks/commands/use-common-commands.js.map +1 -1
  26. package/build/index.js +2 -2
  27. package/build/index.js.map +1 -1
  28. package/build/index.native.js +1 -1
  29. package/build/index.native.js.map +1 -1
  30. package/build/store/actions.js +11 -10
  31. package/build/store/actions.js.map +1 -1
  32. package/build/store/selectors.js +24 -6
  33. package/build/store/selectors.js.map +1 -1
  34. package/build-module/components/header/index.js +2 -2
  35. package/build-module/components/header/index.js.map +1 -1
  36. package/build-module/components/layout/index.native.js +1 -3
  37. package/build-module/components/layout/index.native.js.map +1 -1
  38. package/build-module/components/meta-boxes/index.js +3 -2
  39. package/build-module/components/meta-boxes/index.js.map +1 -1
  40. package/build-module/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -2
  41. package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -0
  42. package/build-module/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +10 -2
  43. package/build-module/components/preferences-modal/enable-panel.js.map +1 -0
  44. package/build-module/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +10 -2
  45. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  46. package/build-module/components/preferences-modal/index.js +31 -150
  47. package/build-module/components/preferences-modal/index.js.map +1 -1
  48. package/build-module/components/preferences-modal/meta-boxes-section.js +7 -2
  49. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  50. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +5 -2
  51. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  52. package/build-module/editor.js +3 -26
  53. package/build-module/editor.js.map +1 -1
  54. package/build-module/editor.native.js +5 -29
  55. package/build-module/editor.native.js.map +1 -1
  56. package/build-module/hooks/commands/use-common-commands.js +49 -9
  57. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  58. package/build-module/index.js +2 -2
  59. package/build-module/index.js.map +1 -1
  60. package/build-module/index.native.js +1 -1
  61. package/build-module/index.native.js.map +1 -1
  62. package/build-module/store/actions.js +11 -10
  63. package/build-module/store/actions.js.map +1 -1
  64. package/build-module/store/selectors.js +24 -6
  65. package/build-module/store/selectors.js.map +1 -1
  66. package/build-style/classic-rtl.css +1 -1
  67. package/build-style/classic.css +1 -1
  68. package/build-style/style-rtl.css +16 -182
  69. package/build-style/style.css +16 -182
  70. package/package.json +32 -32
  71. package/src/components/header/index.js +2 -4
  72. package/src/components/header/style.scss +13 -4
  73. package/src/components/layout/index.native.js +1 -4
  74. package/src/components/meta-boxes/index.js +4 -2
  75. package/src/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -3
  76. package/src/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +9 -2
  77. package/src/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +9 -2
  78. package/src/components/preferences-modal/index.js +44 -267
  79. package/src/components/preferences-modal/meta-boxes-section.js +6 -2
  80. package/src/components/preferences-modal/{options/test → test}/__snapshots__/enable-custom-fields.js.snap +4 -4
  81. package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +18 -18
  82. package/src/components/sidebar/plugin-document-setting-panel/index.js +6 -2
  83. package/src/editor.js +55 -85
  84. package/src/editor.native.js +4 -33
  85. package/src/hooks/commands/use-common-commands.js +77 -7
  86. package/src/index.js +2 -2
  87. package/src/index.native.js +1 -1
  88. package/src/store/actions.js +14 -33
  89. package/src/store/selectors.js +52 -26
  90. package/src/store/test/actions.js +9 -9
  91. package/src/style.scss +0 -1
  92. package/build/components/block-manager/category.js +0 -105
  93. package/build/components/block-manager/category.js.map +0 -1
  94. package/build/components/block-manager/checklist.js +0 -35
  95. package/build/components/block-manager/checklist.js.map +0 -1
  96. package/build/components/block-manager/index.js +0 -127
  97. package/build/components/block-manager/index.js.map +0 -1
  98. package/build/components/preferences-modal/options/enable-custom-fields.js.map +0 -1
  99. package/build/components/preferences-modal/options/enable-feature.js +0 -36
  100. package/build/components/preferences-modal/options/enable-feature.js.map +0 -1
  101. package/build/components/preferences-modal/options/enable-panel.js.map +0 -1
  102. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -32
  103. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +0 -1
  104. package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +0 -1
  105. package/build/components/preferences-modal/options/index.js +0 -42
  106. package/build/components/preferences-modal/options/index.js.map +0 -1
  107. package/build-module/components/block-manager/category.js +0 -96
  108. package/build-module/components/block-manager/category.js.map +0 -1
  109. package/build-module/components/block-manager/checklist.js +0 -27
  110. package/build-module/components/block-manager/checklist.js.map +0 -1
  111. package/build-module/components/block-manager/index.js +0 -118
  112. package/build-module/components/block-manager/index.js.map +0 -1
  113. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +0 -1
  114. package/build-module/components/preferences-modal/options/enable-feature.js +0 -29
  115. package/build-module/components/preferences-modal/options/enable-feature.js.map +0 -1
  116. package/build-module/components/preferences-modal/options/enable-panel.js.map +0 -1
  117. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -24
  118. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +0 -1
  119. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +0 -1
  120. package/build-module/components/preferences-modal/options/index.js +0 -6
  121. package/build-module/components/preferences-modal/options/index.js.map +0 -1
  122. package/src/components/block-manager/category.js +0 -94
  123. package/src/components/block-manager/checklist.js +0 -30
  124. package/src/components/block-manager/index.js +0 -158
  125. package/src/components/block-manager/style.scss +0 -82
  126. package/src/components/preferences-modal/options/enable-feature.js +0 -31
  127. package/src/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -23
  128. package/src/components/preferences-modal/options/index.js +0 -5
  129. /package/src/components/preferences-modal/{options/test → test}/enable-custom-fields.js +0 -0
@@ -1,105 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = require("react");
9
- var _element = require("@wordpress/element");
10
- var _data = require("@wordpress/data");
11
- var _compose = require("@wordpress/compose");
12
- var _components = require("@wordpress/components");
13
- var _editor = require("@wordpress/editor");
14
- var _checklist = _interopRequireDefault(require("./checklist"));
15
- var _store = require("../../store");
16
- /**
17
- * WordPress dependencies
18
- */
19
-
20
- /**
21
- * Internal dependencies
22
- */
23
-
24
- function BlockManagerCategory({
25
- title,
26
- blockTypes
27
- }) {
28
- const instanceId = (0, _compose.useInstanceId)(BlockManagerCategory);
29
- const {
30
- defaultAllowedBlockTypes,
31
- hiddenBlockTypes
32
- } = (0, _data.useSelect)(select => {
33
- const {
34
- getEditorSettings
35
- } = select(_editor.store);
36
- const {
37
- getHiddenBlockTypes
38
- } = select(_store.store);
39
- return {
40
- defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes,
41
- hiddenBlockTypes: getHiddenBlockTypes()
42
- };
43
- }, []);
44
- const filteredBlockTypes = (0, _element.useMemo)(() => {
45
- if (defaultAllowedBlockTypes === true) {
46
- return blockTypes;
47
- }
48
- return blockTypes.filter(({
49
- name
50
- }) => {
51
- return defaultAllowedBlockTypes?.includes(name);
52
- });
53
- }, [defaultAllowedBlockTypes, blockTypes]);
54
- const {
55
- showBlockTypes,
56
- hideBlockTypes
57
- } = (0, _data.useDispatch)(_store.store);
58
- const toggleVisible = (0, _element.useCallback)((blockName, nextIsChecked) => {
59
- if (nextIsChecked) {
60
- showBlockTypes(blockName);
61
- } else {
62
- hideBlockTypes(blockName);
63
- }
64
- }, []);
65
- const toggleAllVisible = (0, _element.useCallback)(nextIsChecked => {
66
- const blockNames = blockTypes.map(({
67
- name
68
- }) => name);
69
- if (nextIsChecked) {
70
- showBlockTypes(blockNames);
71
- } else {
72
- hideBlockTypes(blockNames);
73
- }
74
- }, [blockTypes]);
75
- if (!filteredBlockTypes.length) {
76
- return null;
77
- }
78
- const checkedBlockNames = filteredBlockTypes.map(({
79
- name
80
- }) => name).filter(type => !hiddenBlockTypes.includes(type));
81
- const titleId = 'edit-post-block-manager__category-title-' + instanceId;
82
- const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
83
- const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
84
- return (0, _react.createElement)("div", {
85
- role: "group",
86
- "aria-labelledby": titleId,
87
- className: "edit-post-block-manager__category"
88
- }, (0, _react.createElement)(_components.CheckboxControl, {
89
- __nextHasNoMarginBottom: true,
90
- checked: isAllChecked,
91
- onChange: toggleAllVisible,
92
- className: "edit-post-block-manager__category-title",
93
- indeterminate: isIndeterminate,
94
- label: (0, _react.createElement)("span", {
95
- id: titleId
96
- }, title)
97
- }), (0, _react.createElement)(_checklist.default, {
98
- blockTypes: filteredBlockTypes,
99
- value: checkedBlockNames,
100
- onItemChange: toggleVisible
101
- }));
102
- }
103
- var _default = BlockManagerCategory;
104
- exports.default = _default;
105
- //# sourceMappingURL=category.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_element","require","_data","_compose","_components","_editor","_checklist","_interopRequireDefault","_store","BlockManagerCategory","title","blockTypes","instanceId","useInstanceId","defaultAllowedBlockTypes","hiddenBlockTypes","useSelect","select","getEditorSettings","editorStore","getHiddenBlockTypes","editPostStore","filteredBlockTypes","useMemo","filter","name","includes","showBlockTypes","hideBlockTypes","useDispatch","toggleVisible","useCallback","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate","_react","createElement","role","className","CheckboxControl","__nextHasNoMarginBottom","checked","onChange","indeterminate","label","id","default","value","onItemChange","_default","exports"],"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! hiddenBlockTypes.includes( type ) );\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,UAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA,SAASQ,oBAAoBA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,EAAG;EACtD,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEJ,oBAAqB,CAAC;EACxD,MAAM;IAAEK,wBAAwB;IAAEC;EAAiB,CAAC,GAAG,IAAAC,eAAS,EAC7DC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAkB,CAAC,GAAGD,MAAM,CAAEE,aAAY,CAAC;IACnD,MAAM;MAAEC;IAAoB,CAAC,GAAGH,MAAM,CAAEI,YAAc,CAAC;IACvD,OAAO;MACNP,wBAAwB,EACvBI,iBAAiB,CAAC,CAAC,CAACJ,wBAAwB;MAC7CC,gBAAgB,EAAEK,mBAAmB,CAAC;IACvC,CAAC;EACF,CAAC,EACD,EACD,CAAC;EACD,MAAME,kBAAkB,GAAG,IAAAC,gBAAO,EAAE,MAAM;IACzC,IAAKT,wBAAwB,KAAK,IAAI,EAAG;MACxC,OAAOH,UAAU;IAClB;IACA,OAAOA,UAAU,CAACa,MAAM,CAAE,CAAE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,GAAG,CAAC;EAEtE,OACC,IAAAM,MAAA,CAAAC,aAAA;IACCC,IAAI,EAAC,OAAO;IACZ,mBAAkBL,OAAS;IAC3BM,SAAS,EAAC;EAAmC,GAE7C,IAAAH,MAAA,CAAAC,aAAA,EAACxC,WAAA,CAAA2C,eAAe;IACfC,uBAAuB;IACvBC,OAAO,EAAGR,YAAc;IACxBS,QAAQ,EAAGhB,gBAAkB;IAC7BY,SAAS,EAAC,yCAAyC;IACnDK,aAAa,EAAGT,eAAiB;IACjCU,KAAK,EAAG,IAAAT,MAAA,CAAAC,aAAA;MAAMS,EAAE,EAAGb;IAAS,GAAG9B,KAAa;EAAG,CAC/C,CAAC,EACF,IAAAiC,MAAA,CAAAC,aAAA,EAACtC,UAAA,CAAAgD,OAAmB;IACnB3C,UAAU,EAAGW,kBAAoB;IACjCiC,KAAK,EAAGjB,iBAAmB;IAC3BkB,YAAY,EAAG1B;EAAe,CAC9B,CACG,CAAC;AAER;AAAC,IAAA2B,QAAA,GAEchD,oBAAoB;AAAAiD,OAAA,CAAAJ,OAAA,GAAAG,QAAA"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _blockEditor = require("@wordpress/block-editor");
9
- var _components = require("@wordpress/components");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- function BlockTypesChecklist({
15
- blockTypes,
16
- value,
17
- onItemChange
18
- }) {
19
- return (0, _react.createElement)("ul", {
20
- className: "edit-post-block-manager__checklist"
21
- }, blockTypes.map(blockType => (0, _react.createElement)("li", {
22
- key: blockType.name,
23
- className: "edit-post-block-manager__checklist-item"
24
- }, (0, _react.createElement)(_components.CheckboxControl, {
25
- __nextHasNoMarginBottom: true,
26
- label: blockType.title,
27
- checked: value.includes(blockType.name),
28
- onChange: (...args) => onItemChange(blockType.name, ...args)
29
- }), (0, _react.createElement)(_blockEditor.BlockIcon, {
30
- icon: blockType.icon
31
- }))));
32
- }
33
- var _default = BlockTypesChecklist;
34
- exports.default = _default;
35
- //# sourceMappingURL=checklist.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_blockEditor","require","_components","BlockTypesChecklist","blockTypes","value","onItemChange","_react","createElement","className","map","blockType","key","name","CheckboxControl","__nextHasNoMarginBottom","label","title","checked","includes","onChange","args","BlockIcon","icon","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"edit-post-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"edit-post-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,SAASE,mBAAmBA,CAAE;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAa,CAAC,EAAG;EACnE,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAIC,SAAS,EAAC;EAAoC,GAC/CL,UAAU,CAACM,GAAG,CAAIC,SAAS,IAC5B,IAAAJ,MAAA,CAAAC,aAAA;IACCI,GAAG,EAAGD,SAAS,CAACE,IAAM;IACtBJ,SAAS,EAAC;EAAyC,GAEnD,IAAAF,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAAY,eAAe;IACfC,uBAAuB;IACvBC,KAAK,EAAGL,SAAS,CAACM,KAAO;IACzBC,OAAO,EAAGb,KAAK,CAACc,QAAQ,CAAER,SAAS,CAACE,IAAK,CAAG;IAC5CO,QAAQ,EAAGA,CAAE,GAAGC,IAAI,KACnBf,YAAY,CAAEK,SAAS,CAACE,IAAI,EAAE,GAAGQ,IAAK;EACtC,CACD,CAAC,EACF,IAAAd,MAAA,CAAAC,aAAA,EAACR,YAAA,CAAAsB,SAAS;IAACC,IAAI,EAAGZ,SAAS,CAACY;EAAM,CAAE,CACjC,CACH,CACC,CAAC;AAEP;AAAC,IAAAC,QAAA,GAEcrB,mBAAmB;AAAAsB,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1,127 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = require("react");
9
- var _blocks = require("@wordpress/blocks");
10
- var _data = require("@wordpress/data");
11
- var _components = require("@wordpress/components");
12
- var _i18n = require("@wordpress/i18n");
13
- var _element = require("@wordpress/element");
14
- var _compose = require("@wordpress/compose");
15
- var _a11y = require("@wordpress/a11y");
16
- var _category = _interopRequireDefault(require("./category"));
17
- var _store = require("../../store");
18
- /**
19
- * WordPress dependencies
20
- */
21
-
22
- /**
23
- * Internal dependencies
24
- */
25
-
26
- function BlockManager({
27
- blockTypes,
28
- categories,
29
- hasBlockSupport,
30
- isMatchingSearchTerm,
31
- numberOfHiddenBlocks,
32
- enableAllBlockTypes
33
- }) {
34
- const debouncedSpeak = (0, _compose.useDebounce)(_a11y.speak, 500);
35
- const [search, setSearch] = (0, _element.useState)('');
36
-
37
- // Filtering occurs here (as opposed to `withSelect`) to avoid
38
- // wasted renders by consequence of `Array#filter` producing
39
- // a new value reference on each call.
40
- blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content')));
41
-
42
- // Announce search results on change
43
- (0, _element.useEffect)(() => {
44
- if (!search) {
45
- return;
46
- }
47
- const count = blockTypes.length;
48
- const resultsFoundMessage = (0, _i18n.sprintf)( /* translators: %d: number of results. */
49
- (0, _i18n._n)('%d result found.', '%d results found.', count), count);
50
- debouncedSpeak(resultsFoundMessage);
51
- }, [blockTypes.length, search, debouncedSpeak]);
52
- return (0, _react.createElement)("div", {
53
- className: "edit-post-block-manager__content"
54
- }, !!numberOfHiddenBlocks && (0, _react.createElement)("div", {
55
- className: "edit-post-block-manager__disabled-blocks-count"
56
- }, (0, _i18n.sprintf)( /* translators: %d: number of blocks. */
57
- (0, _i18n._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), (0, _react.createElement)(_components.Button, {
58
- variant: "link",
59
- onClick: () => enableAllBlockTypes(blockTypes)
60
- }, (0, _i18n.__)('Reset'))), (0, _react.createElement)(_components.SearchControl, {
61
- __nextHasNoMarginBottom: true,
62
- label: (0, _i18n.__)('Search for a block'),
63
- placeholder: (0, _i18n.__)('Search for a block'),
64
- value: search,
65
- onChange: nextSearch => setSearch(nextSearch),
66
- className: "edit-post-block-manager__search"
67
- }), (0, _react.createElement)("div", {
68
- tabIndex: "0",
69
- role: "region",
70
- "aria-label": (0, _i18n.__)('Available block types'),
71
- className: "edit-post-block-manager__results"
72
- }, blockTypes.length === 0 && (0, _react.createElement)("p", {
73
- className: "edit-post-block-manager__no-results"
74
- }, (0, _i18n.__)('No blocks found.')), categories.map(category => (0, _react.createElement)(_category.default, {
75
- key: category.slug,
76
- title: category.title,
77
- blockTypes: blockTypes.filter(blockType => blockType.category === category.slug)
78
- })), (0, _react.createElement)(_category.default, {
79
- title: (0, _i18n.__)('Uncategorized'),
80
- blockTypes: blockTypes.filter(({
81
- category
82
- }) => !category)
83
- })));
84
- }
85
- var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
86
- const {
87
- getBlockTypes,
88
- getCategories,
89
- hasBlockSupport,
90
- isMatchingSearchTerm
91
- } = select(_blocks.store);
92
- const {
93
- getHiddenBlockTypes
94
- } = select(_store.store);
95
-
96
- // Some hidden blocks become unregistered
97
- // by removing for instance the plugin that registered them, yet
98
- // they're still remain as hidden by the user's action.
99
- // We consider "hidden", blocks which were hidden and
100
- // are still registered.
101
- const blockTypes = getBlockTypes();
102
- const hiddenBlockTypes = getHiddenBlockTypes().filter(hiddenBlock => {
103
- return blockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock);
104
- });
105
- const numberOfHiddenBlocks = Array.isArray(hiddenBlockTypes) && hiddenBlockTypes.length;
106
- return {
107
- blockTypes,
108
- categories: getCategories(),
109
- hasBlockSupport,
110
- isMatchingSearchTerm,
111
- numberOfHiddenBlocks
112
- };
113
- }), (0, _data.withDispatch)(dispatch => {
114
- const {
115
- showBlockTypes
116
- } = dispatch(_store.store);
117
- return {
118
- enableAllBlockTypes: blockTypes => {
119
- const blockNames = blockTypes.map(({
120
- name
121
- }) => name);
122
- showBlockTypes(blockNames);
123
- }
124
- };
125
- })])(BlockManager);
126
- exports.default = _default;
127
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_blocks","require","_data","_components","_i18n","_element","_compose","_a11y","_category","_interopRequireDefault","_store","BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","enableAllBlockTypes","debouncedSpeak","useDebounce","speak","search","setSearch","useState","filter","blockType","parent","includes","useEffect","count","length","resultsFoundMessage","sprintf","_n","_react","createElement","className","Button","variant","onClick","__","SearchControl","__nextHasNoMarginBottom","label","placeholder","value","onChange","nextSearch","tabIndex","role","map","category","default","key","slug","title","_default","compose","withSelect","select","getBlockTypes","getCategories","blocksStore","getHiddenBlockTypes","editPostStore","hiddenBlockTypes","hiddenBlock","some","registeredBlock","name","Array","isArray","withDispatch","dispatch","showBlockTypes","blockNames","exports"],"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { SearchControl, Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce, compose } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n\tenableAllBlockTypes,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tblockType.parent.includes( 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => enableAllBlockTypes( blockTypes ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t\t( blockType ) =>\n\t\t\t\t\t\t\t\tblockType.category === category.slug\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ blockTypes.filter(\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockTypes,\n\t\t\tgetCategories,\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t} = select( blocksStore );\n\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\n\t\t// Some hidden blocks become unregistered\n\t\t// by removing for instance the plugin that registered them, yet\n\t\t// they're still remain as hidden by the user's action.\n\t\t// We consider \"hidden\", blocks which were hidden and\n\t\t// are still registered.\n\t\tconst blockTypes = getBlockTypes();\n\t\tconst hiddenBlockTypes = getHiddenBlockTypes().filter(\n\t\t\t( hiddenBlock ) => {\n\t\t\t\treturn blockTypes.some(\n\t\t\t\t\t( registeredBlock ) => registeredBlock.name === hiddenBlock\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t\tconst numberOfHiddenBlocks =\n\t\t\tArray.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\t\treturn {\n\t\t\tblockTypes,\n\t\t\tcategories: getCategories(),\n\t\t\thasBlockSupport,\n\t\t\tisMatchingSearchTerm,\n\t\t\tnumberOfHiddenBlocks,\n\t\t};\n\t} ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { showBlockTypes } = dispatch( editPostStore );\n\t\treturn {\n\t\t\tenableAllBlockTypes: ( blockTypes ) => {\n\t\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t},\n\t\t};\n\t} ),\n] )( BlockManager );\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,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Q,CAAET,YAAc,CAAC;EACpD,OAAO;IACN/C,mBAAmB,EAAIL,UAAU,IAAM;MACtC,MAAM+D,UAAU,GAAG/D,UAAU,CAACsC,GAAG,CAAE,CAAE;QAAEmB;MAAK,CAAC,KAAMA,IAAK,CAAC;MACzDK,cAAc,CAAEC,UAAW,CAAC;IAC7B;EACD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEhE,YAAa,CAAC;AAAAiE,OAAA,CAAAxB,OAAA,GAAAI,QAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_element","require","_i18n","_components","_data","_editor","_interface","_url","submitCustomFieldsForm","customFieldsForm","document","getElementById","querySelector","setAttribute","getPathAndQueryString","window","location","href","submit","CustomFieldsConfirmation","willEnable","isReloading","setIsReloading","useState","_react","createElement","Fragment","className","__","Button","variant","isBusy","disabled","onClick","EnableCustomFieldsOption","label","areCustomFieldsEnabled","isChecked","setIsChecked","___unstablePreferencesModalBaseOption","onChange","_default","withSelect","select","editorStore","getEditorSettings","enableCustomFields","exports","default"],"sources":["@wordpress/edit-post/src/components/preferences-modal/options/enable-custom-fields.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';\nimport { getPathAndQueryString } from '@wordpress/url';\n\nfunction submitCustomFieldsForm() {\n\tconst customFieldsForm = document.getElementById(\n\t\t'toggle-custom-fields-form'\n\t);\n\n\t// Ensure the referrer values is up to update with any\n\tcustomFieldsForm\n\t\t.querySelector( '[name=\"_wp_http_referer\"]' )\n\t\t.setAttribute( 'value', getPathAndQueryString( window.location.href ) );\n\n\tcustomFieldsForm.submit();\n}\n\nexport function CustomFieldsConfirmation( { willEnable } ) {\n\tconst [ isReloading, setIsReloading ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<p className=\"edit-post-preferences-modal__custom-fields-confirmation-message\">\n\t\t\t\t{ __(\n\t\t\t\t\t'A page reload is required for this change. Make sure your content is saved before reloading.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-preferences-modal__custom-fields-confirmation-button\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tisBusy={ isReloading }\n\t\t\t\tdisabled={ isReloading }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsReloading( true );\n\t\t\t\t\tsubmitCustomFieldsForm();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ willEnable\n\t\t\t\t\t? __( 'Show & Reload Page' )\n\t\t\t\t\t: __( 'Hide & Reload Page' ) }\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport function EnableCustomFieldsOption( { label, areCustomFieldsEnabled } ) {\n\tconst [ isChecked, setIsChecked ] = useState( areCustomFieldsEnabled );\n\n\treturn (\n\t\t<BaseOption\n\t\t\tlabel={ label }\n\t\t\tisChecked={ isChecked }\n\t\t\tonChange={ setIsChecked }\n\t\t>\n\t\t\t{ isChecked !== areCustomFieldsEnabled && (\n\t\t\t\t<CustomFieldsConfirmation willEnable={ isChecked } />\n\t\t\t) }\n\t\t</BaseOption>\n\t);\n}\n\nexport default withSelect( ( select ) => ( {\n\tareCustomFieldsEnabled:\n\t\t!! select( editorStore ).getEditorSettings().enableCustomFields,\n} ) )( EnableCustomFieldsOption );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AATA;AACA;AACA;;AASA,SAASO,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,gBAAgB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GAEvBD,SAAS,KAAKD,sBAAsB,IACrC,IAAAZ,MAAA,CAAAC,aAAA,EAACN,wBAAwB;IAACC,UAAU,EAAGiB;EAAW,CAAE,CAE1C,CAAC;AAEf;AAAC,IAAAI,QAAA,GAEc,IAAAC,gBAAU,EAAIC,MAAM,KAAQ;EAC1CP,sBAAsB,EACrB,CAAC,CAAEO,MAAM,CAAEC,aAAY,CAAC,CAACC,iBAAiB,CAAC,CAAC,CAACC;AAC/C,CAAC,CAAG,CAAC,CAAEZ,wBAAyB,CAAC;AAAAa,OAAA,CAAAC,OAAA,GAAAP,QAAA"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = EnableFeature;
7
- var _react = require("react");
8
- var _data = require("@wordpress/data");
9
- var _interface = require("@wordpress/interface");
10
- var _preferences = require("@wordpress/preferences");
11
- /**
12
- * WordPress dependencies
13
- */
14
-
15
- function EnableFeature(props) {
16
- const {
17
- scope = 'core/edit-post',
18
- featureName,
19
- onToggle = () => {},
20
- ...remainingProps
21
- } = props;
22
- const isChecked = (0, _data.useSelect)(select => !!select(_preferences.store).get(scope, featureName), [scope, featureName]);
23
- const {
24
- toggle
25
- } = (0, _data.useDispatch)(_preferences.store);
26
- const onChange = () => {
27
- onToggle();
28
- toggle(scope, featureName);
29
- };
30
- return (0, _react.createElement)(_interface.___unstablePreferencesModalBaseOption, {
31
- onChange: onChange,
32
- isChecked: isChecked,
33
- ...remainingProps
34
- });
35
- }
36
- //# sourceMappingURL=enable-feature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_data","require","_interface","_preferences","EnableFeature","props","scope","featureName","onToggle","remainingProps","isChecked","useSelect","select","preferencesStore","get","toggle","useDispatch","onChange","_react","createElement","___unstablePreferencesModalBaseOption"],"sources":["@wordpress/edit-post/src/components/preferences-modal/options/enable-feature.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function EnableFeature( props ) {\n\tconst {\n\t\tscope = 'core/edit-post',\n\t\tfeatureName,\n\t\tonToggle = () => {},\n\t\t...remainingProps\n\t} = props;\n\tconst isChecked = useSelect(\n\t\t( select ) => !! select( preferencesStore ).get( scope, featureName ),\n\t\t[ scope, featureName ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst onChange = () => {\n\t\tonToggle();\n\t\ttoggle( scope, featureName );\n\t};\n\treturn (\n\t\t<BaseOption\n\t\t\tonChange={ onChange }\n\t\t\tisChecked={ isChecked }\n\t\t\t{ ...remainingProps }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKe,SAASG,aAAaA,CAAEC,KAAK,EAAG;EAC9C,MAAM;IACLC,KAAK,GAAG,gBAAgB;IACxBC,WAAW;IACXC,QAAQ,GAAGA,CAAA,KAAM,CAAC,CAAC;IACnB,GAAGC;EACJ,CAAC,GAAGJ,KAAK;EACT,MAAMK,SAAS,GAAG,IAAAC,eAAS,EACxBC,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,GAAG,CAAER,KAAK,EAAEC,WAAY,CAAC,EACrE,CAAED,KAAK,EAAEC,WAAW,CACrB,CAAC;EACD,MAAM;IAAEQ;EAAO,CAAC,GAAG,IAAAC,iBAAW,EAAEH,kBAAiB,CAAC;EAClD,MAAMI,QAAQ,GAAGA,CAAA,KAAM;IACtBT,QAAQ,CAAC,CAAC;IACVO,MAAM,CAAET,KAAK,EAAEC,WAAY,CAAC;EAC7B,CAAC;EACD,OACC,IAAAW,MAAA,CAAAC,aAAA,EAACjB,UAAA,CAAAkB,qCAAU;IACVH,QAAQ,EAAGA,QAAU;IACrBP,SAAS,EAAGA,SAAW;IAAA,GAClBD;EAAc,CACnB,CAAC;AAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_compose","require","_data","_interface","_editor","_default","compose","withSelect","select","panelName","isEditorPanelEnabled","isEditorPanelRemoved","editorStore","isRemoved","isChecked","ifCondition","withDispatch","dispatch","onChange","toggleEditorPanelEnabled","BaseOption","exports","default"],"sources":["@wordpress/edit-post/src/components/preferences-modal/options/enable-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default compose(\n\twithSelect( ( select, { panelName } ) => {\n\t\tconst { isEditorPanelEnabled, isEditorPanelRemoved } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisRemoved: isEditorPanelRemoved( panelName ),\n\t\t\tisChecked: isEditorPanelEnabled( panelName ),\n\t\t};\n\t} ),\n\tifCondition( ( { isRemoved } ) => ! isRemoved ),\n\twithDispatch( ( dispatch, { panelName } ) => ( {\n\t\tonChange: () =>\n\t\t\tdispatch( editorStore ).toggleEditorPanelEnabled( panelName ),\n\t} ) )\n)( BaseOption );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;AAFA,IAAAI,QAAA,GAQe,IAAAC,gBAAO,EACrB,IAAAC,gBAAU,EAAE,CAAEC,MAAM,EAAE;EAAEC;AAAU,CAAC,KAAM;EACxC,MAAM;IAAEC,oBAAoB;IAAEC;EAAqB,CAAC,GACnDH,MAAM,CAAEI,aAAY,CAAC;EACtB,OAAO;IACNC,SAAS,EAAEF,oBAAoB,CAAEF,SAAU,CAAC;IAC5CK,SAAS,EAAEJ,oBAAoB,CAAED,SAAU;EAC5C,CAAC;AACF,CAAE,CAAC,EACH,IAAAM,oBAAW,EAAE,CAAE;EAAEF;AAAU,CAAC,KAAM,CAAEA,SAAU,CAAC,EAC/C,IAAAG,kBAAY,EAAE,CAAEC,QAAQ,EAAE;EAAER;AAAU,CAAC,MAAQ;EAC9CS,QAAQ,EAAEA,CAAA,KACTD,QAAQ,CAAEL,aAAY,CAAC,CAACO,wBAAwB,CAAEV,SAAU;AAC9D,CAAC,CAAG,CACL,CAAC,CAAEW,gDAAW,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAjB,QAAA"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = require("react");
8
- var _components = require("@wordpress/components");
9
- var _index = require("./index");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
14
- /**
15
- * Internal dependencies
16
- */
17
-
18
- const {
19
- Fill,
20
- Slot
21
- } = (0, _components.createSlotFill)('EnablePluginDocumentSettingPanelOption');
22
- const EnablePluginDocumentSettingPanelOption = ({
23
- label,
24
- panelName
25
- }) => (0, _react.createElement)(Fill, null, (0, _react.createElement)(_index.EnablePanelOption, {
26
- label: label,
27
- panelName: panelName
28
- }));
29
- EnablePluginDocumentSettingPanelOption.Slot = Slot;
30
- var _default = EnablePluginDocumentSettingPanelOption;
31
- exports.default = _default;
32
- //# sourceMappingURL=enable-plugin-document-setting-panel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_components","require","_index","Fill","Slot","createSlotFill","EnablePluginDocumentSettingPanelOption","label","panelName","_react","createElement","EnablePanelOption","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/preferences-modal/options/enable-plugin-document-setting-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { EnablePanelOption } from './index';\n\nconst { Fill, Slot } = createSlotFill(\n\t'EnablePluginDocumentSettingPanelOption'\n);\n\nconst EnablePluginDocumentSettingPanelOption = ( { label, panelName } ) => (\n\t<Fill>\n\t\t<EnablePanelOption label={ label } panelName={ panelName } />\n\t</Fill>\n);\n\nEnablePluginDocumentSettingPanelOption.Slot = Slot;\n\nexport default EnablePluginDocumentSettingPanelOption;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAM;EAAEE,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EACpC,wCACD,CAAC;AAED,MAAMC,sCAAsC,GAAGA,CAAE;EAAEC,KAAK;EAAEC;AAAU,CAAC,KACpE,IAAAC,MAAA,CAAAC,aAAA,EAACP,IAAI,QACJ,IAAAM,MAAA,CAAAC,aAAA,EAACR,MAAA,CAAAS,iBAAiB;EAACJ,KAAK,EAAGA,KAAO;EAACC,SAAS,EAAGA;AAAW,CAAE,CACvD,CACN;AAEDF,sCAAsC,CAACF,IAAI,GAAGA,IAAI;AAAC,IAAAQ,QAAA,GAEpCN,sCAAsC;AAAAO,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_compose","require","_data","_viewport","_editor","_interface","_default","compose","withSelect","select","isChecked","editorStore","isPublishSidebarEnabled","withDispatch","dispatch","enablePublishSidebar","disablePublishSidebar","onChange","isEnabled","ifViewportMatches","BaseOption","exports","default"],"sources":["@wordpress/edit-post/src/components/preferences-modal/options/enable-publish-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { ifViewportMatches } from '@wordpress/viewport';\nimport { store as editorStore } from '@wordpress/editor';\nimport { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\tisChecked: select( editorStore ).isPublishSidebarEnabled(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { enablePublishSidebar, disablePublishSidebar } =\n\t\t\tdispatch( editorStore );\n\t\treturn {\n\t\t\tonChange: ( isEnabled ) =>\n\t\t\t\tisEnabled ? enablePublishSidebar() : disablePublishSidebar(),\n\t\t};\n\t} ),\n\t// In < medium viewports we override this option and always show the publish sidebar.\n\t// See the edit-post's header component for the specific logic.\n\tifViewportMatches( 'medium' )\n)( BaseOption );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAPA;AACA;AACA;AAFA,IAAAK,QAAA,GASe,IAAAC,gBAAO,EACrB,IAAAC,gBAAU,EAAIC,MAAM,KAAQ;EAC3BC,SAAS,EAAED,MAAM,CAAEE,aAAY,CAAC,CAACC,uBAAuB,CAAC;AAC1D,CAAC,CAAG,CAAC,EACL,IAAAC,kBAAY,EAAIC,QAAQ,IAAM;EAC7B,MAAM;IAAEC,oBAAoB;IAAEC;EAAsB,CAAC,GACpDF,QAAQ,CAAEH,aAAY,CAAC;EACxB,OAAO;IACNM,QAAQ,EAAIC,SAAS,IACpBA,SAAS,GAAGH,oBAAoB,CAAC,CAAC,GAAGC,qBAAqB,CAAC;EAC7D,CAAC;AACF,CAAE,CAAC;AACH;AACA;AACA,IAAAG,2BAAiB,EAAE,QAAS,CAC7B,CAAC,CAAEC,gDAAW,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAhB,QAAA"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "EnableCustomFieldsOption", {
8
- enumerable: true,
9
- get: function () {
10
- return _enableCustomFields.default;
11
- }
12
- });
13
- Object.defineProperty(exports, "EnableFeature", {
14
- enumerable: true,
15
- get: function () {
16
- return _enableFeature.default;
17
- }
18
- });
19
- Object.defineProperty(exports, "EnablePanelOption", {
20
- enumerable: true,
21
- get: function () {
22
- return _enablePanel.default;
23
- }
24
- });
25
- Object.defineProperty(exports, "EnablePluginDocumentSettingPanelOption", {
26
- enumerable: true,
27
- get: function () {
28
- return _enablePluginDocumentSettingPanel.default;
29
- }
30
- });
31
- Object.defineProperty(exports, "EnablePublishSidebarOption", {
32
- enumerable: true,
33
- get: function () {
34
- return _enablePublishSidebar.default;
35
- }
36
- });
37
- var _enableCustomFields = _interopRequireDefault(require("./enable-custom-fields"));
38
- var _enablePanel = _interopRequireDefault(require("./enable-panel"));
39
- var _enablePluginDocumentSettingPanel = _interopRequireDefault(require("./enable-plugin-document-setting-panel"));
40
- var _enablePublishSidebar = _interopRequireDefault(require("./enable-publish-sidebar"));
41
- var _enableFeature = _interopRequireDefault(require("./enable-feature"));
42
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_enableCustomFields","_interopRequireDefault","require","_enablePanel","_enablePluginDocumentSettingPanel","_enablePublishSidebar","_enableFeature"],"sources":["@wordpress/edit-post/src/components/preferences-modal/options/index.js"],"sourcesContent":["export { default as EnableCustomFieldsOption } from './enable-custom-fields';\nexport { default as EnablePanelOption } from './enable-panel';\nexport { default as EnablePluginDocumentSettingPanelOption } from './enable-plugin-document-setting-panel';\nexport { default as EnablePublishSidebarOption } from './enable-publish-sidebar';\nexport { default as EnableFeature } from './enable-feature';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,qBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA"}
@@ -1,96 +0,0 @@
1
- import { createElement } from "react";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { useMemo, useCallback } from '@wordpress/element';
6
- import { useDispatch, useSelect } from '@wordpress/data';
7
- import { useInstanceId } from '@wordpress/compose';
8
- import { CheckboxControl } from '@wordpress/components';
9
- import { store as editorStore } from '@wordpress/editor';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import BlockTypesChecklist from './checklist';
15
- import { store as editPostStore } from '../../store';
16
- function BlockManagerCategory({
17
- title,
18
- blockTypes
19
- }) {
20
- const instanceId = useInstanceId(BlockManagerCategory);
21
- const {
22
- defaultAllowedBlockTypes,
23
- hiddenBlockTypes
24
- } = useSelect(select => {
25
- const {
26
- getEditorSettings
27
- } = select(editorStore);
28
- const {
29
- getHiddenBlockTypes
30
- } = select(editPostStore);
31
- return {
32
- defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes,
33
- hiddenBlockTypes: getHiddenBlockTypes()
34
- };
35
- }, []);
36
- const filteredBlockTypes = useMemo(() => {
37
- if (defaultAllowedBlockTypes === true) {
38
- return blockTypes;
39
- }
40
- return blockTypes.filter(({
41
- name
42
- }) => {
43
- return defaultAllowedBlockTypes?.includes(name);
44
- });
45
- }, [defaultAllowedBlockTypes, blockTypes]);
46
- const {
47
- showBlockTypes,
48
- hideBlockTypes
49
- } = useDispatch(editPostStore);
50
- const toggleVisible = useCallback((blockName, nextIsChecked) => {
51
- if (nextIsChecked) {
52
- showBlockTypes(blockName);
53
- } else {
54
- hideBlockTypes(blockName);
55
- }
56
- }, []);
57
- const toggleAllVisible = useCallback(nextIsChecked => {
58
- const blockNames = blockTypes.map(({
59
- name
60
- }) => name);
61
- if (nextIsChecked) {
62
- showBlockTypes(blockNames);
63
- } else {
64
- hideBlockTypes(blockNames);
65
- }
66
- }, [blockTypes]);
67
- if (!filteredBlockTypes.length) {
68
- return null;
69
- }
70
- const checkedBlockNames = filteredBlockTypes.map(({
71
- name
72
- }) => name).filter(type => !hiddenBlockTypes.includes(type));
73
- const titleId = 'edit-post-block-manager__category-title-' + instanceId;
74
- const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
75
- const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0;
76
- return createElement("div", {
77
- role: "group",
78
- "aria-labelledby": titleId,
79
- className: "edit-post-block-manager__category"
80
- }, createElement(CheckboxControl, {
81
- __nextHasNoMarginBottom: true,
82
- checked: isAllChecked,
83
- onChange: toggleAllVisible,
84
- className: "edit-post-block-manager__category-title",
85
- indeterminate: isIndeterminate,
86
- label: createElement("span", {
87
- id: titleId
88
- }, title)
89
- }), createElement(BlockTypesChecklist, {
90
- blockTypes: filteredBlockTypes,
91
- value: checkedBlockNames,
92
- onItemChange: toggleVisible
93
- }));
94
- }
95
- export default BlockManagerCategory;
96
- //# sourceMappingURL=category.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useMemo","useCallback","useDispatch","useSelect","useInstanceId","CheckboxControl","store","editorStore","BlockTypesChecklist","editPostStore","BlockManagerCategory","title","blockTypes","instanceId","defaultAllowedBlockTypes","hiddenBlockTypes","select","getEditorSettings","getHiddenBlockTypes","filteredBlockTypes","filter","name","includes","showBlockTypes","hideBlockTypes","toggleVisible","blockName","nextIsChecked","toggleAllVisible","blockNames","map","length","checkedBlockNames","type","titleId","isAllChecked","isIndeterminate","createElement","role","className","__nextHasNoMarginBottom","checked","onChange","indeterminate","label","id","value","onItemChange"],"sources":["@wordpress/edit-post/src/components/block-manager/category.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { CheckboxControl } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport BlockTypesChecklist from './checklist';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManagerCategory( { title, blockTypes } ) {\n\tconst instanceId = useInstanceId( BlockManagerCategory );\n\tconst { defaultAllowedBlockTypes, hiddenBlockTypes } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getHiddenBlockTypes } = select( editPostStore );\n\t\t\treturn {\n\t\t\t\tdefaultAllowedBlockTypes:\n\t\t\t\t\tgetEditorSettings().defaultAllowedBlockTypes,\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst filteredBlockTypes = useMemo( () => {\n\t\tif ( defaultAllowedBlockTypes === true ) {\n\t\t\treturn blockTypes;\n\t\t}\n\t\treturn blockTypes.filter( ( { name } ) => {\n\t\t\treturn defaultAllowedBlockTypes?.includes( name );\n\t\t} );\n\t}, [ defaultAllowedBlockTypes, blockTypes ] );\n\tconst { showBlockTypes, hideBlockTypes } = useDispatch( editPostStore );\n\tconst toggleVisible = useCallback( ( blockName, nextIsChecked ) => {\n\t\tif ( nextIsChecked ) {\n\t\t\tshowBlockTypes( blockName );\n\t\t} else {\n\t\t\thideBlockTypes( blockName );\n\t\t}\n\t}, [] );\n\tconst toggleAllVisible = useCallback(\n\t\t( nextIsChecked ) => {\n\t\t\tconst blockNames = blockTypes.map( ( { name } ) => name );\n\t\t\tif ( nextIsChecked ) {\n\t\t\t\tshowBlockTypes( blockNames );\n\t\t\t} else {\n\t\t\t\thideBlockTypes( blockNames );\n\t\t\t}\n\t\t},\n\t\t[ blockTypes ]\n\t);\n\n\tif ( ! filteredBlockTypes.length ) {\n\t\treturn null;\n\t}\n\n\tconst checkedBlockNames = filteredBlockTypes\n\t\t.map( ( { name } ) => name )\n\t\t.filter( ( type ) => ! hiddenBlockTypes.includes( type ) );\n\n\tconst titleId = 'edit-post-block-manager__category-title-' + instanceId;\n\n\tconst isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;\n\tconst isIndeterminate = ! isAllChecked && checkedBlockNames.length > 0;\n\n\treturn (\n\t\t<div\n\t\t\trole=\"group\"\n\t\t\taria-labelledby={ titleId }\n\t\t\tclassName=\"edit-post-block-manager__category\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tchecked={ isAllChecked }\n\t\t\t\tonChange={ toggleAllVisible }\n\t\t\t\tclassName=\"edit-post-block-manager__category-title\"\n\t\t\t\tindeterminate={ isIndeterminate }\n\t\t\t\tlabel={ <span id={ titleId }>{ title }</span> }\n\t\t\t/>\n\t\t\t<BlockTypesChecklist\n\t\t\t\tblockTypes={ filteredBlockTypes }\n\t\t\t\tvalue={ checkedBlockNames }\n\t\t\t\tonItemChange={ toggleVisible }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default BlockManagerCategory;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,aAAa;AAC7C,SAASF,KAAK,IAAIG,aAAa,QAAQ,aAAa;AAEpD,SAASC,oBAAoBA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,EAAG;EACtD,MAAMC,UAAU,GAAGT,aAAa,CAAEM,oBAAqB,CAAC;EACxD,MAAM;IAAEI,wBAAwB;IAAEC;EAAiB,CAAC,GAAGZ,SAAS,CAC7Da,MAAM,IAAM;IACb,MAAM;MAAEC;IAAkB,CAAC,GAAGD,MAAM,CAAET,WAAY,CAAC;IACnD,MAAM;MAAEW;IAAoB,CAAC,GAAGF,MAAM,CAAEP,aAAc,CAAC;IACvD,OAAO;MACNK,wBAAwB,EAC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,IAAM,CAAElB,gBAAgB,CAACO,QAAQ,CAAEW,IAAK,CAAE,CAAC;EAE3D,MAAMC,OAAO,GAAG,0CAA0C,GAAGrB,UAAU;EAEvE,MAAMsB,YAAY,GAAGH,iBAAiB,CAACD,MAAM,KAAKZ,kBAAkB,CAACY,MAAM;EAC3E,MAAMK,eAAe,GAAG,CAAED,YAAY,IAAIH,iBAAiB,CAACD,MAAM,GAAG,CAAC;EAEtE,OACCM,aAAA;IACCC,IAAI,EAAC,OAAO;IACZ,mBAAkBJ,OAAS;IAC3BK,SAAS,EAAC;EAAmC,GAE7CF,aAAA,CAAChC,eAAe;IACfmC,uBAAuB;IACvBC,OAAO,EAAGN,YAAc;IACxBO,QAAQ,EAAGd,gBAAkB;IAC7BW,SAAS,EAAC,yCAAyC;IACnDI,aAAa,EAAGP,eAAiB;IACjCQ,KAAK,EAAGP,aAAA;MAAMQ,EAAE,EAAGX;IAAS,GAAGvB,KAAa;EAAG,CAC/C,CAAC,EACF0B,aAAA,CAAC7B,mBAAmB;IACnBI,UAAU,EAAGO,kBAAoB;IACjC2B,KAAK,EAAGd,iBAAmB;IAC3Be,YAAY,EAAGtB;EAAe,CAC9B,CACG,CAAC;AAER;AAEA,eAAef,oBAAoB"}
@@ -1,27 +0,0 @@
1
- import { createElement } from "react";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { BlockIcon } from '@wordpress/block-editor';
6
- import { CheckboxControl } from '@wordpress/components';
7
- function BlockTypesChecklist({
8
- blockTypes,
9
- value,
10
- onItemChange
11
- }) {
12
- return createElement("ul", {
13
- className: "edit-post-block-manager__checklist"
14
- }, blockTypes.map(blockType => createElement("li", {
15
- key: blockType.name,
16
- className: "edit-post-block-manager__checklist-item"
17
- }, createElement(CheckboxControl, {
18
- __nextHasNoMarginBottom: true,
19
- label: blockType.title,
20
- checked: value.includes(blockType.name),
21
- onChange: (...args) => onItemChange(blockType.name, ...args)
22
- }), createElement(BlockIcon, {
23
- icon: blockType.icon
24
- }))));
25
- }
26
- export default BlockTypesChecklist;
27
- //# sourceMappingURL=checklist.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["BlockIcon","CheckboxControl","BlockTypesChecklist","blockTypes","value","onItemChange","createElement","className","map","blockType","key","name","__nextHasNoMarginBottom","label","title","checked","includes","onChange","args","icon"],"sources":["@wordpress/edit-post/src/components/block-manager/checklist.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockIcon } from '@wordpress/block-editor';\nimport { CheckboxControl } from '@wordpress/components';\n\nfunction BlockTypesChecklist( { blockTypes, value, onItemChange } ) {\n\treturn (\n\t\t<ul className=\"edit-post-block-manager__checklist\">\n\t\t\t{ blockTypes.map( ( blockType ) => (\n\t\t\t\t<li\n\t\t\t\t\tkey={ blockType.name }\n\t\t\t\t\tclassName=\"edit-post-block-manager__checklist-item\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ blockType.title }\n\t\t\t\t\t\tchecked={ value.includes( blockType.name ) }\n\t\t\t\t\t\tonChange={ ( ...args ) =>\n\t\t\t\t\t\t\tonItemChange( blockType.name, ...args )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<BlockIcon icon={ blockType.icon } />\n\t\t\t\t</li>\n\t\t\t) ) }\n\t\t</ul>\n\t);\n}\n\nexport default BlockTypesChecklist;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,yBAAyB;AACnD,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,SAASC,mBAAmBA,CAAE;EAAEC,UAAU;EAAEC,KAAK;EAAEC;AAAa,CAAC,EAAG;EACnE,OACCC,aAAA;IAAIC,SAAS,EAAC;EAAoC,GAC/CJ,UAAU,CAACK,GAAG,CAAIC,SAAS,IAC5BH,aAAA;IACCI,GAAG,EAAGD,SAAS,CAACE,IAAM;IACtBJ,SAAS,EAAC;EAAyC,GAEnDD,aAAA,CAACL,eAAe;IACfW,uBAAuB;IACvBC,KAAK,EAAGJ,SAAS,CAACK,KAAO;IACzBC,OAAO,EAAGX,KAAK,CAACY,QAAQ,CAAEP,SAAS,CAACE,IAAK,CAAG;IAC5CM,QAAQ,EAAGA,CAAE,GAAGC,IAAI,KACnBb,YAAY,CAAEI,SAAS,CAACE,IAAI,EAAE,GAAGO,IAAK;EACtC,CACD,CAAC,EACFZ,aAAA,CAACN,SAAS;IAACmB,IAAI,EAAGV,SAAS,CAACU;EAAM,CAAE,CACjC,CACH,CACC,CAAC;AAEP;AAEA,eAAejB,mBAAmB"}