@wordpress/edit-post 7.31.0 → 7.32.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 (104) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +5 -127
  3. package/build/components/header/index.js +1 -1
  4. package/build/components/header/index.js.map +1 -1
  5. package/build/components/header/post-publish-button-or-toggle.js +2 -7
  6. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  7. package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
  8. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  9. package/build/components/layout/actions-panel.js +4 -7
  10. package/build/components/layout/actions-panel.js.map +1 -1
  11. package/build/components/layout/index.js +5 -2
  12. package/build/components/layout/index.js.map +1 -1
  13. package/build/components/sidebar/plugin-post-publish-panel/index.js +16 -64
  14. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  15. package/build/components/sidebar/plugin-pre-publish-panel/index.js +16 -63
  16. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  17. package/build/components/sidebar/settings-sidebar/index.js +8 -3
  18. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  19. package/build/editor.js +7 -2
  20. package/build/editor.js.map +1 -1
  21. package/build/hooks/commands/use-common-commands.js +2 -2
  22. package/build/hooks/commands/use-common-commands.js.map +1 -1
  23. package/build/hooks/use-navigate-to-entity-record.js +36 -19
  24. package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
  25. package/build/index.js +3 -4
  26. package/build/index.js.map +1 -1
  27. package/build/index.native.js +2 -4
  28. package/build/index.native.js.map +1 -1
  29. package/build/store/actions.js +36 -23
  30. package/build/store/actions.js.map +1 -1
  31. package/build/store/reducer.js +1 -15
  32. package/build/store/reducer.js.map +1 -1
  33. package/build/store/selectors.js +10 -5
  34. package/build/store/selectors.js.map +1 -1
  35. package/build-module/components/header/index.js +1 -1
  36. package/build-module/components/header/index.js.map +1 -1
  37. package/build-module/components/header/post-publish-button-or-toggle.js +2 -7
  38. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  39. package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
  40. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  41. package/build-module/components/layout/actions-panel.js +4 -5
  42. package/build-module/components/layout/actions-panel.js.map +1 -1
  43. package/build-module/components/layout/index.js +5 -2
  44. package/build-module/components/layout/index.js.map +1 -1
  45. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +14 -62
  46. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  47. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +14 -61
  48. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  49. package/build-module/components/sidebar/settings-sidebar/index.js +9 -4
  50. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  51. package/build-module/editor.js +7 -2
  52. package/build-module/editor.js.map +1 -1
  53. package/build-module/hooks/commands/use-common-commands.js +2 -2
  54. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  55. package/build-module/hooks/use-navigate-to-entity-record.js +37 -20
  56. package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
  57. package/build-module/index.js +4 -4
  58. package/build-module/index.js.map +1 -1
  59. package/build-module/index.native.js +2 -4
  60. package/build-module/index.native.js.map +1 -1
  61. package/build-module/store/actions.js +30 -15
  62. package/build-module/store/actions.js.map +1 -1
  63. package/build-module/store/reducer.js +1 -13
  64. package/build-module/store/reducer.js.map +1 -1
  65. package/build-module/store/selectors.js +9 -3
  66. package/build-module/store/selectors.js.map +1 -1
  67. package/build-style/classic-rtl.css +1 -1
  68. package/build-style/classic.css +1 -1
  69. package/build-style/style-rtl.css +1 -7
  70. package/build-style/style.css +1 -7
  71. package/package.json +32 -32
  72. package/src/classic.scss +2 -1
  73. package/src/components/header/index.js +1 -1
  74. package/src/components/header/post-publish-button-or-toggle.js +2 -8
  75. package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
  76. package/src/components/layout/actions-panel.js +5 -4
  77. package/src/components/layout/index.js +7 -2
  78. package/src/components/meta-boxes/meta-boxes-area/style.scss +1 -1
  79. package/src/components/sidebar/plugin-post-publish-panel/index.js +12 -67
  80. package/src/components/sidebar/plugin-pre-publish-panel/index.js +12 -66
  81. package/src/components/sidebar/settings-sidebar/index.js +6 -2
  82. package/src/editor.js +12 -2
  83. package/src/hooks/commands/use-common-commands.js +2 -2
  84. package/src/hooks/use-navigate-to-entity-record.js +37 -24
  85. package/src/index.js +3 -2
  86. package/src/index.native.js +1 -4
  87. package/src/store/actions.js +27 -12
  88. package/src/store/reducer.js +0 -13
  89. package/src/store/selectors.js +11 -3
  90. package/src/style.scss +0 -1
  91. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -107
  92. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  93. package/build/components/sidebar/template-summary/index.js +0 -36
  94. package/build/components/sidebar/template-summary/index.js.map +0 -1
  95. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -100
  96. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  97. package/build-module/components/sidebar/template-summary/index.js +0 -29
  98. package/build-module/components/sidebar/template-summary/index.js.map +0 -1
  99. package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -108
  100. package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +0 -39
  101. package/src/components/sidebar/plugin-post-publish-panel/test/index.js +0 -33
  102. package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +0 -33
  103. package/src/components/sidebar/template-summary/index.js +0 -37
  104. package/src/components/sidebar/template-summary/style.scss +0 -5
