@wordpress/edit-post 7.32.0 → 7.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +4 -196
- 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 +4 -4
- 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 +7 -6
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +9 -6
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/preferences-menu-item/index.js +12 -4
- package/build/components/header/preferences-menu-item/index.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -36
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +12 -20
- 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/enable-publish-sidebar.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -21
- 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/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.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 +9 -9
- 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 +37 -40
- 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/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 +4 -8
- 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/plugins/copy-content-menu-item/index.js.map +1 -1
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +7 -4
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item/index.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 +3 -3
- 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 +5 -4
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +9 -6
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/preferences-menu-item/index.js +11 -3
- package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -36
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +11 -19
- 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/enable-publish-sidebar.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -20
- 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/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.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 +9 -10
- 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 +38 -41
- 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/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 +5 -5
- 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/plugins/copy-content-menu-item/index.js.map +1 -1
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +6 -3
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item/index.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 +12 -448
- package/build-style/style.css +12 -448
- 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 +2 -3
- package/src/components/header/index.native.js +1 -1
- package/src/components/header/more-menu/index.js +3 -4
- package/src/components/header/post-publish-button-or-toggle.js +8 -3
- package/src/components/header/preferences-menu-item/index.js +9 -3
- package/src/components/header/style.scss +5 -3
- package/src/components/header/test/index.js +13 -1
- package/src/components/keyboard-shortcuts/index.js +3 -44
- package/src/components/layout/index.js +14 -41
- package/src/components/preferences-modal/index.js +1 -24
- package/src/components/sidebar/post-status/index.js +6 -9
- package/src/components/sidebar/settings-sidebar/index.js +62 -58
- 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/editor.js +2 -2
- package/src/hooks/commands/use-common-commands.js +11 -26
- package/src/index.js +8 -4
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +5 -3
- 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/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/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-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-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/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/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-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/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/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/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-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
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* External dependencies
|
|
4
|
-
*/
|
|
5
|
-
import classnames from 'classnames';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { Modal } from '@wordpress/components';
|
|
11
|
-
import { __ } from '@wordpress/i18n';
|
|
12
|
-
import { useShortcut, store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
13
|
-
import { withSelect, withDispatch, useSelect } from '@wordpress/data';
|
|
14
|
-
import { compose } from '@wordpress/compose';
|
|
15
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
import { textFormattingShortcuts } from './config';
|
|
21
|
-
import Shortcut from './shortcut';
|
|
22
|
-
import DynamicShortcut from './dynamic-shortcut';
|
|
23
|
-
export const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'edit-post/keyboard-shortcut-help';
|
|
24
|
-
const ShortcutList = ({
|
|
25
|
-
shortcuts
|
|
26
|
-
}) =>
|
|
27
|
-
/*
|
|
28
|
-
* Disable reason: The `list` ARIA role is redundant but
|
|
29
|
-
* Safari+VoiceOver won't announce the list otherwise.
|
|
30
|
-
*/
|
|
31
|
-
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
32
|
-
createElement("ul", {
|
|
33
|
-
className: "edit-post-keyboard-shortcut-help-modal__shortcut-list",
|
|
34
|
-
role: "list"
|
|
35
|
-
}, shortcuts.map((shortcut, index) => createElement("li", {
|
|
36
|
-
className: "edit-post-keyboard-shortcut-help-modal__shortcut",
|
|
37
|
-
key: index
|
|
38
|
-
}, typeof shortcut === 'string' ? createElement(DynamicShortcut, {
|
|
39
|
-
name: shortcut
|
|
40
|
-
}) : createElement(Shortcut, {
|
|
41
|
-
...shortcut
|
|
42
|
-
}))))
|
|
43
|
-
/* eslint-enable jsx-a11y/no-redundant-roles */;
|
|
44
|
-
const ShortcutSection = ({
|
|
45
|
-
title,
|
|
46
|
-
shortcuts,
|
|
47
|
-
className
|
|
48
|
-
}) => createElement("section", {
|
|
49
|
-
className: classnames('edit-post-keyboard-shortcut-help-modal__section', className)
|
|
50
|
-
}, !!title && createElement("h2", {
|
|
51
|
-
className: "edit-post-keyboard-shortcut-help-modal__section-title"
|
|
52
|
-
}, title), createElement(ShortcutList, {
|
|
53
|
-
shortcuts: shortcuts
|
|
54
|
-
}));
|
|
55
|
-
const ShortcutCategorySection = ({
|
|
56
|
-
title,
|
|
57
|
-
categoryName,
|
|
58
|
-
additionalShortcuts = []
|
|
59
|
-
}) => {
|
|
60
|
-
const categoryShortcuts = useSelect(select => {
|
|
61
|
-
return select(keyboardShortcutsStore).getCategoryShortcuts(categoryName);
|
|
62
|
-
}, [categoryName]);
|
|
63
|
-
return createElement(ShortcutSection, {
|
|
64
|
-
title: title,
|
|
65
|
-
shortcuts: categoryShortcuts.concat(additionalShortcuts)
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
export function KeyboardShortcutHelpModal({
|
|
69
|
-
isModalActive,
|
|
70
|
-
toggleModal
|
|
71
|
-
}) {
|
|
72
|
-
useShortcut('core/edit-post/keyboard-shortcuts', toggleModal);
|
|
73
|
-
if (!isModalActive) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
return createElement(Modal, {
|
|
77
|
-
className: "edit-post-keyboard-shortcut-help-modal",
|
|
78
|
-
title: __('Keyboard shortcuts'),
|
|
79
|
-
closeButtonLabel: __('Close'),
|
|
80
|
-
onRequestClose: toggleModal
|
|
81
|
-
}, createElement(ShortcutSection, {
|
|
82
|
-
className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts",
|
|
83
|
-
shortcuts: ['core/edit-post/keyboard-shortcuts']
|
|
84
|
-
}), createElement(ShortcutCategorySection, {
|
|
85
|
-
title: __('Global shortcuts'),
|
|
86
|
-
categoryName: "global"
|
|
87
|
-
}), createElement(ShortcutCategorySection, {
|
|
88
|
-
title: __('Selection shortcuts'),
|
|
89
|
-
categoryName: "selection"
|
|
90
|
-
}), createElement(ShortcutCategorySection, {
|
|
91
|
-
title: __('Block shortcuts'),
|
|
92
|
-
categoryName: "block",
|
|
93
|
-
additionalShortcuts: [{
|
|
94
|
-
keyCombination: {
|
|
95
|
-
character: '/'
|
|
96
|
-
},
|
|
97
|
-
description: __('Change the block type after adding a new paragraph.'),
|
|
98
|
-
/* translators: The forward-slash character. e.g. '/'. */
|
|
99
|
-
ariaLabel: __('Forward-slash')
|
|
100
|
-
}]
|
|
101
|
-
}), createElement(ShortcutSection, {
|
|
102
|
-
title: __('Text formatting'),
|
|
103
|
-
shortcuts: textFormattingShortcuts
|
|
104
|
-
}), createElement(ShortcutCategorySection, {
|
|
105
|
-
title: __('List View shortcuts'),
|
|
106
|
-
categoryName: "list-view"
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
export default compose([withSelect(select => ({
|
|
110
|
-
isModalActive: select(interfaceStore).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME)
|
|
111
|
-
})), withDispatch((dispatch, {
|
|
112
|
-
isModalActive
|
|
113
|
-
}) => {
|
|
114
|
-
const {
|
|
115
|
-
openModal,
|
|
116
|
-
closeModal
|
|
117
|
-
} = dispatch(interfaceStore);
|
|
118
|
-
return {
|
|
119
|
-
toggleModal: () => isModalActive ? closeModal() : openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME)
|
|
120
|
-
};
|
|
121
|
-
})])(KeyboardShortcutHelpModal);
|
|
122
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","Modal","__","useShortcut","store","keyboardShortcutsStore","withSelect","withDispatch","useSelect","compose","interfaceStore","textFormattingShortcuts","Shortcut","DynamicShortcut","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","ShortcutList","shortcuts","createElement","className","role","map","shortcut","index","key","name","ShortcutSection","title","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","select","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","closeButtonLabel","onRequestClose","keyCombination","character","description","ariaLabel","dispatch","openModal","closeModal"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcut-help-modal/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { withSelect, withDispatch, useSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { textFormattingShortcuts } from './config';\nimport Shortcut from './shortcut';\nimport DynamicShortcut from './dynamic-shortcut';\n\nexport const KEYBOARD_SHORTCUT_HELP_MODAL_NAME =\n\t'edit-post/keyboard-shortcut-help';\n\nconst ShortcutList = ( { shortcuts } ) => (\n\t/*\n\t * Disable reason: The `list` ARIA role is redundant but\n\t * Safari+VoiceOver won't announce the list otherwise.\n\t */\n\t/* eslint-disable jsx-a11y/no-redundant-roles */\n\t<ul\n\t\tclassName=\"edit-post-keyboard-shortcut-help-modal__shortcut-list\"\n\t\trole=\"list\"\n\t>\n\t\t{ shortcuts.map( ( shortcut, index ) => (\n\t\t\t<li\n\t\t\t\tclassName=\"edit-post-keyboard-shortcut-help-modal__shortcut\"\n\t\t\t\tkey={ index }\n\t\t\t>\n\t\t\t\t{ typeof shortcut === 'string' ? (\n\t\t\t\t\t<DynamicShortcut name={ shortcut } />\n\t\t\t\t) : (\n\t\t\t\t\t<Shortcut { ...shortcut } />\n\t\t\t\t) }\n\t\t\t</li>\n\t\t) ) }\n\t</ul>\n\t/* eslint-enable jsx-a11y/no-redundant-roles */\n);\n\nconst ShortcutSection = ( { title, shortcuts, className } ) => (\n\t<section\n\t\tclassName={ classnames(\n\t\t\t'edit-post-keyboard-shortcut-help-modal__section',\n\t\t\tclassName\n\t\t) }\n\t>\n\t\t{ !! title && (\n\t\t\t<h2 className=\"edit-post-keyboard-shortcut-help-modal__section-title\">\n\t\t\t\t{ title }\n\t\t\t</h2>\n\t\t) }\n\t\t<ShortcutList shortcuts={ shortcuts } />\n\t</section>\n);\n\nconst ShortcutCategorySection = ( {\n\ttitle,\n\tcategoryName,\n\tadditionalShortcuts = [],\n} ) => {\n\tconst categoryShortcuts = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( keyboardShortcutsStore ).getCategoryShortcuts(\n\t\t\t\tcategoryName\n\t\t\t);\n\t\t},\n\t\t[ categoryName ]\n\t);\n\n\treturn (\n\t\t<ShortcutSection\n\t\t\ttitle={ title }\n\t\t\tshortcuts={ categoryShortcuts.concat( additionalShortcuts ) }\n\t\t/>\n\t);\n};\n\nexport function KeyboardShortcutHelpModal( { isModalActive, toggleModal } ) {\n\tuseShortcut( 'core/edit-post/keyboard-shortcuts', toggleModal );\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-post-keyboard-shortcut-help-modal\"\n\t\t\ttitle={ __( 'Keyboard shortcuts' ) }\n\t\t\tcloseButtonLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ toggleModal }\n\t\t>\n\t\t\t<ShortcutSection\n\t\t\t\tclassName=\"edit-post-keyboard-shortcut-help-modal__main-shortcuts\"\n\t\t\t\tshortcuts={ [ 'core/edit-post/keyboard-shortcuts' ] }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Global shortcuts' ) }\n\t\t\t\tcategoryName=\"global\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Selection shortcuts' ) }\n\t\t\t\tcategoryName=\"selection\"\n\t\t\t/>\n\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'Block shortcuts' ) }\n\t\t\t\tcategoryName=\"block\"\n\t\t\t\tadditionalShortcuts={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tkeyCombination: { character: '/' },\n\t\t\t\t\t\tdescription: __(\n\t\t\t\t\t\t\t'Change the block type after adding a new paragraph.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t/* translators: The forward-slash character. e.g. '/'. */\n\t\t\t\t\t\tariaLabel: __( 'Forward-slash' ),\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t\t<ShortcutSection\n\t\t\t\ttitle={ __( 'Text formatting' ) }\n\t\t\t\tshortcuts={ textFormattingShortcuts }\n\t\t\t/>\n\t\t\t<ShortcutCategorySection\n\t\t\t\ttitle={ __( 'List View shortcuts' ) }\n\t\t\t\tcategoryName=\"list-view\"\n\t\t\t/>\n\t\t</Modal>\n\t);\n}\n\nexport default compose( [\n\twithSelect( ( select ) => ( {\n\t\tisModalActive: select( interfaceStore ).isModalActive(\n\t\t\tKEYBOARD_SHORTCUT_HELP_MODAL_NAME\n\t\t),\n\t} ) ),\n\twithDispatch( ( dispatch, { isModalActive } ) => {\n\t\tconst { openModal, closeModal } = dispatch( interfaceStore );\n\n\t\treturn {\n\t\t\ttoggleModal: () =>\n\t\t\t\tisModalActive\n\t\t\t\t\t? closeModal()\n\t\t\t\t\t: openModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME ),\n\t\t};\n\t} ),\n] )( KeyboardShortcutHelpModal );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,EACXC,KAAK,IAAIC,sBAAsB,QACzB,+BAA+B;AACtC,SAASC,UAAU,EAAEC,YAAY,EAAEC,SA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GxB,EAAE,CAAE,iBAAkB,CAAG;IACjCc,SAAS,EAAGL;EAAyB,CACrC,CAAC,EACFM,aAAA,CAACU,uBAAuB;IACvBD,KAAK,EAAGxB,EAAE,CAAE,qBAAsB,CAAG;IACrC0B,YAAY,EAAC;EAAW,CACxB,CACK,CAAC;AAEV;AAEA,eAAenB,OAAO,CAAE,CACvBH,UAAU,CAAIyB,MAAM,KAAQ;EAC3BI,aAAa,EAAEJ,MAAM,CAAErB,cAAe,CAAC,CAACyB,aAAa,CACpDrB,iCACD;AACD,CAAC,CAAG,CAAC,EACLP,YAAY,CAAE,CAAEoC,QAAQ,EAAE;EAAER;AAAc,CAAC,KAAM;EAChD,MAAM;IAAES,SAAS;IAAEC;EAAW,CAAC,GAAGF,QAAQ,CAAEjC,cAAe,CAAC;EAE5D,OAAO;IACN0B,WAAW,EAAEA,CAAA,KACZD,aAAa,GACVU,UAAU,CAAC,CAAC,GACZD,SAAS,CAAE9B,iCAAkC;EAClD,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAEoB,yBAA0B,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { Fragment } from '@wordpress/element';
|
|
6
|
-
import { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';
|
|
7
|
-
function KeyCombination({
|
|
8
|
-
keyCombination,
|
|
9
|
-
forceAriaLabel
|
|
10
|
-
}) {
|
|
11
|
-
const shortcut = keyCombination.modifier ? displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
|
|
12
|
-
const ariaLabel = keyCombination.modifier ? shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
|
|
13
|
-
return createElement("kbd", {
|
|
14
|
-
className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination",
|
|
15
|
-
"aria-label": forceAriaLabel || ariaLabel
|
|
16
|
-
}, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => {
|
|
17
|
-
if (character === '+') {
|
|
18
|
-
return createElement(Fragment, {
|
|
19
|
-
key: index
|
|
20
|
-
}, character);
|
|
21
|
-
}
|
|
22
|
-
return createElement("kbd", {
|
|
23
|
-
key: index,
|
|
24
|
-
className: "edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
25
|
-
}, character);
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
function Shortcut({
|
|
29
|
-
description,
|
|
30
|
-
keyCombination,
|
|
31
|
-
aliases = [],
|
|
32
|
-
ariaLabel
|
|
33
|
-
}) {
|
|
34
|
-
return createElement(Fragment, null, createElement("div", {
|
|
35
|
-
className: "edit-post-keyboard-shortcut-help-modal__shortcut-description"
|
|
36
|
-
}, description), createElement("div", {
|
|
37
|
-
className: "edit-post-keyboard-shortcut-help-modal__shortcut-term"
|
|
38
|
-
}, createElement(KeyCombination, {
|
|
39
|
-
keyCombination: keyCombination,
|
|
40
|
-
forceAriaLabel: ariaLabel
|
|
41
|
-
}), aliases.map((alias, index) => createElement(KeyCombination, {
|
|
42
|
-
keyCombination: alias,
|
|
43
|
-
forceAriaLabel: ariaLabel,
|
|
44
|
-
key: index
|
|
45
|
-
}))));
|
|
46
|
-
}
|
|
47
|
-
export default Shortcut;
|
|
48
|
-
//# sourceMappingURL=shortcut.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Fragment","displayShortcutList","shortcutAriaLabel","KeyCombination","keyCombination","forceAriaLabel","shortcut","modifier","character","ariaLabel","createElement","className","Array","isArray","map","index","key","Shortcut","description","aliases","alias"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcut-help-modal/shortcut.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';\n\nfunction KeyCombination( { keyCombination, forceAriaLabel } ) {\n\tconst shortcut = keyCombination.modifier\n\t\t? displayShortcutList[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\tconst ariaLabel = keyCombination.modifier\n\t\t? shortcutAriaLabel[ keyCombination.modifier ](\n\t\t\t\tkeyCombination.character\n\t\t )\n\t\t: keyCombination.character;\n\n\treturn (\n\t\t<kbd\n\t\t\tclassName=\"edit-post-keyboard-shortcut-help-modal__shortcut-key-combination\"\n\t\t\taria-label={ forceAriaLabel || ariaLabel }\n\t\t>\n\t\t\t{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(\n\t\t\t\t( character, index ) => {\n\t\t\t\t\tif ( character === '+' ) {\n\t\t\t\t\t\treturn <Fragment key={ index }>{ character }</Fragment>;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<kbd\n\t\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t\t\tclassName=\"edit-post-keyboard-shortcut-help-modal__shortcut-key\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ character }\n\t\t\t\t\t\t</kbd>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</kbd>\n\t);\n}\n\nfunction Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-post-keyboard-shortcut-help-modal__shortcut-description\">\n\t\t\t\t{ description }\n\t\t\t</div>\n\t\t\t<div className=\"edit-post-keyboard-shortcut-help-modal__shortcut-term\">\n\t\t\t\t<KeyCombination\n\t\t\t\t\tkeyCombination={ keyCombination }\n\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t/>\n\t\t\t\t{ aliases.map( ( alias, index ) => (\n\t\t\t\t\t<KeyCombination\n\t\t\t\t\t\tkeyCombination={ alias }\n\t\t\t\t\t\tforceAriaLabel={ ariaLabel }\n\t\t\t\t\t\tkey={ index }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</div>\n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IACdC,cAAc,EAAGA,cAAgB;IACjCC,cAAc,EAAGI;EAAW,CAC5B,CAAC,EACAU,OAAO,CAACL,GAAG,CAAE,CAAEM,KAAK,EAAEL,KAAK,KAC5BL,aAAA,CAACP,cAAc;IACdC,cAAc,EAAGgB,KAAO;IACxBf,cAAc,EAAGI,SAAW;IAC5BO,GAAG,EAAGD;EAAO,CACb,CACA,CACE,CACJ,CAAC;AAEL;AAEA,eAAeE,QAAQ"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Defines as extensibility slot for the Summary panel.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { createSlotFill, PanelRow } from '@wordpress/components';
|
|
10
|
-
const {
|
|
11
|
-
Fill,
|
|
12
|
-
Slot
|
|
13
|
-
} = createSlotFill('PluginPostStatusInfo');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Renders a row in the Summary panel of the Document sidebar.
|
|
17
|
-
* It should be noted that this is named and implemented around the function it serves
|
|
18
|
-
* and not its location, which may change in future iterations.
|
|
19
|
-
*
|
|
20
|
-
* @param {Object} props Component properties.
|
|
21
|
-
* @param {string} [props.className] An optional class name added to the row.
|
|
22
|
-
* @param {Element} props.children Children to be rendered.
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```js
|
|
26
|
-
* // Using ES5 syntax
|
|
27
|
-
* var __ = wp.i18n.__;
|
|
28
|
-
* var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
|
|
29
|
-
*
|
|
30
|
-
* function MyPluginPostStatusInfo() {
|
|
31
|
-
* return React.createElement(
|
|
32
|
-
* PluginPostStatusInfo,
|
|
33
|
-
* {
|
|
34
|
-
* className: 'my-plugin-post-status-info',
|
|
35
|
-
* },
|
|
36
|
-
* __( 'My post status info' )
|
|
37
|
-
* )
|
|
38
|
-
* }
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```jsx
|
|
43
|
-
* // Using ESNext syntax
|
|
44
|
-
* import { __ } from '@wordpress/i18n';
|
|
45
|
-
* import { PluginPostStatusInfo } from '@wordpress/edit-post';
|
|
46
|
-
*
|
|
47
|
-
* const MyPluginPostStatusInfo = () => (
|
|
48
|
-
* <PluginPostStatusInfo
|
|
49
|
-
* className="my-plugin-post-status-info"
|
|
50
|
-
* >
|
|
51
|
-
* { __( 'My post status info' ) }
|
|
52
|
-
* </PluginPostStatusInfo>
|
|
53
|
-
* );
|
|
54
|
-
* ```
|
|
55
|
-
*
|
|
56
|
-
* @return {Component} The component to be rendered.
|
|
57
|
-
*/
|
|
58
|
-
const PluginPostStatusInfo = ({
|
|
59
|
-
children,
|
|
60
|
-
className
|
|
61
|
-
}) => createElement(Fill, null, createElement(PanelRow, {
|
|
62
|
-
className: className
|
|
63
|
-
}, children));
|
|
64
|
-
PluginPostStatusInfo.Slot = Slot;
|
|
65
|
-
export default PluginPostStatusInfo;
|
|
66
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createSlotFill","PanelRow","Fill","Slot","PluginPostStatusInfo","children","className","createElement"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-post-status-info/index.js"],"sourcesContent":["/**\n * Defines as extensibility slot for the Summary panel.\n */\n\n/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelRow } from '@wordpress/components';\n\nconst { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );\n\n/**\n * Renders a row in the Summary panel of the Document sidebar.\n * It should be noted that this is named and implemented around the function it serves\n * and not its location, which may change in future iterations.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {Element} props.children Children to be rendered.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;\n *\n * function MyPluginPostStatusInfo() {\n * \treturn React.createElement(\n * \t\tPluginPostStatusInfo,\n * \t\t{\n * \t\t\tclassName: 'my-plugin-post-status-info',\n * \t\t},\n * \t\t__( 'My post status info' )\n * \t)\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginPostStatusInfo } from '@wordpress/edit-post';\n *\n * const MyPluginPostStatusInfo = () => (\n * \t<PluginPostStatusInfo\n * \t\tclassName=\"my-plugin-post-status-info\"\n * \t>\n * \t\t{ __( 'My post status info' ) }\n * \t</PluginPostStatusInfo>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginPostStatusInfo = ( { children, className } ) => (\n\t<Fill>\n\t\t<PanelRow className={ className }>{ children }</PanelRow>\n\t</Fill>\n);\n\nPluginPostStatusInfo.Slot = Slot;\n\nexport default PluginPostStatusInfo;\n"],"mappings":";AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,QAAQ,QAAQ,uBAAuB;AAEhE,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGH,cAAc,CAAE,sBAAuB,CAAC;;AAE/D;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,MAAMI,oBAAoB,GAAGA,CAAE;EAAEC,QAAQ;EAAEC;AAAU,CAAC,KACrDC,aAAA,CAACL,IAAI,QACJK,aAAA,CAACN,QAAQ;EAACK,SAAS,EAAGA;AAAW,GAAGD,QAAoB,CACnD,CACN;AAEDD,oBAAoB,CAACD,IAAI,GAAGA,IAAI;AAEhC,eAAeC,oBAAoB"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { ComplementaryArea } from '@wordpress/interface';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
9
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
13
|
-
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
14
|
-
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
|
|
15
|
-
*
|
|
16
|
-
* ```js
|
|
17
|
-
* wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @see PluginSidebarMoreMenuItem
|
|
21
|
-
*
|
|
22
|
-
* @param {Object} props Element props.
|
|
23
|
-
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
|
|
24
|
-
* @param {string} [props.className] An optional class name added to the sidebar body.
|
|
25
|
-
* @param {string} props.title Title displayed at the top of the sidebar.
|
|
26
|
-
* @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
|
|
27
|
-
* @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.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```js
|
|
31
|
-
* // Using ES5 syntax
|
|
32
|
-
* var __ = wp.i18n.__;
|
|
33
|
-
* var el = React.createElement;
|
|
34
|
-
* var PanelBody = wp.components.PanelBody;
|
|
35
|
-
* var PluginSidebar = wp.editPost.PluginSidebar;
|
|
36
|
-
* var moreIcon = React.createElement( 'svg' ); //... svg element.
|
|
37
|
-
*
|
|
38
|
-
* function MyPluginSidebar() {
|
|
39
|
-
* return el(
|
|
40
|
-
* PluginSidebar,
|
|
41
|
-
* {
|
|
42
|
-
* name: 'my-sidebar',
|
|
43
|
-
* title: 'My sidebar title',
|
|
44
|
-
* icon: moreIcon,
|
|
45
|
-
* },
|
|
46
|
-
* el(
|
|
47
|
-
* PanelBody,
|
|
48
|
-
* {},
|
|
49
|
-
* __( 'My sidebar content' )
|
|
50
|
-
* )
|
|
51
|
-
* );
|
|
52
|
-
* }
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```jsx
|
|
57
|
-
* // Using ESNext syntax
|
|
58
|
-
* import { __ } from '@wordpress/i18n';
|
|
59
|
-
* import { PanelBody } from '@wordpress/components';
|
|
60
|
-
* import { PluginSidebar } from '@wordpress/edit-post';
|
|
61
|
-
* import { more } from '@wordpress/icons';
|
|
62
|
-
*
|
|
63
|
-
* const MyPluginSidebar = () => (
|
|
64
|
-
* <PluginSidebar
|
|
65
|
-
* name="my-sidebar"
|
|
66
|
-
* title="My sidebar title"
|
|
67
|
-
* icon={ more }
|
|
68
|
-
* >
|
|
69
|
-
* <PanelBody>
|
|
70
|
-
* { __( 'My sidebar content' ) }
|
|
71
|
-
* </PanelBody>
|
|
72
|
-
* </PluginSidebar>
|
|
73
|
-
* );
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
export default function PluginSidebarEditPost({
|
|
77
|
-
className,
|
|
78
|
-
...props
|
|
79
|
-
}) {
|
|
80
|
-
const {
|
|
81
|
-
postTitle,
|
|
82
|
-
shortcut
|
|
83
|
-
} = useSelect(select => {
|
|
84
|
-
return {
|
|
85
|
-
postTitle: select(editorStore).getEditedPostAttribute('title'),
|
|
86
|
-
shortcut: select(keyboardShortcutsStore).getShortcutRepresentation('core/edit-post/toggle-sidebar')
|
|
87
|
-
};
|
|
88
|
-
}, []);
|
|
89
|
-
return createElement(ComplementaryArea, {
|
|
90
|
-
panelClassName: className,
|
|
91
|
-
className: "edit-post-sidebar",
|
|
92
|
-
smallScreenTitle: postTitle || __('(no title)'),
|
|
93
|
-
scope: "core/edit-post",
|
|
94
|
-
toggleShortcut: shortcut,
|
|
95
|
-
...props
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["ComplementaryArea","useSelect","__","store","keyboardShortcutsStore","editorStore","PluginSidebarEditPost","className","props","postTitle","shortcut","select","getEditedPostAttribute","getShortcutRepresentation","createElement","panelClassName","smallScreenTitle","scope","toggleShortcut"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\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 *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = React.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editPost.PluginSidebar;\n * var moreIcon = React.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/edit-post';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebarEditPost( { className, ...props } ) {\n\tconst { postTitle, shortcut } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostTitle: select( editorStore ).getEditedPostAttribute( 'title' ),\n\t\t\tshortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"edit-post-sidebar\"\n\t\t\tsmallScreenTitle={ postTitle || __( '(no title)' ) }\n\t\t\tscope=\"core/edit-post\"\n\t\t\ttoggleShortcut={ shortcut }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;;AAExD;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,qBAAqBA,CAAE;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EACxE,MAAM;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAGT,SAAS,CAAIU,MAAM,IAAM;IACxD,OAAO;MACNF,SAAS,EAAEE,MAAM,CAAEN,WAAY,CAAC,CAACO,sBAAsB,CAAE,OAAQ,CAAC;MAClEF,QAAQ,EAAEC,MAAM,CACfP,sBACD,CAAC,CAACS,yBAAyB,CAAE,+BAAgC;IAC9D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OACCC,aAAA,CAACd,iBAAiB;IACjBe,cAAc,EAAGR,SAAW;IAC5BA,SAAS,EAAC,mBAAmB;IAC7BS,gBAAgB,EAAGP,SAAS,IAAIP,EAAE,CAAE,YAAa,CAAG;IACpDe,KAAK,EAAC,gBAAgB;IACtBC,cAAc,EAAGR,QAAU;IAAA,GACtBF;EAAK,CACV,CAAC;AAEJ"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { Modal } from '@wordpress/components';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
8
|
-
import { store as blockEditorStore, __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';
|
|
9
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
-
import { useAsyncList } from '@wordpress/compose';
|
|
11
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { store as editPostStore } from '../../store';
|
|
17
|
-
function useStartPatterns() {
|
|
18
|
-
// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
|
|
19
|
-
// and it has no postTypes declared and the current post type is page or if
|
|
20
|
-
// the current post type is part of the postTypes declared.
|
|
21
|
-
const {
|
|
22
|
-
blockPatternsWithPostContentBlockType,
|
|
23
|
-
postType
|
|
24
|
-
} = useSelect(select => {
|
|
25
|
-
const {
|
|
26
|
-
getPatternsByBlockTypes
|
|
27
|
-
} = select(blockEditorStore);
|
|
28
|
-
const {
|
|
29
|
-
getCurrentPostType
|
|
30
|
-
} = select(editorStore);
|
|
31
|
-
return {
|
|
32
|
-
blockPatternsWithPostContentBlockType: getPatternsByBlockTypes('core/post-content'),
|
|
33
|
-
postType: getCurrentPostType()
|
|
34
|
-
};
|
|
35
|
-
}, []);
|
|
36
|
-
return useMemo(() => {
|
|
37
|
-
// filter patterns without postTypes declared if the current postType is page
|
|
38
|
-
// or patterns that declare the current postType in its post type array.
|
|
39
|
-
return blockPatternsWithPostContentBlockType.filter(pattern => {
|
|
40
|
-
return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType);
|
|
41
|
-
});
|
|
42
|
-
}, [postType, blockPatternsWithPostContentBlockType]);
|
|
43
|
-
}
|
|
44
|
-
function PatternSelection({
|
|
45
|
-
blockPatterns,
|
|
46
|
-
onChoosePattern
|
|
47
|
-
}) {
|
|
48
|
-
const shownBlockPatterns = useAsyncList(blockPatterns);
|
|
49
|
-
const {
|
|
50
|
-
resetEditorBlocks
|
|
51
|
-
} = useDispatch(editorStore);
|
|
52
|
-
return createElement(BlockPatternsList, {
|
|
53
|
-
blockPatterns: blockPatterns,
|
|
54
|
-
shownPatterns: shownBlockPatterns,
|
|
55
|
-
onClickPattern: (_pattern, blocks) => {
|
|
56
|
-
resetEditorBlocks(blocks);
|
|
57
|
-
onChoosePattern();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function StartPageOptionsModal({
|
|
62
|
-
onClose
|
|
63
|
-
}) {
|
|
64
|
-
const startPatterns = useStartPatterns();
|
|
65
|
-
const hasStartPattern = startPatterns.length > 0;
|
|
66
|
-
if (!hasStartPattern) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
return createElement(Modal, {
|
|
70
|
-
className: "edit-post-start-page-options__modal",
|
|
71
|
-
title: __('Choose a pattern'),
|
|
72
|
-
isFullScreen: true,
|
|
73
|
-
onRequestClose: onClose
|
|
74
|
-
}, createElement("div", {
|
|
75
|
-
className: "edit-post-start-page-options__modal-content"
|
|
76
|
-
}, createElement(PatternSelection, {
|
|
77
|
-
blockPatterns: startPatterns,
|
|
78
|
-
onChoosePattern: onClose
|
|
79
|
-
})));
|
|
80
|
-
}
|
|
81
|
-
export default function StartPageOptions() {
|
|
82
|
-
const [isClosed, setIsClosed] = useState(false);
|
|
83
|
-
const shouldEnableModal = useSelect(select => {
|
|
84
|
-
const {
|
|
85
|
-
isCleanNewPost,
|
|
86
|
-
getRenderingMode
|
|
87
|
-
} = select(editorStore);
|
|
88
|
-
const {
|
|
89
|
-
isFeatureActive
|
|
90
|
-
} = select(editPostStore);
|
|
91
|
-
return getRenderingMode() === 'post-only' && !isFeatureActive('welcomeGuide') && isCleanNewPost();
|
|
92
|
-
}, []);
|
|
93
|
-
if (!shouldEnableModal || isClosed) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return createElement(StartPageOptionsModal, {
|
|
97
|
-
onClose: () => setIsClosed(true)
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Modal","__","useState","useMemo","store","blockEditorStore","__experimentalBlockPatternsList","BlockPatternsList","useSelect","useDispatch","useAsyncList","editorStore","editPostStore","useStartPatterns","blockPatternsWithPostContentBlockType","postType","select","getPatternsByBlockTypes","getCurrentPostType","filter","pattern","postTypes","Array","isArray","includes","PatternSelection","blockPatterns","onChoosePattern","shownBlockPatterns","resetEditorBlocks","createElement","shownPatterns","onClickPattern","_pattern","blocks","StartPageOptionsModal","onClose","startPatterns","hasStartPattern","length","className","title","isFullScreen","onRequestClose","StartPageOptions","isClosed","setIsClosed","shouldEnableModal","isCleanNewPost","getRenderingMode","isFeatureActive"],"sources":["@wordpress/edit-post/src/components/start-page-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockPatternsList as BlockPatternsList,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nfunction useStartPatterns() {\n\t// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,\n\t// and it has no postTypes declared and the current post type is page or if\n\t// the current post type is part of the postTypes declared.\n\tconst { blockPatternsWithPostContentBlockType, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPatternsByBlockTypes } = select( blockEditorStore );\n\t\t\tconst { getCurrentPostType } = select( editorStore );\n\t\t\treturn {\n\t\t\t\tblockPatternsWithPostContentBlockType:\n\t\t\t\t\tgetPatternsByBlockTypes( 'core/post-content' ),\n\t\t\t\tpostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\treturn useMemo( () => {\n\t\t// filter patterns without postTypes declared if the current postType is page\n\t\t// or patterns that declare the current postType in its post type array.\n\t\treturn blockPatternsWithPostContentBlockType.filter( ( pattern ) => {\n\t\t\treturn (\n\t\t\t\t( postType === 'page' && ! pattern.postTypes ) ||\n\t\t\t\t( Array.isArray( pattern.postTypes ) &&\n\t\t\t\t\tpattern.postTypes.includes( postType ) )\n\t\t\t);\n\t\t} );\n\t}, [ postType, blockPatternsWithPostContentBlockType ] );\n}\n\nfunction PatternSelection( { blockPatterns, onChoosePattern } ) {\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\tconst { resetEditorBlocks } = useDispatch( editorStore );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( _pattern, blocks ) => {\n\t\t\t\tresetEditorBlocks( blocks );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartPageOptionsModal( { onClose } ) {\n\tconst startPatterns = useStartPatterns();\n\tconst hasStartPattern = startPatterns.length > 0;\n\n\tif ( ! hasStartPattern ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-post-start-page-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tisFullScreen\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t<div className=\"edit-post-start-page-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tblockPatterns={ startPatterns }\n\t\t\t\t\tonChoosePattern={ onClose }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</Modal>\n\t);\n}\n\nexport default function StartPageOptions() {\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst shouldEnableModal = useSelect( ( select ) => {\n\t\tconst { isCleanNewPost, getRenderingMode } = select( editorStore );\n\t\tconst { isFeatureActive } = select( editPostStore );\n\n\t\treturn (\n\t\t\tgetRenderingMode() === 'post-only' &&\n\t\t\t! isFeatureActive( 'welcomeGuide' ) &&\n\t\t\tisCleanNewPost()\n\t\t);\n\t}, [] );\n\n\tif ( ! shouldEnableModal || isClosed ) {\n\t\treturn null;\n\t}\n\n\treturn <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,QAAQ,uBAAuB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,+BAA+B,IAAIC,iBAAiB,QAC9C,yBAAyB;AAChC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASN,KAAK,IAAIO,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASP,KAAK,IAAIQ,aAAa,QAAQ,aAAa;AAEpD,SAASC,gBAAgBA,CAAA,EAAG;EAC3B;EACA;EACA;EACA,MAAM;IAAEC,qCAAqC;IAAEC;EAAS,CAAC,GAAGP,SAAS,CAClEQ,MAAM,IAAM;IACb,MAAM;MAAEC;IAAwB,CAAC,GAAGD,MAAM,CAAEX,gBAAiB,CAAC;IAC9D,MAAM;MAAEa;IAAmB,CAAC,GAAGF,MAAM,CAAEL,WAAY,CAAC;IACpD,OAAO;MACNG,qCAAqC,EACpCG,uBAAuB,CAAE,mBAAoB,CAAC;MAC/CF,QAAQ,EAAEG,kBAAkB,CAAC;IAC9B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,aAAA,CAACL,gBAAgB;IAChBC,aAAa,EAAGW,aAAe;IAC/BV,eAAe,EAAGS;EAAS,CAC3B,CACG,CACC,CAAC;AAEV;AAEA,eAAe,SAASQ,gBAAgBA,CAAA,EAAG;EAC1C,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAG5C,QAAQ,CAAE,KAAM,CAAC;EACnD,MAAM6C,iBAAiB,GAAGvC,SAAS,CAAIQ,MAAM,IAAM;IAClD,MAAM;MAAEgC,cAAc;MAAEC;IAAiB,CAAC,GAAGjC,MAAM,CAAEL,WAAY,CAAC;IAClE,MAAM;MAAEuC;IAAgB,CAAC,GAAGlC,MAAM,CAAEJ,aAAc,CAAC;IAEnD,OACCqC,gBAAgB,CAAC,CAAC,KAAK,WAAW,IAClC,CAAEC,eAAe,CAAE,cAAe,CAAC,IACnCF,cAAc,CAAC,CAAC;EAElB,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAED,iBAAiB,IAAIF,QAAQ,EAAG;IACtC,OAAO,IAAI;EACZ;EAEA,OAAOf,aAAA,CAACK,qBAAqB;IAACC,OAAO,EAAGA,CAAA,KAAMU,WAAW,CAAE,IAAK;EAAG,CAAE,CAAC;AACvE"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { ActionItem } from '@wordpress/interface';
|
|
5
|
-
import { compose } from '@wordpress/compose';
|
|
6
|
-
import { MenuItem } from '@wordpress/components';
|
|
7
|
-
import { withPluginContext } from '@wordpress/plugins';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* 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.
|
|
11
|
-
* The text within the component appears as the menu item label.
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} props Component properties.
|
|
14
|
-
* @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.
|
|
15
|
-
* @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.
|
|
16
|
-
* @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
|
|
17
|
-
* @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.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```js
|
|
21
|
-
* // Using ES5 syntax
|
|
22
|
-
* var __ = wp.i18n.__;
|
|
23
|
-
* var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;
|
|
24
|
-
* var moreIcon = React.createElement( 'svg' ); //... svg element.
|
|
25
|
-
*
|
|
26
|
-
* function onButtonClick() {
|
|
27
|
-
* alert( 'Button clicked.' );
|
|
28
|
-
* }
|
|
29
|
-
*
|
|
30
|
-
* function MyButtonMoreMenuItem() {
|
|
31
|
-
* return React.createElement(
|
|
32
|
-
* PluginMoreMenuItem,
|
|
33
|
-
* {
|
|
34
|
-
* icon: moreIcon,
|
|
35
|
-
* onClick: onButtonClick,
|
|
36
|
-
* },
|
|
37
|
-
* __( 'My button title' )
|
|
38
|
-
* );
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```jsx
|
|
44
|
-
* // Using ESNext syntax
|
|
45
|
-
* import { __ } from '@wordpress/i18n';
|
|
46
|
-
* import { PluginMoreMenuItem } from '@wordpress/edit-post';
|
|
47
|
-
* import { more } from '@wordpress/icons';
|
|
48
|
-
*
|
|
49
|
-
* function onButtonClick() {
|
|
50
|
-
* alert( 'Button clicked.' );
|
|
51
|
-
* }
|
|
52
|
-
*
|
|
53
|
-
* const MyButtonMoreMenuItem = () => (
|
|
54
|
-
* <PluginMoreMenuItem
|
|
55
|
-
* icon={ more }
|
|
56
|
-
* onClick={ onButtonClick }
|
|
57
|
-
* >
|
|
58
|
-
* { __( 'My button title' ) }
|
|
59
|
-
* </PluginMoreMenuItem>
|
|
60
|
-
* );
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @return {Component} The component to be rendered.
|
|
64
|
-
*/
|
|
65
|
-
export default compose(
|
|
66
|
-
withPluginContext( ( context, ownProps ) => {
|
|
67
|
-
return {
|
|
68
|
-
as: ownProps.as ?? MenuItem,
|
|
69
|
-
icon: ownProps.icon || context.icon,
|
|
70
|
-
name: 'core/edit-post/plugin-more-menu',
|
|
71
|
-
};
|
|
72
|
-
} )
|
|
73
|
-
)( ActionItem );
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { ComplementaryAreaMoreMenuItem } from '@wordpress/interface';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Renders a menu item in `Plugins` group in `More Menu` drop down,
|
|
8
|
-
* and can be used to activate the corresponding `PluginSidebar` component.
|
|
9
|
-
* The text within the component appears as the menu item label.
|
|
10
|
-
*
|
|
11
|
-
* @param {Object} props Component props.
|
|
12
|
-
* @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.
|
|
13
|
-
* @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.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```js
|
|
17
|
-
* // Using ES5 syntax
|
|
18
|
-
* var __ = wp.i18n.__;
|
|
19
|
-
* var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
|
|
20
|
-
* var moreIcon = React.createElement( 'svg' ); //... svg element.
|
|
21
|
-
*
|
|
22
|
-
* function MySidebarMoreMenuItem() {
|
|
23
|
-
* return React.createElement(
|
|
24
|
-
* PluginSidebarMoreMenuItem,
|
|
25
|
-
* {
|
|
26
|
-
* target: 'my-sidebar',
|
|
27
|
-
* icon: moreIcon,
|
|
28
|
-
* },
|
|
29
|
-
* __( 'My sidebar title' )
|
|
30
|
-
* )
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```jsx
|
|
36
|
-
* // Using ESNext syntax
|
|
37
|
-
* import { __ } from '@wordpress/i18n';
|
|
38
|
-
* import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
|
|
39
|
-
* import { more } from '@wordpress/icons';
|
|
40
|
-
*
|
|
41
|
-
* const MySidebarMoreMenuItem = () => (
|
|
42
|
-
* <PluginSidebarMoreMenuItem
|
|
43
|
-
* target="my-sidebar"
|
|
44
|
-
* icon={ more }
|
|
45
|
-
* >
|
|
46
|
-
* { __( 'My sidebar title' ) }
|
|
47
|
-
* </PluginSidebarMoreMenuItem>
|
|
48
|
-
* );
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @return {Component} The component to be rendered.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
export default function PluginSidebarMoreMenuItem( props ) {
|
|
55
|
-
return (
|
|
56
|
-
<ComplementaryAreaMoreMenuItem
|
|
57
|
-
// Menu item is marked with unstable prop for backward compatibility.
|
|
58
|
-
// @see https://github.com/WordPress/gutenberg/issues/14457
|
|
59
|
-
__unstableExplicitMenuItem
|
|
60
|
-
scope="core/edit-post"
|
|
61
|
-
{ ...props }
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
}
|