@wordpress/edit-post 7.30.0 → 7.31.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 (43) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +1 -58
  3. package/build/components/init-pattern-modal/index.js +99 -0
  4. package/build/components/init-pattern-modal/index.js.map +1 -0
  5. package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
  6. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  7. package/build/components/layout/index.js +2 -1
  8. package/build/components/layout/index.js.map +1 -1
  9. package/build/components/sidebar/post-status/index.js +3 -1
  10. package/build/components/sidebar/post-status/index.js.map +1 -1
  11. package/build/components/sidebar/settings-sidebar/index.js +1 -2
  12. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  13. package/build/editor.native.js +2 -2
  14. package/build/editor.native.js.map +1 -1
  15. package/build/index.js +1 -2
  16. package/build/index.js.map +1 -1
  17. package/build-module/components/init-pattern-modal/index.js +93 -0
  18. package/build-module/components/init-pattern-modal/index.js.map +1 -0
  19. package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
  20. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  21. package/build-module/components/layout/index.js +3 -2
  22. package/build-module/components/layout/index.js.map +1 -1
  23. package/build-module/components/sidebar/post-status/index.js +4 -2
  24. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  25. package/build-module/components/sidebar/settings-sidebar/index.js +2 -3
  26. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  27. package/build-module/editor.native.js +3 -3
  28. package/build-module/editor.native.js.map +1 -1
  29. package/build-module/index.js +2 -2
  30. package/build-module/index.js.map +1 -1
  31. package/package.json +32 -32
  32. package/src/components/init-pattern-modal/index.js +117 -0
  33. package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
  34. package/src/components/layout/index.js +2 -2
  35. package/src/components/sidebar/post-status/index.js +2 -0
  36. package/src/components/sidebar/settings-sidebar/index.js +1 -3
  37. package/src/editor.native.js +8 -2
  38. package/src/index.js +2 -1
  39. package/build/components/sidebar/plugin-document-setting-panel/index.js +0 -126
  40. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +0 -1
  41. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +0 -118
  42. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +0 -1
  43. package/src/components/sidebar/plugin-document-setting-panel/index.js +0 -125
