@wordpress/edit-post 7.32.0 → 7.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +17 -223
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/editor-initialization/index.js +0 -1
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/editor-initialization/listener-hooks.js +1 -38
- package/build/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +20 -51
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/index.native.js +1 -1
- package/build/components/header/index.native.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +17 -42
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/more-menu/manage-patterns-menu-item.js +40 -0
- package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -123
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +28 -29
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/index.js +3 -32
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/sidebar/post-format/index.js.map +1 -1
- package/build/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build/components/sidebar/post-slug/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +35 -12
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-sticky/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +68 -41
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/block-inspector-button.js +1 -1
- package/build/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +4 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/components/visual-editor/use-padding-appender.js +62 -0
- package/build/components/visual-editor/use-padding-appender.js.map +1 -0
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/deprecated.js +132 -0
- package/build/deprecated.js.map +1 -0
- package/build/editor.js +2 -2
- package/build/editor.js.map +1 -1
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +5 -22
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/components/index.js.map +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +19 -62
- package/build/index.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/store/actions.js +10 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +34 -19
- package/build/store/selectors.js.map +1 -1
- package/build/utils/meta-boxes.js.map +1 -1
- package/build-module/components/browser-url/index.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +1 -2
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/editor-initialization/listener-hooks.js +2 -38
- package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +22 -53
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/index.native.js +1 -1
- package/build-module/components/header/index.native.js.map +1 -1
- package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +17 -42
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build-module/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -124
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +28 -29
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +4 -32
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/sidebar/post-format/index.js.map +1 -1
- package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-slug/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +36 -14
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
- package/build-module/components/sidebar/post-trash/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +71 -44
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +4 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/index.native.js.map +1 -1
- package/build-module/components/visual-editor/use-padding-appender.js +55 -0
- package/build-module/components/visual-editor/use-padding-appender.js.map +1 -0
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/deprecated.js +116 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/editor.js +2 -2
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +7 -24
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/components/index.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +2 -15
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/actions.js +8 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +33 -18
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/meta-boxes.js.map +1 -1
- package/build-style/classic-rtl.css +2 -2
- package/build-style/classic.css +2 -2
- package/build-style/style-rtl.css +18 -589
- package/build-style/style.css +18 -589
- package/package.json +32 -34
- package/src/classic.scss +1 -1
- package/src/components/editor-initialization/index.js +1 -5
- package/src/components/editor-initialization/listener-hooks.js +1 -40
- package/src/components/editor-initialization/test/listener-hooks.js +1 -96
- package/src/components/header/index.js +25 -71
- package/src/components/header/index.native.js +1 -1
- package/src/components/header/more-menu/index.js +27 -43
- package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/src/components/header/style.scss +5 -82
- package/src/components/keyboard-shortcuts/index.js +2 -148
- package/src/components/layout/index.js +26 -47
- package/src/components/layout/style.scss +7 -80
- package/src/components/preferences-modal/index.js +3 -46
- package/src/components/sidebar/post-status/index.js +61 -24
- package/src/components/sidebar/settings-sidebar/index.js +113 -73
- package/src/components/visual-editor/block-inspector-button.js +1 -1
- package/src/components/visual-editor/index.js +4 -0
- package/src/components/visual-editor/use-padding-appender.js +66 -0
- package/src/deprecated.js +107 -0
- package/src/editor.js +2 -2
- package/src/hooks/commands/use-common-commands.js +11 -26
- package/src/index.js +3 -20
- package/src/store/actions.js +10 -12
- package/src/store/selectors.js +41 -33
- package/src/store/test/actions.js +11 -10
- package/src/style.scss +1 -19
- package/build/components/header/plugin-more-menu-item/index.js +0 -78
- package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +0 -71
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build/components/header/post-publish-button-or-toggle.js +0 -91
- package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build/components/header/preferences-menu-item/index.js +0 -31
- package/build/components/header/preferences-menu-item/index.js.map +0 -1
- package/build/components/header/tools-more-menu-group/index.js +0 -26
- package/build/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build/components/header/writing-menu/index.js +0 -71
- package/build/components/header/writing-menu/index.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +0 -78
- package/build/components/keyboard-shortcut-help-modal/config.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -49
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +0 -132
- package/build/components/keyboard-shortcut-help-modal/index.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -55
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
- package/build/components/layout/actions-panel.js +0 -86
- package/build/components/layout/actions-panel.js.map +0 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +0 -38
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +0 -39
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +0 -73
- package/build/components/sidebar/plugin-post-status-info/index.js.map +0 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +0 -43
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
- package/build/components/sidebar/plugin-sidebar/index.js +0 -104
- package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build/components/start-page-options/index.js +0 -107
- package/build/components/start-page-options/index.js.map +0 -1
- package/build/plugins/copy-content-menu-item/index.js +0 -39
- package/build/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build/plugins/index.js +0 -69
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -41
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item/index.js.map +0 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +0 -73
- package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +0 -65
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +0 -83
- package/build-module/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build-module/components/header/preferences-menu-item/index.js +0 -24
- package/build-module/components/header/preferences-menu-item/index.js.map +0 -1
- package/build-module/components/header/tools-more-menu-group/index.js +0 -19
- package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/header/writing-menu/index.js +0 -64
- package/build-module/components/header/writing-menu/index.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +0 -71
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -41
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -122
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -48
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
- package/build-module/components/layout/actions-panel.js +0 -78
- package/build-module/components/layout/actions-panel.js.map +0 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +0 -31
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +0 -32
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js +0 -66
- package/build-module/components/sidebar/plugin-post-status-info/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +0 -36
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +0 -98
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build-module/components/start-page-options/index.js +0 -100
- package/build-module/components/start-page-options/index.js.map +0 -1
- package/build-module/plugins/copy-content-menu-item/index.js +0 -32
- package/build-module/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build-module/plugins/index.js +0 -65
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -33
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +0 -1
- package/src/components/header/plugin-more-menu-item/index.js +0 -73
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +0 -64
- package/src/components/header/post-publish-button-or-toggle.js +0 -92
- package/src/components/header/preferences-menu-item/index.js +0 -25
- package/src/components/header/test/index.js +0 -51
- package/src/components/header/tools-more-menu-group/index.js +0 -20
- package/src/components/header/writing-menu/index.js +0 -73
- package/src/components/keyboard-shortcut-help-modal/config.js +0 -53
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -43
- package/src/components/keyboard-shortcut-help-modal/index.js +0 -163
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +0 -67
- package/src/components/keyboard-shortcut-help-modal/style.scss +0 -61
- package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -36
- package/src/components/layout/actions-panel.js +0 -103
- package/src/components/preferences-modal/enable-publish-sidebar.js +0 -32
- package/src/components/preferences-modal/test/index.js +0 -28
- package/src/components/sidebar/plugin-post-publish-panel/index.js +0 -28
- package/src/components/sidebar/plugin-post-status-info/index.js +0 -63
- package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +0 -11
- package/src/components/sidebar/plugin-post-status-info/test/index.js +0 -29
- package/src/components/sidebar/plugin-pre-publish-panel/index.js +0 -32
- package/src/components/sidebar/plugin-sidebar/index.js +0 -94
- package/src/components/start-page-options/index.js +0 -108
- package/src/components/start-page-options/style.scss +0 -26
- package/src/plugins/copy-content-menu-item/index.js +0 -29
- package/src/plugins/index.js +0 -85
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -34
- /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
|
@@ -7,35 +7,37 @@ import {
|
|
|
7
7
|
drawerLeft,
|
|
8
8
|
drawerRight,
|
|
9
9
|
blockDefault,
|
|
10
|
-
keyboard,
|
|
11
10
|
fullscreen,
|
|
12
11
|
formatListBullets,
|
|
13
12
|
} from '@wordpress/icons';
|
|
14
13
|
import { useCommand } from '@wordpress/commands';
|
|
15
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
16
|
-
import {
|
|
17
|
-
|
|
15
|
+
import {
|
|
16
|
+
store as editorStore,
|
|
17
|
+
privateApis as editorPrivateApis,
|
|
18
|
+
} from '@wordpress/editor';
|
|
18
19
|
import { store as noticesStore } from '@wordpress/notices';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
22
23
|
*/
|
|
23
|
-
import { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';
|
|
24
|
-
import { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';
|
|
25
24
|
import { store as editPostStore } from '../../store';
|
|
25
|
+
import { unlock } from '../../lock-unlock';
|
|
26
|
+
|
|
27
|
+
const { interfaceStore } = unlock( editorPrivateApis );
|
|
26
28
|
|
|
27
29
|
export default function useCommonCommands() {
|
|
28
30
|
const { openGeneralSidebar, closeGeneralSidebar } =
|
|
29
31
|
useDispatch( editPostStore );
|
|
30
|
-
const { openModal } = useDispatch( interfaceStore );
|
|
31
32
|
const { activeSidebar, isFullscreen, isPublishSidebarEnabled } = useSelect(
|
|
32
33
|
( select ) => {
|
|
33
34
|
const { get } = select( preferencesStore );
|
|
34
35
|
|
|
35
36
|
return {
|
|
36
|
-
activeSidebar:
|
|
37
|
-
interfaceStore
|
|
38
|
-
|
|
37
|
+
activeSidebar:
|
|
38
|
+
select( interfaceStore ).getActiveComplementaryArea(
|
|
39
|
+
'core'
|
|
40
|
+
),
|
|
39
41
|
isPublishSidebarEnabled:
|
|
40
42
|
select( editorStore ).isPublishSidebarEnabled(),
|
|
41
43
|
isFullscreen: get( 'core/edit-post', 'fullscreenMode' ),
|
|
@@ -101,23 +103,6 @@ export default function useCommonCommands() {
|
|
|
101
103
|
},
|
|
102
104
|
} );
|
|
103
105
|
|
|
104
|
-
useCommand( {
|
|
105
|
-
name: 'core/open-preferences',
|
|
106
|
-
label: __( 'Editor preferences' ),
|
|
107
|
-
callback: () => {
|
|
108
|
-
openModal( PREFERENCES_MODAL_NAME );
|
|
109
|
-
},
|
|
110
|
-
} );
|
|
111
|
-
|
|
112
|
-
useCommand( {
|
|
113
|
-
name: 'core/open-shortcut-help',
|
|
114
|
-
label: __( 'Keyboard shortcuts' ),
|
|
115
|
-
icon: keyboard,
|
|
116
|
-
callback: () => {
|
|
117
|
-
openModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );
|
|
118
|
-
},
|
|
119
|
-
} );
|
|
120
|
-
|
|
121
106
|
useCommand( {
|
|
122
107
|
name: 'core/toggle-publish-sidebar',
|
|
123
108
|
label: isPublishSidebarEnabled
|
package/src/index.js
CHANGED
|
@@ -14,23 +14,13 @@ import {
|
|
|
14
14
|
registerLegacyWidgetBlock,
|
|
15
15
|
registerWidgetGroupBlock,
|
|
16
16
|
} from '@wordpress/widgets';
|
|
17
|
-
import {
|
|
18
|
-
PluginBlockSettingsMenuItem,
|
|
19
|
-
PluginDocumentSettingPanel,
|
|
20
|
-
privateApis as editorPrivateApis,
|
|
21
|
-
store as editorStore,
|
|
22
|
-
} from '@wordpress/editor';
|
|
17
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
23
18
|
|
|
24
19
|
/**
|
|
25
20
|
* Internal dependencies
|
|
26
21
|
*/
|
|
27
22
|
import './hooks';
|
|
28
|
-
import './plugins';
|
|
29
23
|
import Editor from './editor';
|
|
30
|
-
import { unlock } from './lock-unlock';
|
|
31
|
-
|
|
32
|
-
const { PluginPostExcerpt: __experimentalPluginPostExcerpt } =
|
|
33
|
-
unlock( editorPrivateApis );
|
|
34
24
|
|
|
35
25
|
/**
|
|
36
26
|
* Initializes and returns an instance of Editor.
|
|
@@ -162,15 +152,8 @@ export function reinitializeEditor() {
|
|
|
162
152
|
} );
|
|
163
153
|
}
|
|
164
154
|
|
|
165
|
-
export { PluginBlockSettingsMenuItem };
|
|
166
|
-
export { PluginDocumentSettingPanel };
|
|
167
|
-
export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
|
|
168
|
-
export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';
|
|
169
|
-
export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';
|
|
170
|
-
export { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';
|
|
171
|
-
export { default as PluginSidebar } from './components/sidebar/plugin-sidebar';
|
|
172
|
-
export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';
|
|
173
155
|
export { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';
|
|
174
156
|
export { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';
|
|
175
|
-
|
|
157
|
+
|
|
176
158
|
export { store } from './store';
|
|
159
|
+
export * from './deprecated';
|
package/src/store/actions.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import apiFetch from '@wordpress/api-fetch';
|
|
5
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
6
5
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
7
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
store as editorStore,
|
|
8
|
+
privateApis as editorPrivateApis,
|
|
9
|
+
} from '@wordpress/editor';
|
|
8
10
|
import deprecated from '@wordpress/deprecated';
|
|
9
11
|
import { addFilter } from '@wordpress/hooks';
|
|
10
12
|
|
|
@@ -12,9 +14,10 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
12
14
|
* Internal dependencies
|
|
13
15
|
*/
|
|
14
16
|
import { getMetaBoxContainer } from '../utils/meta-boxes';
|
|
15
|
-
import { store as editPostStore } from '.';
|
|
16
17
|
import { unlock } from '../lock-unlock';
|
|
17
18
|
|
|
19
|
+
const { interfaceStore } = unlock( editorPrivateApis );
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* Returns an action object used in signalling that the user opened an editor sidebar.
|
|
20
23
|
*
|
|
@@ -25,7 +28,7 @@ export const openGeneralSidebar =
|
|
|
25
28
|
( { registry } ) => {
|
|
26
29
|
registry
|
|
27
30
|
.dispatch( interfaceStore )
|
|
28
|
-
.enableComplementaryArea(
|
|
31
|
+
.enableComplementaryArea( 'core', name );
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
/**
|
|
@@ -34,9 +37,7 @@ export const openGeneralSidebar =
|
|
|
34
37
|
export const closeGeneralSidebar =
|
|
35
38
|
() =>
|
|
36
39
|
( { registry } ) =>
|
|
37
|
-
registry
|
|
38
|
-
.dispatch( interfaceStore )
|
|
39
|
-
.disableComplementaryArea( editPostStore.name );
|
|
40
|
+
registry.dispatch( interfaceStore ).disableComplementaryArea( 'core' );
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* Returns an action object used in signalling that the user opened a modal.
|
|
@@ -219,14 +220,11 @@ export const togglePinnedPluginItem =
|
|
|
219
220
|
( { registry } ) => {
|
|
220
221
|
const isPinned = registry
|
|
221
222
|
.select( interfaceStore )
|
|
222
|
-
.isItemPinned( 'core
|
|
223
|
+
.isItemPinned( 'core', pluginName );
|
|
223
224
|
|
|
224
225
|
registry
|
|
225
226
|
.dispatch( interfaceStore )
|
|
226
|
-
[ isPinned ? 'unpinItem' : 'pinItem' ](
|
|
227
|
-
'core/edit-post',
|
|
228
|
-
pluginName
|
|
229
|
-
);
|
|
227
|
+
[ isPinned ? 'unpinItem' : 'pinItem' ]( 'core', pluginName );
|
|
230
228
|
};
|
|
231
229
|
|
|
232
230
|
/**
|
package/src/store/selectors.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import createSelector from 'rememo';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
10
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
4
|
+
import { createSelector, createRegistrySelector } from '@wordpress/data';
|
|
11
5
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
12
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
store as editorStore,
|
|
9
|
+
privateApis as editorPrivateApis,
|
|
10
|
+
} from '@wordpress/editor';
|
|
14
11
|
import deprecated from '@wordpress/deprecated';
|
|
15
12
|
|
|
16
13
|
/**
|
|
@@ -18,6 +15,7 @@ import deprecated from '@wordpress/deprecated';
|
|
|
18
15
|
*/
|
|
19
16
|
import { unlock } from '../lock-unlock';
|
|
20
17
|
|
|
18
|
+
const { interfaceStore } = unlock( editorPrivateApis );
|
|
21
19
|
const EMPTY_ARRAY = [];
|
|
22
20
|
const EMPTY_OBJECT = {};
|
|
23
21
|
|
|
@@ -43,9 +41,7 @@ export const getEditorMode = createRegistrySelector(
|
|
|
43
41
|
export const isEditorSidebarOpened = createRegistrySelector(
|
|
44
42
|
( select ) => () => {
|
|
45
43
|
const activeGeneralSidebar =
|
|
46
|
-
select( interfaceStore ).getActiveComplementaryArea(
|
|
47
|
-
'core/edit-post'
|
|
48
|
-
);
|
|
44
|
+
select( interfaceStore ).getActiveComplementaryArea( 'core' );
|
|
49
45
|
return [ 'edit-post/document', 'edit-post/block' ].includes(
|
|
50
46
|
activeGeneralSidebar
|
|
51
47
|
);
|
|
@@ -62,9 +58,7 @@ export const isEditorSidebarOpened = createRegistrySelector(
|
|
|
62
58
|
export const isPluginSidebarOpened = createRegistrySelector(
|
|
63
59
|
( select ) => () => {
|
|
64
60
|
const activeGeneralSidebar =
|
|
65
|
-
select( interfaceStore ).getActiveComplementaryArea(
|
|
66
|
-
'core/edit-post'
|
|
67
|
-
);
|
|
61
|
+
select( interfaceStore ).getActiveComplementaryArea( 'core' );
|
|
68
62
|
return (
|
|
69
63
|
!! activeGeneralSidebar &&
|
|
70
64
|
! [ 'edit-post/document', 'edit-post/block' ].includes(
|
|
@@ -90,9 +84,7 @@ export const isPluginSidebarOpened = createRegistrySelector(
|
|
|
90
84
|
*/
|
|
91
85
|
export const getActiveGeneralSidebarName = createRegistrySelector(
|
|
92
86
|
( select ) => () => {
|
|
93
|
-
return select( interfaceStore ).getActiveComplementaryArea(
|
|
94
|
-
'core/edit-post'
|
|
95
|
-
);
|
|
87
|
+
return select( interfaceStore ).getActiveComplementaryArea( 'core' );
|
|
96
88
|
}
|
|
97
89
|
);
|
|
98
90
|
|
|
@@ -352,10 +344,7 @@ export const isFeatureActive = createRegistrySelector(
|
|
|
352
344
|
*/
|
|
353
345
|
export const isPluginItemPinned = createRegistrySelector(
|
|
354
346
|
( select ) => ( state, pluginName ) => {
|
|
355
|
-
return select( interfaceStore ).isItemPinned(
|
|
356
|
-
'core/edit-post',
|
|
357
|
-
pluginName
|
|
358
|
-
);
|
|
347
|
+
return select( interfaceStore ).isItemPinned( 'core', pluginName );
|
|
359
348
|
}
|
|
360
349
|
);
|
|
361
350
|
|
|
@@ -567,36 +556,55 @@ export function areMetaBoxesInitialized( state ) {
|
|
|
567
556
|
*/
|
|
568
557
|
export const getEditedPostTemplate = createRegistrySelector(
|
|
569
558
|
( select ) => () => {
|
|
559
|
+
const {
|
|
560
|
+
id: postId,
|
|
561
|
+
type: postType,
|
|
562
|
+
slug,
|
|
563
|
+
} = select( editorStore ).getCurrentPost();
|
|
564
|
+
const { getSite, getEditedEntityRecord, getEntityRecords } =
|
|
565
|
+
select( coreStore );
|
|
566
|
+
const siteSettings = getSite();
|
|
567
|
+
// First check if the current page is set as the posts page.
|
|
568
|
+
const isPostsPage = +postId === siteSettings?.page_for_posts;
|
|
569
|
+
if ( isPostsPage ) {
|
|
570
|
+
const defaultTemplateId = select( coreStore ).getDefaultTemplateId(
|
|
571
|
+
{ slug: 'home' }
|
|
572
|
+
);
|
|
573
|
+
return getEditedEntityRecord(
|
|
574
|
+
'postType',
|
|
575
|
+
'wp_template',
|
|
576
|
+
defaultTemplateId
|
|
577
|
+
);
|
|
578
|
+
}
|
|
570
579
|
const currentTemplate =
|
|
571
580
|
select( editorStore ).getEditedPostAttribute( 'template' );
|
|
572
581
|
if ( currentTemplate ) {
|
|
573
|
-
const templateWithSameSlug =
|
|
574
|
-
|
|
575
|
-
|
|
582
|
+
const templateWithSameSlug = getEntityRecords(
|
|
583
|
+
'postType',
|
|
584
|
+
'wp_template',
|
|
585
|
+
{ per_page: -1 }
|
|
586
|
+
)?.find( ( template ) => template.slug === currentTemplate );
|
|
576
587
|
if ( ! templateWithSameSlug ) {
|
|
577
588
|
return templateWithSameSlug;
|
|
578
589
|
}
|
|
579
|
-
return
|
|
590
|
+
return getEditedEntityRecord(
|
|
580
591
|
'postType',
|
|
581
592
|
'wp_template',
|
|
582
593
|
templateWithSameSlug.id
|
|
583
594
|
);
|
|
584
595
|
}
|
|
585
|
-
|
|
586
|
-
const post = select( editorStore ).getCurrentPost();
|
|
587
596
|
let slugToCheck;
|
|
588
597
|
// In `draft` status we might not have a slug available, so we use the `single`
|
|
589
598
|
// post type templates slug(ex page, single-post, single-product etc..).
|
|
590
599
|
// Pages do not need the `single` prefix in the slug to be prioritized
|
|
591
600
|
// through template hierarchy.
|
|
592
|
-
if (
|
|
601
|
+
if ( slug ) {
|
|
593
602
|
slugToCheck =
|
|
594
|
-
|
|
595
|
-
? `${
|
|
596
|
-
: `single-${
|
|
603
|
+
postType === 'page'
|
|
604
|
+
? `${ postType }-${ slug }`
|
|
605
|
+
: `single-${ postType }-${ slug }`;
|
|
597
606
|
} else {
|
|
598
|
-
slugToCheck =
|
|
599
|
-
post.type === 'page' ? 'page' : `single-${ post.type }`;
|
|
607
|
+
slugToCheck = postType === 'page' ? 'page' : `single-${ postType }`;
|
|
600
608
|
}
|
|
601
609
|
const defaultTemplateId = select( coreStore ).getDefaultTemplateId( {
|
|
602
610
|
slug: slugToCheck,
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { createRegistry } from '@wordpress/data';
|
|
5
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
6
5
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
7
6
|
import { store as noticesStore } from '@wordpress/notices';
|
|
8
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
8
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
store as editorStore,
|
|
11
|
+
privateApis as editorPrivateApis,
|
|
12
|
+
} from '@wordpress/editor';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Internal dependencies
|
|
14
16
|
*/
|
|
15
17
|
import { store as editPostStore } from '..';
|
|
18
|
+
import { unlock } from '../../lock-unlock';
|
|
19
|
+
|
|
20
|
+
const { interfaceStore } = unlock( editorPrivateApis );
|
|
16
21
|
|
|
17
22
|
function createRegistryWithStores() {
|
|
18
23
|
// Create a registry and register used stores.
|
|
@@ -40,7 +45,7 @@ describe( 'actions', () => {
|
|
|
40
45
|
expect(
|
|
41
46
|
registry
|
|
42
47
|
.select( interfaceStore )
|
|
43
|
-
.getActiveComplementaryArea( 'core
|
|
48
|
+
.getActiveComplementaryArea( 'core' )
|
|
44
49
|
).toBe( 'test/sidebar' );
|
|
45
50
|
|
|
46
51
|
registry
|
|
@@ -49,7 +54,7 @@ describe( 'actions', () => {
|
|
|
49
54
|
expect(
|
|
50
55
|
registry
|
|
51
56
|
.select( interfaceStore )
|
|
52
|
-
.getActiveComplementaryArea( 'core
|
|
57
|
+
.getActiveComplementaryArea( 'core' )
|
|
53
58
|
).toBeNull();
|
|
54
59
|
} );
|
|
55
60
|
|
|
@@ -74,15 +79,11 @@ describe( 'actions', () => {
|
|
|
74
79
|
// Sidebars are pinned by default.
|
|
75
80
|
// @See https://github.com/WordPress/gutenberg/pull/21645
|
|
76
81
|
expect(
|
|
77
|
-
registry
|
|
78
|
-
.select( interfaceStore )
|
|
79
|
-
.isItemPinned( editPostStore.name, 'rigatoni' )
|
|
82
|
+
registry.select( interfaceStore ).isItemPinned( 'core', 'rigatoni' )
|
|
80
83
|
).toBe( false );
|
|
81
84
|
registry.dispatch( editPostStore ).togglePinnedPluginItem( 'rigatoni' );
|
|
82
85
|
expect(
|
|
83
|
-
registry
|
|
84
|
-
.select( interfaceStore )
|
|
85
|
-
.isItemPinned( editPostStore.name, 'rigatoni' )
|
|
86
|
+
registry.select( interfaceStore ).isItemPinned( 'core', 'rigatoni' )
|
|
86
87
|
).toBe( true );
|
|
87
88
|
} );
|
|
88
89
|
|
package/src/style.scss
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
@import "../../interface/src/style.scss";
|
|
2
1
|
@import "./components/header/style.scss";
|
|
3
2
|
@import "./components/header/fullscreen-mode-close/style.scss";
|
|
4
|
-
@import "./components/keyboard-shortcut-help-modal/style.scss";
|
|
5
3
|
@import "./components/layout/style.scss";
|
|
6
4
|
@import "./components/meta-boxes/meta-boxes-area/style.scss";
|
|
7
5
|
@import "./components/sidebar/style.scss";
|
|
@@ -11,7 +9,6 @@
|
|
|
11
9
|
@import "./components/text-editor/style.scss";
|
|
12
10
|
@import "./components/visual-editor/style.scss";
|
|
13
11
|
@import "./components/welcome-guide/style.scss";
|
|
14
|
-
@import "./components/start-page-options/style.scss";
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
* Animations
|
|
@@ -44,7 +41,7 @@ body.js.block-editor-page {
|
|
|
44
41
|
// Target the editor UI excluding the visual editor contents, metaboxes and custom fields areas.
|
|
45
42
|
.edit-post-header,
|
|
46
43
|
.edit-post-text-editor,
|
|
47
|
-
.
|
|
44
|
+
.editor-sidebar,
|
|
48
45
|
.editor-post-publish-panel {
|
|
49
46
|
@include reset;
|
|
50
47
|
}
|
|
@@ -77,18 +74,3 @@ body.js.block-editor-page {
|
|
|
77
74
|
}
|
|
78
75
|
|
|
79
76
|
@include wordpress-admin-schemes();
|
|
80
|
-
|
|
81
|
-
// The edit-site package adds or removes the sidebar when it's opened or closed.
|
|
82
|
-
// The edit-post package, however, always has the sidebar in the canvas.
|
|
83
|
-
// These edit-post specific rules ensures there isn't a border on the right of
|
|
84
|
-
// the canvas when a sidebar is visually closed.
|
|
85
|
-
.interface-interface-skeleton__sidebar {
|
|
86
|
-
border-left: none;
|
|
87
|
-
|
|
88
|
-
.is-sidebar-opened & {
|
|
89
|
-
@include break-medium() {
|
|
90
|
-
border-left: $border-width solid $gray-200;
|
|
91
|
-
overflow: hidden scroll;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _interface = require("@wordpress/interface");
|
|
8
|
-
var _compose = require("@wordpress/compose");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _plugins = require("@wordpress/plugins");
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
|
|
16
|
-
* The text within the component appears as the menu item label.
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} props Component properties.
|
|
19
|
-
* @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
|
|
20
|
-
* @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 to the left of the menu item label.
|
|
21
|
-
* @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
|
|
22
|
-
* @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```js
|
|
26
|
-
* // Using ES5 syntax
|
|
27
|
-
* var __ = wp.i18n.__;
|
|
28
|
-
* var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;
|
|
29
|
-
* var moreIcon = React.createElement( 'svg' ); //... svg element.
|
|
30
|
-
*
|
|
31
|
-
* function onButtonClick() {
|
|
32
|
-
* alert( 'Button clicked.' );
|
|
33
|
-
* }
|
|
34
|
-
*
|
|
35
|
-
* function MyButtonMoreMenuItem() {
|
|
36
|
-
* return React.createElement(
|
|
37
|
-
* PluginMoreMenuItem,
|
|
38
|
-
* {
|
|
39
|
-
* icon: moreIcon,
|
|
40
|
-
* onClick: onButtonClick,
|
|
41
|
-
* },
|
|
42
|
-
* __( 'My button title' )
|
|
43
|
-
* );
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```jsx
|
|
49
|
-
* // Using ESNext syntax
|
|
50
|
-
* import { __ } from '@wordpress/i18n';
|
|
51
|
-
* import { PluginMoreMenuItem } from '@wordpress/edit-post';
|
|
52
|
-
* import { more } from '@wordpress/icons';
|
|
53
|
-
*
|
|
54
|
-
* function onButtonClick() {
|
|
55
|
-
* alert( 'Button clicked.' );
|
|
56
|
-
* }
|
|
57
|
-
*
|
|
58
|
-
* const MyButtonMoreMenuItem = () => (
|
|
59
|
-
* <PluginMoreMenuItem
|
|
60
|
-
* icon={ more }
|
|
61
|
-
* onClick={ onButtonClick }
|
|
62
|
-
* >
|
|
63
|
-
* { __( 'My button title' ) }
|
|
64
|
-
* </PluginMoreMenuItem>
|
|
65
|
-
* );
|
|
66
|
-
* ```
|
|
67
|
-
*
|
|
68
|
-
* @return {Component} The component to be rendered.
|
|
69
|
-
*/
|
|
70
|
-
var _default = exports.default = (0, _compose.compose)((0, _plugins.withPluginContext)((context, ownProps) => {
|
|
71
|
-
var _ownProps$as;
|
|
72
|
-
return {
|
|
73
|
-
as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : _components.MenuItem,
|
|
74
|
-
icon: ownProps.icon || context.icon,
|
|
75
|
-
name: 'core/edit-post/plugin-more-menu'
|
|
76
|
-
};
|
|
77
|
-
}))(_interface.ActionItem);
|
|
78
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_interface","require","_compose","_components","_plugins","_default","exports","default","compose","withPluginContext","context","ownProps","_ownProps$as","as","MenuItem","icon","name","ActionItem"],"sources":["@wordpress/edit-post/src/components/header/plugin-more-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ActionItem } from '@wordpress/interface';\nimport { compose } from '@wordpress/compose';\nimport { MenuItem } from '@wordpress/components';\nimport { withPluginContext } from '@wordpress/plugins';\n\n/**\n * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.\n * The text within the component appears as the menu item label.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.\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 to the left of the menu item label.\n * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.\n * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;\n * var moreIcon = React.createElement( 'svg' ); //... svg element.\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * function MyButtonMoreMenuItem() {\n * \treturn React.createElement(\n * \t\tPluginMoreMenuItem,\n * \t\t{\n * \t\t\ticon: moreIcon,\n * \t\t\tonClick: onButtonClick,\n * \t\t},\n * \t\t__( 'My button title' )\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginMoreMenuItem } from '@wordpress/edit-post';\n * import { more } from '@wordpress/icons';\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * const MyButtonMoreMenuItem = () => (\n * \t<PluginMoreMenuItem\n * \t\ticon={ more }\n * \t\tonClick={ onButtonClick }\n * \t>\n * \t\t{ __( 'My button title' ) }\n * \t</PluginMoreMenuItem>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nexport default compose(\n\twithPluginContext( ( context, ownProps ) => {\n\t\treturn {\n\t\t\tas: ownProps.as ?? MenuItem,\n\t\t\ticon: ownProps.icon || context.icon,\n\t\t\tname: 'core/edit-post/plugin-more-menu',\n\t\t};\n\t} )\n)( ActionItem );\n"],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AANA;AACA;AACA;AAMA;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;AAvDA,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAwDe,IAAAC,gBAAO,EACrB,IAAAC,0BAAiB,EAAE,CAAEC,OAAO,EAAEC,QAAQ,KAAM;EAAA,IAAAC,YAAA;EAC3C,OAAO;IACNC,EAAE,GAAAD,YAAA,GAAED,QAAQ,CAACE,EAAE,cAAAD,YAAA,cAAAA,YAAA,GAAIE,oBAAQ;IAC3BC,IAAI,EAAEJ,QAAQ,CAACI,IAAI,IAAIL,OAAO,CAACK,IAAI;IACnCC,IAAI,EAAE;EACP,CAAC;AACF,CAAE,CACH,CAAC,CAAEC,qBAAW,CAAC"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = PluginSidebarMoreMenuItem;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _interface = require("@wordpress/interface");
|
|
9
|
-
/**
|
|
10
|
-
* WordPress dependencies
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Renders a menu item in `Plugins` group in `More Menu` drop down,
|
|
15
|
-
* and can be used to activate the corresponding `PluginSidebar` component.
|
|
16
|
-
* The text within the component appears as the menu item label.
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} props Component props.
|
|
19
|
-
* @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
|
|
20
|
-
* @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 to the left of the menu item label.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```js
|
|
24
|
-
* // Using ES5 syntax
|
|
25
|
-
* var __ = wp.i18n.__;
|
|
26
|
-
* var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
|
|
27
|
-
* var moreIcon = React.createElement( 'svg' ); //... svg element.
|
|
28
|
-
*
|
|
29
|
-
* function MySidebarMoreMenuItem() {
|
|
30
|
-
* return React.createElement(
|
|
31
|
-
* PluginSidebarMoreMenuItem,
|
|
32
|
-
* {
|
|
33
|
-
* target: 'my-sidebar',
|
|
34
|
-
* icon: moreIcon,
|
|
35
|
-
* },
|
|
36
|
-
* __( 'My sidebar title' )
|
|
37
|
-
* )
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```jsx
|
|
43
|
-
* // Using ESNext syntax
|
|
44
|
-
* import { __ } from '@wordpress/i18n';
|
|
45
|
-
* import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
|
|
46
|
-
* import { more } from '@wordpress/icons';
|
|
47
|
-
*
|
|
48
|
-
* const MySidebarMoreMenuItem = () => (
|
|
49
|
-
* <PluginSidebarMoreMenuItem
|
|
50
|
-
* target="my-sidebar"
|
|
51
|
-
* icon={ more }
|
|
52
|
-
* >
|
|
53
|
-
* { __( 'My sidebar title' ) }
|
|
54
|
-
* </PluginSidebarMoreMenuItem>
|
|
55
|
-
* );
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* @return {Component} The component to be rendered.
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
function PluginSidebarMoreMenuItem(props) {
|
|
62
|
-
return (0, _react.createElement)(_interface.ComplementaryAreaMoreMenuItem
|
|
63
|
-
// Menu item is marked with unstable prop for backward compatibility.
|
|
64
|
-
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
65
|
-
, {
|
|
66
|
-
__unstableExplicitMenuItem: true,
|
|
67
|
-
scope: "core/edit-post",
|
|
68
|
-
...props
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_interface","require","PluginSidebarMoreMenuItem","props","_react","createElement","ComplementaryAreaMoreMenuItem","__unstableExplicitMenuItem","scope"],"sources":["@wordpress/edit-post/src/components/header/plugin-sidebar-more-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ComplementaryAreaMoreMenuItem } from '@wordpress/interface';\n\n/**\n * Renders a menu item in `Plugins` group in `More Menu` drop down,\n * and can be used to activate the corresponding `PluginSidebar` component.\n * The text within the component appears as the menu item label.\n *\n * @param {Object} props Component props.\n * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.\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 to the left of the menu item label.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;\n * var moreIcon = React.createElement( 'svg' ); //... svg element.\n *\n * function MySidebarMoreMenuItem() {\n * \treturn React.createElement(\n * \t\tPluginSidebarMoreMenuItem,\n * \t\t{\n * \t\t\ttarget: 'my-sidebar',\n * \t\t\ticon: moreIcon,\n * \t\t},\n * \t\t__( 'My sidebar title' )\n * \t)\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';\n * import { more } from '@wordpress/icons';\n *\n * const MySidebarMoreMenuItem = () => (\n * \t<PluginSidebarMoreMenuItem\n * \t\ttarget=\"my-sidebar\"\n * \t\ticon={ more }\n * \t>\n * \t\t{ __( 'My sidebar title' ) }\n * \t</PluginSidebarMoreMenuItem>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\n\nexport default function PluginSidebarMoreMenuItem( props ) {\n\treturn (\n\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t// Menu item is marked with unstable prop for backward compatibility.\n\t\t\t// @see https://github.com/WordPress/gutenberg/issues/14457\n\t\t\t__unstableExplicitMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;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;;AAEe,SAASC,yBAAyBA,CAAEC,KAAK,EAAG;EAC1D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACL,UAAA,CAAAM;EACA;EACA;EAAA;IACAC,0BAA0B;IAC1BC,KAAK,EAAC,gBAAgB;IAAA,GACjBL;EAAK,CACV,CAAC;AAEJ"}
|