@wordpress/edit-post 7.33.0 → 7.35.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 +10 -2
- package/README.md +22 -36
- package/build/components/header/fullscreen-mode-close/index.js +2 -2
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/index.js +7 -127
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +17 -43
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/more-menu/manage-patterns-menu-item.js +40 -0
- package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +0 -88
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +72 -33
- package/build/components/layout/index.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +2 -2
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +2 -11
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/visual-editor/index.js +11 -5
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/use-padding-appender.js +6 -1
- package/build/components/visual-editor/use-padding-appender.js.map +1 -1
- package/build/deprecated.js +132 -0
- package/build/deprecated.js.map +1 -0
- package/build/index.js +19 -58
- package/build/index.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js +2 -2
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/index.js +11 -131
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +17 -43
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build-module/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +1 -89
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +73 -34
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js +2 -2
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +3 -12
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +11 -5
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/use-padding-appender.js +6 -1
- package/build-module/components/visual-editor/use-padding-appender.js.map +1 -1
- package/build-module/deprecated.js +116 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/index.js +2 -15
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +14 -409
- package/build-style/style.css +14 -409
- package/package.json +32 -32
- package/src/components/header/fullscreen-mode-close/index.js +2 -2
- package/src/components/header/index.js +11 -159
- package/src/components/header/more-menu/index.js +27 -42
- package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/src/components/header/style.scss +4 -320
- package/src/components/keyboard-shortcuts/index.js +1 -106
- package/src/components/layout/index.js +84 -25
- package/src/components/layout/style.scss +7 -80
- package/src/components/meta-boxes/meta-boxes-area/index.js +4 -8
- package/src/components/preferences-modal/index.js +2 -22
- package/src/components/visual-editor/index.js +11 -4
- package/src/components/visual-editor/use-padding-appender.js +7 -1
- package/src/deprecated.js +107 -0
- package/src/index.js +3 -24
- package/src/style.scss +1 -5
- package/build/components/header/post-publish-button-or-toggle.js +0 -94
- package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build/components/header/preferences-menu-item/index.js +0 -39
- package/build/components/header/preferences-menu-item/index.js.map +0 -1
- package/build/components/header/tools-more-menu-group/index.js +0 -26
- package/build/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build/components/header/writing-menu/index.js +0 -71
- package/build/components/header/writing-menu/index.js.map +0 -1
- package/build/components/layout/actions-panel.js +0 -86
- package/build/components/layout/actions-panel.js.map +0 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +0 -38
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +0 -39
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +0 -43
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
- package/build/components/sidebar/post-format/index.js +0 -21
- package/build/components/sidebar/post-format/index.js.map +0 -1
- package/build/components/sidebar/post-pending-status/index.js +0 -26
- package/build/components/sidebar/post-pending-status/index.js.map +0 -1
- package/build/components/sidebar/post-slug/index.js +0 -21
- package/build/components/sidebar/post-slug/index.js.map +0 -1
- package/build/components/sidebar/post-status/index.js +0 -69
- package/build/components/sidebar/post-status/index.js.map +0 -1
- package/build/components/sidebar/post-sticky/index.js +0 -26
- package/build/components/sidebar/post-sticky/index.js.map +0 -1
- package/build/components/sidebar/post-trash/index.js +0 -16
- package/build/components/sidebar/post-trash/index.js.map +0 -1
- package/build/components/sidebar/post-visibility/index.js +0 -78
- package/build/components/sidebar/post-visibility/index.js.map +0 -1
- package/build/components/sidebar/settings-header/index.js +0 -53
- package/build/components/sidebar/settings-header/index.js.map +0 -1
- package/build/components/sidebar/settings-sidebar/index.js +0 -163
- package/build/components/sidebar/settings-sidebar/index.js.map +0 -1
- package/build/plugins/copy-content-menu-item/index.js +0 -39
- package/build/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build/plugins/index.js +0 -69
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -44
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item/index.js.map +0 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +0 -86
- package/build-module/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build-module/components/header/preferences-menu-item/index.js +0 -32
- package/build-module/components/header/preferences-menu-item/index.js.map +0 -1
- package/build-module/components/header/tools-more-menu-group/index.js +0 -19
- package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/header/writing-menu/index.js +0 -64
- package/build-module/components/header/writing-menu/index.js.map +0 -1
- package/build-module/components/layout/actions-panel.js +0 -78
- package/build-module/components/layout/actions-panel.js.map +0 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +0 -31
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +0 -32
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +0 -36
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
- package/build-module/components/sidebar/post-format/index.js +0 -13
- package/build-module/components/sidebar/post-format/index.js.map +0 -1
- package/build-module/components/sidebar/post-pending-status/index.js +0 -18
- package/build-module/components/sidebar/post-pending-status/index.js.map +0 -1
- package/build-module/components/sidebar/post-slug/index.js +0 -13
- package/build-module/components/sidebar/post-slug/index.js.map +0 -1
- package/build-module/components/sidebar/post-status/index.js +0 -61
- package/build-module/components/sidebar/post-status/index.js.map +0 -1
- package/build-module/components/sidebar/post-sticky/index.js +0 -18
- package/build-module/components/sidebar/post-sticky/index.js.map +0 -1
- package/build-module/components/sidebar/post-trash/index.js +0 -9
- package/build-module/components/sidebar/post-trash/index.js.map +0 -1
- package/build-module/components/sidebar/post-visibility/index.js +0 -70
- package/build-module/components/sidebar/post-visibility/index.js.map +0 -1
- package/build-module/components/sidebar/settings-header/index.js +0 -46
- package/build-module/components/sidebar/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +0 -155
- package/build-module/components/sidebar/settings-sidebar/index.js.map +0 -1
- package/build-module/plugins/copy-content-menu-item/index.js +0 -32
- package/build-module/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build-module/plugins/index.js +0 -65
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -36
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +0 -1
- package/src/components/header/post-publish-button-or-toggle.js +0 -97
- package/src/components/header/preferences-menu-item/index.js +0 -31
- package/src/components/header/test/index.js +0 -63
- package/src/components/header/tools-more-menu-group/index.js +0 -20
- package/src/components/header/writing-menu/index.js +0 -73
- package/src/components/layout/actions-panel.js +0 -103
- package/src/components/preferences-modal/enable-publish-sidebar.js +0 -32
- package/src/components/preferences-modal/test/index.js +0 -28
- package/src/components/sidebar/plugin-post-publish-panel/index.js +0 -28
- package/src/components/sidebar/plugin-pre-publish-panel/index.js +0 -32
- package/src/components/sidebar/post-format/index.js +0 -20
- package/src/components/sidebar/post-format/style.scss +0 -5
- package/src/components/sidebar/post-pending-status/index.js +0 -27
- package/src/components/sidebar/post-slug/index.js +0 -17
- package/src/components/sidebar/post-slug/style.scss +0 -5
- package/src/components/sidebar/post-status/index.js +0 -88
- package/src/components/sidebar/post-sticky/index.js +0 -27
- package/src/components/sidebar/post-trash/index.js +0 -12
- package/src/components/sidebar/post-visibility/index.js +0 -88
- package/src/components/sidebar/post-visibility/style.scss +0 -5
- package/src/components/sidebar/settings-header/index.js +0 -49
- package/src/components/sidebar/settings-sidebar/index.js +0 -211
- package/src/components/sidebar/style.scss +0 -18
- package/src/plugins/copy-content-menu-item/index.js +0 -29
- package/src/plugins/index.js +0 -85
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -36
- /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { MenuItem, VisuallyHidden } from '@wordpress/components';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
-
import { useSelect } from '@wordpress/data';
|
|
9
|
-
import { external } from '@wordpress/icons';
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { registerPlugin } from '@wordpress/plugins';
|
|
12
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
|
-
import CopyContentMenuItem from './copy-content-menu-item';
|
|
18
|
-
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
19
|
-
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
20
|
-
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
21
|
-
function ManagePatternsMenuItem() {
|
|
22
|
-
const url = useSelect(select => {
|
|
23
|
-
const {
|
|
24
|
-
canUser
|
|
25
|
-
} = select(coreStore);
|
|
26
|
-
const {
|
|
27
|
-
getEditorSettings
|
|
28
|
-
} = select(editorStore);
|
|
29
|
-
const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;
|
|
30
|
-
const defaultUrl = addQueryArgs('edit.php', {
|
|
31
|
-
post_type: 'wp_block'
|
|
32
|
-
});
|
|
33
|
-
const patternsUrl = addQueryArgs('site-editor.php', {
|
|
34
|
-
path: '/patterns'
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// The site editor and templates both check whether the user has
|
|
38
|
-
// edit_theme_options capabilities. We can leverage that here and not
|
|
39
|
-
// display the manage patterns link if the user can't access it.
|
|
40
|
-
return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl;
|
|
41
|
-
}, []);
|
|
42
|
-
return createElement(MenuItem, {
|
|
43
|
-
role: "menuitem",
|
|
44
|
-
href: url
|
|
45
|
-
}, __('Manage patterns'));
|
|
46
|
-
}
|
|
47
|
-
registerPlugin('edit-post', {
|
|
48
|
-
render() {
|
|
49
|
-
return createElement(Fragment, null, createElement(ToolsMoreMenuGroup, null, ({
|
|
50
|
-
onClose
|
|
51
|
-
}) => createElement(Fragment, null, createElement(ManagePatternsMenuItem, null), createElement(KeyboardShortcutsHelpMenuItem, {
|
|
52
|
-
onSelect: onClose
|
|
53
|
-
}), createElement(WelcomeGuideMenuItem, null), createElement(CopyContentMenuItem, null), createElement(MenuItem, {
|
|
54
|
-
role: "menuitem",
|
|
55
|
-
icon: external,
|
|
56
|
-
href: __('https://wordpress.org/documentation/article/wordpress-block-editor/'),
|
|
57
|
-
target: "_blank",
|
|
58
|
-
rel: "noopener noreferrer"
|
|
59
|
-
}, __('Help'), createElement(VisuallyHidden, {
|
|
60
|
-
as: "span"
|
|
61
|
-
}, /* translators: accessibility text */
|
|
62
|
-
__('(opens in a new tab)'))))));
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["MenuItem","VisuallyHidden","store","coreStore","editorStore","useSelect","external","__","registerPlugin","addQueryArgs","CopyContentMenuItem","KeyboardShortcutsHelpMenuItem","ToolsMoreMenuGroup","WelcomeGuideMenuItem","ManagePatternsMenuItem","url","select","canUser","getEditorSettings","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","post_type","patternsUrl","path","createElement","role","href","render","Fragment","onClose","onSelect","icon","target","rel","as"],"sources":["@wordpress/edit-post/src/plugins/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem, VisuallyHidden } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { external } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { registerPlugin } from '@wordpress/plugins';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport CopyContentMenuItem from './copy-content-menu-item';\nimport KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';\nimport ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nfunction ManagePatternsMenuItem() {\n\tconst url = useSelect( ( select ) => {\n\t\tconst { canUser } = select( coreStore );\n\t\tconst { getEditorSettings } = select( editorStore );\n\n\t\tconst isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;\n\t\tconst defaultUrl = addQueryArgs( 'edit.php', {\n\t\t\tpost_type: 'wp_block',\n\t\t} );\n\t\tconst patternsUrl = addQueryArgs( 'site-editor.php', {\n\t\t\tpath: '/patterns',\n\t\t} );\n\n\t\t// The site editor and templates both check whether the user has\n\t\t// edit_theme_options capabilities. We can leverage that here and not\n\t\t// display the manage patterns link if the user can't access it.\n\t\treturn canUser( 'read', 'templates' ) && isBlockTheme\n\t\t\t? patternsUrl\n\t\t\t: defaultUrl;\n\t}, [] );\n\n\treturn (\n\t\t<MenuItem role=\"menuitem\" href={ url }>\n\t\t\t{ __( 'Manage patterns' ) }\n\t\t</MenuItem>\n\t);\n}\n\nregisterPlugin( 'edit-post', {\n\trender() {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<ToolsMoreMenuGroup>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ManagePatternsMenuItem />\n\t\t\t\t\t\t\t<KeyboardShortcutsHelpMenuItem\n\t\t\t\t\t\t\t\tonSelect={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<CopyContentMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsMoreMenuGroup>\n\t\t\t</>\n\t\t);\n\t},\n} );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,cAAc,QAAQ,uBAAuB;AAChE,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SAASC,YAAY,QAAQ,gBAAgB;;AAE7C;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,6BAA6B,MAAM,qCAAqC;AAC/E,OAAOC,kBAAkB,MAAM,4CAA4C;AAC3E,OAAOC,oBAAoB,MAAM,2BAA2B;AAE5D,SAASC,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,GAAG,GAAGV,SAAS,CAAIW,MAAM,IAAM;IACpC,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM,CAAEb,SAAU,CAAC;IACvC,MAAM;MAAEe;IAAkB,CAAC,GAAGF,MAAM,CAAEZ,WAAY,CAAC;IAEnD,MAAMe,YAAY,GAAGD,iBAAiB,CAAC,CAAC,CAACE,2BAA2B;IACpE,MAAMC,UAAU,GAAGZ,YAAY,CAAE,UAAU,EAAE;MAC5Ca,SAAS,EAAE;IACZ,CAAE,CAAC;IACH,MAAMC,WAAW,GAAGd,YAAY,CAAE,iBAAiB,EAAE;MACpDe,IAAI,EAAE;IACP,CAAE,CAAC;;IAEH;IACA;IACA;IACA,OAAOP,OAAO,CAAE,MAAM,EAAE,WAAY,CAAC,IAAIE,YAAY,GAClDI,WAAW,GACXF,UAAU;EACd,CAAC,EAAE,EAAG,CAAC;EAEP,OACCI,aAAA,CAACzB,QAAQ;IAAC0B,IAAI,EAAC,UAAU;IAACC,IAAI,EAAGZ;EAAK,GACnCR,EAAE,CAAE,iBAAkB,CACf,CAAC;AAEb;AAEAC,cAAc,CAAE,WAAW,EAAE;EAC5BoB,MAAMA,CAAA,EAAG;IACR,OACCH,aAAA,CAAAI,QAAA,QACCJ,aAAA,CAACb,kBAAkB,QAChB,CAAE;MAAEkB;IAAQ,CAAC,KACdL,aAAA,CAAAI,QAAA,QACCJ,aAAA,CAACX,sBAAsB,MAAE,CAAC,EAC1BW,aAAA,CAACd,6BAA6B;MAC7BoB,QAAQ,EAAGD;IAAS,CACpB,CAAC,EACFL,aAAA,CAACZ,oBAAoB,MAAE,CAAC,EACxBY,aAAA,CAACf,mBAAmB,MAAE,CAAC,EACvBe,aAAA,CAACzB,QAAQ;MACR0B,IAAI,EAAC,UAAU;MACfM,IAAI,EAAG1B,QAAU;MACjBqB,IAAI,EAAGpB,EAAE,CACR,qEACD,CAAG;MACH0B,MAAM,EAAC,QAAQ;MACfC,GAAG,EAAC;IAAqB,GAEvB3B,EAAE,CAAE,MAAO,CAAC,EACdkB,aAAA,CAACxB,cAAc;MAACkC,EAAE,EAAC;IAAM,GAEvB;IACA5B,EAAE,CAAE,sBAAuB,CAEb,CACP,CACT,CAEgB,CACnB,CAAC;EAEL;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { MenuItem } from '@wordpress/components';
|
|
6
|
-
import { withDispatch } from '@wordpress/data';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { displayShortcut } from '@wordpress/keycodes';
|
|
9
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { unlock } from '../../lock-unlock';
|
|
15
|
-
const {
|
|
16
|
-
interfaceStore
|
|
17
|
-
} = unlock(editorPrivateApis);
|
|
18
|
-
export function KeyboardShortcutsHelpMenuItem({
|
|
19
|
-
openModal
|
|
20
|
-
}) {
|
|
21
|
-
return createElement(MenuItem, {
|
|
22
|
-
onClick: () => {
|
|
23
|
-
openModal('editor/keyboard-shortcut-help');
|
|
24
|
-
},
|
|
25
|
-
shortcut: displayShortcut.access('h')
|
|
26
|
-
}, __('Keyboard shortcuts'));
|
|
27
|
-
}
|
|
28
|
-
export default withDispatch(dispatch => {
|
|
29
|
-
const {
|
|
30
|
-
openModal
|
|
31
|
-
} = dispatch(interfaceStore);
|
|
32
|
-
return {
|
|
33
|
-
openModal
|
|
34
|
-
};
|
|
35
|
-
})(KeyboardShortcutsHelpMenuItem);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["MenuItem","withDispatch","__","displayShortcut","privateApis","editorPrivateApis","unlock","interfaceStore","KeyboardShortcutsHelpMenuItem","openModal","createElement","onClick","shortcut","access","dispatch"],"sources":["@wordpress/edit-post/src/plugins/keyboard-shortcuts-help-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { withDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\nexport function KeyboardShortcutsHelpMenuItem( { openModal } ) {\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\topenModal( 'editor/keyboard-shortcut-help' );\n\t\t\t} }\n\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t>\n\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default withDispatch( ( dispatch ) => {\n\tconst { openModal } = dispatch( interfaceStore );\n\n\treturn {\n\t\topenModal,\n\t};\n} )( KeyboardShortcutsHelpMenuItem );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAe,CAAC,GAAGD,MAAM,CAAED,iBAAkB,CAAC;AAEtD,OAAO,SAASG,6BAA6BA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAC9D,OACCC,aAAA,CAACV,QAAQ;IACRW,OAAO,EAAGA,CAAA,KAAM;MACfF,SAAS,CAAE,+BAAgC,CAAC;IAC7C,CAAG;IACHG,QAAQ,EAAGT,eAAe,CAACU,MAAM,CAAE,GAAI;EAAG,GAExCX,EAAE,CAAE,oBAAqB,CAClB,CAAC;AAEb;AAEA,eAAeD,YAAY,CAAIa,QAAQ,IAAM;EAC5C,MAAM;IAAEL;EAAU,CAAC,GAAGK,QAAQ,CAAEP,cAAe,CAAC;EAEhD,OAAO;IACNE;EACD,CAAC;AACF,CAAE,CAAC,CAAED,6BAA8B,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","PreferenceToggleMenuItem","__","store","editorStore","WelcomeGuideMenuItem","isEditingTemplate","select","getCurrentPostType","createElement","scope","name","label"],"sources":["@wordpress/edit-post/src/plugins/welcome-guide-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { PreferenceToggleMenuItem } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function WelcomeGuideMenuItem() {\n\tconst isEditingTemplate = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).getCurrentPostType() === 'wp_template',\n\t\t[]\n\t);\n\n\treturn (\n\t\t<PreferenceToggleMenuItem\n\t\t\tscope=\"core/edit-post\"\n\t\t\tname={ isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide' }\n\t\t\tlabel={ __( 'Welcome Guide' ) }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,wBAAwB,QAAQ,wBAAwB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AAExD,eAAe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAGN,SAAS,CAChCO,MAAM,IACPA,MAAM,CAAEH,WAAY,CAAC,CAACI,kBAAkB,CAAC,CAAC,KAAK,aAAa,EAC7D,EACD,CAAC;EAED,OACCC,aAAA,CAACR,wBAAwB;IACxBS,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGL,iBAAiB,GAAG,sBAAsB,GAAG,cAAgB;IACpEM,KAAK,EAAGV,EAAE,CAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useViewportMatch, compose } from '@wordpress/compose';
|
|
5
|
-
import { withDispatch, withSelect } from '@wordpress/data';
|
|
6
|
-
import { PostPublishButton, store as editorStore } from '@wordpress/editor';
|
|
7
|
-
|
|
8
|
-
export function PostPublishButtonOrToggle( {
|
|
9
|
-
forceIsDirty,
|
|
10
|
-
hasPublishAction,
|
|
11
|
-
isBeingScheduled,
|
|
12
|
-
isPending,
|
|
13
|
-
isPublished,
|
|
14
|
-
isPublishSidebarEnabled,
|
|
15
|
-
isPublishSidebarOpened,
|
|
16
|
-
isScheduled,
|
|
17
|
-
togglePublishSidebar,
|
|
18
|
-
setEntitiesSavedStatesCallback,
|
|
19
|
-
postStatusHasChanged,
|
|
20
|
-
postStatus,
|
|
21
|
-
} ) {
|
|
22
|
-
const IS_TOGGLE = 'toggle';
|
|
23
|
-
const IS_BUTTON = 'button';
|
|
24
|
-
const isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );
|
|
25
|
-
let component;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
|
|
29
|
-
*
|
|
30
|
-
* 1) We want to show a BUTTON when the post status is at the _final stage_
|
|
31
|
-
* for a particular role (see https://wordpress.org/documentation/article/post-status/):
|
|
32
|
-
*
|
|
33
|
-
* - is published
|
|
34
|
-
* - post status has changed explicitely to something different than 'future' or 'publish'
|
|
35
|
-
* - is scheduled to be published
|
|
36
|
-
* - is pending and can't be published (but only for viewports >= medium).
|
|
37
|
-
* Originally, we considered showing a button for pending posts that couldn't be published
|
|
38
|
-
* (for example, for an author with the contributor role). Some languages can have
|
|
39
|
-
* long translations for "Submit for review", so given the lack of UI real estate available
|
|
40
|
-
* we decided to take into account the viewport in that case.
|
|
41
|
-
* See: https://github.com/WordPress/gutenberg/issues/10475
|
|
42
|
-
*
|
|
43
|
-
* 2) Then, in small viewports, we'll show a TOGGLE.
|
|
44
|
-
*
|
|
45
|
-
* 3) Finally, we'll use the publish sidebar status to decide:
|
|
46
|
-
*
|
|
47
|
-
* - if it is enabled, we show a TOGGLE
|
|
48
|
-
* - if it is disabled, we show a BUTTON
|
|
49
|
-
*/
|
|
50
|
-
if (
|
|
51
|
-
isPublished ||
|
|
52
|
-
( postStatusHasChanged &&
|
|
53
|
-
! [ 'future', 'publish' ].includes( postStatus ) ) ||
|
|
54
|
-
( isScheduled && isBeingScheduled ) ||
|
|
55
|
-
( isPending && ! hasPublishAction && ! isSmallerThanMediumViewport )
|
|
56
|
-
) {
|
|
57
|
-
component = IS_BUTTON;
|
|
58
|
-
} else if ( isSmallerThanMediumViewport || isPublishSidebarEnabled ) {
|
|
59
|
-
component = IS_TOGGLE;
|
|
60
|
-
} else {
|
|
61
|
-
component = IS_BUTTON;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<PostPublishButton
|
|
66
|
-
forceIsDirty={ forceIsDirty }
|
|
67
|
-
isOpen={ isPublishSidebarOpened }
|
|
68
|
-
isToggle={ component === IS_TOGGLE }
|
|
69
|
-
onToggle={ togglePublishSidebar }
|
|
70
|
-
setEntitiesSavedStatesCallback={ setEntitiesSavedStatesCallback }
|
|
71
|
-
/>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default compose(
|
|
76
|
-
withSelect( ( select ) => ( {
|
|
77
|
-
hasPublishAction:
|
|
78
|
-
select( editorStore ).getCurrentPost()?._links?.[
|
|
79
|
-
'wp:action-publish'
|
|
80
|
-
] ?? false,
|
|
81
|
-
isBeingScheduled: select( editorStore ).isEditedPostBeingScheduled(),
|
|
82
|
-
isPending: select( editorStore ).isCurrentPostPending(),
|
|
83
|
-
isPublished: select( editorStore ).isCurrentPostPublished(),
|
|
84
|
-
isPublishSidebarEnabled:
|
|
85
|
-
select( editorStore ).isPublishSidebarEnabled(),
|
|
86
|
-
isPublishSidebarOpened: select( editorStore ).isPublishSidebarOpened(),
|
|
87
|
-
isScheduled: select( editorStore ).isCurrentPostScheduled(),
|
|
88
|
-
postStatus: select( editorStore ).getEditedPostAttribute( 'status' ),
|
|
89
|
-
postStatusHasChanged: select( editorStore ).getPostEdits()?.status,
|
|
90
|
-
} ) ),
|
|
91
|
-
withDispatch( ( dispatch ) => {
|
|
92
|
-
const { togglePublishSidebar } = dispatch( editorStore );
|
|
93
|
-
return {
|
|
94
|
-
togglePublishSidebar,
|
|
95
|
-
};
|
|
96
|
-
} )
|
|
97
|
-
)( PostPublishButtonOrToggle );
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useDispatch } from '@wordpress/data';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { MenuItem } from '@wordpress/components';
|
|
7
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import { unlock } from '../../../lock-unlock';
|
|
13
|
-
|
|
14
|
-
const { interfaceStore } = unlock( editorPrivateApis );
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export default function PreferencesMenuItem() {
|
|
21
|
-
const { openModal } = useDispatch( interfaceStore );
|
|
22
|
-
return (
|
|
23
|
-
<MenuItem
|
|
24
|
-
onClick={ () => {
|
|
25
|
-
openModal( 'editor/preferences' );
|
|
26
|
-
} }
|
|
27
|
-
>
|
|
28
|
-
{ __( 'Preferences' ) }
|
|
29
|
-
</MenuItem>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { PostPublishButtonOrToggle } from '../post-publish-button-or-toggle';
|
|
15
|
-
|
|
16
|
-
jest.mock( '@wordpress/compose/src/hooks/use-viewport-match' );
|
|
17
|
-
|
|
18
|
-
describe( 'PostPublishButtonOrToggle should render a', () => {
|
|
19
|
-
afterEach( () => {
|
|
20
|
-
useViewportMatch.mockRestore();
|
|
21
|
-
} );
|
|
22
|
-
|
|
23
|
-
it( 'button when the post is published (1)', () => {
|
|
24
|
-
render( <PostPublishButtonOrToggle isPublished /> );
|
|
25
|
-
expect(
|
|
26
|
-
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
27
|
-
).toBeVisible();
|
|
28
|
-
} );
|
|
29
|
-
|
|
30
|
-
it( 'button when the post is scheduled (2)', () => {
|
|
31
|
-
render( <PostPublishButtonOrToggle isScheduled isBeingScheduled /> );
|
|
32
|
-
expect(
|
|
33
|
-
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
34
|
-
).toBeVisible();
|
|
35
|
-
} );
|
|
36
|
-
|
|
37
|
-
it( 'button when the post is pending and cannot be published but the viewport is >= medium (3)', () => {
|
|
38
|
-
render(
|
|
39
|
-
<PostPublishButtonOrToggle isPending hasPublishAction={ false } />
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
expect(
|
|
43
|
-
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
44
|
-
).toBeVisible();
|
|
45
|
-
} );
|
|
46
|
-
|
|
47
|
-
it( 'toggle when post is not (1), (2), (3), the viewport is <= medium, and the publish sidebar is enabled', () => {
|
|
48
|
-
useViewportMatch.mockReturnValue( true );
|
|
49
|
-
render( <PostPublishButtonOrToggle isPublishSidebarEnabled /> );
|
|
50
|
-
expect(
|
|
51
|
-
screen.getByRole( 'button', { name: 'Publish' } )
|
|
52
|
-
).toBeVisible();
|
|
53
|
-
} );
|
|
54
|
-
|
|
55
|
-
it( 'button when post is not (1), (2), (3), the viewport is >= medium, and the publish sidebar is disabled', () => {
|
|
56
|
-
render(
|
|
57
|
-
<PostPublishButtonOrToggle isPublishSidebarEnabled={ false } />
|
|
58
|
-
);
|
|
59
|
-
expect(
|
|
60
|
-
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
61
|
-
).toBeVisible();
|
|
62
|
-
} );
|
|
63
|
-
} );
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createSlotFill, MenuGroup } from '@wordpress/components';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
|
|
7
|
-
const { Fill: ToolsMoreMenuGroup, Slot } =
|
|
8
|
-
createSlotFill( 'ToolsMoreMenuGroup' );
|
|
9
|
-
|
|
10
|
-
ToolsMoreMenuGroup.Slot = ( { fillProps } ) => (
|
|
11
|
-
<Slot fillProps={ fillProps }>
|
|
12
|
-
{ ( fills ) =>
|
|
13
|
-
fills.length > 0 && (
|
|
14
|
-
<MenuGroup label={ __( 'Tools' ) }>{ fills }</MenuGroup>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
</Slot>
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
export default ToolsMoreMenuGroup;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useDispatch } from '@wordpress/data';
|
|
5
|
-
import { MenuGroup } from '@wordpress/components';
|
|
6
|
-
import { __, _x } from '@wordpress/i18n';
|
|
7
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
-
import { displayShortcut } from '@wordpress/keycodes';
|
|
9
|
-
import {
|
|
10
|
-
PreferenceToggleMenuItem,
|
|
11
|
-
store as preferencesStore,
|
|
12
|
-
} from '@wordpress/preferences';
|
|
13
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
14
|
-
|
|
15
|
-
function WritingMenu() {
|
|
16
|
-
const { set: setPreference } = useDispatch( preferencesStore );
|
|
17
|
-
const { toggleDistractionFree } = useDispatch( editorStore );
|
|
18
|
-
|
|
19
|
-
const turnOffDistractionFree = () => {
|
|
20
|
-
setPreference( 'core', 'distractionFree', false );
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const isLargeViewport = useViewportMatch( 'medium' );
|
|
24
|
-
if ( ! isLargeViewport ) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
30
|
-
<PreferenceToggleMenuItem
|
|
31
|
-
scope="core"
|
|
32
|
-
name="fixedToolbar"
|
|
33
|
-
onToggle={ turnOffDistractionFree }
|
|
34
|
-
label={ __( 'Top toolbar' ) }
|
|
35
|
-
info={ __(
|
|
36
|
-
'Access all block and document tools in a single place'
|
|
37
|
-
) }
|
|
38
|
-
messageActivated={ __( 'Top toolbar activated' ) }
|
|
39
|
-
messageDeactivated={ __( 'Top toolbar deactivated' ) }
|
|
40
|
-
/>
|
|
41
|
-
<PreferenceToggleMenuItem
|
|
42
|
-
scope="core"
|
|
43
|
-
name="distractionFree"
|
|
44
|
-
handleToggling={ false }
|
|
45
|
-
onToggle={ toggleDistractionFree }
|
|
46
|
-
label={ __( 'Distraction free' ) }
|
|
47
|
-
info={ __( 'Write with calmness' ) }
|
|
48
|
-
messageActivated={ __( 'Distraction free mode activated' ) }
|
|
49
|
-
messageDeactivated={ __( 'Distraction free mode deactivated' ) }
|
|
50
|
-
shortcut={ displayShortcut.primaryShift( '\\' ) }
|
|
51
|
-
/>
|
|
52
|
-
<PreferenceToggleMenuItem
|
|
53
|
-
scope="core"
|
|
54
|
-
name="focusMode"
|
|
55
|
-
label={ __( 'Spotlight mode' ) }
|
|
56
|
-
info={ __( 'Focus on one block at a time' ) }
|
|
57
|
-
messageActivated={ __( 'Spotlight mode activated' ) }
|
|
58
|
-
messageDeactivated={ __( 'Spotlight mode deactivated' ) }
|
|
59
|
-
/>
|
|
60
|
-
<PreferenceToggleMenuItem
|
|
61
|
-
scope="core/edit-post"
|
|
62
|
-
name="fullscreenMode"
|
|
63
|
-
label={ __( 'Fullscreen mode' ) }
|
|
64
|
-
info={ __( 'Show and hide the admin user interface' ) }
|
|
65
|
-
messageActivated={ __( 'Fullscreen mode activated' ) }
|
|
66
|
-
messageDeactivated={ __( 'Fullscreen mode deactivated' ) }
|
|
67
|
-
shortcut={ displayShortcut.secondary( 'f' ) }
|
|
68
|
-
/>
|
|
69
|
-
</MenuGroup>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export default WritingMenu;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
EntitiesSavedStates,
|
|
6
|
-
PostPublishPanel,
|
|
7
|
-
PluginPrePublishPanel,
|
|
8
|
-
PluginPostPublishPanel,
|
|
9
|
-
store as editorStore,
|
|
10
|
-
} from '@wordpress/editor';
|
|
11
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import { Button, createSlotFill } from '@wordpress/components';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
14
|
-
import { useCallback } from '@wordpress/element';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
import { store as editPostStore } from '../../store';
|
|
20
|
-
|
|
21
|
-
const { Fill, Slot } = createSlotFill( 'ActionsPanel' );
|
|
22
|
-
|
|
23
|
-
export const ActionsPanelFill = Fill;
|
|
24
|
-
|
|
25
|
-
export default function ActionsPanel( {
|
|
26
|
-
setEntitiesSavedStatesCallback,
|
|
27
|
-
closeEntitiesSavedStates,
|
|
28
|
-
isEntitiesSavedStatesOpen,
|
|
29
|
-
} ) {
|
|
30
|
-
const { closePublishSidebar, togglePublishSidebar } =
|
|
31
|
-
useDispatch( editorStore );
|
|
32
|
-
const {
|
|
33
|
-
publishSidebarOpened,
|
|
34
|
-
hasActiveMetaboxes,
|
|
35
|
-
hasNonPostEntityChanges,
|
|
36
|
-
} = useSelect(
|
|
37
|
-
( select ) => ( {
|
|
38
|
-
publishSidebarOpened:
|
|
39
|
-
select( editorStore ).isPublishSidebarOpened(),
|
|
40
|
-
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
41
|
-
hasNonPostEntityChanges:
|
|
42
|
-
select( editorStore ).hasNonPostEntityChanges(),
|
|
43
|
-
} ),
|
|
44
|
-
[]
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const openEntitiesSavedStates = useCallback(
|
|
48
|
-
() => setEntitiesSavedStatesCallback( true ),
|
|
49
|
-
[]
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
// It is ok for these components to be unmounted when not in visual use.
|
|
53
|
-
// We don't want more than one present at a time, decide which to render.
|
|
54
|
-
let unmountableContent;
|
|
55
|
-
if ( publishSidebarOpened ) {
|
|
56
|
-
unmountableContent = (
|
|
57
|
-
<PostPublishPanel
|
|
58
|
-
onClose={ closePublishSidebar }
|
|
59
|
-
forceIsDirty={ hasActiveMetaboxes }
|
|
60
|
-
PrePublishExtension={ PluginPrePublishPanel.Slot }
|
|
61
|
-
PostPublishExtension={ PluginPostPublishPanel.Slot }
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
} else if ( hasNonPostEntityChanges ) {
|
|
65
|
-
unmountableContent = (
|
|
66
|
-
<div className="edit-post-layout__toggle-entities-saved-states-panel">
|
|
67
|
-
<Button
|
|
68
|
-
variant="secondary"
|
|
69
|
-
className="edit-post-layout__toggle-entities-saved-states-panel-button"
|
|
70
|
-
onClick={ openEntitiesSavedStates }
|
|
71
|
-
aria-expanded={ false }
|
|
72
|
-
>
|
|
73
|
-
{ __( 'Open save panel' ) }
|
|
74
|
-
</Button>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
} else {
|
|
78
|
-
unmountableContent = (
|
|
79
|
-
<div className="edit-post-layout__toggle-publish-panel">
|
|
80
|
-
<Button
|
|
81
|
-
variant="secondary"
|
|
82
|
-
className="edit-post-layout__toggle-publish-panel-button"
|
|
83
|
-
onClick={ togglePublishSidebar }
|
|
84
|
-
aria-expanded={ false }
|
|
85
|
-
>
|
|
86
|
-
{ __( 'Open publish panel' ) }
|
|
87
|
-
</Button>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Since EntitiesSavedStates controls its own panel, we can keep it
|
|
93
|
-
// always mounted to retain its own component state (such as checkboxes).
|
|
94
|
-
return (
|
|
95
|
-
<>
|
|
96
|
-
{ isEntitiesSavedStatesOpen && (
|
|
97
|
-
<EntitiesSavedStates close={ closeEntitiesSavedStates } />
|
|
98
|
-
) }
|
|
99
|
-
<Slot bubblesVirtually />
|
|
100
|
-
{ ! isEntitiesSavedStatesOpen && unmountableContent }
|
|
101
|
-
</>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { compose } from '@wordpress/compose';
|
|
5
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
6
|
-
import { ifViewportMatches } from '@wordpress/viewport';
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
-
import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../lock-unlock';
|
|
14
|
-
|
|
15
|
-
const { PreferenceBaseOption } = unlock( preferencesPrivateApis );
|
|
16
|
-
|
|
17
|
-
export default compose(
|
|
18
|
-
withSelect( ( select ) => ( {
|
|
19
|
-
isChecked: select( editorStore ).isPublishSidebarEnabled(),
|
|
20
|
-
} ) ),
|
|
21
|
-
withDispatch( ( dispatch ) => {
|
|
22
|
-
const { enablePublishSidebar, disablePublishSidebar } =
|
|
23
|
-
dispatch( editorStore );
|
|
24
|
-
return {
|
|
25
|
-
onChange: ( isEnabled ) =>
|
|
26
|
-
isEnabled ? enablePublishSidebar() : disablePublishSidebar(),
|
|
27
|
-
};
|
|
28
|
-
} ),
|
|
29
|
-
// In < medium viewports we override this option and always show the publish sidebar.
|
|
30
|
-
// See the edit-post's header component for the specific logic.
|
|
31
|
-
ifViewportMatches( 'medium' )
|
|
32
|
-
)( PreferenceBaseOption );
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import EditPostPreferencesModal from '../';
|
|
15
|
-
|
|
16
|
-
// This allows us to tweak the returned value on each test.
|
|
17
|
-
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
18
|
-
jest.mock( '@wordpress/compose/src/hooks/use-viewport-match', () => jest.fn() );
|
|
19
|
-
|
|
20
|
-
describe( 'EditPostPreferencesModal', () => {
|
|
21
|
-
it( 'should not render when the modal is not active', () => {
|
|
22
|
-
useSelect.mockImplementation( () => [ false, false, false ] );
|
|
23
|
-
render( <EditPostPreferencesModal /> );
|
|
24
|
-
expect(
|
|
25
|
-
screen.queryByRole( 'dialog', { name: 'Preferences' } )
|
|
26
|
-
).not.toBeInTheDocument();
|
|
27
|
-
} );
|
|
28
|
-
} );
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import deprecated from '@wordpress/deprecated';
|
|
5
|
-
import { PluginPostPublishPanel } from '@wordpress/editor';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Renders provided content to the post-publish panel in the publish flow
|
|
9
|
-
* (side panel that opens after a user publishes the post).
|
|
10
|
-
*
|
|
11
|
-
* @deprecated since 6.6, use `wp.editor.PluginPostPublishPanel` instead.
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} props Component properties.
|
|
14
|
-
* @param {string} [props.className] An optional class name added to the panel.
|
|
15
|
-
* @param {string} [props.title] Title displayed at the top of the panel.
|
|
16
|
-
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
|
|
17
|
-
* @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.
|
|
18
|
-
* @param {Element} props.children Children to be rendered
|
|
19
|
-
* @return {Component} The component to be rendered.
|
|
20
|
-
*/
|
|
21
|
-
export default function EditPostPluginPostPublishPanel( props ) {
|
|
22
|
-
deprecated( 'wp.editPost.PluginPostPublishPanel', {
|
|
23
|
-
since: '6.6',
|
|
24
|
-
version: '6.8',
|
|
25
|
-
alternative: 'wp.editor.PluginPostPublishPanel',
|
|
26
|
-
} );
|
|
27
|
-
return <PluginPostPublishPanel { ...props } />;
|
|
28
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import deprecated from '@wordpress/deprecated';
|
|
5
|
-
import { PluginPrePublishPanel } from '@wordpress/editor';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Renders provided content to the pre-publish side panel in the publish flow
|
|
9
|
-
* (side panel that opens when a user first pushes "Publish" from the main editor).
|
|
10
|
-
*
|
|
11
|
-
* @deprecated since 6.6, use `wp.editor.PluginPrePublishPanel` instead.
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} props Component props.
|
|
14
|
-
* @param {string} [props.className] An optional class name added to the panel.
|
|
15
|
-
* @param {string} [props.title] Title displayed at the top of the panel.
|
|
16
|
-
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
|
|
17
|
-
* When no title is provided it is always opened.
|
|
18
|
-
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
|
|
19
|
-
* icon slug string, or an SVG WP element, to be rendered when
|
|
20
|
-
* the sidebar is pinned to toolbar.
|
|
21
|
-
* @param {Element} props.children Children to be rendered
|
|
22
|
-
*
|
|
23
|
-
* @return {Component} The component to be rendered.
|
|
24
|
-
*/
|
|
25
|
-
export default function EditPostPluginPrePublishPanel( props ) {
|
|
26
|
-
deprecated( 'wp.editPost.PluginPrePublishPanel', {
|
|
27
|
-
since: '6.6',
|
|
28
|
-
version: '6.8',
|
|
29
|
-
alternative: 'wp.editor.PluginPrePublishPanel',
|
|
30
|
-
} );
|
|
31
|
-
return <PluginPrePublishPanel { ...props } />;
|
|
32
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { PanelRow } from '@wordpress/components';
|
|
5
|
-
import {
|
|
6
|
-
PostFormat as PostFormatForm,
|
|
7
|
-
PostFormatCheck,
|
|
8
|
-
} from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
export function PostFormat() {
|
|
11
|
-
return (
|
|
12
|
-
<PostFormatCheck>
|
|
13
|
-
<PanelRow className="edit-post-post-format">
|
|
14
|
-
<PostFormatForm />
|
|
15
|
-
</PanelRow>
|
|
16
|
-
</PostFormatCheck>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default PostFormat;
|