@@ -1,118 +0,0 @@
1
- import { createElement, Fragment } from "react";
2
- /**
3
- * WordPress dependencies
4
- */
5
- import { createSlotFill, PanelBody } from '@wordpress/components';
6
- import { usePluginContext } from '@wordpress/plugins';
7
- import { useDispatch, useSelect } from '@wordpress/data';
8
- import warning from '@wordpress/warning';
9
- import { store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
10
-
11
- /**
12
- * Internal dependencies
13
- */
14
- import { unlock } from '../../../lock-unlock';
15
- const {
16
- Fill,
17
- Slot
18
- } = createSlotFill('PluginDocumentSettingPanel');
19
- const {
20
- EnablePluginDocumentSettingPanelOption
21
- } = unlock(editorPrivateApis);
22
-
23
- /**
24
- * Renders items below the Status & Availability panel in the Document Sidebar.
25
- *
26
- * @param {Object} props Component properties.
27
- * @param {string} props.name Required. A machine-friendly name for the panel.
28
- * @param {string} [props.className] An optional class name added to the row.
29
- * @param {string} [props.title] The title of the panel
30
- * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
31
- * @param {Element} props.children Children to be rendered
32
- *
33
- * @example
34
- * ```js
35
- * // Using ES5 syntax
36
- * var el = React.createElement;
37
- * var __ = wp.i18n.__;
38
- * var registerPlugin = wp.plugins.registerPlugin;
39
- * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
40
- *
41
- * function MyDocumentSettingPlugin() {
42
- * return el(
43
- * PluginDocumentSettingPanel,
44
- * {
45
- * className: 'my-document-setting-plugin',
46
- * title: 'My Panel',
47
- * name: 'my-panel',
48
- * },
49
- * __( 'My Document Setting Panel' )
50
- * );
51
- * }
52
- *
53
- * registerPlugin( 'my-document-setting-plugin', {
54
- * render: MyDocumentSettingPlugin
55
- * } );
56
- * ```
57
- *
58
- * @example
59
- * ```jsx
60
- * // Using ESNext syntax
61
- * import { registerPlugin } from '@wordpress/plugins';
62
- * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
63
- *
64
- * const MyDocumentSettingTest = () => (
65
- * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel">
66
- * <p>My Document Setting Panel</p>
67
- * </PluginDocumentSettingPanel>
68
- * );
69
- *
70
- * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
71
- * ```
72
- *
73
- * @return {Component} The component to be rendered.
74
- */
75
- const PluginDocumentSettingPanel = ({
76
- name,
77
- className,
78
- title,
79
- icon,
80
- children
81
- }) => {
82
- const {
83
- name: pluginName
84
- } = usePluginContext();
85
- const panelName = `${pluginName}/${name}`;
86
- const {
87
- opened,
88
- isEnabled
89
- } = useSelect(select => {
90
- const {
91
- isEditorPanelOpened,
92
- isEditorPanelEnabled
93
- } = select(editorStore);
94
- return {
95
- opened: isEditorPanelOpened(panelName),
96
- isEnabled: isEditorPanelEnabled(panelName)
97
- };
98
- }, [panelName]);
99
- const {
100
- toggleEditorPanelOpened
101
- } = useDispatch(editorStore);
102
- if (undefined === name) {
103
- typeof SCRIPT_DEBUG !== "undefined" && SCRIPT_DEBUG === true ? warning('PluginDocumentSettingPanel requires a name property.') : void 0;
104
- }
105
- return createElement(Fragment, null, createElement(EnablePluginDocumentSettingPanelOption, {
106
- label: title,
107
- panelName: panelName
108
- }), createElement(Fill, null, isEnabled && createElement(PanelBody, {
109
- className: className,
110
- title: title,
111
- icon: icon,
112
- opened: opened,
113
- onToggle: () => toggleEditorPanelOpened(panelName)
114
- }, children)));
115
- };
116
- PluginDocumentSettingPanel.Slot = Slot;
117
- export default PluginDocumentSettingPanel;
118
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createSlotFill","PanelBody","usePluginContext","useDispatch","useSelect","warning","store","editorStore","privateApis","editorPrivateApis","unlock","Fill","Slot","EnablePluginDocumentSettingPanelOption","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","panelName","opened","isEnabled","select","isEditorPanelOpened","isEditorPanelEnabled","toggleEditorPanelOpened","undefined","SCRIPT_DEBUG","createElement","Fragment","label","onToggle"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\nconst { EnablePluginDocumentSettingPanelOption } = unlock( editorPrivateApis );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,SAAS,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,OAAOC,OAAO,MAAM,oBAAoB;AACxC,SACCC,KAAK,IAAIC,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGZ,cAAc,CAAE,4BAA6B,CAAC;AACrE,MAAM;EAAEa;AAAuC,CAAC,GAAGH,MAAM,CAAED,iBAAkB,CAAC;;AAE9E;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,MAAMK,0BAA0B,GAAGA,CAAE;EACpCC,IAAI;EACJC,SAAS;EACTC,KAAK;EACLC,IAAI;EACJC;AACD,CAAC,KAAM;EACN,MAAM;IAAEJ,IAAI,EAAEK;EAAW,CAAC,GAAGlB,gBAAgB,CAAC,CAAC;EAC/C,MAAMmB,SAAS,GAAI,GAAGD,UAAY,IAAIL,IAAM,EAAC;EAC7C,MAAM;IAAEO,MAAM;IAAEC;EAAU,CAAC,GAAGnB,SAAS,CACpCoB,MAAM,IAAM;IACb,MAAM;MAAEC,mBAAmB;MAAEC;IAAqB,CAAC,GAClDF,MAAM,CAAEjB,WAAY,CAAC;IAEtB,OAAO;MACNe,MAAM,EAAEG,mBAAmB,CAAEJ,SAAU,CAAC;MACxCE,SAAS,EAAEG,oBAAoB,CAAEL,SAAU;IAC5C,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;EACD,MAAM;IAAEM;EAAwB,CAAC,GAAGxB,WAAW,CAAEI,WAAY,CAAC;EAE9D,IAAKqB,SAAS,KAAKb,IAAI,EAAG;IACzB,OAAAc,YAAA,oBAAAA,YAAA,YAAAxB,OAAO,CAAE,sDAAuD,CAAC;EAClE;EAEA,OACCyB,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACjB,sCAAsC;IACtCmB,KAAK,EAAGf,KAAO;IACfI,SAAS,EAAGA;EAAW,CACvB,CAAC,EACFS,aAAA,CAACnB,IAAI,QACFY,SAAS,IACVO,aAAA,CAAC7B,SAAS;IACTe,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGA,KAAO;IACfC,IAAI,EAAGA,IAAM;IACbI,MAAM,EAAGA,MAAQ;IACjBW,QAAQ,EAAGA,CAAA,KAAMN,uBAAuB,CAAEN,SAAU;EAAG,GAErDF,QACQ,CAEP,CACL,CAAC;AAEL,CAAC;AAEDL,0BAA0B,CAACF,IAAI,GAAGA,IAAI;AAEtC,eAAeE,0BAA0B"}
@@ -1,125 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { createSlotFill, PanelBody } from '@wordpress/components';
5
- import { usePluginContext } from '@wordpress/plugins';
6
- import { useDispatch, useSelect } from '@wordpress/data';
7
- import warning from '@wordpress/warning';
8
- import {
9
- store as editorStore,
10
- privateApis as editorPrivateApis,
11
- } from '@wordpress/editor';
12
-
13
- /**
14
- * Internal dependencies
15
- */
16
- import { unlock } from '../../../lock-unlock';
17
-
18
- const { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );
19
- const { EnablePluginDocumentSettingPanelOption } = unlock( editorPrivateApis );
20
-
21
- /**
22
- * Renders items below the Status & Availability panel in the Document Sidebar.
23
- *
24
- * @param {Object} props Component properties.
25
- * @param {string} props.name Required. A machine-friendly name for the panel.
26
- * @param {string} [props.className] An optional class name added to the row.
27
- * @param {string} [props.title] The title of the panel
28
- * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
29
- * @param {Element} props.children Children to be rendered
30
- *
31
- * @example
32
- * ```js
33
- * // Using ES5 syntax
34
- * var el = React.createElement;
35
- * var __ = wp.i18n.__;
36
- * var registerPlugin = wp.plugins.registerPlugin;
37
- * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
38
- *
39
- * function MyDocumentSettingPlugin() {
40
- * return el(
41
- * PluginDocumentSettingPanel,
42
- * {
43
- * className: 'my-document-setting-plugin',
44
- * title: 'My Panel',
45
- * name: 'my-panel',
46
- * },
47
- * __( 'My Document Setting Panel' )
48
- * );
49
- * }
50
- *
51
- * registerPlugin( 'my-document-setting-plugin', {
52
- * render: MyDocumentSettingPlugin
53
- * } );
54
- * ```
55
- *
56
- * @example
57
- * ```jsx
58
- * // Using ESNext syntax
59
- * import { registerPlugin } from '@wordpress/plugins';
60
- * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
61
- *
62
- * const MyDocumentSettingTest = () => (
63
- * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel">
64
- * <p>My Document Setting Panel</p>
65
- * </PluginDocumentSettingPanel>
66
- * );
67
- *
68
- * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
69
- * ```
70
- *
71
- * @return {Component} The component to be rendered.
72
- */
73
- const PluginDocumentSettingPanel = ( {
74
- name,
75
- className,
76
- title,
77
- icon,
78
- children,
79
- } ) => {
80
- const { name: pluginName } = usePluginContext();
81
- const panelName = `${ pluginName }/${ name }`;
82
- const { opened, isEnabled } = useSelect(
83
- ( select ) => {
84
- const { isEditorPanelOpened, isEditorPanelEnabled } =
85
- select( editorStore );
86
-
87
- return {
88
- opened: isEditorPanelOpened( panelName ),
89
- isEnabled: isEditorPanelEnabled( panelName ),
90
- };
91
- },
92
- [ panelName ]
93
- );
94
- const { toggleEditorPanelOpened } = useDispatch( editorStore );
95
-
96
- if ( undefined === name ) {
97
- warning( 'PluginDocumentSettingPanel requires a name property.' );
98
- }
99
-
100
- return (
101
- <>
102
- <EnablePluginDocumentSettingPanelOption
103
- label={ title }
104
- panelName={ panelName }
105
- />
106
- <Fill>
107
- { isEnabled && (
108
- <PanelBody
109
- className={ className }
110
- title={ title }
111
- icon={ icon }
112
- opened={ opened }
113
- onToggle={ () => toggleEditorPanelOpened( panelName ) }
114
- >
115
- { children }
116
- </PanelBody>
117
- ) }
118
- </Fill>
119
- </>
120
- );
121
- };
122
-
123
- PluginDocumentSettingPanel.Slot = Slot;
124
-
125
- export default PluginDocumentSettingPanel;