@wordpress/edit-post 7.33.0 → 7.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +22 -36
- package/build/components/header/index.js +17 -48
- 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 +18 -11
- package/build/components/layout/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/sidebar/post-status/index.js +29 -6
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +40 -10
- package/build/components/sidebar/settings-sidebar/index.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/index.js +20 -51
- 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 +18 -11
- package/build-module/components/layout/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/sidebar/post-status/index.js +30 -7
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +43 -13
- package/build-module/components/sidebar/settings-sidebar/index.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 +6 -141
- package/build-style/style.css +6 -141
- package/package.json +31 -31
- package/src/components/header/index.js +24 -69
- 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 +0 -79
- package/src/components/keyboard-shortcuts/index.js +1 -106
- package/src/components/layout/index.js +12 -6
- package/src/components/layout/style.scss +7 -80
- package/src/components/preferences-modal/index.js +2 -22
- package/src/components/sidebar/post-status/index.js +57 -17
- package/src/components/sidebar/settings-sidebar/index.js +60 -24
- package/src/deprecated.js +107 -0
- package/src/index.js +3 -24
- 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/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/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/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,43 +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 = EditPostPluginPrePublishPanel;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
10
|
-
var _editor = require("@wordpress/editor");
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Renders provided content to the pre-publish side panel in the publish flow
|
|
17
|
-
* (side panel that opens when a user first pushes "Publish" from the main editor).
|
|
18
|
-
*
|
|
19
|
-
* @deprecated since 6.6, use `wp.editor.PluginPrePublishPanel` instead.
|
|
20
|
-
*
|
|
21
|
-
* @param {Object} props Component props.
|
|
22
|
-
* @param {string} [props.className] An optional class name added to the panel.
|
|
23
|
-
* @param {string} [props.title] Title displayed at the top of the panel.
|
|
24
|
-
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
|
|
25
|
-
* When no title is provided it is always opened.
|
|
26
|
-
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
|
|
27
|
-
* icon slug string, or an SVG WP element, to be rendered when
|
|
28
|
-
* the sidebar is pinned to toolbar.
|
|
29
|
-
* @param {Element} props.children Children to be rendered
|
|
30
|
-
*
|
|
31
|
-
* @return {Component} The component to be rendered.
|
|
32
|
-
*/
|
|
33
|
-
function EditPostPluginPrePublishPanel(props) {
|
|
34
|
-
(0, _deprecated.default)('wp.editPost.PluginPrePublishPanel', {
|
|
35
|
-
since: '6.6',
|
|
36
|
-
version: '6.8',
|
|
37
|
-
alternative: 'wp.editor.PluginPrePublishPanel'
|
|
38
|
-
});
|
|
39
|
-
return (0, _react.createElement)(_editor.PluginPrePublishPanel, {
|
|
40
|
-
...props
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_deprecated","_interopRequireDefault","require","_editor","EditPostPluginPrePublishPanel","props","deprecated","since","version","alternative","_react","createElement","PluginPrePublishPanel"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-pre-publish-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { PluginPrePublishPanel } from '@wordpress/editor';\n\n/**\n * Renders provided content to the pre-publish side panel in the publish flow\n * (side panel that opens when a user first pushes \"Publish\" from the main editor).\n *\n * @deprecated since 6.6, use `wp.editor.PluginPrePublishPanel` instead.\n *\n * @param {Object} props Component props.\n * @param {string} [props.className] An optional class name added to the panel.\n * @param {string} [props.title] Title displayed at the top of the panel.\n * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.\n * When no title is provided it is always opened.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)\n * icon slug string, or an SVG WP element, to be rendered when\n * the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @return {Component} The component to be rendered.\n */\nexport default function EditPostPluginPrePublishPanel( props ) {\n\tdeprecated( 'wp.editPost.PluginPrePublishPanel', {\n\t\tsince: '6.6',\n\t\tversion: '6.8',\n\t\talternative: 'wp.editor.PluginPrePublishPanel',\n\t} );\n\treturn <PluginPrePublishPanel { ...props } />;\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,6BAA6BA,CAAEC,KAAK,EAAG;EAC9D,IAAAC,mBAAU,EAAE,mCAAmC,EAAE;IAChDC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE,KAAK;IACdC,WAAW,EAAE;EACd,CAAE,CAAC;EACH,OAAO,IAAAC,MAAA,CAAAC,aAAA,EAACR,OAAA,CAAAS,qBAAqB;IAAA,GAAMP;EAAK,CAAI,CAAC;AAC9C","ignoreList":[]}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = CopyContentMenuItem;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _components = require("@wordpress/components");
|
|
9
|
-
var _data = require("@wordpress/data");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _compose = require("@wordpress/compose");
|
|
12
|
-
var _notices = require("@wordpress/notices");
|
|
13
|
-
var _editor = require("@wordpress/editor");
|
|
14
|
-
/**
|
|
15
|
-
* WordPress dependencies
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
function CopyContentMenuItem() {
|
|
19
|
-
const {
|
|
20
|
-
createNotice
|
|
21
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
22
|
-
const {
|
|
23
|
-
getEditedPostAttribute
|
|
24
|
-
} = (0, _data.useSelect)(_editor.store);
|
|
25
|
-
function getText() {
|
|
26
|
-
return getEditedPostAttribute('content');
|
|
27
|
-
}
|
|
28
|
-
function onSuccess() {
|
|
29
|
-
createNotice('info', (0, _i18n.__)('All content copied.'), {
|
|
30
|
-
isDismissible: true,
|
|
31
|
-
type: 'snackbar'
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const ref = (0, _compose.useCopyToClipboard)(getText, onSuccess);
|
|
35
|
-
return (0, _react.createElement)(_components.MenuItem, {
|
|
36
|
-
ref: ref
|
|
37
|
-
}, (0, _i18n.__)('Copy all blocks'));
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_compose","_notices","_editor","CopyContentMenuItem","createNotice","useDispatch","noticesStore","getEditedPostAttribute","useSelect","editorStore","getText","onSuccess","__","isDismissible","type","ref","useCopyToClipboard","_react","createElement","MenuItem"],"sources":["@wordpress/edit-post/src/plugins/copy-content-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function CopyContentMenuItem() {\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { getEditedPostAttribute } = useSelect( editorStore );\n\n\tfunction getText() {\n\t\treturn getEditedPostAttribute( 'content' );\n\t}\n\n\tfunction onSuccess() {\n\t\tcreateNotice( 'info', __( 'All content copied.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}\n\n\tconst ref = useCopyToClipboard( getText, onSuccess );\n\n\treturn <MenuItem ref={ ref }>{ __( 'Copy all blocks' ) }</MenuItem>;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AARA;AACA;AACA;;AAQe,SAASM,mBAAmBA,CAAA,EAAG;EAC7C,MAAM;IAAEC;EAAa,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EACpD,MAAM;IAAEC;EAAuB,CAAC,GAAG,IAAAC,eAAS,EAAEC,aAAY,CAAC;EAE3D,SAASC,OAAOA,CAAA,EAAG;IAClB,OAAOH,sBAAsB,CAAE,SAAU,CAAC;EAC3C;EAEA,SAASI,SAASA,CAAA,EAAG;IACpBP,YAAY,CAAE,MAAM,EAAE,IAAAQ,QAAE,EAAE,qBAAsB,CAAC,EAAE;MAClDC,aAAa,EAAE,IAAI;MACnBC,IAAI,EAAE;IACP,CAAE,CAAC;EACJ;EAEA,MAAMC,GAAG,GAAG,IAAAC,2BAAkB,EAAEN,OAAO,EAAEC,SAAU,CAAC;EAEpD,OAAO,IAAAM,MAAA,CAAAC,aAAA,EAACtB,WAAA,CAAAuB,QAAQ;IAACJ,GAAG,EAAGA;EAAK,GAAG,IAAAH,QAAE,EAAE,iBAAkB,CAAa,CAAC;AACpE","ignoreList":[]}
|
package/build/plugins/index.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _react = require("react");
|
|
5
|
-
var _components = require("@wordpress/components");
|
|
6
|
-
var _coreData = require("@wordpress/core-data");
|
|
7
|
-
var _editor = require("@wordpress/editor");
|
|
8
|
-
var _data = require("@wordpress/data");
|
|
9
|
-
var _icons = require("@wordpress/icons");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _plugins = require("@wordpress/plugins");
|
|
12
|
-
var _url = require("@wordpress/url");
|
|
13
|
-
var _copyContentMenuItem = _interopRequireDefault(require("./copy-content-menu-item"));
|
|
14
|
-
var _keyboardShortcutsHelpMenuItem = _interopRequireDefault(require("./keyboard-shortcuts-help-menu-item"));
|
|
15
|
-
var _toolsMoreMenuGroup = _interopRequireDefault(require("../components/header/tools-more-menu-group"));
|
|
16
|
-
var _welcomeGuideMenuItem = _interopRequireDefault(require("./welcome-guide-menu-item"));
|
|
17
|
-
/**
|
|
18
|
-
* WordPress dependencies
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Internal dependencies
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
function ManagePatternsMenuItem() {
|
|
26
|
-
const url = (0, _data.useSelect)(select => {
|
|
27
|
-
const {
|
|
28
|
-
canUser
|
|
29
|
-
} = select(_coreData.store);
|
|
30
|
-
const {
|
|
31
|
-
getEditorSettings
|
|
32
|
-
} = select(_editor.store);
|
|
33
|
-
const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme;
|
|
34
|
-
const defaultUrl = (0, _url.addQueryArgs)('edit.php', {
|
|
35
|
-
post_type: 'wp_block'
|
|
36
|
-
});
|
|
37
|
-
const patternsUrl = (0, _url.addQueryArgs)('site-editor.php', {
|
|
38
|
-
path: '/patterns'
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// The site editor and templates both check whether the user has
|
|
42
|
-
// edit_theme_options capabilities. We can leverage that here and not
|
|
43
|
-
// display the manage patterns link if the user can't access it.
|
|
44
|
-
return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl;
|
|
45
|
-
}, []);
|
|
46
|
-
return (0, _react.createElement)(_components.MenuItem, {
|
|
47
|
-
role: "menuitem",
|
|
48
|
-
href: url
|
|
49
|
-
}, (0, _i18n.__)('Manage patterns'));
|
|
50
|
-
}
|
|
51
|
-
(0, _plugins.registerPlugin)('edit-post', {
|
|
52
|
-
render() {
|
|
53
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_toolsMoreMenuGroup.default, null, ({
|
|
54
|
-
onClose
|
|
55
|
-
}) => (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(ManagePatternsMenuItem, null), (0, _react.createElement)(_keyboardShortcutsHelpMenuItem.default, {
|
|
56
|
-
onSelect: onClose
|
|
57
|
-
}), (0, _react.createElement)(_welcomeGuideMenuItem.default, null), (0, _react.createElement)(_copyContentMenuItem.default, null), (0, _react.createElement)(_components.MenuItem, {
|
|
58
|
-
role: "menuitem",
|
|
59
|
-
icon: _icons.external,
|
|
60
|
-
href: (0, _i18n.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'),
|
|
61
|
-
target: "_blank",
|
|
62
|
-
rel: "noopener noreferrer"
|
|
63
|
-
}, (0, _i18n.__)('Help'), (0, _react.createElement)(_components.VisuallyHidden, {
|
|
64
|
-
as: "span"
|
|
65
|
-
}, /* translators: accessibility text */
|
|
66
|
-
(0, _i18n.__)('(opens in a new tab)'))))));
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_coreData","_editor","_data","_icons","_i18n","_plugins","_url","_copyContentMenuItem","_interopRequireDefault","_keyboardShortcutsHelpMenuItem","_toolsMoreMenuGroup","_welcomeGuideMenuItem","ManagePatternsMenuItem","url","useSelect","select","canUser","coreStore","getEditorSettings","editorStore","isBlockTheme","__unstableIsBlockBasedTheme","defaultUrl","addQueryArgs","post_type","patternsUrl","path","_react","createElement","MenuItem","role","href","__","registerPlugin","render","Fragment","default","onClose","onSelect","icon","external","target","rel","VisuallyHidden","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":";;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AAKA,IAAAQ,oBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,8BAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,mBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,qBAAA,GAAAH,sBAAA,CAAAT,OAAA;AAlBA;AACA;AACA;;AAUA;AACA;AACA;;AAMA,SAASa,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,GA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B,MAAE,CAAC,EACxB,IAAAT,MAAA,CAAAC,aAAA,EAACrB,oBAAA,CAAA6B,OAAmB,MAAE,CAAC,EACvB,IAAAT,MAAA,CAAAC,aAAA,EAAC9B,WAAA,CAAA+B,QAAQ;MACRC,IAAI,EAAC,UAAU;MACfS,IAAI,EAAGC,eAAU;MACjBT,IAAI,EAAG,IAAAC,QAAE,EACR,qEACD,CAAG;MACHS,MAAM,EAAC,QAAQ;MACfC,GAAG,EAAC;IAAqB,GAEvB,IAAAV,QAAE,EAAE,MAAO,CAAC,EACd,IAAAL,MAAA,CAAAC,aAAA,EAAC9B,WAAA,CAAA6C,cAAc;MAACC,EAAE,EAAC;IAAM,GAEvB;IACA,IAAAZ,QAAE,EAAE,sBAAuB,CAEb,CACP,CACT,CAEgB,CACnB,CAAC;EAEL;AACD,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.KeyboardShortcutsHelpMenuItem = KeyboardShortcutsHelpMenuItem;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _components = require("@wordpress/components");
|
|
10
|
-
var _data = require("@wordpress/data");
|
|
11
|
-
var _i18n = require("@wordpress/i18n");
|
|
12
|
-
var _keycodes = require("@wordpress/keycodes");
|
|
13
|
-
var _editor = require("@wordpress/editor");
|
|
14
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
15
|
-
/**
|
|
16
|
-
* WordPress dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const {
|
|
24
|
-
interfaceStore
|
|
25
|
-
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
26
|
-
function KeyboardShortcutsHelpMenuItem({
|
|
27
|
-
openModal
|
|
28
|
-
}) {
|
|
29
|
-
return (0, _react.createElement)(_components.MenuItem, {
|
|
30
|
-
onClick: () => {
|
|
31
|
-
openModal('editor/keyboard-shortcut-help');
|
|
32
|
-
},
|
|
33
|
-
shortcut: _keycodes.displayShortcut.access('h')
|
|
34
|
-
}, (0, _i18n.__)('Keyboard shortcuts'));
|
|
35
|
-
}
|
|
36
|
-
var _default = exports.default = (0, _data.withDispatch)(dispatch => {
|
|
37
|
-
const {
|
|
38
|
-
openModal
|
|
39
|
-
} = dispatch(interfaceStore);
|
|
40
|
-
return {
|
|
41
|
-
openModal
|
|
42
|
-
};
|
|
43
|
-
})(KeyboardShortcutsHelpMenuItem);
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_i18n","_keycodes","_editor","_lockUnlock","interfaceStore","unlock","editorPrivateApis","KeyboardShortcutsHelpMenuItem","openModal","_react","createElement","MenuItem","onClick","shortcut","displayShortcut","access","__","_default","exports","default","withDispatch","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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAKA,IAAAK,WAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAOA;AACA;AACA;;AAGA,MAAM;EAAEM;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE/C,SAASC,6BAA6BA,CAAE;EAAEC;AAAU,CAAC,EAAG;EAC9D,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACb,WAAA,CAAAc,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACfJ,SAAS,CAAE,+BAAgC,CAAC;IAC7C,CAAG;IACHK,QAAQ,EAAGC,yBAAe,CAACC,MAAM,CAAE,GAAI;EAAG,GAExC,IAAAC,QAAE,EAAE,oBAAqB,CAClB,CAAC;AAEb;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,kBAAY,EAAIC,QAAQ,IAAM;EAC5C,MAAM;IAAEb;EAAU,CAAC,GAAGa,QAAQ,CAAEjB,cAAe,CAAC;EAEhD,OAAO;IACNI;EACD,CAAC;AACF,CAAE,CAAC,CAAED,6BAA8B,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_preferences","_i18n","_editor","WelcomeGuideMenuItem","isEditingTemplate","useSelect","select","editorStore","getCurrentPostType","_react","createElement","PreferenceToggleMenuItem","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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMe,SAASI,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,iBAAiB,GAAG,IAAAC,eAAS,EAChCC,MAAM,IACPA,MAAM,CAAEC,aAAY,CAAC,CAACC,kBAAkB,CAAC,CAAC,KAAK,aAAa,EAC7D,EACD,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACV,YAAA,CAAAW,wBAAwB;IACxBC,KAAK,EAAC,gBAAgB;IACtBC,IAAI,EAAGT,iBAAiB,GAAG,sBAAsB,GAAG,cAAgB;IACpEU,KAAK,EAAG,IAAAC,QAAE,EAAE,eAAgB;EAAG,CAC/B,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { useViewportMatch, compose } from '@wordpress/compose';
|
|
6
|
-
import { withDispatch, withSelect } from '@wordpress/data';
|
|
7
|
-
import { PostPublishButton, store as editorStore } from '@wordpress/editor';
|
|
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 (isPublished || postStatusHasChanged && !['future', 'publish'].includes(postStatus) || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
|
|
51
|
-
component = IS_BUTTON;
|
|
52
|
-
} else if (isSmallerThanMediumViewport || isPublishSidebarEnabled) {
|
|
53
|
-
component = IS_TOGGLE;
|
|
54
|
-
} else {
|
|
55
|
-
component = IS_BUTTON;
|
|
56
|
-
}
|
|
57
|
-
return createElement(PostPublishButton, {
|
|
58
|
-
forceIsDirty: forceIsDirty,
|
|
59
|
-
isOpen: isPublishSidebarOpened,
|
|
60
|
-
isToggle: component === IS_TOGGLE,
|
|
61
|
-
onToggle: togglePublishSidebar,
|
|
62
|
-
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
export default compose(withSelect(select => {
|
|
66
|
-
var _select$getCurrentPos;
|
|
67
|
-
return {
|
|
68
|
-
hasPublishAction: (_select$getCurrentPos = select(editorStore).getCurrentPost()?._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false,
|
|
69
|
-
isBeingScheduled: select(editorStore).isEditedPostBeingScheduled(),
|
|
70
|
-
isPending: select(editorStore).isCurrentPostPending(),
|
|
71
|
-
isPublished: select(editorStore).isCurrentPostPublished(),
|
|
72
|
-
isPublishSidebarEnabled: select(editorStore).isPublishSidebarEnabled(),
|
|
73
|
-
isPublishSidebarOpened: select(editorStore).isPublishSidebarOpened(),
|
|
74
|
-
isScheduled: select(editorStore).isCurrentPostScheduled(),
|
|
75
|
-
postStatus: select(editorStore).getEditedPostAttribute('status'),
|
|
76
|
-
postStatusHasChanged: select(editorStore).getPostEdits()?.status
|
|
77
|
-
};
|
|
78
|
-
}), withDispatch(dispatch => {
|
|
79
|
-
const {
|
|
80
|
-
togglePublishSidebar
|
|
81
|
-
} = dispatch(editorStore);
|
|
82
|
-
return {
|
|
83
|
-
togglePublishSidebar
|
|
84
|
-
};
|
|
85
|
-
}))(PostPublishButtonOrToggle);
|
|
86
|
-
//# sourceMappingURL=post-publish-button-or-toggle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useViewportMatch","compose","withDispatch","withSelect","PostPublishButton","store","editorStore","PostPublishButtonOrToggle","forceIsDirty","hasPublishAction","isBeingScheduled","isPending","isPublished","isPublishSidebarEnabled","isPublishSidebarOpened","isScheduled","togglePublishSidebar","setEntitiesSavedStatesCallback","postStatusHasChanged","postStatus","IS_TOGGLE","IS_BUTTON","isSmallerThanMediumViewport","component","includes","createElement","isOpen","isToggle","onToggle","select","_select$getCurrentPos","getCurrentPost","_links","isEditedPostBeingScheduled","isCurrentPostPending","isCurrentPostPublished","isCurrentPostScheduled","getEditedPostAttribute","getPostEdits","status","dispatch"],"sources":["@wordpress/edit-post/src/components/header/post-publish-button-or-toggle.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch, compose } from '@wordpress/compose';\nimport { withDispatch, withSelect } from '@wordpress/data';\nimport { PostPublishButton, store as editorStore } from '@wordpress/editor';\n\nexport function PostPublishButtonOrToggle( {\n\tforceIsDirty,\n\thasPublishAction,\n\tisBeingScheduled,\n\tisPending,\n\tisPublished,\n\tisPublishSidebarEnabled,\n\tisPublishSidebarOpened,\n\tisScheduled,\n\ttogglePublishSidebar,\n\tsetEntitiesSavedStatesCallback,\n\tpostStatusHasChanged,\n\tpostStatus,\n} ) {\n\tconst IS_TOGGLE = 'toggle';\n\tconst IS_BUTTON = 'button';\n\tconst isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );\n\tlet component;\n\n\t/**\n\t * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):\n\t *\n\t * 1) We want to show a BUTTON when the post status is at the _final stage_\n\t * for a particular role (see https://wordpress.org/documentation/article/post-status/):\n\t *\n\t * - is published\n\t * - post status has changed explicitely to something different than 'future' or 'publish'\n\t * - is scheduled to be published\n\t * - is pending and can't be published (but only for viewports >= medium).\n\t * \t Originally, we considered showing a button for pending posts that couldn't be published\n\t * \t (for example, for an author with the contributor role). Some languages can have\n\t * \t long translations for \"Submit for review\", so given the lack of UI real estate available\n\t * \t we decided to take into account the viewport in that case.\n\t * \t See: https://github.com/WordPress/gutenberg/issues/10475\n\t *\n\t * 2) Then, in small viewports, we'll show a TOGGLE.\n\t *\n\t * 3) Finally, we'll use the publish sidebar status to decide:\n\t *\n\t * - if it is enabled, we show a TOGGLE\n\t * - if it is disabled, we show a BUTTON\n\t */\n\tif (\n\t\tisPublished ||\n\t\t( postStatusHasChanged &&\n\t\t\t! [ 'future', 'publish' ].includes( postStatus ) ) ||\n\t\t( isScheduled && isBeingScheduled ) ||\n\t\t( isPending && ! hasPublishAction && ! isSmallerThanMediumViewport )\n\t) {\n\t\tcomponent = IS_BUTTON;\n\t} else if ( isSmallerThanMediumViewport || isPublishSidebarEnabled ) {\n\t\tcomponent = IS_TOGGLE;\n\t} else {\n\t\tcomponent = IS_BUTTON;\n\t}\n\n\treturn (\n\t\t<PostPublishButton\n\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\tisOpen={ isPublishSidebarOpened }\n\t\t\tisToggle={ component === IS_TOGGLE }\n\t\t\tonToggle={ togglePublishSidebar }\n\t\t\tsetEntitiesSavedStatesCallback={ setEntitiesSavedStatesCallback }\n\t\t/>\n\t);\n}\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\thasPublishAction:\n\t\t\tselect( editorStore ).getCurrentPost()?._links?.[\n\t\t\t\t'wp:action-publish'\n\t\t\t] ?? false,\n\t\tisBeingScheduled: select( editorStore ).isEditedPostBeingScheduled(),\n\t\tisPending: select( editorStore ).isCurrentPostPending(),\n\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\tisPublishSidebarEnabled:\n\t\t\tselect( editorStore ).isPublishSidebarEnabled(),\n\t\tisPublishSidebarOpened: select( editorStore ).isPublishSidebarOpened(),\n\t\tisScheduled: select( editorStore ).isCurrentPostScheduled(),\n\t\tpostStatus: select( editorStore ).getEditedPostAttribute( 'status' ),\n\t\tpostStatusHasChanged: select( editorStore ).getPostEdits()?.status,\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { togglePublishSidebar } = dispatch( editorStore );\n\t\treturn {\n\t\t\ttogglePublishSidebar,\n\t\t};\n\t} )\n)( PostPublishButtonOrToggle );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,EAAEC,OAAO,QAAQ,oBAAoB;AAC9D,SAASC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAC1D,SAASC,iBAAiB,EAAEC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AAE3E,OAAO,SAASC,yBAAyBA,CAAE;EAC1CC,YAAY;EACZC,gBAAgB;EAChBC,gBAAgB;EAChBC,SAAS;EACTC,WAAW;EACXC,uBAAuB;EACvBC,sBAAsB;EACtBC,WAAW;EACXC,oBAAoB;EACpBC,8BAA8B;EAC9BC,oBAAoB;EACpBC;AACD,CAAC,EAAG;EACH,MAAMC,SAAS,GAAG,QAAQ;EAC1B,MAAMC,SAAS,GAAG,QAAQ;EAC1B,MAAMC,2BAA2B,GAAGtB,gBAAgB,CAAE,QAAQ,EAAE,GAAI,CAAC;EACrE,IAAIuB,SAAS;;EAEb;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACC,IACCX,WAAW,IACTM,oBAAoB,IACrB,CAAE,CAAE,QAAQ,EAAE,SAAS,CAAE,CAACM,QAAQ,CAAEL,UAAW,CAAG,IACjDJ,WAAW,IAAIL,gBAAkB,IACjCC,SAAS,IAAI,CAAEF,gBAAgB,IAAI,CAAEa,2BAA6B,EACnE;IACDC,SAAS,GAAGF,SAAS;EACtB,CAAC,MAAM,IAAKC,2BAA2B,IAAIT,uBAAuB,EAAG;IACpEU,SAAS,GAAGH,SAAS;EACtB,CAAC,MAAM;IACNG,SAAS,GAAGF,SAAS;EACtB;EAEA,OACCI,aAAA,CAACrB,iBAAiB;IACjBI,YAAY,EAA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C,CAAET,yBAA0B,CAAC","ignoreList":[]}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { useDispatch } from '@wordpress/data';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { MenuItem } from '@wordpress/components';
|
|
8
|
-
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../../lock-unlock';
|
|
14
|
-
const {
|
|
15
|
-
interfaceStore
|
|
16
|
-
} = unlock(editorPrivateApis);
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
export default function PreferencesMenuItem() {
|
|
23
|
-
const {
|
|
24
|
-
openModal
|
|
25
|
-
} = useDispatch(interfaceStore);
|
|
26
|
-
return createElement(MenuItem, {
|
|
27
|
-
onClick: () => {
|
|
28
|
-
openModal('editor/preferences');
|
|
29
|
-
}
|
|
30
|
-
}, __('Preferences'));
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","__","MenuItem","privateApis","editorPrivateApis","unlock","interfaceStore","PreferencesMenuItem","openModal","createElement","onClick"],"sources":["@wordpress/edit-post/src/components/header/preferences-menu-item/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { interfaceStore } = unlock( editorPrivateApis );\n\n/**\n * Internal dependencies\n */\n\nexport default function PreferencesMenuItem() {\n\tconst { openModal } = useDispatch( interfaceStore );\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\topenModal( 'editor/preferences' );\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Preferences' ) }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAM;EAAEC;AAAe,CAAC,GAAGD,MAAM,CAAED,iBAAkB,CAAC;;AAEtD;AACA;AACA;;AAEA,eAAe,SAASG,mBAAmBA,CAAA,EAAG;EAC7C,MAAM;IAAEC;EAAU,CAAC,GAAGR,WAAW,CAAEM,cAAe,CAAC;EACnD,OACCG,aAAA,CAACP,QAAQ;IACRQ,OAAO,EAAGA,CAAA,KAAM;MACfF,SAAS,CAAE,oBAAqB,CAAC;IAClC;EAAG,GAEDP,EAAE,CAAE,aAAc,CACX,CAAC;AAEb","ignoreList":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { createSlotFill, MenuGroup } from '@wordpress/components';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
const {
|
|
8
|
-
Fill: ToolsMoreMenuGroup,
|
|
9
|
-
Slot
|
|
10
|
-
} = createSlotFill('ToolsMoreMenuGroup');
|
|
11
|
-
ToolsMoreMenuGroup.Slot = ({
|
|
12
|
-
fillProps
|
|
13
|
-
}) => createElement(Slot, {
|
|
14
|
-
fillProps: fillProps
|
|
15
|
-
}, fills => fills.length > 0 && createElement(MenuGroup, {
|
|
16
|
-
label: __('Tools')
|
|
17
|
-
}, fills));
|
|
18
|
-
export default ToolsMoreMenuGroup;
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createSlotFill","MenuGroup","__","Fill","ToolsMoreMenuGroup","Slot","fillProps","createElement","fills","length","label"],"sources":["@wordpress/edit-post/src/components/header/tools-more-menu-group/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, MenuGroup } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nconst { Fill: ToolsMoreMenuGroup, Slot } =\n\tcreateSlotFill( 'ToolsMoreMenuGroup' );\n\nToolsMoreMenuGroup.Slot = ( { fillProps } ) => (\n\t<Slot fillProps={ fillProps }>\n\t\t{ ( fills ) =>\n\t\t\tfills.length > 0 && (\n\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>{ fills }</MenuGroup>\n\t\t\t)\n\t\t}\n\t</Slot>\n);\n\nexport default ToolsMoreMenuGroup;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,SAAS,QAAQ,uBAAuB;AACjE,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,MAAM;EAAEC,IAAI,EAAEC,kBAAkB;EAAEC;AAAK,CAAC,GACvCL,cAAc,CAAE,oBAAqB,CAAC;AAEvCI,kBAAkB,CAACC,IAAI,GAAG,CAAE;EAAEC;AAAU,CAAC,KACxCC,aAAA,CAACF,IAAI;EAACC,SAAS,EAAGA;AAAW,GACxBE,KAAK,IACRA,KAAK,CAACC,MAAM,GAAG,CAAC,IACfF,aAAA,CAACN,SAAS;EAACS,KAAK,EAAGR,EAAE,CAAE,OAAQ;AAAG,GAAGM,KAAkB,CAGpD,CACN;AAED,eAAeJ,kBAAkB","ignoreList":[]}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { useDispatch } from '@wordpress/data';
|
|
6
|
-
import { MenuGroup } from '@wordpress/components';
|
|
7
|
-
import { __, _x } from '@wordpress/i18n';
|
|
8
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
9
|
-
import { displayShortcut } from '@wordpress/keycodes';
|
|
10
|
-
import { PreferenceToggleMenuItem, store as preferencesStore } from '@wordpress/preferences';
|
|
11
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
12
|
-
function WritingMenu() {
|
|
13
|
-
const {
|
|
14
|
-
set: setPreference
|
|
15
|
-
} = useDispatch(preferencesStore);
|
|
16
|
-
const {
|
|
17
|
-
toggleDistractionFree
|
|
18
|
-
} = useDispatch(editorStore);
|
|
19
|
-
const turnOffDistractionFree = () => {
|
|
20
|
-
setPreference('core', 'distractionFree', false);
|
|
21
|
-
};
|
|
22
|
-
const isLargeViewport = useViewportMatch('medium');
|
|
23
|
-
if (!isLargeViewport) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
return createElement(MenuGroup, {
|
|
27
|
-
label: _x('View', 'noun')
|
|
28
|
-
}, createElement(PreferenceToggleMenuItem, {
|
|
29
|
-
scope: "core",
|
|
30
|
-
name: "fixedToolbar",
|
|
31
|
-
onToggle: turnOffDistractionFree,
|
|
32
|
-
label: __('Top toolbar'),
|
|
33
|
-
info: __('Access all block and document tools in a single place'),
|
|
34
|
-
messageActivated: __('Top toolbar activated'),
|
|
35
|
-
messageDeactivated: __('Top toolbar deactivated')
|
|
36
|
-
}), createElement(PreferenceToggleMenuItem, {
|
|
37
|
-
scope: "core",
|
|
38
|
-
name: "distractionFree",
|
|
39
|
-
handleToggling: false,
|
|
40
|
-
onToggle: toggleDistractionFree,
|
|
41
|
-
label: __('Distraction free'),
|
|
42
|
-
info: __('Write with calmness'),
|
|
43
|
-
messageActivated: __('Distraction free mode activated'),
|
|
44
|
-
messageDeactivated: __('Distraction free mode deactivated'),
|
|
45
|
-
shortcut: displayShortcut.primaryShift('\\')
|
|
46
|
-
}), createElement(PreferenceToggleMenuItem, {
|
|
47
|
-
scope: "core",
|
|
48
|
-
name: "focusMode",
|
|
49
|
-
label: __('Spotlight mode'),
|
|
50
|
-
info: __('Focus on one block at a time'),
|
|
51
|
-
messageActivated: __('Spotlight mode activated'),
|
|
52
|
-
messageDeactivated: __('Spotlight mode deactivated')
|
|
53
|
-
}), createElement(PreferenceToggleMenuItem, {
|
|
54
|
-
scope: "core/edit-post",
|
|
55
|
-
name: "fullscreenMode",
|
|
56
|
-
label: __('Fullscreen mode'),
|
|
57
|
-
info: __('Show and hide the admin user interface'),
|
|
58
|
-
messageActivated: __('Fullscreen mode activated'),
|
|
59
|
-
messageDeactivated: __('Fullscreen mode deactivated'),
|
|
60
|
-
shortcut: displayShortcut.secondary('f')
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
export default WritingMenu;
|
|
64
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","MenuGroup","__","_x","useViewportMatch","displayShortcut","PreferenceToggleMenuItem","store","preferencesStore","editorStore","WritingMenu","set","setPreference","toggleDistractionFree","turnOffDistractionFree","isLargeViewport","createElement","label","scope","name","onToggle","info","messageActivated","messageDeactivated","handleToggling","shortcut","primaryShift","secondary"],"sources":["@wordpress/edit-post/src/components/header/writing-menu/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { MenuGroup } from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport {\n\tPreferenceToggleMenuItem,\n\tstore as preferencesStore,\n} from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\nfunction WritingMenu() {\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { toggleDistractionFree } = useDispatch( editorStore );\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tif ( ! isLargeViewport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core\"\n\t\t\t\tname=\"fixedToolbar\"\n\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\tinfo={ __(\n\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t) }\n\t\t\t\tmessageActivated={ __( 'Top toolbar activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Top toolbar deactivated' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core\"\n\t\t\t\tname=\"distractionFree\"\n\t\t\t\thandleToggling={ false }\n\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\tinfo={ __( 'Write with calmness' ) }\n\t\t\t\tmessageActivated={ __( 'Distraction free mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Distraction free mode deactivated' ) }\n\t\t\t\tshortcut={ displayShortcut.primaryShift( '\\\\' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core\"\n\t\t\t\tname=\"focusMode\"\n\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\tmessageActivated={ __( 'Spotlight mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Spotlight mode deactivated' ) }\n\t\t\t/>\n\t\t\t<PreferenceToggleMenuItem\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tname=\"fullscreenMode\"\n\t\t\t\tlabel={ __( 'Fullscreen mode' ) }\n\t\t\t\tinfo={ __( 'Show and hide the admin user interface' ) }\n\t\t\t\tmessageActivated={ __( 'Fullscreen mode activated' ) }\n\t\t\t\tmessageDeactivated={ __( 'Fullscreen mode deactivated' ) }\n\t\t\t\tshortcut={ displayShortcut.secondary( 'f' ) }\n\t\t\t/>\n\t\t</MenuGroup>\n\t);\n}\n\nexport default WritingMenu;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SACCC,wBAAwB,EACxBC,KAAK,IAAIC,gBAAgB,QACnB,wBAAwB;AAC/B,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AAExD,SAASC,WAAWA,CAAA,EAAG;EACtB,MAAM;IAAEC,GAAG,EAAEC;EAAc,CAAC,GAAGZ,WAAW,CAAEQ,gBAAiB,CAAC;EAC9D,MAAM;IAAEK;EAAsB,CAAC,GAAGb,WAAW,CAAES,WAAY,CAAC;EAE5D,MAAMK,sBAAsB,GAAGA,CAAA,KAAM;IACpCF,aAAa,CAAE,MAAM,EAAE,iBAAiB,EAAE,KAAM,CAAC;EAClD,CAAC;EAED,MAAMG,eAAe,GAAGX,gBAAgB,CAAE,QAAS,CAAC;EACpD,IAAK,CAAEW,eAAe,EAAG;IACxB,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA,CAACf,SAAS;IAACgB,KAAK,EAAGd,EAAE,CAAE,MAAM,EAAE,MAAO;EAAG,GACxCa,aAAA,CAACV,wBAAwB;IACxBY,KAAK,EAAC,MAAM;IACZC,IAAI,EAAC,cAAc;IACnBC,QAAQ,EAAGN,sBAAwB;IACnCG,KAAK,EAAGf,EAAE,CAAE,aAAc,CAAG;IAC7BmB,IAAI,EAAGnB,EAAE,CACR,uDACD,CAAG;IACHoB,gBAAgB,EAAGpB,EAAE,CAAE,uBAAwB,CAAG;IAClDqB,kBAAkB,EAAGrB,E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|
|
4
|
-
*/
|
|
5
|
-
import { EntitiesSavedStates, PostPublishPanel, PluginPrePublishPanel, PluginPostPublishPanel, store as editorStore } from '@wordpress/editor';
|
|
6
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
-
import { Button, createSlotFill } from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { useCallback } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { store as editPostStore } from '../../store';
|
|
15
|
-
const {
|
|
16
|
-
Fill,
|
|
17
|
-
Slot
|
|
18
|
-
} = createSlotFill('ActionsPanel');
|
|
19
|
-
export const ActionsPanelFill = Fill;
|
|
20
|
-
export default function ActionsPanel({
|
|
21
|
-
setEntitiesSavedStatesCallback,
|
|
22
|
-
closeEntitiesSavedStates,
|
|
23
|
-
isEntitiesSavedStatesOpen
|
|
24
|
-
}) {
|
|
25
|
-
const {
|
|
26
|
-
closePublishSidebar,
|
|
27
|
-
togglePublishSidebar
|
|
28
|
-
} = useDispatch(editorStore);
|
|
29
|
-
const {
|
|
30
|
-
publishSidebarOpened,
|
|
31
|
-
hasActiveMetaboxes,
|
|
32
|
-
hasNonPostEntityChanges
|
|
33
|
-
} = useSelect(select => ({
|
|
34
|
-
publishSidebarOpened: select(editorStore).isPublishSidebarOpened(),
|
|
35
|
-
hasActiveMetaboxes: select(editPostStore).hasMetaBoxes(),
|
|
36
|
-
hasNonPostEntityChanges: select(editorStore).hasNonPostEntityChanges()
|
|
37
|
-
}), []);
|
|
38
|
-
const openEntitiesSavedStates = useCallback(() => setEntitiesSavedStatesCallback(true), []);
|
|
39
|
-
|
|
40
|
-
// It is ok for these components to be unmounted when not in visual use.
|
|
41
|
-
// We don't want more than one present at a time, decide which to render.
|
|
42
|
-
let unmountableContent;
|
|
43
|
-
if (publishSidebarOpened) {
|
|
44
|
-
unmountableContent = createElement(PostPublishPanel, {
|
|
45
|
-
onClose: closePublishSidebar,
|
|
46
|
-
forceIsDirty: hasActiveMetaboxes,
|
|
47
|
-
PrePublishExtension: PluginPrePublishPanel.Slot,
|
|
48
|
-
PostPublishExtension: PluginPostPublishPanel.Slot
|
|
49
|
-
});
|
|
50
|
-
} else if (hasNonPostEntityChanges) {
|
|
51
|
-
unmountableContent = createElement("div", {
|
|
52
|
-
className: "edit-post-layout__toggle-entities-saved-states-panel"
|
|
53
|
-
}, createElement(Button, {
|
|
54
|
-
variant: "secondary",
|
|
55
|
-
className: "edit-post-layout__toggle-entities-saved-states-panel-button",
|
|
56
|
-
onClick: openEntitiesSavedStates,
|
|
57
|
-
"aria-expanded": false
|
|
58
|
-
}, __('Open save panel')));
|
|
59
|
-
} else {
|
|
60
|
-
unmountableContent = createElement("div", {
|
|
61
|
-
className: "edit-post-layout__toggle-publish-panel"
|
|
62
|
-
}, createElement(Button, {
|
|
63
|
-
variant: "secondary",
|
|
64
|
-
className: "edit-post-layout__toggle-publish-panel-button",
|
|
65
|
-
onClick: togglePublishSidebar,
|
|
66
|
-
"aria-expanded": false
|
|
67
|
-
}, __('Open publish panel')));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Since EntitiesSavedStates controls its own panel, we can keep it
|
|
71
|
-
// always mounted to retain its own component state (such as checkboxes).
|
|
72
|
-
return createElement(Fragment, null, isEntitiesSavedStatesOpen && createElement(EntitiesSavedStates, {
|
|
73
|
-
close: closeEntitiesSavedStates
|
|
74
|
-
}), createElement(Slot, {
|
|
75
|
-
bubblesVirtually: true
|
|
76
|
-
}), !isEntitiesSavedStatesOpen && unmountableContent);
|
|
77
|
-
}
|
|
78
|
-
//# sourceMappingURL=actions-panel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["EntitiesSavedStates","PostPublishPanel","PluginPrePublishPanel","PluginPostPublishPanel","store","editorStore","useSelect","useDispatch","Button","createSlotFill","__","useCallback","editPostStore","Fill","Slot","ActionsPanelFill","ActionsPanel","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","isEntitiesSavedStatesOpen","closePublishSidebar","togglePublishSidebar","publishSidebarOpened","hasActiveMetaboxes","hasNonPostEntityChanges","select","isPublishSidebarOpened","hasMetaBoxes","openEntitiesSavedStates","unmountableContent","createElement","onClose","forceIsDirty","PrePublishExtension","PostPublishExtension","className","variant","onClick","Fragment","close","bubblesVirtually"],"sources":["@wordpress/edit-post/src/components/layout/actions-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tEntitiesSavedStates,\n\tPostPublishPanel,\n\tPluginPrePublishPanel,\n\tPluginPostPublishPanel,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, createSlotFill } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nconst { Fill, Slot } = createSlotFill( 'ActionsPanel' );\n\nexport const ActionsPanelFill = Fill;\n\nexport default function ActionsPanel( {\n\tsetEntitiesSavedStatesCallback,\n\tcloseEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n} ) {\n\tconst { closePublishSidebar, togglePublishSidebar } =\n\t\tuseDispatch( editorStore );\n\tconst {\n\t\tpublishSidebarOpened,\n\t\thasActiveMetaboxes,\n\t\thasNonPostEntityChanges,\n\t} = useSelect(\n\t\t( select ) => ( {\n\t\t\tpublishSidebarOpened:\n\t\t\t\tselect( editorStore ).isPublishSidebarOpened(),\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\thasNonPostEntityChanges:\n\t\t\t\tselect( editorStore ).hasNonPostEntityChanges(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst openEntitiesSavedStates = useCallback(\n\t\t() => setEntitiesSavedStatesCallback( true ),\n\t\t[]\n\t);\n\n\t// It is ok for these components to be unmounted when not in visual use.\n\t// We don't want more than one present at a time, decide which to render.\n\tlet unmountableContent;\n\tif ( publishSidebarOpened ) {\n\t\tunmountableContent = (\n\t\t\t<PostPublishPanel\n\t\t\t\tonClose={ closePublishSidebar }\n\t\t\t\tforceIsDirty={ hasActiveMetaboxes }\n\t\t\t\tPrePublishExtension={ PluginPrePublishPanel.Slot }\n\t\t\t\tPostPublishExtension={ PluginPostPublishPanel.Slot }\n\t\t\t/>\n\t\t);\n\t} else if ( hasNonPostEntityChanges ) {\n\t\tunmountableContent = (\n\t\t\t<div className=\"edit-post-layout__toggle-entities-saved-states-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"edit-post-layout__toggle-entities-saved-states-panel-button\"\n\t\t\t\t\tonClick={ openEntitiesSavedStates }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open save panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t} else {\n\t\tunmountableContent = (\n\t\t\t<div className=\"edit-post-layout__toggle-publish-panel\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tclassName=\"edit-post-layout__toggle-publish-panel-button\"\n\t\t\t\t\tonClick={ togglePublishSidebar }\n\t\t\t\t\taria-expanded={ false }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Open publish panel' ) }\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Since EntitiesSavedStates controls its own panel, we can keep it\n\t// always mounted to retain its own component state (such as checkboxes).\n\treturn (\n\t\t<>\n\t\t\t{ isEntitiesSavedStatesOpen && (\n\t\t\t\t<EntitiesSavedStates close={ closeEntitiesSavedStates } />\n\t\t\t) }\n\t\t\t<Slot bubblesVirtually />\n\t\t\t{ ! isEntitiesSavedStatesOpen && unmountableContent }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,mBAAmB,EACnBC,gBAAgB,EAChBC,qBA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AClDoB,oBAAoB,EAAG/B,sBAAsB,CAACW;IAAM,CACpD,CACD;EACF,CAAC,MAAM,IAAKU,uBAAuB,EAAG;IACrCK,kBAAkB,GACjBC,aAAA;MAAKK,SAAS,EAAC;IAAsD,GACpEL,aAAA,CAACtB,MAAM;MACN4B,OAAO,EAAC,WAAW;MACnBD,SAAS,EAAC,6DAA6D;MACvEE,OAAO,EAAGT,uBAAyB;MACnC,iBAAgB;IAAO,GAErBlB,EAAE,CAAE,iBAAkB,CACjB,CACJ,CACL;EACF,CAAC,MAAM;IACNmB,kBAAkB,GACjBC,aAAA;MAAKK,SAAS,EAAC;IAAwC,GACtDL,aAAA,CAACtB,MAAM;MACN4B,OAAO,EAAC,WAAW;MACnBD,SAAS,EAAC,+CAA+C;MACzDE,OAAO,EAAGhB,oBAAsB;MAChC,iBAAgB;IAAO,GAErBX,EAAE,CAAE,oBAAqB,CACpB,CACJ,CACL;EACF;;EAEA;EACA;EACA,OACCoB,aAAA,CAAAQ,QAAA,QACGnB,yBAAyB,IAC1BW,aAAA,CAAC9B,mBAAmB;IAACuC,KAAK,EAAGrB;EAA0B,CAAE,CACzD,EACDY,aAAA,CAAChB,IAAI;IAAC0B,gBAAgB;EAAA,CAAE,CAAC,EACvB,CAAErB,yBAAyB,IAAIU,kBAChC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -1,31 +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
|
-
const {
|
|
15
|
-
PreferenceBaseOption
|
|
16
|
-
} = unlock(preferencesPrivateApis);
|
|
17
|
-
export default compose(withSelect(select => ({
|
|
18
|
-
isChecked: select(editorStore).isPublishSidebarEnabled()
|
|
19
|
-
})), withDispatch(dispatch => {
|
|
20
|
-
const {
|
|
21
|
-
enablePublishSidebar,
|
|
22
|
-
disablePublishSidebar
|
|
23
|
-
} = dispatch(editorStore);
|
|
24
|
-
return {
|
|
25
|
-
onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar()
|
|
26
|
-
};
|
|
27
|
-
}),
|
|
28
|
-
// In < medium viewports we override this option and always show the publish sidebar.
|
|
29
|
-
// See the edit-post's header component for the specific logic.
|
|
30
|
-
ifViewportMatches('medium'))(PreferenceBaseOption);
|
|
31
|
-
//# sourceMappingURL=enable-publish-sidebar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["compose","withSelect","withDispatch","ifViewportMatches","store","editorStore","privateApis","preferencesPrivateApis","unlock","PreferenceBaseOption","select","isChecked","isPublishSidebarEnabled","dispatch","enablePublishSidebar","disablePublishSidebar","onChange","isEnabled"],"sources":["@wordpress/edit-post/src/components/preferences-modal/enable-publish-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { ifViewportMatches } from '@wordpress/viewport';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\tisChecked: select( editorStore ).isPublishSidebarEnabled(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { enablePublishSidebar, disablePublishSidebar } =\n\t\t\tdispatch( editorStore );\n\t\treturn {\n\t\t\tonChange: ( isEnabled ) =>\n\t\t\t\tisEnabled ? enablePublishSidebar() : disablePublishSidebar(),\n\t\t};\n\t} ),\n\t// In < medium viewports we override this option and always show the publish sidebar.\n\t// See the edit-post's header component for the specific logic.\n\tifViewportMatches( 'medium' )\n)( PreferenceBaseOption );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;;AAE9E;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAqB,CAAC,GAAGD,MAAM,CAAED,sBAAuB,CAAC;AAEjE,eAAeP,OAAO,CACrBC,UAAU,CAAIS,MAAM,KAAQ;EAC3BC,SAAS,EAAED,MAAM,CAAEL,WAAY,CAAC,CAACO,uBAAuB,CAAC;AAC1D,CAAC,CAAG,CAAC,EACLV,YAAY,CAAIW,QAAQ,IAAM;EAC7B,MAAM;IAAEC,oBAAoB;IAAEC;EAAsB,CAAC,GACpDF,QAAQ,CAAER,WAAY,CAAC;EACxB,OAAO;IACNW,QAAQ,EAAIC,SAAS,IACpBA,SAAS,GAAGH,oBAAoB,CAAC,CAAC,GAAGC,qBAAqB,CAAC;EAC7D,CAAC;AACF,CAAE,CAAC;AACH;AACA;AACAZ,iBAAiB,CAAE,QAAS,CAC7B,CAAC,CAAEM,oBAAqB,CAAC","ignoreList":[]}
|