@wordpress/edit-post 7.31.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 +4 -0
- package/README.md +9 -323
- 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 +5 -5
- 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 +11 -13
- 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 +4 -7
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +16 -21
- 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 +16 -64
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +16 -63
- 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 +42 -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 +9 -4
- package/build/editor.js.map +1 -1
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +7 -24
- 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 +36 -19
- 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 +7 -12
- package/build/index.js.map +1 -1
- package/build/index.native.js +2 -4
- 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 +46 -31
- 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 +1 -15
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +44 -24
- 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 +4 -4
- 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 +11 -13
- 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 +4 -5
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +15 -20
- 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 +14 -62
- 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 +14 -61
- 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 +43 -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 +9 -4
- 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 +9 -26
- 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 +37 -20
- 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 +8 -8
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +2 -4
- 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 +38 -22
- 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 +1 -13
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +42 -21
- 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 -454
- package/build-style/style.css +12 -454
- package/package.json +32 -34
- package/src/classic.scss +2 -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 +3 -4
- 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 +10 -11
- 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/actions-panel.js +5 -4
- package/src/components/layout/index.js +20 -42
- package/src/components/meta-boxes/meta-boxes-area/style.scss +1 -1
- package/src/components/preferences-modal/index.js +1 -24
- package/src/components/sidebar/plugin-post-publish-panel/index.js +12 -67
- package/src/components/sidebar/plugin-pre-publish-panel/index.js +12 -66
- package/src/components/sidebar/post-status/index.js +6 -9
- package/src/components/sidebar/settings-sidebar/index.js +64 -56
- 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 +14 -4
- package/src/hooks/commands/use-common-commands.js +13 -28
- package/src/hooks/use-navigate-to-entity-record.js +37 -24
- package/src/index.js +11 -6
- package/src/index.native.js +1 -4
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +5 -3
- package/src/store/actions.js +37 -24
- package/src/store/reducer.js +0 -13
- package/src/store/selectors.js +52 -36
- package/src/store/test/actions.js +11 -10
- package/src/style.scss +1 -20
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -107
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
- 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 -129
- 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/sidebar/template-summary/index.js +0 -36
- package/build/components/sidebar/template-summary/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/block-settings-menu/plugin-block-settings-menu-item.js +0 -100
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.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 -119
- 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/sidebar/template-summary/index.js +0 -29
- package/build-module/components/sidebar/template-summary/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/block-settings-menu/plugin-block-settings-menu-item.js +0 -108
- 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 -159
- 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-publish-panel/test/__snapshots__/index.js.snap +0 -39
- package/src/components/sidebar/plugin-post-publish-panel/test/index.js +0 -33
- 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/test/index.js +0 -33
- package/src/components/sidebar/plugin-sidebar/index.js +0 -94
- package/src/components/sidebar/template-summary/index.js +0 -37
- package/src/components/sidebar/template-summary/style.scss +0 -5
- package/src/components/start-page-options/index.js +0 -108
- package/src/components/start-page-options/style.scss +0 -26
package/src/style.scss
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
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";
|
|
8
6
|
@import "./components/sidebar/post-format/style.scss";
|
|
9
7
|
@import "./components/sidebar/post-slug/style.scss";
|
|
10
8
|
@import "./components/sidebar/post-visibility/style.scss";
|
|
11
|
-
@import "./components/sidebar/template-summary/style.scss";
|
|
12
9
|
@import "./components/text-editor/style.scss";
|
|
13
10
|
@import "./components/visual-editor/style.scss";
|
|
14
11
|
@import "./components/welcome-guide/style.scss";
|
|
15
|
-
@import "./components/start-page-options/style.scss";
|
|
16
12
|
|
|
17
13
|
/**
|
|
18
14
|
* Animations
|
|
@@ -45,7 +41,7 @@ body.js.block-editor-page {
|
|
|
45
41
|
// Target the editor UI excluding the visual editor contents, metaboxes and custom fields areas.
|
|
46
42
|
.edit-post-header,
|
|
47
43
|
.edit-post-text-editor,
|
|
48
|
-
.
|
|
44
|
+
.editor-sidebar,
|
|
49
45
|
.editor-post-publish-panel {
|
|
50
46
|
@include reset;
|
|
51
47
|
}
|
|
@@ -78,18 +74,3 @@ body.js.block-editor-page {
|
|
|
78
74
|
}
|
|
79
75
|
|
|
80
76
|
@include wordpress-admin-schemes();
|
|
81
|
-
|
|
82
|
-
// The edit-site package adds or removes the sidebar when it's opened or closed.
|
|
83
|
-
// The edit-post package, however, always has the sidebar in the canvas.
|
|
84
|
-
// These edit-post specific rules ensures there isn't a border on the right of
|
|
85
|
-
// the canvas when a sidebar is visually closed.
|
|
86
|
-
.interface-interface-skeleton__sidebar {
|
|
87
|
-
border-left: none;
|
|
88
|
-
|
|
89
|
-
.is-sidebar-opened & {
|
|
90
|
-
@include break-medium() {
|
|
91
|
-
border-left: $border-width solid $gray-200;
|
|
92
|
-
overflow: hidden scroll;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _compose = require("@wordpress/compose");
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Plugins may want to add an item to the menu either for every block
|
|
19
|
-
* or only for the specific ones provided in the `allowedBlocks` component property.
|
|
20
|
-
*
|
|
21
|
-
* If there are multiple blocks selected the item will be rendered if every block
|
|
22
|
-
* is of one allowed type (not necessarily the same).
|
|
23
|
-
*
|
|
24
|
-
* @param {string[]} selectedBlocks Array containing the names of the blocks selected
|
|
25
|
-
* @param {string[]} allowedBlocks Array containing the names of the blocks allowed
|
|
26
|
-
* @return {boolean} Whether the item will be rendered or not.
|
|
27
|
-
*/
|
|
28
|
-
const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Renders a new item in the block settings menu.
|
|
32
|
-
*
|
|
33
|
-
* @param {Object} props Component props.
|
|
34
|
-
* @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
|
|
35
|
-
* @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
|
|
36
|
-
* @param {string} props.label The menu item text.
|
|
37
|
-
* @param {Function} props.onClick Callback function to be executed when the user click the menu item.
|
|
38
|
-
* @param {boolean} [props.small] Whether to render the label or not.
|
|
39
|
-
* @param {string} [props.role] The ARIA role for the menu item.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```js
|
|
43
|
-
* // Using ES5 syntax
|
|
44
|
-
* var __ = wp.i18n.__;
|
|
45
|
-
* var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
|
|
46
|
-
*
|
|
47
|
-
* function doOnClick(){
|
|
48
|
-
* // To be called when the user clicks the menu item.
|
|
49
|
-
* }
|
|
50
|
-
*
|
|
51
|
-
* function MyPluginBlockSettingsMenuItem() {
|
|
52
|
-
* return React.createElement(
|
|
53
|
-
* PluginBlockSettingsMenuItem,
|
|
54
|
-
* {
|
|
55
|
-
* allowedBlocks: [ 'core/paragraph' ],
|
|
56
|
-
* icon: 'dashicon-name',
|
|
57
|
-
* label: __( 'Menu item text' ),
|
|
58
|
-
* onClick: doOnClick,
|
|
59
|
-
* }
|
|
60
|
-
* );
|
|
61
|
-
* }
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```jsx
|
|
66
|
-
* // Using ESNext syntax
|
|
67
|
-
* import { __ } from '@wordpress/i18n';
|
|
68
|
-
* import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
|
|
69
|
-
*
|
|
70
|
-
* const doOnClick = ( ) => {
|
|
71
|
-
* // To be called when the user clicks the menu item.
|
|
72
|
-
* };
|
|
73
|
-
*
|
|
74
|
-
* const MyPluginBlockSettingsMenuItem = () => (
|
|
75
|
-
* <PluginBlockSettingsMenuItem
|
|
76
|
-
* allowedBlocks={ [ 'core/paragraph' ] }
|
|
77
|
-
* icon='dashicon-name'
|
|
78
|
-
* label={ __( 'Menu item text' ) }
|
|
79
|
-
* onClick={ doOnClick } />
|
|
80
|
-
* );
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* @return {Component} The component to be rendered.
|
|
84
|
-
*/
|
|
85
|
-
const PluginBlockSettingsMenuItem = ({
|
|
86
|
-
allowedBlocks,
|
|
87
|
-
icon,
|
|
88
|
-
label,
|
|
89
|
-
onClick,
|
|
90
|
-
small,
|
|
91
|
-
role
|
|
92
|
-
}) => (0, _react.createElement)(_blockEditor.BlockSettingsMenuControls, null, ({
|
|
93
|
-
selectedBlocks,
|
|
94
|
-
onClose
|
|
95
|
-
}) => {
|
|
96
|
-
if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
return (0, _react.createElement)(_components.MenuItem, {
|
|
100
|
-
onClick: (0, _compose.compose)(onClick, onClose),
|
|
101
|
-
icon: icon,
|
|
102
|
-
label: small ? label : undefined,
|
|
103
|
-
role: role
|
|
104
|
-
}, !small && label);
|
|
105
|
-
});
|
|
106
|
-
var _default = exports.default = PluginBlockSettingsMenuItem;
|
|
107
|
-
//# sourceMappingURL=plugin-block-settings-menu-item.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_components","_compose","isEverySelectedBlockAllowed","selected","allowed","filter","id","includes","length","shouldRenderItem","selectedBlocks","allowedBlocks","Array","isArray","PluginBlockSettingsMenuItem","icon","label","onClick","small","role","_react","createElement","BlockSettingsMenuControls","onClose","MenuItem","compose","undefined","_default","exports","default"],"sources":["@wordpress/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { compose } from '@wordpress/compose';\n\nconst isEverySelectedBlockAllowed = ( selected, allowed ) =>\n\tselected.filter( ( id ) => ! allowed.includes( id ) ).length === 0;\n\n/**\n * Plugins may want to add an item to the menu either for every block\n * or only for the specific ones provided in the `allowedBlocks` component property.\n *\n * If there are multiple blocks selected the item will be rendered if every block\n * is of one allowed type (not necessarily the same).\n *\n * @param {string[]} selectedBlocks Array containing the names of the blocks selected\n * @param {string[]} allowedBlocks Array containing the names of the blocks allowed\n * @return {boolean} Whether the item will be rendered or not.\n */\nconst shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>\n\t! Array.isArray( allowedBlocks ) ||\n\tisEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );\n\n/**\n * Renders a new item in the block settings menu.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.\n * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.\n * @param {string} props.label The menu item text.\n * @param {Function} props.onClick Callback function to be executed when the user click the menu item.\n * @param {boolean} [props.small] Whether to render the label or not.\n * @param {string} [props.role] The ARIA role for the menu item.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;\n *\n * function doOnClick(){\n * \t// To be called when the user clicks the menu item.\n * }\n *\n * function MyPluginBlockSettingsMenuItem() {\n * \treturn React.createElement(\n * \t\tPluginBlockSettingsMenuItem,\n * \t\t{\n * \t\t\tallowedBlocks: [ 'core/paragraph' ],\n * \t\t\ticon: 'dashicon-name',\n * \t\t\tlabel: __( 'Menu item text' ),\n * \t\t\tonClick: doOnClick,\n * \t\t}\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';\n *\n * const doOnClick = ( ) => {\n * // To be called when the user clicks the menu item.\n * };\n *\n * const MyPluginBlockSettingsMenuItem = () => (\n * <PluginBlockSettingsMenuItem\n * \t\tallowedBlocks={ [ 'core/paragraph' ] }\n * \t\ticon='dashicon-name'\n * \t\tlabel={ __( 'Menu item text' ) }\n * \t\tonClick={ doOnClick } />\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginBlockSettingsMenuItem = ( {\n\tallowedBlocks,\n\ticon,\n\tlabel,\n\tonClick,\n\tsmall,\n\trole,\n} ) => (\n\t<BlockSettingsMenuControls>\n\t\t{ ( { selectedBlocks, onClose } ) => {\n\t\t\tif ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<MenuItem\n\t\t\t\t\tonClick={ compose( onClick, onClose ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tlabel={ small ? label : undefined }\n\t\t\t\t\trole={ role }\n\t\t\t\t>\n\t\t\t\t\t{ ! small && label }\n\t\t\t\t</MenuItem>\n\t\t\t);\n\t\t} }\n\t</BlockSettingsMenuControls>\n);\n\nexport default PluginBlockSettingsMenuItem;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,MAAMG,2BAA2B,GAAGA,CAAEC,QAAQ,EAAEC,OAAO,KACtDD,QAAQ,CAACE,MAAM,CAAIC,EAAE,IAAM,CAAEF,OAAO,CAACG,QAAQ,CAAED,EAAG,CAAE,CAAC,CAACE,MAAM,KAAK,CAAC;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAGA,CAAEC,cAAc,EAAEC,aAAa,KACvD,CAAEC,KAAK,CAACC,OAAO,CAAEF,aAAc,CAAC,IAChCT,2BAA2B,CAAEQ,cAAc,EAAEC,aAAc,CAAC;;AAE7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,2BAA2B,GAAGA,CAAE;EACrCH,aAAa;EACbI,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,KAAK;EACLC;AACD,CAAC,KACA,IAAAC,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAAwB,yBAAyB,QACvB,CAAE;EAAEZ,cAAc;EAAEa;AAAQ,CAAC,KAAM;EACpC,IAAK,CAAEd,gBAAgB,CAAEC,cAAc,EAAEC,aAAc,CAAC,EAAG;IAC1D,OAAO,IAAI;EACZ;EACA,OACC,IAAAS,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAAwB,QAAQ;IACRP,OAAO,EAAG,IAAAQ,gBAAO,EAAER,OAAO,EAAEM,OAAQ,CAAG;IACvCR,IAAI,EAAGA,IAAM;IACbC,KAAK,EAAGE,KAAK,GAAGF,KAAK,GAAGU,SAAW;IACnCP,IAAI,EAAGA;EAAM,GAEX,CAAED,KAAK,IAAIF,KACJ,CAAC;AAEb,CAC0B,CAC3B;AAAC,IAAAW,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaf,2BAA2B"}
|
|
@@ -1,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"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.textFormattingShortcuts = void 0;
|
|
7
|
-
var _i18n = require("@wordpress/i18n");
|
|
8
|
-
/**
|
|
9
|
-
* WordPress dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const textFormattingShortcuts = exports.textFormattingShortcuts = [{
|
|
13
|
-
keyCombination: {
|
|
14
|
-
modifier: 'primary',
|
|
15
|
-
character: 'b'
|
|
16
|
-
},
|
|
17
|
-
description: (0, _i18n.__)('Make the selected text bold.')
|
|
18
|
-
}, {
|
|
19
|
-
keyCombination: {
|
|
20
|
-
modifier: 'primary',
|
|
21
|
-
character: 'i'
|
|
22
|
-
},
|
|
23
|
-
description: (0, _i18n.__)('Make the selected text italic.')
|
|
24
|
-
}, {
|
|
25
|
-
keyCombination: {
|
|
26
|
-
modifier: 'primary',
|
|
27
|
-
character: 'k'
|
|
28
|
-
},
|
|
29
|
-
description: (0, _i18n.__)('Convert the selected text into a link.')
|
|
30
|
-
}, {
|
|
31
|
-
keyCombination: {
|
|
32
|
-
modifier: 'primaryShift',
|
|
33
|
-
character: 'k'
|
|
34
|
-
},
|
|
35
|
-
description: (0, _i18n.__)('Remove a link.')
|
|
36
|
-
}, {
|
|
37
|
-
keyCombination: {
|
|
38
|
-
character: '[['
|
|
39
|
-
},
|
|
40
|
-
description: (0, _i18n.__)('Insert a link to a post or page.')
|
|
41
|
-
}, {
|
|
42
|
-
keyCombination: {
|
|
43
|
-
modifier: 'primary',
|
|
44
|
-
character: 'u'
|
|
45
|
-
},
|
|
46
|
-
description: (0, _i18n.__)('Underline the selected text.')
|
|
47
|
-
}, {
|
|
48
|
-
keyCombination: {
|
|
49
|
-
modifier: 'access',
|
|
50
|
-
character: 'd'
|
|
51
|
-
},
|
|
52
|
-
description: (0, _i18n.__)('Strikethrough the selected text.')
|
|
53
|
-
}, {
|
|
54
|
-
keyCombination: {
|
|
55
|
-
modifier: 'access',
|
|
56
|
-
character: 'x'
|
|
57
|
-
},
|
|
58
|
-
description: (0, _i18n.__)('Make the selected text inline code.')
|
|
59
|
-
}, {
|
|
60
|
-
keyCombination: {
|
|
61
|
-
modifier: 'access',
|
|
62
|
-
character: '0'
|
|
63
|
-
},
|
|
64
|
-
description: (0, _i18n.__)('Convert the current heading to a paragraph.')
|
|
65
|
-
}, {
|
|
66
|
-
keyCombination: {
|
|
67
|
-
modifier: 'access',
|
|
68
|
-
character: '1-6'
|
|
69
|
-
},
|
|
70
|
-
description: (0, _i18n.__)('Convert the current paragraph or heading to a heading of level 1 to 6.')
|
|
71
|
-
}, {
|
|
72
|
-
keyCombination: {
|
|
73
|
-
modifier: 'primaryShift',
|
|
74
|
-
character: '\u00a0'
|
|
75
|
-
},
|
|
76
|
-
description: (0, _i18n.__)('Add non breaking space.')
|
|
77
|
-
}];
|
|
78
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","textFormattingShortcuts","exports","keyCombination","modifier","character","description","__"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcut-help-modal/config.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const textFormattingShortcuts = [\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'b' },\n\t\tdescription: __( 'Make the selected text bold.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'i' },\n\t\tdescription: __( 'Make the selected text italic.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'k' },\n\t\tdescription: __( 'Convert the selected text into a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: 'k' },\n\t\tdescription: __( 'Remove a link.' ),\n\t},\n\t{\n\t\tkeyCombination: { character: '[[' },\n\t\tdescription: __( 'Insert a link to a post or page.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primary', character: 'u' },\n\t\tdescription: __( 'Underline the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'd' },\n\t\tdescription: __( 'Strikethrough the selected text.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: 'x' },\n\t\tdescription: __( 'Make the selected text inline code.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: '0' },\n\t\tdescription: __( 'Convert the current heading to a paragraph.' ),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'access', character: '1-6' },\n\t\tdescription: __(\n\t\t\t'Convert the current paragraph or heading to a heading of level 1 to 6.'\n\t\t),\n\t},\n\t{\n\t\tkeyCombination: { modifier: 'primaryShift', character: '\\u00a0' },\n\t\tdescription: __( 'Add non breaking space.' ),\n\t},\n];\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,CACtC;EACCE,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,SAAS,EAAE;EAAI,CAAC;EACvDC,WAAW,EAAE,IAAAC,QAAE,EAAE,8BAA+B;AACjD,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,SAAS,EAAE;EAAI,CAAC;EACvDC,WAAW,EAAE,IAAAC,QAAE,EAAE,gCAAiC;AACnD,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,SAAS,EAAE;EAAI,CAAC;EACvDC,WAAW,EAAE,IAAAC,QAAE,EAAE,wCAAyC;AAC3D,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,cAAc;IAAEC,SAAS,EAAE;EAAI,CAAC;EAC5DC,WAAW,EAAE,IAAAC,QAAE,EAAE,gBAAiB;AACnC,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEE,SAAS,EAAE;EAAK,CAAC;EACnCC,WAAW,EAAE,IAAAC,QAAE,EAAE,kCAAmC;AACrD,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,SAAS;IAAEC,SAAS,EAAE;EAAI,CAAC;EACvDC,WAAW,EAAE,IAAAC,QAAE,EAAE,8BAA+B;AACjD,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAI,CAAC;EACtDC,WAAW,EAAE,IAAAC,QAAE,EAAE,kCAAmC;AACrD,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAI,CAAC;EACtDC,WAAW,EAAE,IAAAC,QAAE,EAAE,qCAAsC;AACxD,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAI,CAAC;EACtDC,WAAW,EAAE,IAAAC,QAAE,EAAE,6CAA8C;AAChE,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,QAAQ;IAAEC,SAAS,EAAE;EAAM,CAAC;EACxDC,WAAW,EAAE,IAAAC,QAAE,EACd,wEACD;AACD,CAAC,EACD;EACCJ,cAAc,EAAE;IAAEC,QAAQ,EAAE,cAAc;IAAEC,SAAS,EAAE;EAAS,CAAC;EACjEC,WAAW,EAAE,IAAAC,QAAE,EAAE,yBAA0B;AAC5C,CAAC,CACD"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
|
-
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
11
|
-
var _shortcut = _interopRequireDefault(require("./shortcut"));
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
function DynamicShortcut({
|
|
21
|
-
name
|
|
22
|
-
}) {
|
|
23
|
-
const {
|
|
24
|
-
keyCombination,
|
|
25
|
-
description,
|
|
26
|
-
aliases
|
|
27
|
-
} = (0, _data.useSelect)(select => {
|
|
28
|
-
const {
|
|
29
|
-
getShortcutKeyCombination,
|
|
30
|
-
getShortcutDescription,
|
|
31
|
-
getShortcutAliases
|
|
32
|
-
} = select(_keyboardShortcuts.store);
|
|
33
|
-
return {
|
|
34
|
-
keyCombination: getShortcutKeyCombination(name),
|
|
35
|
-
aliases: getShortcutAliases(name),
|
|
36
|
-
description: getShortcutDescription(name)
|
|
37
|
-
};
|
|
38
|
-
}, [name]);
|
|
39
|
-
if (!keyCombination) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
return (0, _react.createElement)(_shortcut.default, {
|
|
43
|
-
keyCombination: keyCombination,
|
|
44
|
-
description: description,
|
|
45
|
-
aliases: aliases
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
var _default = exports.default = DynamicShortcut;
|
|
49
|
-
//# sourceMappingURL=dynamic-shortcut.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_keyboardShortcuts","_shortcut","_interopRequireDefault","DynamicShortcut","name","keyCombination","description","aliases","useSelect","select","getShortcutKeyCombination","getShortcutDescription","getShortcutAliases","keyboardShortcutsStore","_react","createElement","default","_default","exports"],"sources":["@wordpress/edit-post/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport Shortcut from './shortcut';\n\nfunction DynamicShortcut( { name } ) {\n\tconst { keyCombination, description, aliases } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetShortcutKeyCombination,\n\t\t\t\tgetShortcutDescription,\n\t\t\t\tgetShortcutAliases,\n\t\t\t} = select( keyboardShortcutsStore );\n\n\t\t\treturn {\n\t\t\t\tkeyCombination: getShortcutKeyCombination( name ),\n\t\t\t\taliases: getShortcutAliases( name ),\n\t\t\t\tdescription: getShortcutDescription( name ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\n\tif ( ! keyCombination ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Shortcut\n\t\t\tkeyCombination={ keyCombination }\n\t\t\tdescription={ description }\n\t\t\taliases={ aliases }\n\t\t/>\n\t);\n}\n\nexport default DynamicShortcut;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAC,sBAAA,CAAAH,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA,SAASI,eAAeA,CAAE;EAAEC;AAAK,CAAC,EAAG;EACpC,MAAM;IAAEC,cAAc;IAAEC,WAAW;IAAEC;EAAQ,CAAC,GAAG,IAAAC,eAAS,EACvDC,MAAM,IAAM;IACb,MAAM;MACLC,yBAAyB;MACzBC,sBAAsB;MACtBC;IACD,CAAC,GAAGH,MAAM,CAAEI,wBAAuB,CAAC;IAEpC,OAAO;MACNR,cAAc,EAAEK,yBAAyB,CAAEN,IAAK,CAAC;MACjDG,OAAO,EAAEK,kBAAkB,CAAER,IAAK,CAAC;MACnCE,WAAW,EAAEK,sBAAsB,CAAEP,IAAK;IAC3C,CAAC;EACF,CAAC,EACD,CAAEA,IAAI,CACP,CAAC;EAED,IAAK,CAAEC,cAAc,EAAG;IACvB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAS,MAAA,CAAAC,aAAA,EAACd,SAAA,CAAAe,OAAQ;IACRX,cAAc,EAAGA,cAAgB;IACjCC,WAAW,EAAGA,WAAa;IAC3BC,OAAO,EAAGA;EAAS,CACnB,CAAC;AAEJ;AAAC,IAAAU,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEcb,eAAe"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.KEYBOARD_SHORTCUT_HELP_MODAL_NAME = void 0;
|
|
8
|
-
exports.KeyboardShortcutHelpModal = KeyboardShortcutHelpModal;
|
|
9
|
-
exports.default = void 0;
|
|
10
|
-
var _react = require("react");
|
|
11
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
var _i18n = require("@wordpress/i18n");
|
|
14
|
-
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
15
|
-
var _data = require("@wordpress/data");
|
|
16
|
-
var _compose = require("@wordpress/compose");
|
|
17
|
-
var _interface = require("@wordpress/interface");
|
|
18
|
-
var _config = require("./config");
|
|
19
|
-
var _shortcut = _interopRequireDefault(require("./shortcut"));
|
|
20
|
-
var _dynamicShortcut = _interopRequireDefault(require("./dynamic-shortcut"));
|
|
21
|
-
/**
|
|
22
|
-
* External dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* WordPress dependencies
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Internal dependencies
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = exports.KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'edit-post/keyboard-shortcut-help';
|
|
34
|
-
const ShortcutList = ({
|
|
35
|
-
shortcuts
|
|
36
|
-
}) =>
|
|
37
|
-
/*
|
|
38
|
-
* Disable reason: The `list` ARIA role is redundant but
|
|
39
|
-
* Safari+VoiceOver won't announce the list otherwise.
|
|
40
|
-
*/
|
|
41
|
-
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
42
|
-
(0, _react.createElement)("ul", {
|
|
43
|
-
className: "edit-post-keyboard-shortcut-help-modal__shortcut-list",
|
|
44
|
-
role: "list"
|
|
45
|
-
}, shortcuts.map((shortcut, index) => (0, _react.createElement)("li", {
|
|
46
|
-
className: "edit-post-keyboard-shortcut-help-modal__shortcut",
|
|
47
|
-
key: index
|
|
48
|
-
}, typeof shortcut === 'string' ? (0, _react.createElement)(_dynamicShortcut.default, {
|
|
49
|
-
name: shortcut
|
|
50
|
-
}) : (0, _react.createElement)(_shortcut.default, {
|
|
51
|
-
...shortcut
|
|
52
|
-
}))))
|
|
53
|
-
/* eslint-enable jsx-a11y/no-redundant-roles */;
|
|
54
|
-
const ShortcutSection = ({
|
|
55
|
-
title,
|
|
56
|
-
shortcuts,
|
|
57
|
-
className
|
|
58
|
-
}) => (0, _react.createElement)("section", {
|
|
59
|
-
className: (0, _classnames.default)('edit-post-keyboard-shortcut-help-modal__section', className)
|
|
60
|
-
}, !!title && (0, _react.createElement)("h2", {
|
|
61
|
-
className: "edit-post-keyboard-shortcut-help-modal__section-title"
|
|
62
|
-
}, title), (0, _react.createElement)(ShortcutList, {
|
|
63
|
-
shortcuts: shortcuts
|
|
64
|
-
}));
|
|
65
|
-
const ShortcutCategorySection = ({
|
|
66
|
-
title,
|
|
67
|
-
categoryName,
|
|
68
|
-
additionalShortcuts = []
|
|
69
|
-
}) => {
|
|
70
|
-
const categoryShortcuts = (0, _data.useSelect)(select => {
|
|
71
|
-
return select(_keyboardShortcuts.store).getCategoryShortcuts(categoryName);
|
|
72
|
-
}, [categoryName]);
|
|
73
|
-
return (0, _react.createElement)(ShortcutSection, {
|
|
74
|
-
title: title,
|
|
75
|
-
shortcuts: categoryShortcuts.concat(additionalShortcuts)
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
function KeyboardShortcutHelpModal({
|
|
79
|
-
isModalActive,
|
|
80
|
-
toggleModal
|
|
81
|
-
}) {
|
|
82
|
-
(0, _keyboardShortcuts.useShortcut)('core/edit-post/keyboard-shortcuts', toggleModal);
|
|
83
|
-
if (!isModalActive) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
return (0, _react.createElement)(_components.Modal, {
|
|
87
|
-
className: "edit-post-keyboard-shortcut-help-modal",
|
|
88
|
-
title: (0, _i18n.__)('Keyboard shortcuts'),
|
|
89
|
-
closeButtonLabel: (0, _i18n.__)('Close'),
|
|
90
|
-
onRequestClose: toggleModal
|
|
91
|
-
}, (0, _react.createElement)(ShortcutSection, {
|
|
92
|
-
className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts",
|
|
93
|
-
shortcuts: ['core/edit-post/keyboard-shortcuts']
|
|
94
|
-
}), (0, _react.createElement)(ShortcutCategorySection, {
|
|
95
|
-
title: (0, _i18n.__)('Global shortcuts'),
|
|
96
|
-
categoryName: "global"
|
|
97
|
-
}), (0, _react.createElement)(ShortcutCategorySection, {
|
|
98
|
-
title: (0, _i18n.__)('Selection shortcuts'),
|
|
99
|
-
categoryName: "selection"
|
|
100
|
-
}), (0, _react.createElement)(ShortcutCategorySection, {
|
|
101
|
-
title: (0, _i18n.__)('Block shortcuts'),
|
|
102
|
-
categoryName: "block",
|
|
103
|
-
additionalShortcuts: [{
|
|
104
|
-
keyCombination: {
|
|
105
|
-
character: '/'
|
|
106
|
-
},
|
|
107
|
-
description: (0, _i18n.__)('Change the block type after adding a new paragraph.'),
|
|
108
|
-
/* translators: The forward-slash character. e.g. '/'. */
|
|
109
|
-
ariaLabel: (0, _i18n.__)('Forward-slash')
|
|
110
|
-
}]
|
|
111
|
-
}), (0, _react.createElement)(ShortcutSection, {
|
|
112
|
-
title: (0, _i18n.__)('Text formatting'),
|
|
113
|
-
shortcuts: _config.textFormattingShortcuts
|
|
114
|
-
}));
|
|
115
|
-
}
|
|
116
|
-
var _default = exports.default = (0, _compose.compose)([(0, _data.withSelect)(select => ({
|
|
117
|
-
isModalActive: select(_interface.store).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME)
|
|
118
|
-
})), (0, _data.withDispatch)((dispatch, {
|
|
119
|
-
isModalActive
|
|
120
|
-
}) => {
|
|
121
|
-
const {
|
|
122
|
-
openModal,
|
|
123
|
-
closeModal
|
|
124
|
-
} = dispatch(_interface.store);
|
|
125
|
-
return {
|
|
126
|
-
toggleModal: () => isModalActive ? closeModal() : openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME)
|
|
127
|
-
};
|
|
128
|
-
})])(KeyboardShortcutHelpModal);
|
|
129
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_i18n","_keyboardShortcuts","_data","_compose","_interface","_config","_shortcut","_dynamicShortcut","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","exports","ShortcutList","shortcuts","_react","createElement","className","role","map","shortcut","index","key","default","name","ShortcutSection","title","classnames","ShortcutCategorySection","categoryName","additionalShortcuts","categoryShortcuts","useSelect","select","keyboardShortcutsStore","getCategoryShortcuts","concat","KeyboardShortcutHelpModal","isModalActive","toggleModal","useShortcut","Modal","__","closeButtonLabel","onRequestClose","keyCombination","character","description","ariaLabel","textFormattingShortcuts","_default","compose","withSelect","interfaceStore","withDispatch","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</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":"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"}
|