@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
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
.edit-post-keyboard-shortcut-help-modal {
|
|
2
|
-
&__section {
|
|
3
|
-
margin: 0 0 2rem 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
&__section-title {
|
|
7
|
-
font-size: 0.9rem;
|
|
8
|
-
font-weight: 600;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
&__shortcut {
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: baseline;
|
|
14
|
-
padding: 0.6rem 0;
|
|
15
|
-
border-top: 1px solid $gray-300;
|
|
16
|
-
margin-bottom: 0;
|
|
17
|
-
|
|
18
|
-
&:last-child {
|
|
19
|
-
border-bottom: 1px solid $gray-300;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&:empty {
|
|
23
|
-
display: none;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&__shortcut-term {
|
|
28
|
-
font-weight: 600;
|
|
29
|
-
margin: 0 0 0 1rem;
|
|
30
|
-
text-align: right;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&__shortcut-description {
|
|
34
|
-
flex: 1;
|
|
35
|
-
margin: 0;
|
|
36
|
-
|
|
37
|
-
// IE 11 flex item fix - ensure the item does not collapse.
|
|
38
|
-
flex-basis: auto;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&__shortcut-key-combination {
|
|
42
|
-
display: block;
|
|
43
|
-
background: none;
|
|
44
|
-
margin: 0;
|
|
45
|
-
padding: 0;
|
|
46
|
-
|
|
47
|
-
& + .edit-post-keyboard-shortcut-help-modal__shortcut-key-combination {
|
|
48
|
-
margin-top: 10px;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&__shortcut-key {
|
|
53
|
-
padding: 0.25rem 0.5rem;
|
|
54
|
-
border-radius: 8%;
|
|
55
|
-
margin: 0 0.2rem 0 0.2rem;
|
|
56
|
-
|
|
57
|
-
&:last-child {
|
|
58
|
-
margin: 0 0 0 0.2rem;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { EditorKeyboardShortcutsRegister } from '@wordpress/editor';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { KeyboardShortcutHelpModal } from '../index';
|
|
15
|
-
|
|
16
|
-
const noop = () => {};
|
|
17
|
-
|
|
18
|
-
describe( 'KeyboardShortcutHelpModal', () => {
|
|
19
|
-
it( 'should not render the modal when inactive', () => {
|
|
20
|
-
render(
|
|
21
|
-
<>
|
|
22
|
-
<EditorKeyboardShortcutsRegister />
|
|
23
|
-
<KeyboardShortcutHelpModal
|
|
24
|
-
isModalActive={ false }
|
|
25
|
-
toggleModal={ noop }
|
|
26
|
-
/>
|
|
27
|
-
</>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
expect(
|
|
31
|
-
screen.queryByRole( 'dialog', {
|
|
32
|
-
name: 'Keyboard shortcuts',
|
|
33
|
-
} )
|
|
34
|
-
).not.toBeInTheDocument();
|
|
35
|
-
} );
|
|
36
|
-
} );
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`PluginPostPublishPanel renders fill properly 1`] = `
|
|
4
|
-
<div>
|
|
5
|
-
<div
|
|
6
|
-
class="components-panel__body my-plugin-post-publish-panel is-opened"
|
|
7
|
-
>
|
|
8
|
-
<h2
|
|
9
|
-
class="components-panel__body-title"
|
|
10
|
-
>
|
|
11
|
-
<button
|
|
12
|
-
aria-expanded="true"
|
|
13
|
-
class="components-button components-panel__body-toggle"
|
|
14
|
-
type="button"
|
|
15
|
-
>
|
|
16
|
-
<span
|
|
17
|
-
aria-hidden="true"
|
|
18
|
-
>
|
|
19
|
-
<svg
|
|
20
|
-
aria-hidden="true"
|
|
21
|
-
class="components-panel__arrow"
|
|
22
|
-
focusable="false"
|
|
23
|
-
height="24"
|
|
24
|
-
viewBox="0 0 24 24"
|
|
25
|
-
width="24"
|
|
26
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
27
|
-
>
|
|
28
|
-
<path
|
|
29
|
-
d="M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
|
|
30
|
-
/>
|
|
31
|
-
</svg>
|
|
32
|
-
</span>
|
|
33
|
-
My panel title
|
|
34
|
-
</button>
|
|
35
|
-
</h2>
|
|
36
|
-
My panel content
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
`;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { SlotFillProvider } from '@wordpress/components';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import PluginPostPublishPanel from '../';
|
|
15
|
-
|
|
16
|
-
describe( 'PluginPostPublishPanel', () => {
|
|
17
|
-
test( 'renders fill properly', () => {
|
|
18
|
-
const { container } = render(
|
|
19
|
-
<SlotFillProvider>
|
|
20
|
-
<PluginPostPublishPanel
|
|
21
|
-
className="my-plugin-post-publish-panel"
|
|
22
|
-
title="My panel title"
|
|
23
|
-
initialOpen
|
|
24
|
-
>
|
|
25
|
-
My panel content
|
|
26
|
-
</PluginPostPublishPanel>
|
|
27
|
-
<PluginPostPublishPanel.Slot />
|
|
28
|
-
</SlotFillProvider>
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
expect( container ).toMatchSnapshot();
|
|
32
|
-
} );
|
|
33
|
-
} );
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines as extensibility slot for the Summary panel.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* WordPress dependencies
|
|
7
|
-
*/
|
|
8
|
-
import { createSlotFill, PanelRow } from '@wordpress/components';
|
|
9
|
-
|
|
10
|
-
const { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Renders a row in the Summary panel of the Document sidebar.
|
|
14
|
-
* It should be noted that this is named and implemented around the function it serves
|
|
15
|
-
* and not its location, which may change in future iterations.
|
|
16
|
-
*
|
|
17
|
-
* @param {Object} props Component properties.
|
|
18
|
-
* @param {string} [props.className] An optional class name added to the row.
|
|
19
|
-
* @param {Element} props.children Children to be rendered.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```js
|
|
23
|
-
* // Using ES5 syntax
|
|
24
|
-
* var __ = wp.i18n.__;
|
|
25
|
-
* var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
|
|
26
|
-
*
|
|
27
|
-
* function MyPluginPostStatusInfo() {
|
|
28
|
-
* return React.createElement(
|
|
29
|
-
* PluginPostStatusInfo,
|
|
30
|
-
* {
|
|
31
|
-
* className: 'my-plugin-post-status-info',
|
|
32
|
-
* },
|
|
33
|
-
* __( 'My post status info' )
|
|
34
|
-
* )
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```jsx
|
|
40
|
-
* // Using ESNext syntax
|
|
41
|
-
* import { __ } from '@wordpress/i18n';
|
|
42
|
-
* import { PluginPostStatusInfo } from '@wordpress/edit-post';
|
|
43
|
-
*
|
|
44
|
-
* const MyPluginPostStatusInfo = () => (
|
|
45
|
-
* <PluginPostStatusInfo
|
|
46
|
-
* className="my-plugin-post-status-info"
|
|
47
|
-
* >
|
|
48
|
-
* { __( 'My post status info' ) }
|
|
49
|
-
* </PluginPostStatusInfo>
|
|
50
|
-
* );
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @return {Component} The component to be rendered.
|
|
54
|
-
*/
|
|
55
|
-
const PluginPostStatusInfo = ( { children, className } ) => (
|
|
56
|
-
<Fill>
|
|
57
|
-
<PanelRow className={ className }>{ children }</PanelRow>
|
|
58
|
-
</Fill>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
PluginPostStatusInfo.Slot = Slot;
|
|
62
|
-
|
|
63
|
-
export default PluginPostStatusInfo;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { SlotFillProvider } from '@wordpress/components';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import PluginPostStatusInfo from '../';
|
|
15
|
-
|
|
16
|
-
describe( 'PluginPostStatusInfo', () => {
|
|
17
|
-
test( 'renders fill properly', () => {
|
|
18
|
-
const { container } = render(
|
|
19
|
-
<SlotFillProvider>
|
|
20
|
-
<PluginPostStatusInfo className="my-plugin-post-status-info">
|
|
21
|
-
My plugin post status info
|
|
22
|
-
</PluginPostStatusInfo>
|
|
23
|
-
<PluginPostStatusInfo.Slot />
|
|
24
|
-
</SlotFillProvider>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
expect( container ).toMatchSnapshot();
|
|
28
|
-
} );
|
|
29
|
-
} );
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { SlotFillProvider } from '@wordpress/components';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import PluginPrePublishPanel from '../';
|
|
15
|
-
|
|
16
|
-
describe( 'PluginPrePublishPanel', () => {
|
|
17
|
-
test( 'renders fill properly', () => {
|
|
18
|
-
render(
|
|
19
|
-
<SlotFillProvider>
|
|
20
|
-
<PluginPrePublishPanel
|
|
21
|
-
className="my-plugin-pre-publish-panel"
|
|
22
|
-
title="My panel title"
|
|
23
|
-
initialOpen
|
|
24
|
-
>
|
|
25
|
-
My panel content
|
|
26
|
-
</PluginPrePublishPanel>
|
|
27
|
-
<PluginPrePublishPanel.Slot />
|
|
28
|
-
</SlotFillProvider>
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
expect( screen.getByText( 'My panel title' ) ).toBeVisible();
|
|
32
|
-
} );
|
|
33
|
-
} );
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { ComplementaryArea } from '@wordpress/interface';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
8
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
12
|
-
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
13
|
-
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
|
|
14
|
-
*
|
|
15
|
-
* ```js
|
|
16
|
-
* wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @see PluginSidebarMoreMenuItem
|
|
20
|
-
*
|
|
21
|
-
* @param {Object} props Element props.
|
|
22
|
-
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
|
|
23
|
-
* @param {string} [props.className] An optional class name added to the sidebar body.
|
|
24
|
-
* @param {string} props.title Title displayed at the top of the sidebar.
|
|
25
|
-
* @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.
|
|
26
|
-
* @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.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```js
|
|
30
|
-
* // Using ES5 syntax
|
|
31
|
-
* var __ = wp.i18n.__;
|
|
32
|
-
* var el = React.createElement;
|
|
33
|
-
* var PanelBody = wp.components.PanelBody;
|
|
34
|
-
* var PluginSidebar = wp.editPost.PluginSidebar;
|
|
35
|
-
* var moreIcon = React.createElement( 'svg' ); //... svg element.
|
|
36
|
-
*
|
|
37
|
-
* function MyPluginSidebar() {
|
|
38
|
-
* return el(
|
|
39
|
-
* PluginSidebar,
|
|
40
|
-
* {
|
|
41
|
-
* name: 'my-sidebar',
|
|
42
|
-
* title: 'My sidebar title',
|
|
43
|
-
* icon: moreIcon,
|
|
44
|
-
* },
|
|
45
|
-
* el(
|
|
46
|
-
* PanelBody,
|
|
47
|
-
* {},
|
|
48
|
-
* __( 'My sidebar content' )
|
|
49
|
-
* )
|
|
50
|
-
* );
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```jsx
|
|
56
|
-
* // Using ESNext syntax
|
|
57
|
-
* import { __ } from '@wordpress/i18n';
|
|
58
|
-
* import { PanelBody } from '@wordpress/components';
|
|
59
|
-
* import { PluginSidebar } from '@wordpress/edit-post';
|
|
60
|
-
* import { more } from '@wordpress/icons';
|
|
61
|
-
*
|
|
62
|
-
* const MyPluginSidebar = () => (
|
|
63
|
-
* <PluginSidebar
|
|
64
|
-
* name="my-sidebar"
|
|
65
|
-
* title="My sidebar title"
|
|
66
|
-
* icon={ more }
|
|
67
|
-
* >
|
|
68
|
-
* <PanelBody>
|
|
69
|
-
* { __( 'My sidebar content' ) }
|
|
70
|
-
* </PanelBody>
|
|
71
|
-
* </PluginSidebar>
|
|
72
|
-
* );
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
export default function PluginSidebarEditPost( { className, ...props } ) {
|
|
76
|
-
const { postTitle, shortcut } = useSelect( ( select ) => {
|
|
77
|
-
return {
|
|
78
|
-
postTitle: select( editorStore ).getEditedPostAttribute( 'title' ),
|
|
79
|
-
shortcut: select(
|
|
80
|
-
keyboardShortcutsStore
|
|
81
|
-
).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' ),
|
|
82
|
-
};
|
|
83
|
-
}, [] );
|
|
84
|
-
return (
|
|
85
|
-
<ComplementaryArea
|
|
86
|
-
panelClassName={ className }
|
|
87
|
-
className="edit-post-sidebar"
|
|
88
|
-
smallScreenTitle={ postTitle || __( '(no title)' ) }
|
|
89
|
-
scope="core/edit-post"
|
|
90
|
-
toggleShortcut={ shortcut }
|
|
91
|
-
{ ...props }
|
|
92
|
-
/>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Icon, layout } from '@wordpress/icons';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { Flex, FlexItem, FlexBlock, PanelBody } from '@wordpress/components';
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
-
|
|
9
|
-
function TemplateSummary() {
|
|
10
|
-
const template = useSelect( ( select ) => {
|
|
11
|
-
const { getCurrentPost } = select( editorStore );
|
|
12
|
-
return getCurrentPost();
|
|
13
|
-
}, [] );
|
|
14
|
-
|
|
15
|
-
if ( ! template ) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<PanelBody>
|
|
21
|
-
<Flex align="flex-start" gap="3">
|
|
22
|
-
<FlexItem>
|
|
23
|
-
<Icon icon={ layout } />
|
|
24
|
-
</FlexItem>
|
|
25
|
-
|
|
26
|
-
<FlexBlock>
|
|
27
|
-
<h2 className="edit-post-template-summary__title">
|
|
28
|
-
{ template?.title || template?.slug }
|
|
29
|
-
</h2>
|
|
30
|
-
<p>{ template?.description }</p>
|
|
31
|
-
</FlexBlock>
|
|
32
|
-
</Flex>
|
|
33
|
-
</PanelBody>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default TemplateSummary;
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Modal } from '@wordpress/components';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
7
|
-
import {
|
|
8
|
-
store as blockEditorStore,
|
|
9
|
-
__experimentalBlockPatternsList as BlockPatternsList,
|
|
10
|
-
} from '@wordpress/block-editor';
|
|
11
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import { useAsyncList } from '@wordpress/compose';
|
|
13
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Internal dependencies
|
|
17
|
-
*/
|
|
18
|
-
import { store as editPostStore } from '../../store';
|
|
19
|
-
|
|
20
|
-
function useStartPatterns() {
|
|
21
|
-
// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
|
|
22
|
-
// and it has no postTypes declared and the current post type is page or if
|
|
23
|
-
// the current post type is part of the postTypes declared.
|
|
24
|
-
const { blockPatternsWithPostContentBlockType, postType } = useSelect(
|
|
25
|
-
( select ) => {
|
|
26
|
-
const { getPatternsByBlockTypes } = select( blockEditorStore );
|
|
27
|
-
const { getCurrentPostType } = select( editorStore );
|
|
28
|
-
return {
|
|
29
|
-
blockPatternsWithPostContentBlockType:
|
|
30
|
-
getPatternsByBlockTypes( 'core/post-content' ),
|
|
31
|
-
postType: getCurrentPostType(),
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
[]
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
return useMemo( () => {
|
|
38
|
-
// filter patterns without postTypes declared if the current postType is page
|
|
39
|
-
// or patterns that declare the current postType in its post type array.
|
|
40
|
-
return blockPatternsWithPostContentBlockType.filter( ( pattern ) => {
|
|
41
|
-
return (
|
|
42
|
-
( postType === 'page' && ! pattern.postTypes ) ||
|
|
43
|
-
( Array.isArray( pattern.postTypes ) &&
|
|
44
|
-
pattern.postTypes.includes( postType ) )
|
|
45
|
-
);
|
|
46
|
-
} );
|
|
47
|
-
}, [ postType, blockPatternsWithPostContentBlockType ] );
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function PatternSelection( { blockPatterns, onChoosePattern } ) {
|
|
51
|
-
const shownBlockPatterns = useAsyncList( blockPatterns );
|
|
52
|
-
const { resetEditorBlocks } = useDispatch( editorStore );
|
|
53
|
-
return (
|
|
54
|
-
<BlockPatternsList
|
|
55
|
-
blockPatterns={ blockPatterns }
|
|
56
|
-
shownPatterns={ shownBlockPatterns }
|
|
57
|
-
onClickPattern={ ( _pattern, blocks ) => {
|
|
58
|
-
resetEditorBlocks( blocks );
|
|
59
|
-
onChoosePattern();
|
|
60
|
-
} }
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function StartPageOptionsModal( { onClose } ) {
|
|
66
|
-
const startPatterns = useStartPatterns();
|
|
67
|
-
const hasStartPattern = startPatterns.length > 0;
|
|
68
|
-
|
|
69
|
-
if ( ! hasStartPattern ) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Modal
|
|
75
|
-
className="edit-post-start-page-options__modal"
|
|
76
|
-
title={ __( 'Choose a pattern' ) }
|
|
77
|
-
isFullScreen
|
|
78
|
-
onRequestClose={ onClose }
|
|
79
|
-
>
|
|
80
|
-
<div className="edit-post-start-page-options__modal-content">
|
|
81
|
-
<PatternSelection
|
|
82
|
-
blockPatterns={ startPatterns }
|
|
83
|
-
onChoosePattern={ onClose }
|
|
84
|
-
/>
|
|
85
|
-
</div>
|
|
86
|
-
</Modal>
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default function StartPageOptions() {
|
|
91
|
-
const [ isClosed, setIsClosed ] = useState( false );
|
|
92
|
-
const shouldEnableModal = useSelect( ( select ) => {
|
|
93
|
-
const { isCleanNewPost, getRenderingMode } = select( editorStore );
|
|
94
|
-
const { isFeatureActive } = select( editPostStore );
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
getRenderingMode() === 'post-only' &&
|
|
98
|
-
! isFeatureActive( 'welcomeGuide' ) &&
|
|
99
|
-
isCleanNewPost()
|
|
100
|
-
);
|
|
101
|
-
}, [] );
|
|
102
|
-
|
|
103
|
-
if ( ! shouldEnableModal || isClosed ) {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;
|
|
108
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// 2 column masonry layout.
|
|
2
|
-
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
3
|
-
column-count: 2;
|
|
4
|
-
column-gap: $grid-unit-30;
|
|
5
|
-
|
|
6
|
-
@include break-medium() {
|
|
7
|
-
column-count: 3;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@include break-wide() {
|
|
11
|
-
column-count: 4;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.block-editor-block-patterns-list__list-item {
|
|
15
|
-
break-inside: avoid-column;
|
|
16
|
-
margin-bottom: $grid-unit-30;
|
|
17
|
-
|
|
18
|
-
.block-editor-block-preview__container {
|
|
19
|
-
min-height: 100px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.block-editor-block-preview__content {
|
|
23
|
-
width: 100%;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|