@@ -25,7 +25,6 @@ export function initializeEditor( id, postType, postId ) {
25
25
  editorMode: 'visual',
26
26
  fullscreenMode: true,
27
27
  inactivePanels: [],
28
- isPublishSidebarEnabled: true,
29
28
  openPanels: [ 'post-status' ],
30
29
  welcomeGuide: true,
31
30
  } );
@@ -33,9 +32,7 @@ export function initializeEditor( id, postType, postId ) {
33
32
  hiddenBlockTypes: [],
34
33
  inactivePanels: [],
35
34
  openPanels: [ 'post-status' ],
36
- } );
37
-
38
- dispatch( preferencesStore ).setDefaults( 'core', {
35
+ isPublishSidebarEnabled: true,
39
36
  fixedToolbar: false,
40
37
  } );
41
38
 
@@ -78,37 +78,52 @@ export const closeModal =
78
78
  /**
79
79
  * Returns an action object used in signalling that the user opened the publish
80
80
  * sidebar.
81
+ * @deprecated
81
82
  *
82
83
  * @return {Object} Action object
83
84
  */
84
- export function openPublishSidebar() {
85
- return {
86
- type: 'OPEN_PUBLISH_SIDEBAR',
85
+ export const openPublishSidebar =
86
+ () =>
87
+ ( { registry } ) => {
88
+ deprecated( "dispatch( 'core/edit-post' ).openPublishSidebar", {
89
+ since: '6.6',
90
+ alternative: "dispatch( 'core/editor').openPublishSidebar",
91
+ } );
92
+ registry.dispatch( editorStore ).openPublishSidebar();
87
93
  };
88
- }
89
94
 
90
95
  /**
91
96
  * Returns an action object used in signalling that the user closed the
92
97
  * publish sidebar.
98
+ * @deprecated
93
99
  *
94
100
  * @return {Object} Action object.
95
101
  */
96
- export function closePublishSidebar() {
97
- return {
98
- type: 'CLOSE_PUBLISH_SIDEBAR',
102
+ export const closePublishSidebar =
103
+ () =>
104
+ ( { registry } ) => {
105
+ deprecated( "dispatch( 'core/edit-post' ).closePublishSidebar", {
106
+ since: '6.6',
107
+ alternative: "dispatch( 'core/editor').closePublishSidebar",
108
+ } );
109
+ registry.dispatch( editorStore ).closePublishSidebar();
99
110
  };
100
- }
101
111
 
102
112
  /**
103
113
  * Returns an action object used in signalling that the user toggles the publish sidebar.
114
+ * @deprecated
104
115
  *
105
116
  * @return {Object} Action object
106
117
  */
107
- export function togglePublishSidebar() {
108
- return {
109
- type: 'TOGGLE_PUBLISH_SIDEBAR',
118
+ export const togglePublishSidebar =
119
+ () =>
120
+ ( { registry } ) => {
121
+ deprecated( "dispatch( 'core/edit-post' ).togglePublishSidebar", {
122
+ since: '6.6',
123
+ alternative: "dispatch( 'core/editor').togglePublishSidebar",
124
+ } );
125
+ registry.dispatch( editorStore ).togglePublishSidebar();
110
126
  };
111
- }
112
127
 
113
128
  /**
114
129
  * Returns an action object used to enable or disable a panel in the editor.
@@ -3,18 +3,6 @@
3
3
  */
4
4
  import { combineReducers } from '@wordpress/data';
5
5
 
6
- export function publishSidebarActive( state = false, action ) {
7
- switch ( action.type ) {
8
- case 'OPEN_PUBLISH_SIDEBAR':
9
- return true;
10
- case 'CLOSE_PUBLISH_SIDEBAR':
11
- return false;
12
- case 'TOGGLE_PUBLISH_SIDEBAR':
13
- return ! state;
14
- }
15
- return state;
16
- }
17
-
18
6
  /**
19
7
  * Reducer keeping track of the meta boxes isSaving state.
20
8
  * A "true" value means the meta boxes saving request is in-flight.
@@ -103,5 +91,4 @@ const metaBoxes = combineReducers( {
103
91
 
104
92
  export default combineReducers( {
105
93
  metaBoxes,
106
- publishSidebarActive,
107
94
  } );
@@ -228,13 +228,21 @@ export const getHiddenBlockTypes = createRegistrySelector( ( select ) => () => {
228
228
  /**
229
229
  * Returns true if the publish sidebar is opened.
230
230
  *
231
+ * @deprecated
232
+ *
231
233
  * @param {Object} state Global application state
232
234
  *
233
235
  * @return {boolean} Whether the publish sidebar is open.
234
236
  */
235
- export function isPublishSidebarOpened( state ) {
236
- return state.publishSidebarActive;
237
- }
237
+ export const isPublishSidebarOpened = createRegistrySelector(
238
+ ( select ) => () => {
239
+ deprecated( `select( 'core/edit-post' ).isPublishSidebarOpened`, {
240
+ since: '6.6',
241
+ alternative: `select( 'core/editor' ).isPublishSidebarOpened`,
242
+ } );
243
+ return select( editorStore ).isPublishSidebarOpened();
244
+ }
245
+ );
238
246
 
239
247
  /**
240
248
  * Returns true if the given panel was programmatically removed, or false otherwise.
package/src/style.scss CHANGED
@@ -8,7 +8,6 @@
8
8
  @import "./components/sidebar/post-format/style.scss";
9
9
  @import "./components/sidebar/post-slug/style.scss";
10
10
  @import "./components/sidebar/post-visibility/style.scss";
11
- @import "./components/sidebar/template-summary/style.scss";
12
11
  @import "./components/text-editor/style.scss";
13
12
  @import "./components/visual-editor/style.scss";
14
13
  @import "./components/welcome-guide/style.scss";
@@ -1,107 +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
- var _compose = require("@wordpress/compose");
11
- /**
12
- * WordPress dependencies
13
- */
14
-
15
- const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0;
16
-
17
- /**
18
- * Plugins may want to add an item to the menu either for every block
19
- * or only for the specific ones provided in the `allowedBlocks` component property.
20
- *
21
- * If there are multiple blocks selected the item will be rendered if every block
22
- * is of one allowed type (not necessarily the same).
23
- *
24
- * @param {string[]} selectedBlocks Array containing the names of the blocks selected
25
- * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
26
- * @return {boolean} Whether the item will be rendered or not.
27
- */
28
- const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
29
-
30
- /**
31
- * Renders a new item in the block settings menu.
32
- *
33
- * @param {Object} props Component props.
34
- * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
35
- * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
36
- * @param {string} props.label The menu item text.
37
- * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
38
- * @param {boolean} [props.small] Whether to render the label or not.
39
- * @param {string} [props.role] The ARIA role for the menu item.
40
- *
41
- * @example
42
- * ```js
43
- * // Using ES5 syntax
44
- * var __ = wp.i18n.__;
45
- * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
46
- *
47
- * function doOnClick(){
48
- * // To be called when the user clicks the menu item.
49
- * }
50
- *
51
- * function MyPluginBlockSettingsMenuItem() {
52
- * return React.createElement(
53
- * PluginBlockSettingsMenuItem,
54
- * {
55
- * allowedBlocks: [ 'core/paragraph' ],
56
- * icon: 'dashicon-name',
57
- * label: __( 'Menu item text' ),
58
- * onClick: doOnClick,
59
- * }
60
- * );
61
- * }
62
- * ```
63
- *
64
- * @example
65
- * ```jsx
66
- * // Using ESNext syntax
67
- * import { __ } from '@wordpress/i18n';
68
- * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
69
- *
70
- * const doOnClick = ( ) => {
71
- * // To be called when the user clicks the menu item.
72
- * };
73
- *
74
- * const MyPluginBlockSettingsMenuItem = () => (
75
- * <PluginBlockSettingsMenuItem
76
- * allowedBlocks={ [ 'core/paragraph' ] }
77
- * icon='dashicon-name'
78
- * label={ __( 'Menu item text' ) }
79
- * onClick={ doOnClick } />
80
- * );
81
- * ```
82
- *
83
- * @return {Component} The component to be rendered.
84
- */
85
- const PluginBlockSettingsMenuItem = ({
86
- allowedBlocks,
87
- icon,
88
- label,
89
- onClick,
90
- small,
91
- role
92
- }) => (0, _react.createElement)(_blockEditor.BlockSettingsMenuControls, null, ({
93
- selectedBlocks,
94
- onClose
95
- }) => {
96
- if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
97
- return null;
98
- }
99
- return (0, _react.createElement)(_components.MenuItem, {
100
- onClick: (0, _compose.compose)(onClick, onClose),
101
- icon: icon,
102
- label: small ? label : undefined,
103
- role: role
104
- }, !small && label);
105
- });
106
- var _default = exports.default = PluginBlockSettingsMenuItem;
107
- //# sourceMappingURL=plugin-block-settings-menu-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_blockEditor","require","_components","_compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","_react","createElement","BlockSettingsMenuControls","onClose","MenuItem","compose","undefined","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\n\nconst isEverySelectedBlockAllowed = ( selected, allowed ) =>\n\tselected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;\n\n/**\n * Plugins may want to add an item to the menu either for every block\n * or only for the specific ones provided in the `allowedBlocks` component property.\n *\n * If there are multiple blocks selected the item will be rendered if every block\n * is of one allowed type (not necessarily the same).\n *\n * @param {string[]} selectedBlocks Array containing the names of the blocks selected\n * @param {string[]} allowedBlocks Array containing the names of the blocks allowed\n * @return {boolean} Whether the item will be rendered or not.\n */\nconst shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>\n\t! Array.isArray( allowedBlocks ) ||\n\tisEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );\n\n/**\n * Renders a new item in the block settings menu.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.\n * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.\n * @param {string} props.label The menu item text.\n * @param {Function} props.onClick Callback function to be executed when the user click the menu item.\n * @param {boolean} [props.small] Whether to render the label or not.\n * @param {string} [props.role] The ARIA role for the menu item.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;\n *\n * function doOnClick(){\n * \t// To be called when the user clicks the menu item.\n * }\n *\n * function MyPluginBlockSettingsMenuItem() {\n * \treturn React.createElement(\n * \t\tPluginBlockSettingsMenuItem,\n * \t\t{\n * \t\t\tallowedBlocks: [ 'core/paragraph' ],\n * \t\t\ticon: 'dashicon-name',\n * \t\t\tlabel: __( 'Menu item text' ),\n * \t\t\tonClick: doOnClick,\n * \t\t}\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';\n *\n * const doOnClick = ( ) => {\n * // To be called when the user clicks the menu item.\n * };\n *\n * const MyPluginBlockSettingsMenuItem = () => (\n * <PluginBlockSettingsMenuItem\n * \t\tallowedBlocks={ [ 'core/paragraph' ] }\n * \t\ticon='dashicon-name'\n * \t\tlabel={ __( 'Menu item text' ) }\n * \t\tonClick={ doOnClick } />\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginBlockSettingsMenuItem = ( {\n\tallowedBlocks,\n\ticon,\n\tlabel,\n\tonClick,\n\tsmall,\n\trole,\n} ) => (\n\t<BlockSettingsMenuControls>\n\t\t{ ( { selectedBlocks, onClose } ) => {\n\t\t\tif ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ compose( onClick, onClose ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ small ? label : undefined }\n\t\t\t\t\trole={ role }\n\t\t\t\t>\n\t\t\t\t\t{ ! small && label }\n\t\t\t\t</MenuItem>\n\t\t\t);\n\t\t} }\n\t</BlockSettingsMenuControls>\n);\n\nexport default PluginBlockSettingsMenuItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,MAAMG,2BAA2B,GAAGA,CAAEC,QAAQ,EAAEC,OAAO,KACtDD,QAAQ,CAACE,MAAM,CAAIC,EAAE,IAAM,CAAEF,OAAO,CAACG,QAAQ,CAAED,EAAG,CAAE,CAAC,CAACE,MAAM,KAAK,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAEC,cAAc,EAAEC,aAAa,KACvD,CAAEC,KAAK,CAACC,OAAO,CAAEF,aAAc,CAAC,IAChCT,2BAA2B,CAAEQ,cAAc,EAAEC,aAAc,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,2BAA2B,GAAGA,CAAE;EACrCH,aAAa;EACbI,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,KAAK;EACLC;AACD,CAAC,KACA,IAAAC,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAAwB,yBAAyB,QACvB,CAAE;EAAEZ,cAAc;EAAEa;AAAQ,CAAC,KAAM;EACpC,IAAK,CAAEd,gBAAgB,CAAEC,cAAc,EAAEC,aAAc,CAAC,EAAG;IAC1D,OAAO,IAAI;EACZ;EACA,OACC,IAAAS,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAwB,QAAQ;IACRP,OAAO,EAAG,IAAAQ,gBAAO,EAAER,OAAO,EAAEM,OAAQ,CAAG;IACvCR,IAAI,EAAGA,IAAM;IACbC,KAAK,EAAGE,KAAK,GAAGF,KAAK,GAAGU,SAAW;IACnCP,IAAI,EAAGA;EAAM,GAEX,CAAED,KAAK,IAAIF,KACJ,CAAC;AAEb,CAC0B,CAC3B;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaf,2BAA2B"}
@@ -1,36 +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 _icons = require("@wordpress/icons");
9
- var _data = require("@wordpress/data");
10
- var _components = require("@wordpress/components");
11
- var _editor = require("@wordpress/editor");
12
- /**
13
- * WordPress dependencies
14
- */
15
-
16
- function TemplateSummary() {
17
- const template = (0, _data.useSelect)(select => {
18
- const {
19
- getCurrentPost
20
- } = select(_editor.store);
21
- return getCurrentPost();
22
- }, []);
23
- if (!template) {
24
- return null;
25
- }
26
- return (0, _react.createElement)(_components.PanelBody, null, (0, _react.createElement)(_components.Flex, {
27
- align: "flex-start",
28
- gap: "3"
29
- }, (0, _react.createElement)(_components.FlexItem, null, (0, _react.createElement)(_icons.Icon, {
30
- icon: _icons.layout
31
- })), (0, _react.createElement)(_components.FlexBlock, null, (0, _react.createElement)("h2", {
32
- className: "edit-post-template-summary__title"
33
- }, template?.title || template?.slug), (0, _react.createElement)("p", null, template?.description))));
34
- }
35
- var _default = exports.default = TemplateSummary;
36
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_icons","require","_data","_components","_editor","TemplateSummary","template","useSelect","select","getCurrentPost","editorStore","_react","createElement","PanelBody","Flex","align","gap","FlexItem","Icon","icon","layout","FlexBlock","className","title","slug","description","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/sidebar/template-summary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Icon, layout } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { Flex, FlexItem, FlexBlock, PanelBody } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\nfunction TemplateSummary() {\n\tconst template = useSelect( ( select ) => {\n\t\tconst { getCurrentPost } = select( editorStore );\n\t\treturn getCurrentPost();\n\t}, [] );\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody>\n\t\t\t<Flex align=\"flex-start\" gap=\"3\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Icon icon={ layout } />\n\t\t\t\t</FlexItem>\n\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<h2 className=\"edit-post-template-summary__title\">\n\t\t\t\t\t\t{ template?.title || template?.slug }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p>{ template?.description }</p>\n\t\t\t\t</FlexBlock>\n\t\t\t</Flex>\n\t\t</PanelBody>\n\t);\n}\n\nexport default TemplateSummary;\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMA,SAASI,eAAeA,CAAA,EAAG;EAC1B,MAAMC,QAAQ,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAe,CAAC,GAAGD,MAAM,CAAEE,aAAY,CAAC;IAChD,OAAOD,cAAc,CAAC,CAAC;EACxB,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEH,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAU,SAAS,QACT,IAAAF,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAW,IAAI;IAACC,KAAK,EAAC,YAAY;IAACC,GAAG,EAAC;EAAG,GAC/B,IAAAL,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAc,QAAQ,QACR,IAAAN,MAAA,CAAAC,aAAA,EAACZ,MAAA,CAAAkB,IAAI;IAACC,IAAI,EAAGC;EAAQ,CAAE,CACd,CAAC,EAEX,IAAAT,MAAA,CAAAC,aAAA,EAACT,WAAA,CAAAkB,SAAS,QACT,IAAAV,MAAA,CAAAC,aAAA;IAAIU,SAAS,EAAC;EAAmC,GAC9ChB,QAAQ,EAAEiB,KAAK,IAAIjB,QAAQ,EAAEkB,IAC5B,CAAC,EACL,IAAAb,MAAA,CAAAC,aAAA,aAAKN,QAAQ,EAAEmB,WAAgB,CACrB,CACN,CACI,CAAC;AAEd;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcvB,eAAe"}
@@ -1,100 +0,0 @@
1
- import { createElement } from "react";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { BlockSettingsMenuControls } from '@wordpress/block-editor';
6
- import { MenuItem } from '@wordpress/components';
7
- import { compose } from '@wordpress/compose';
8
- const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0;
9
-
10
- /**
11
- * Plugins may want to add an item to the menu either for every block
12
- * or only for the specific ones provided in the `allowedBlocks` component property.
13
- *
14
- * If there are multiple blocks selected the item will be rendered if every block
15
- * is of one allowed type (not necessarily the same).
16
- *
17
- * @param {string[]} selectedBlocks Array containing the names of the blocks selected
18
- * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
19
- * @return {boolean} Whether the item will be rendered or not.
20
- */
21
- const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
22
-
23
- /**
24
- * Renders a new item in the block settings menu.
25
- *
26
- * @param {Object} props Component props.
27
- * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
28
- * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
29
- * @param {string} props.label The menu item text.
30
- * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
31
- * @param {boolean} [props.small] Whether to render the label or not.
32
- * @param {string} [props.role] The ARIA role for the menu item.
33
- *
34
- * @example
35
- * ```js
36
- * // Using ES5 syntax
37
- * var __ = wp.i18n.__;
38
- * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
39
- *
40
- * function doOnClick(){
41
- * // To be called when the user clicks the menu item.
42
- * }
43
- *
44
- * function MyPluginBlockSettingsMenuItem() {
45
- * return React.createElement(
46
- * PluginBlockSettingsMenuItem,
47
- * {
48
- * allowedBlocks: [ 'core/paragraph' ],
49
- * icon: 'dashicon-name',
50
- * label: __( 'Menu item text' ),
51
- * onClick: doOnClick,
52
- * }
53
- * );
54
- * }
55
- * ```
56
- *
57
- * @example
58
- * ```jsx
59
- * // Using ESNext syntax
60
- * import { __ } from '@wordpress/i18n';
61
- * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
62
- *
63
- * const doOnClick = ( ) => {
64
- * // To be called when the user clicks the menu item.
65
- * };
66
- *
67
- * const MyPluginBlockSettingsMenuItem = () => (
68
- * <PluginBlockSettingsMenuItem
69
- * allowedBlocks={ [ 'core/paragraph' ] }
70
- * icon='dashicon-name'
71
- * label={ __( 'Menu item text' ) }
72
- * onClick={ doOnClick } />
73
- * );
74
- * ```
75
- *
76
- * @return {Component} The component to be rendered.
77
- */
78
- const PluginBlockSettingsMenuItem = ({
79
- allowedBlocks,
80
- icon,
81
- label,
82
- onClick,
83
- small,
84
- role
85
- }) => createElement(BlockSettingsMenuControls, null, ({
86
- selectedBlocks,
87
- onClose
88
- }) => {
89
- if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
90
- return null;
91
- }
92
- return createElement(MenuItem, {
93
- onClick: compose(onClick, onClose),
94
- icon: icon,
95
- label: small ? label : undefined,
96
- role: role
97
- }, !small && label);
98
- });
99
- export default PluginBlockSettingsMenuItem;
100
- //# sourceMappingURL=plugin-block-settings-menu-item.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["BlockSettingsMenuControls","MenuItem","compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","createElement","onClose","undefined"],"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\n\nconst isEverySelectedBlockAllowed = ( selected, allowed ) =>\n\tselected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;\n\n/**\n * Plugins may want to add an item to the menu either for every block\n * or only for the specific ones provided in the `allowedBlocks` component property.\n *\n * If there are multiple blocks selected the item will be rendered if every block\n * is of one allowed type (not necessarily the same).\n *\n * @param {string[]} selectedBlocks Array containing the names of the blocks selected\n * @param {string[]} allowedBlocks Array containing the names of the blocks allowed\n * @return {boolean} Whether the item will be rendered or not.\n */\nconst shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>\n\t! Array.isArray( allowedBlocks ) ||\n\tisEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );\n\n/**\n * Renders a new item in the block settings menu.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.\n * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.\n * @param {string} props.label The menu item text.\n * @param {Function} props.onClick Callback function to be executed when the user click the menu item.\n * @param {boolean} [props.small] Whether to render the label or not.\n * @param {string} [props.role] The ARIA role for the menu item.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;\n *\n * function doOnClick(){\n * \t// To be called when the user clicks the menu item.\n * }\n *\n * function MyPluginBlockSettingsMenuItem() {\n * \treturn React.createElement(\n * \t\tPluginBlockSettingsMenuItem,\n * \t\t{\n * \t\t\tallowedBlocks: [ 'core/paragraph' ],\n * \t\t\ticon: 'dashicon-name',\n * \t\t\tlabel: __( 'Menu item text' ),\n * \t\t\tonClick: doOnClick,\n * \t\t}\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';\n *\n * const doOnClick = ( ) => {\n * // To be called when the user clicks the menu item.\n * };\n *\n * const MyPluginBlockSettingsMenuItem = () => (\n * <PluginBlockSettingsMenuItem\n * \t\tallowedBlocks={ [ 'core/paragraph' ] }\n * \t\ticon='dashicon-name'\n * \t\tlabel={ __( 'Menu item text' ) }\n * \t\tonClick={ doOnClick } />\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginBlockSettingsMenuItem = ( {\n\tallowedBlocks,\n\ticon,\n\tlabel,\n\tonClick,\n\tsmall,\n\trole,\n} ) => (\n\t<BlockSettingsMenuControls>\n\t\t{ ( { selectedBlocks, onClose } ) => {\n\t\t\tif ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ compose( onClick, onClose ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ small ? label : undefined }\n\t\t\t\t\trole={ role }\n\t\t\t\t>\n\t\t\t\t\t{ ! small && label }\n\t\t\t\t</MenuItem>\n\t\t\t);\n\t\t} }\n\t</BlockSettingsMenuControls>\n);\n\nexport default PluginBlockSettingsMenuItem;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,yBAAyB;AACnE,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,MAAMC,2BAA2B,GAAGA,CAAEC,QAAQ,EAAEC,OAAO,KACtDD,QAAQ,CAACE,MAAM,CAAIC,EAAE,IAAM,CAAEF,OAAO,CAACG,QAAQ,CAAED,EAAG,CAAE,CAAC,CAACE,MAAM,KAAK,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAEC,cAAc,EAAEC,aAAa,KACvD,CAAEC,KAAK,CAACC,OAAO,CAAEF,aAAc,CAAC,IAChCT,2BAA2B,CAAEQ,cAAc,EAAEC,aAAc,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,2BAA2B,GAAGA,CAAE;EACrCH,aAAa;EACbI,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,KAAK;EACLC;AACD,CAAC,KACAC,aAAA,CAACrB,yBAAyB,QACvB,CAAE;EAAEW,cAAc;EAAEW;AAAQ,CAAC,KAAM;EACpC,IAAK,CAAEZ,gBAAgB,CAAEC,cAAc,EAAEC,aAAc,CAAC,EAAG;IAC1D,OAAO,IAAI;EACZ;EACA,OACCS,aAAA,CAACpB,QAAQ;IACRiB,OAAO,EAAGhB,OAAO,CAAEgB,OAAO,EAAEI,OAAQ,CAAG;IACvCN,IAAI,EAAGA,IAAM;IACbC,KAAK,EAAGE,KAAK,GAAGF,KAAK,GAAGM,SAAW;IACnCH,IAAI,EAAGA;EAAM,GAEX,CAAED,KAAK,IAAIF,KACJ,CAAC;AAEb,CAC0B,CAC3B;AAED,eAAeF,2BAA2B"}
@@ -1,29 +0,0 @@
1
- import { createElement } from "react";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { Icon, layout } from '@wordpress/icons';
6
- import { useSelect } from '@wordpress/data';
7
- import { Flex, FlexItem, FlexBlock, PanelBody } from '@wordpress/components';
8
- import { store as editorStore } from '@wordpress/editor';
9
- function TemplateSummary() {
10
- const template = useSelect(select => {
11
- const {
12
- getCurrentPost
13
- } = select(editorStore);
14
- return getCurrentPost();
15
- }, []);
16
- if (!template) {
17
- return null;
18
- }
19
- return createElement(PanelBody, null, createElement(Flex, {
20
- align: "flex-start",
21
- gap: "3"
22
- }, createElement(FlexItem, null, createElement(Icon, {
23
- icon: layout
24
- })), createElement(FlexBlock, null, createElement("h2", {
25
- className: "edit-post-template-summary__title"
26
- }, template?.title || template?.slug), createElement("p", null, template?.description))));
27
- }
28
- export default TemplateSummary;
29
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["Icon","layout","useSelect","Flex","FlexItem","FlexBlock","PanelBody","store","editorStore","TemplateSummary","template","select","getCurrentPost","createElement","align","gap","icon","className","title","slug","description"],"sources":["@wordpress/edit-post/src/components/sidebar/template-summary/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Icon, layout } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { Flex, FlexItem, FlexBlock, PanelBody } from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\n\nfunction TemplateSummary() {\n\tconst template = useSelect( ( select ) => {\n\t\tconst { getCurrentPost } = select( editorStore );\n\t\treturn getCurrentPost();\n\t}, [] );\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody>\n\t\t\t<Flex align=\"flex-start\" gap=\"3\">\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Icon icon={ layout } />\n\t\t\t\t</FlexItem>\n\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<h2 className=\"edit-post-template-summary__title\">\n\t\t\t\t\t\t{ template?.title || template?.slug }\n\t\t\t\t\t</h2>\n\t\t\t\t\t<p>{ template?.description }</p>\n\t\t\t\t</FlexBlock>\n\t\t\t</Flex>\n\t\t</PanelBody>\n\t);\n}\n\nexport default TemplateSummary;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;AAC/C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AAExD,SAASC,eAAeA,CAAA,EAAG;EAC1B,MAAMC,QAAQ,GAAGR,SAAS,CAAIS,MAAM,IAAM;IACzC,MAAM;MAAEC;IAAe,CAAC,GAAGD,MAAM,CAAEH,WAAY,CAAC;IAChD,OAAOI,cAAc,CAAC,CAAC;EACxB,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEF,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OACCG,aAAA,CAACP,SAAS,QACTO,aAAA,CAACV,IAAI;IAACW,KAAK,EAAC,YAAY;IAACC,GAAG,EAAC;EAAG,GAC/BF,aAAA,CAACT,QAAQ,QACRS,aAAA,CAACb,IAAI;IAACgB,IAAI,EAAGf;EAAQ,CAAE,CACd,CAAC,EAEXY,aAAA,CAACR,SAAS,QACTQ,aAAA;IAAII,SAAS,EAAC;EAAmC,GAC9CP,QAAQ,EAAEQ,KAAK,IAAIR,QAAQ,EAAES,IAC5B,CAAC,EACLN,aAAA,YAAKH,QAAQ,EAAEU,WAAgB,CACrB,CACN,CACI,CAAC;AAEd;AAEA,eAAeX,eAAe"}
@@ -1,108 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { BlockSettingsMenuControls } from '@wordpress/block-editor';
5
- import { MenuItem } from '@wordpress/components';
6
- import { compose } from '@wordpress/compose';
7
-
8
- const isEverySelectedBlockAllowed = ( selected, allowed ) =>
9
- selected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;
10
-
11
- /**
12
- * Plugins may want to add an item to the menu either for every block
13
- * or only for the specific ones provided in the `allowedBlocks` component property.
14
- *
15
- * If there are multiple blocks selected the item will be rendered if every block
16
- * is of one allowed type (not necessarily the same).
17
- *
18
- * @param {string[]} selectedBlocks Array containing the names of the blocks selected
19
- * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
20
- * @return {boolean} Whether the item will be rendered or not.
21
- */
22
- const shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>
23
- ! Array.isArray( allowedBlocks ) ||
24
- isEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );
25
-
26
- /**
27
- * Renders a new item in the block settings menu.
28
- *
29
- * @param {Object} props Component props.
30
- * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
31
- * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
32
- * @param {string} props.label The menu item text.
33
- * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
34
- * @param {boolean} [props.small] Whether to render the label or not.
35
- * @param {string} [props.role] The ARIA role for the menu item.
36
- *
37
- * @example
38
- * ```js
39
- * // Using ES5 syntax
40
- * var __ = wp.i18n.__;
41
- * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
42
- *
43
- * function doOnClick(){
44
- * // To be called when the user clicks the menu item.
45
- * }
46
- *
47
- * function MyPluginBlockSettingsMenuItem() {
48
- * return React.createElement(
49
- * PluginBlockSettingsMenuItem,
50
- * {
51
- * allowedBlocks: [ 'core/paragraph' ],
52
- * icon: 'dashicon-name',
53
- * label: __( 'Menu item text' ),
54
- * onClick: doOnClick,
55
- * }
56
- * );
57
- * }
58
- * ```
59
- *
60
- * @example
61
- * ```jsx
62
- * // Using ESNext syntax
63
- * import { __ } from '@wordpress/i18n';
64
- * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
65
- *
66
- * const doOnClick = ( ) => {
67
- * // To be called when the user clicks the menu item.
68
- * };
69
- *
70
- * const MyPluginBlockSettingsMenuItem = () => (
71
- * <PluginBlockSettingsMenuItem
72
- * allowedBlocks={ [ 'core/paragraph' ] }
73
- * icon='dashicon-name'
74
- * label={ __( 'Menu item text' ) }
75
- * onClick={ doOnClick } />
76
- * );
77
- * ```
78
- *
79
- * @return {Component} The component to be rendered.
80
- */
81
- const PluginBlockSettingsMenuItem = ( {
82
- allowedBlocks,
83
- icon,
84
- label,
85
- onClick,
86
- small,
87
- role,
88
- } ) => (
89
- <BlockSettingsMenuControls>
90
- { ( { selectedBlocks, onClose } ) => {
91
- if ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {
92
- return null;
93
- }
94
- return (
95
- <MenuItem
96
- onClick={ compose( onClick, onClose ) }
97
- icon={ icon }
98
- label={ small ? label : undefined }
99
- role={ role }
100
- >
101
- { ! small && label }
102
- </MenuItem>
103
- );
104
- } }
105
- </BlockSettingsMenuControls>
106
- );
107
-
108
- export default PluginBlockSettingsMenuItem;
@@ -1,39 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`PluginPostPublishPanel renders fill properly 1`] = `
4
- <div>
5
- <div
6
- class="components-panel__body my-plugin-post-publish-panel is-opened"
7
- >
8
- <h2
9
- class="components-panel__body-title"
10
- >
11
- <button
12
- aria-expanded="true"
13
- class="components-button components-panel__body-toggle"
14
- type="button"
15
- >
16
- <span
17
- aria-hidden="true"
18
- >
19
- <svg
20
- aria-hidden="true"
21
- class="components-panel__arrow"
22
- focusable="false"
23
- height="24"
24
- viewBox="0 0 24 24"
25
- width="24"
26
- xmlns="http://www.w3.org/2000/svg"
27
- >
28
- <path
29
- d="M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
30
- />
31
- </svg>
32
- </span>
33
- My panel title
34
- </button>
35
- </h2>
36
- My panel content
37
- </div>
38
- </div>
39
- `;
@@ -1,33 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { render } from '@testing-library/react';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import { SlotFillProvider } from '@wordpress/components';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import PluginPostPublishPanel from '../';
15
-
16
- describe( 'PluginPostPublishPanel', () => {
17
- test( 'renders fill properly', () => {
18
- const { container } = render(
19
- <SlotFillProvider>
20
- <PluginPostPublishPanel
21
- className="my-plugin-post-publish-panel"
22
- title="My panel title"
23
- initialOpen
24
- >
25
- My panel content
26
- </PluginPostPublishPanel>
27
- <PluginPostPublishPanel.Slot />
28
- </SlotFillProvider>
29
- );
30
-
31
- expect( container ).toMatchSnapshot();
32
- } );
33
- } );