@wordpress/edit-post 7.25.0 → 7.26.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 +6 -0
- package/LICENSE.md +1 -1
- package/build/components/browser-url/index.js +3 -2
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/header/index.js +25 -25
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +11 -8
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -20
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +33 -26
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +3 -1
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js +2 -6
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/preferences-modal/index.js +25 -8
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/options/enable-feature.js +23 -23
- package/build/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/options/enable-panel.js +3 -6
- package/build/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +3 -3
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +2 -10
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +2 -3
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +1 -7
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/editor.js +19 -28
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +3 -10
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +16 -12
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/use-post-history.js +79 -0
- package/build/hooks/use-post-history.js.map +1 -0
- package/build/index.js +19 -16
- package/build/index.js.map +1 -1
- package/build/index.native.js +7 -1
- package/build/index.native.js.map +1 -1
- package/build/store/actions.js +59 -73
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -62
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +66 -38
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/browser-url/index.js +3 -2
- package/build-module/components/browser-url/index.js.map +1 -1
- package/build-module/components/header/index.js +25 -25
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +11 -8
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -20
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +33 -25
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +4 -2
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js +2 -6
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +25 -8
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-feature.js +22 -23
- package/build-module/components/preferences-modal/options/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-panel.js +3 -7
- package/build-module/components/preferences-modal/options/enable-panel.js.map +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +3 -3
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +2 -10
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +3 -4
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +2 -8
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/editor.js +19 -28
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +3 -10
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +16 -12
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/use-post-history.js +73 -0
- package/build-module/hooks/use-post-history.js.map +1 -0
- package/build-module/index.js +17 -11
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +7 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/actions.js +55 -69
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +1 -60
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +58 -29
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +13 -284
- package/build-style/style.css +13 -284
- package/package.json +32 -32
- package/src/components/browser-url/index.js +4 -2
- package/src/components/header/index.js +24 -40
- package/src/components/header/style.scss +3 -3
- package/src/components/header/writing-menu/index.js +10 -8
- package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -15
- package/src/components/keyboard-shortcuts/index.js +1 -23
- package/src/components/layout/index.js +18 -27
- package/src/components/layout/index.native.js +9 -1
- package/src/components/meta-boxes/meta-box-visibility.js +2 -8
- package/src/components/preferences-modal/index.js +27 -9
- package/src/components/preferences-modal/options/enable-feature.js +26 -21
- package/src/components/preferences-modal/options/enable-panel.js +3 -7
- package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +187 -175
- package/src/components/sidebar/plugin-document-setting-panel/index.js +3 -3
- package/src/components/sidebar/plugin-sidebar/index.js +1 -9
- package/src/components/sidebar/post-status/index.js +3 -3
- package/src/components/sidebar/settings-sidebar/index.js +15 -13
- package/src/components/text-editor/style.scss +0 -6
- package/src/editor.js +34 -33
- package/src/editor.native.js +2 -17
- package/src/hooks/commands/use-common-commands.js +14 -16
- package/src/hooks/use-post-history.js +73 -0
- package/src/index.js +22 -12
- package/src/index.native.js +8 -1
- package/src/store/actions.js +48 -85
- package/src/store/reducer.js +0 -60
- package/src/store/selectors.js +74 -46
- package/src/store/test/actions.js +10 -103
- package/src/store/test/reducer.js +1 -108
- package/src/store/test/selectors.js +0 -50
- package/src/style.scss +1 -5
- package/src/test/editor.native.js +17 -0
- package/build/components/header/header-toolbar/index.js +0 -160
- package/build/components/header/header-toolbar/index.js.map +0 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +0 -73
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build/components/secondary-sidebar/list-view-outline.js +0 -112
- package/build/components/secondary-sidebar/list-view-outline.js.map +0 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +0 -148
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build/components/sidebar/discussion-panel/index.js +0 -59
- package/build/components/sidebar/discussion-panel/index.js.map +0 -1
- package/build/components/sidebar/featured-image/index.js +0 -70
- package/build/components/sidebar/featured-image/index.js.map +0 -1
- package/build/components/sidebar/last-revision/index.js +0 -21
- package/build/components/sidebar/last-revision/index.js.map +0 -1
- package/build/components/sidebar/page-attributes/index.js +0 -65
- package/build/components/sidebar/page-attributes/index.js.map +0 -1
- package/build/components/sidebar/plugin-post-excerpt/index.js +0 -72
- package/build/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
- package/build/components/sidebar/post-excerpt/index.js +0 -54
- package/build/components/sidebar/post-excerpt/index.js.map +0 -1
- package/build/components/sidebar/post-taxonomies/index.js +0 -30
- package/build/components/sidebar/post-taxonomies/index.js.map +0 -1
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -56
- package/build/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
- package/build/components/view-link/index.js +0 -53
- package/build/components/view-link/index.js.map +0 -1
- package/build-module/components/header/header-toolbar/index.js +0 -152
- package/build-module/components/header/header-toolbar/index.js.map +0 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +0 -66
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +0 -1
- package/build-module/components/secondary-sidebar/list-view-outline.js +0 -105
- package/build-module/components/secondary-sidebar/list-view-outline.js.map +0 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +0 -140
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +0 -1
- package/build-module/components/sidebar/discussion-panel/index.js +0 -52
- package/build-module/components/sidebar/discussion-panel/index.js.map +0 -1
- package/build-module/components/sidebar/featured-image/index.js +0 -63
- package/build-module/components/sidebar/featured-image/index.js.map +0 -1
- package/build-module/components/sidebar/last-revision/index.js +0 -13
- package/build-module/components/sidebar/last-revision/index.js.map +0 -1
- package/build-module/components/sidebar/page-attributes/index.js +0 -57
- package/build-module/components/sidebar/page-attributes/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-excerpt/index.js +0 -64
- package/build-module/components/sidebar/plugin-post-excerpt/index.js.map +0 -1
- package/build-module/components/sidebar/post-excerpt/index.js +0 -47
- package/build-module/components/sidebar/post-excerpt/index.js.map +0 -1
- package/build-module/components/sidebar/post-taxonomies/index.js +0 -21
- package/build-module/components/sidebar/post-taxonomies/index.js.map +0 -1
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
- package/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js.map +0 -1
- package/build-module/components/view-link/index.js +0 -46
- package/build-module/components/view-link/index.js.map +0 -1
- package/src/components/header/header-toolbar/index.js +0 -186
- package/src/components/header/header-toolbar/style.scss +0 -116
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +0 -929
- package/src/components/secondary-sidebar/inserter-sidebar.js +0 -71
- package/src/components/secondary-sidebar/list-view-outline.js +0 -98
- package/src/components/secondary-sidebar/list-view-sidebar.js +0 -170
- package/src/components/secondary-sidebar/style.scss +0 -120
- package/src/components/sidebar/discussion-panel/index.js +0 -62
- package/src/components/sidebar/featured-image/index.js +0 -67
- package/src/components/sidebar/last-revision/index.js +0 -17
- package/src/components/sidebar/last-revision/style.scss +0 -10
- package/src/components/sidebar/page-attributes/index.js +0 -65
- package/src/components/sidebar/plugin-post-excerpt/index.js +0 -61
- package/src/components/sidebar/plugin-post-excerpt/test/index.js +0 -36
- package/src/components/sidebar/post-excerpt/index.js +0 -59
- package/src/components/sidebar/post-taxonomies/index.js +0 -30
- package/src/components/sidebar/post-taxonomies/taxonomy-panel.js +0 -48
- package/src/components/view-link/index.js +0 -48
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Defines as extensibility slot for the Excerpt panel.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { createSlotFill, PanelRow } from '@wordpress/components';
|
|
10
|
-
const {
|
|
11
|
-
Fill,
|
|
12
|
-
Slot
|
|
13
|
-
} = createSlotFill('PluginPostExcerpt');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Renders a post excerpt panel in the post sidebar.
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} props Component properties.
|
|
19
|
-
* @param {string} [props.className] An optional class name added to the row.
|
|
20
|
-
* @param {Element} props.children Children to be rendered.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```js
|
|
24
|
-
* // Using ES5 syntax
|
|
25
|
-
* var __ = wp.i18n.__;
|
|
26
|
-
* var PluginPostExcerpt = wp.editPost.PluginPostExcerpt;
|
|
27
|
-
*
|
|
28
|
-
* function MyPluginPostExcerpt() {
|
|
29
|
-
* return React.createElement(
|
|
30
|
-
* PluginPostExcerpt,
|
|
31
|
-
* {
|
|
32
|
-
* className: 'my-plugin-post-excerpt',
|
|
33
|
-
* },
|
|
34
|
-
* __( 'Post excerpt custom content' )
|
|
35
|
-
* )
|
|
36
|
-
* }
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```jsx
|
|
41
|
-
* // Using ESNext syntax
|
|
42
|
-
* import { __ } from '@wordpress/i18n';
|
|
43
|
-
* import { PluginPostExcerpt } from '@wordpress/edit-post';
|
|
44
|
-
*
|
|
45
|
-
* const MyPluginPostExcerpt = () => (
|
|
46
|
-
* <PluginPostExcerpt className="my-plugin-post-excerpt">
|
|
47
|
-
* { __( 'Post excerpt custom content' ) }
|
|
48
|
-
* </PluginPostExcerpt>
|
|
49
|
-
* );
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* @return {Component} The component to be rendered.
|
|
53
|
-
*/
|
|
54
|
-
const PluginPostExcerpt = ({
|
|
55
|
-
children,
|
|
56
|
-
className
|
|
57
|
-
}) => {
|
|
58
|
-
return createElement(Fill, null, createElement(PanelRow, {
|
|
59
|
-
className: className
|
|
60
|
-
}, children));
|
|
61
|
-
};
|
|
62
|
-
PluginPostExcerpt.Slot = Slot;
|
|
63
|
-
export default PluginPostExcerpt;
|
|
64
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createSlotFill","PanelRow","Fill","Slot","PluginPostExcerpt","children","className","createElement"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-post-excerpt/index.js"],"sourcesContent":["/**\n * Defines as extensibility slot for the Excerpt panel.\n */\n\n/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelRow } from '@wordpress/components';\n\nconst { Fill, Slot } = createSlotFill( 'PluginPostExcerpt' );\n\n/**\n * Renders a post excerpt panel in the post sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {Element} props.children Children to be rendered.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginPostExcerpt = wp.editPost.PluginPostExcerpt;\n *\n * function MyPluginPostExcerpt() {\n * \treturn React.createElement(\n * \t\tPluginPostExcerpt,\n * \t\t{\n * \t\t\tclassName: 'my-plugin-post-excerpt',\n * \t\t},\n * \t\t__( 'Post excerpt custom content' )\n * \t)\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginPostExcerpt } from '@wordpress/edit-post';\n *\n * const MyPluginPostExcerpt = () => (\n * \t<PluginPostExcerpt className=\"my-plugin-post-excerpt\">\n * \t\t{ __( 'Post excerpt custom content' ) }\n * \t</PluginPostExcerpt>\n * );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginPostExcerpt = ( { children, className } ) => {\n\treturn (\n\t\t<Fill>\n\t\t\t<PanelRow className={ className }>{ children }</PanelRow>\n\t\t</Fill>\n\t);\n};\n\nPluginPostExcerpt.Slot = Slot;\n\nexport default PluginPostExcerpt;\n"],"mappings":";AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,QAAQ,QAAQ,uBAAuB;AAEhE,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGH,cAAc,CAAE,mBAAoB,CAAC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,iBAAiB,GAAGA,CAAE;EAAEC,QAAQ;EAAEC;AAAU,CAAC,KAAM;EACxD,OACCC,aAAA,CAACL,IAAI,QACJK,aAAA,CAACN,QAAQ;IAACK,SAAS,EAAGA;EAAW,GAAGD,QAAoB,CACnD,CAAC;AAET,CAAC;AAEDD,iBAAiB,CAACD,IAAI,GAAGA,IAAI;AAE7B,eAAeC,iBAAiB"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { PanelBody } from '@wordpress/components';
|
|
7
|
-
import { PostExcerpt as PostExcerptForm, PostExcerptCheck } from '@wordpress/editor';
|
|
8
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { store as editPostStore } from '../../../store';
|
|
14
|
-
import PluginPostExcerpt from '../plugin-post-excerpt';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Module Constants
|
|
18
|
-
*/
|
|
19
|
-
const PANEL_NAME = 'post-excerpt';
|
|
20
|
-
export default function PostExcerpt() {
|
|
21
|
-
const {
|
|
22
|
-
isOpened,
|
|
23
|
-
isEnabled
|
|
24
|
-
} = useSelect(select => {
|
|
25
|
-
const {
|
|
26
|
-
isEditorPanelOpened,
|
|
27
|
-
isEditorPanelEnabled
|
|
28
|
-
} = select(editPostStore);
|
|
29
|
-
return {
|
|
30
|
-
isOpened: isEditorPanelOpened(PANEL_NAME),
|
|
31
|
-
isEnabled: isEditorPanelEnabled(PANEL_NAME)
|
|
32
|
-
};
|
|
33
|
-
}, []);
|
|
34
|
-
const {
|
|
35
|
-
toggleEditorPanelOpened
|
|
36
|
-
} = useDispatch(editPostStore);
|
|
37
|
-
const toggleExcerptPanel = () => toggleEditorPanelOpened(PANEL_NAME);
|
|
38
|
-
if (!isEnabled) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return createElement(PostExcerptCheck, null, createElement(PanelBody, {
|
|
42
|
-
title: __('Excerpt'),
|
|
43
|
-
opened: isOpened,
|
|
44
|
-
onToggle: toggleExcerptPanel
|
|
45
|
-
}, createElement(PluginPostExcerpt.Slot, null, fills => createElement(Fragment, null, createElement(PostExcerptForm, null), fills))));
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","PanelBody","PostExcerpt","PostExcerptForm","PostExcerptCheck","useDispatch","useSelect","store","editPostStore","PluginPostExcerpt","PANEL_NAME","isOpened","isEnabled","select","isEditorPanelOpened","isEditorPanelEnabled","toggleEditorPanelOpened","toggleExcerptPanel","createElement","title","opened","onToggle","Slot","fills","Fragment"],"sources":["@wordpress/edit-post/src/components/sidebar/post-excerpt/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { PanelBody } from '@wordpress/components';\nimport {\n\tPostExcerpt as PostExcerptForm,\n\tPostExcerptCheck,\n} from '@wordpress/editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport PluginPostExcerpt from '../plugin-post-excerpt';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-excerpt';\n\nexport default function PostExcerpt() {\n\tconst { isOpened, isEnabled } = useSelect( ( select ) => {\n\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\tselect( editPostStore );\n\n\t\treturn {\n\t\t\tisOpened: isEditorPanelOpened( PANEL_NAME ),\n\t\t\tisEnabled: isEditorPanelEnabled( PANEL_NAME ),\n\t\t};\n\t}, [] );\n\n\tconst { toggleEditorPanelOpened } = useDispatch( editPostStore );\n\tconst toggleExcerptPanel = () => toggleEditorPanelOpened( PANEL_NAME );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PostExcerptCheck>\n\t\t\t<PanelBody\n\t\t\t\ttitle={ __( 'Excerpt' ) }\n\t\t\t\topened={ isOpened }\n\t\t\t\tonToggle={ toggleExcerptPanel }\n\t\t\t>\n\t\t\t\t<PluginPostExcerpt.Slot>\n\t\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<PostExcerptForm />\n\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</PluginPostExcerpt.Slot>\n\t\t\t</PanelBody>\n\t\t</PostExcerptCheck>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SACCC,WAAW,IAAIC,eAAe,EAC9BC,gBAAgB,QACV,mBAAmB;AAC1B,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,gBAAgB;AACvD,OAAOC,iBAAiB,MAAM,wBAAwB;;AAEtD;AACA;AACA;AACA,MAAMC,UAAU,GAAG,cAAc;AAEjC,eAAe,SAASR,WAAWA,CAAA,EAAG;EACrC,MAAM;IAAES,QAAQ;IAAEC;EAAU,CAAC,GAAGN,SAAS,CAAIO,MAAM,IAAM;IACxD,MAAM;MAAEC,mBAAmB;MAAEC;IAAqB,CAAC,GAClDF,MAAM,CAAEL,aAAc,CAAC;IAExB,OAAO;MACNG,QAAQ,EAAEG,mBAAmB,CAAEJ,UAAW,CAAC;MAC3CE,SAAS,EAAEG,oBAAoB,CAAEL,UAAW;IAC7C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAM;IAAEM;EAAwB,CAAC,GAAGX,WAAW,CAAEG,aAAc,CAAC;EAChE,MAAMS,kBAAkB,GAAGA,CAAA,KAAMD,uBAAuB,CAAEN,UAAW,CAAC;EAEtE,IAAK,CAAEE,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OACCM,aAAA,CAACd,gBAAgB,QAChBc,aAAA,CAACjB,SAAS;IACTkB,KAAK,EAAGnB,EAAE,CAAE,SAAU,CAAG;IACzBoB,MAAM,EAAGT,QAAU;IACnBU,QAAQ,EAAGJ;EAAoB,GAE/BC,aAAA,CAACT,iBAAiB,CAACa,IAAI,QAClBC,KAAK,IACRL,aAAA,CAAAM,QAAA,QACCN,aAAA,CAACf,eAAe,MAAE,CAAC,EACjBoB,KACD,CAEoB,CACd,CACM,CAAC;AAErB"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { PostTaxonomies as PostTaxonomiesForm, PostTaxonomiesCheck } from '@wordpress/editor';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import TaxonomyPanel from './taxonomy-panel';
|
|
11
|
-
function PostTaxonomies() {
|
|
12
|
-
return createElement(PostTaxonomiesCheck, null, createElement(PostTaxonomiesForm, {
|
|
13
|
-
taxonomyWrapper: (content, taxonomy) => {
|
|
14
|
-
return createElement(TaxonomyPanel, {
|
|
15
|
-
taxonomy: taxonomy
|
|
16
|
-
}, content);
|
|
17
|
-
}
|
|
18
|
-
}));
|
|
19
|
-
}
|
|
20
|
-
export default PostTaxonomies;
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PostTaxonomies","PostTaxonomiesForm","PostTaxonomiesCheck","TaxonomyPanel","createElement","taxonomyWrapper","content","taxonomy"],"sources":["@wordpress/edit-post/src/components/sidebar/post-taxonomies/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPostTaxonomies as PostTaxonomiesForm,\n\tPostTaxonomiesCheck,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport TaxonomyPanel from './taxonomy-panel';\n\nfunction PostTaxonomies() {\n\treturn (\n\t\t<PostTaxonomiesCheck>\n\t\t\t<PostTaxonomiesForm\n\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TaxonomyPanel taxonomy={ taxonomy }>\n\t\t\t\t\t\t\t{ content }\n\t\t\t\t\t\t</TaxonomyPanel>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t</PostTaxonomiesCheck>\n\t);\n}\n\nexport default PostTaxonomies;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,IAAIC,kBAAkB,EACpCC,mBAAmB,QACb,mBAAmB;;AAE1B;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAE5C,SAASH,cAAcA,CAAA,EAAG;EACzB,OACCI,aAAA,CAACF,mBAAmB,QACnBE,aAAA,CAACH,kBAAkB;IAClBI,eAAe,EAAGA,CAAEC,OAAO,EAAEC,QAAQ,KAAM;MAC1C,OACCH,aAAA,CAACD,aAAa;QAACI,QAAQ,EAAGA;MAAU,GACjCD,OACY,CAAC;IAElB;EAAG,CACH,CACmB,CAAC;AAExB;AAEA,eAAeN,cAAc"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { PanelBody } from '@wordpress/components';
|
|
6
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editPostStore } from '../../../store';
|
|
12
|
-
function TaxonomyPanel({
|
|
13
|
-
taxonomy,
|
|
14
|
-
children
|
|
15
|
-
}) {
|
|
16
|
-
const slug = taxonomy?.slug;
|
|
17
|
-
const panelName = slug ? `taxonomy-panel-${slug}` : '';
|
|
18
|
-
const {
|
|
19
|
-
isEnabled,
|
|
20
|
-
isOpened
|
|
21
|
-
} = useSelect(select => {
|
|
22
|
-
const {
|
|
23
|
-
isEditorPanelEnabled,
|
|
24
|
-
isEditorPanelOpened
|
|
25
|
-
} = select(editPostStore);
|
|
26
|
-
return {
|
|
27
|
-
isEnabled: slug ? isEditorPanelEnabled(panelName) : false,
|
|
28
|
-
isOpened: slug ? isEditorPanelOpened(panelName) : false
|
|
29
|
-
};
|
|
30
|
-
}, [panelName, slug]);
|
|
31
|
-
const {
|
|
32
|
-
toggleEditorPanelOpened
|
|
33
|
-
} = useDispatch(editPostStore);
|
|
34
|
-
if (!isEnabled) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const taxonomyMenuName = taxonomy?.labels?.menu_name;
|
|
38
|
-
if (!taxonomyMenuName) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
return createElement(PanelBody, {
|
|
42
|
-
title: taxonomyMenuName,
|
|
43
|
-
opened: isOpened,
|
|
44
|
-
onToggle: () => toggleEditorPanelOpened(panelName)
|
|
45
|
-
}, children);
|
|
46
|
-
}
|
|
47
|
-
export default TaxonomyPanel;
|
|
48
|
-
//# sourceMappingURL=taxonomy-panel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PanelBody","useSelect","useDispatch","store","editPostStore","TaxonomyPanel","taxonomy","children","slug","panelName","isEnabled","isOpened","select","isEditorPanelEnabled","isEditorPanelOpened","toggleEditorPanelOpened","taxonomyMenuName","labels","menu_name","createElement","title","opened","onToggle"],"sources":["@wordpress/edit-post/src/components/sidebar/post-taxonomies/taxonomy-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelBody } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nfunction TaxonomyPanel( { taxonomy, children } ) {\n\tconst slug = taxonomy?.slug;\n\tconst panelName = slug ? `taxonomy-panel-${ slug }` : '';\n\tconst { isEnabled, isOpened } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelEnabled, isEditorPanelOpened } =\n\t\t\t\tselect( editPostStore );\n\t\t\treturn {\n\t\t\t\tisEnabled: slug ? isEditorPanelEnabled( panelName ) : false,\n\t\t\t\tisOpened: slug ? isEditorPanelOpened( panelName ) : false,\n\t\t\t};\n\t\t},\n\t\t[ panelName, slug ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editPostStore );\n\n\tif ( ! isEnabled ) {\n\t\treturn null;\n\t}\n\n\tconst taxonomyMenuName = taxonomy?.labels?.menu_name;\n\tif ( ! taxonomyMenuName ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PanelBody\n\t\t\ttitle={ taxonomyMenuName }\n\t\t\topened={ isOpened }\n\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t>\n\t\t\t{ children }\n\t\t</PanelBody>\n\t);\n}\n\nexport default TaxonomyPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,uBAAuB;AACjD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;;AAExD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,gBAAgB;AAEvD,SAASC,aAAaA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EAChD,MAAMC,IAAI,GAAGF,QAAQ,EAAEE,IAAI;EAC3B,MAAMC,SAAS,GAAGD,IAAI,GAAI,kBAAkBA,IAAM,EAAC,GAAG,EAAE;EACxD,MAAM;IAAEE,SAAS;IAAEC;EAAS,CAAC,GAAGV,SAAS,CACtCW,MAAM,IAAM;IACb,MAAM;MAAEC,oBAAoB;MAAEC;IAAoB,CAAC,GAClDF,MAAM,CAAER,aAAc,CAAC;IACxB,OAAO;MACNM,SAAS,EAAEF,IAAI,GAAGK,oBAAoB,CAAEJ,SAAU,CAAC,GAAG,KAAK;MAC3DE,QAAQ,EAAEH,IAAI,GAAGM,mBAAmB,CAAEL,SAAU,CAAC,GAAG;IACrD,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,EAAED,IAAI,CAClB,CAAC;EACD,MAAM;IAAEO;EAAwB,CAAC,GAAGb,WAAW,CAAEE,aAAc,CAAC;EAEhE,IAAK,CAAEM,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,MAAMM,gBAAgB,GAAGV,QAAQ,EAAEW,MAAM,EAAEC,SAAS;EACpD,IAAK,CAAEF,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OACCG,aAAA,CAACnB,SAAS;IACToB,KAAK,EAAGJ,gBAAkB;IAC1BK,MAAM,EAAGV,QAAU;IACnBW,QAAQ,EAAGA,CAAA,KAAMP,uBAAuB,CAAEN,SAAU;EAAG,GAErDF,QACQ,CAAC;AAEd;AAEA,eAAeF,aAAa"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { Button } from '@wordpress/components';
|
|
7
|
-
import { external } from '@wordpress/icons';
|
|
8
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
9
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import { useSelect } from '@wordpress/data';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { store as editPostStore } from '../../store';
|
|
16
|
-
export default function ViewLink() {
|
|
17
|
-
const {
|
|
18
|
-
permalink,
|
|
19
|
-
isPublished,
|
|
20
|
-
label,
|
|
21
|
-
showIconLabels
|
|
22
|
-
} = useSelect(select => {
|
|
23
|
-
// Grab post type to retrieve the view_item label.
|
|
24
|
-
const postTypeSlug = select(editorStore).getCurrentPostType();
|
|
25
|
-
const postType = select(coreStore).getPostType(postTypeSlug);
|
|
26
|
-
return {
|
|
27
|
-
permalink: select(editorStore).getPermalink(),
|
|
28
|
-
isPublished: select(editorStore).isCurrentPostPublished(),
|
|
29
|
-
label: postType?.labels.view_item,
|
|
30
|
-
showIconLabels: select(editPostStore).isFeatureActive('showIconLabels')
|
|
31
|
-
};
|
|
32
|
-
}, []);
|
|
33
|
-
|
|
34
|
-
// Only render the view button if the post is published and has a permalink.
|
|
35
|
-
if (!isPublished || !permalink) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
return createElement(Button, {
|
|
39
|
-
icon: external,
|
|
40
|
-
label: label || __('View post'),
|
|
41
|
-
href: permalink,
|
|
42
|
-
target: "_blank",
|
|
43
|
-
showTooltip: !showIconLabels
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["__","Button","external","store","editorStore","coreStore","useSelect","editPostStore","ViewLink","permalink","isPublished","label","showIconLabels","select","postTypeSlug","getCurrentPostType","postType","getPostType","getPermalink","isCurrentPostPublished","labels","view_item","isFeatureActive","createElement","icon","href","target","showTooltip"],"sources":["@wordpress/edit-post/src/components/view-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { external } from '@wordpress/icons';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../store';\n\nexport default function ViewLink() {\n\tconst { permalink, isPublished, label, showIconLabels } = useSelect(\n\t\t( select ) => {\n\t\t\t// Grab post type to retrieve the view_item label.\n\t\t\tconst postTypeSlug = select( editorStore ).getCurrentPostType();\n\t\t\tconst postType = select( coreStore ).getPostType( postTypeSlug );\n\n\t\t\treturn {\n\t\t\t\tpermalink: select( editorStore ).getPermalink(),\n\t\t\t\tisPublished: select( editorStore ).isCurrentPostPublished(),\n\t\t\t\tlabel: postType?.labels.view_item,\n\t\t\t\tshowIconLabels:\n\t\t\t\t\tselect( editPostStore ).isFeatureActive( 'showIconLabels' ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\t// Only render the view button if the post is published and has a permalink.\n\tif ( ! isPublished || ! permalink ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\ticon={ external }\n\t\t\tlabel={ label || __( 'View post' ) }\n\t\t\thref={ permalink }\n\t\t\ttarget=\"_blank\"\n\t\t\tshowTooltip={ ! showIconLabels }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AAEpD,eAAe,SAASC,QAAQA,CAAA,EAAG;EAClC,MAAM;IAAEC,SAAS;IAAEC,WAAW;IAAEC,KAAK;IAAEC;EAAe,CAAC,GAAGN,SAAS,CAChEO,MAAM,IAAM;IACb;IACA,MAAMC,YAAY,GAAGD,MAAM,CAAET,WAAY,CAAC,CAACW,kBAAkB,CAAC,CAAC;IAC/D,MAAMC,QAAQ,GAAGH,MAAM,CAAER,SAAU,CAAC,CAACY,WAAW,CAAEH,YAAa,CAAC;IAEhE,OAAO;MACNL,SAAS,EAAEI,MAAM,CAAET,WAAY,CAAC,CAACc,YAAY,CAAC,CAAC;MAC/CR,WAAW,EAAEG,MAAM,CAAET,WAAY,CAAC,CAACe,sBAAsB,CAAC,CAAC;MAC3DR,KAAK,EAAEK,QAAQ,EAAEI,MAAM,CAACC,SAAS;MACjCT,cAAc,EACbC,MAAM,CAAEN,aAAc,CAAC,CAACe,eAAe,CAAE,gBAAiB;IAC5D,CAAC;EACF,CAAC,EACD,EACD,CAAC;;EAED;EACA,IAAK,CAAEZ,WAAW,IAAI,CAAED,SAAS,EAAG;IACnC,OAAO,IAAI;EACZ;EAEA,OACCc,aAAA,CAACtB,MAAM;IACNuB,IAAI,EAAGtB,QAAU;IACjBS,KAAK,EAAGA,KAAK,IAAIX,EAAE,CAAE,WAAY,CAAG;IACpCyB,IAAI,EAAGhB,SAAW;IAClBiB,MAAM,EAAC,QAAQ;IACfC,WAAW,EAAG,CAAEf;EAAgB,CAChC,CAAC;AAEJ"}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
5
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import { __, _x } from '@wordpress/i18n';
|
|
7
|
-
import {
|
|
8
|
-
NavigableToolbar,
|
|
9
|
-
ToolSelector,
|
|
10
|
-
store as blockEditorStore,
|
|
11
|
-
privateApis as blockEditorPrivateApis,
|
|
12
|
-
} from '@wordpress/block-editor';
|
|
13
|
-
import {
|
|
14
|
-
EditorHistoryRedo,
|
|
15
|
-
EditorHistoryUndo,
|
|
16
|
-
store as editorStore,
|
|
17
|
-
} from '@wordpress/editor';
|
|
18
|
-
import { Button, ToolbarItem } from '@wordpress/components';
|
|
19
|
-
import { listView, plus } from '@wordpress/icons';
|
|
20
|
-
import { useRef, useCallback } from '@wordpress/element';
|
|
21
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Internal dependencies
|
|
25
|
-
*/
|
|
26
|
-
import { store as editPostStore } from '../../../store';
|
|
27
|
-
import { unlock } from '../../../lock-unlock';
|
|
28
|
-
|
|
29
|
-
const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );
|
|
30
|
-
|
|
31
|
-
const preventDefault = ( event ) => {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
function HeaderToolbar( { hasFixedToolbar, setListViewToggleElement } ) {
|
|
36
|
-
const inserterButton = useRef();
|
|
37
|
-
const { setIsInserterOpened, setIsListViewOpened } =
|
|
38
|
-
useDispatch( editPostStore );
|
|
39
|
-
const {
|
|
40
|
-
isInserterEnabled,
|
|
41
|
-
isInserterOpened,
|
|
42
|
-
isTextModeEnabled,
|
|
43
|
-
showIconLabels,
|
|
44
|
-
isListViewOpen,
|
|
45
|
-
listViewShortcut,
|
|
46
|
-
} = useSelect( ( select ) => {
|
|
47
|
-
const { hasInserterItems, getBlockRootClientId, getBlockSelectionEnd } =
|
|
48
|
-
select( blockEditorStore );
|
|
49
|
-
const { getEditorSettings } = select( editorStore );
|
|
50
|
-
const { getEditorMode, isFeatureActive, isListViewOpened } =
|
|
51
|
-
select( editPostStore );
|
|
52
|
-
const { getShortcutRepresentation } = select( keyboardShortcutsStore );
|
|
53
|
-
|
|
54
|
-
return {
|
|
55
|
-
// This setting (richEditingEnabled) should not live in the block editor's setting.
|
|
56
|
-
isInserterEnabled:
|
|
57
|
-
getEditorMode() === 'visual' &&
|
|
58
|
-
getEditorSettings().richEditingEnabled &&
|
|
59
|
-
hasInserterItems(
|
|
60
|
-
getBlockRootClientId( getBlockSelectionEnd() )
|
|
61
|
-
),
|
|
62
|
-
isInserterOpened: select( editPostStore ).isInserterOpened(),
|
|
63
|
-
isTextModeEnabled: getEditorMode() === 'text',
|
|
64
|
-
showIconLabels: isFeatureActive( 'showIconLabels' ),
|
|
65
|
-
isListViewOpen: isListViewOpened(),
|
|
66
|
-
listViewShortcut: getShortcutRepresentation(
|
|
67
|
-
'core/edit-post/toggle-list-view'
|
|
68
|
-
),
|
|
69
|
-
};
|
|
70
|
-
}, [] );
|
|
71
|
-
|
|
72
|
-
const isLargeViewport = useViewportMatch( 'medium' );
|
|
73
|
-
const isWideViewport = useViewportMatch( 'wide' );
|
|
74
|
-
const {
|
|
75
|
-
shouldShowContextualToolbar,
|
|
76
|
-
canFocusHiddenToolbar,
|
|
77
|
-
fixedToolbarCanBeFocused,
|
|
78
|
-
} = useShouldContextualToolbarShow();
|
|
79
|
-
// If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar.
|
|
80
|
-
// There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport.
|
|
81
|
-
const blockToolbarCanBeFocused =
|
|
82
|
-
shouldShowContextualToolbar ||
|
|
83
|
-
canFocusHiddenToolbar ||
|
|
84
|
-
fixedToolbarCanBeFocused;
|
|
85
|
-
/* translators: accessibility text for the editor toolbar */
|
|
86
|
-
const toolbarAriaLabel = __( 'Document tools' );
|
|
87
|
-
|
|
88
|
-
const toggleListView = useCallback(
|
|
89
|
-
() => setIsListViewOpened( ! isListViewOpen ),
|
|
90
|
-
[ setIsListViewOpened, isListViewOpen ]
|
|
91
|
-
);
|
|
92
|
-
const overflowItems = (
|
|
93
|
-
<>
|
|
94
|
-
<ToolbarItem
|
|
95
|
-
as={ Button }
|
|
96
|
-
className="edit-post-header-toolbar__document-overview-toggle"
|
|
97
|
-
icon={ listView }
|
|
98
|
-
disabled={ isTextModeEnabled }
|
|
99
|
-
isPressed={ isListViewOpen }
|
|
100
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
101
|
-
label={ __( 'Document Overview' ) }
|
|
102
|
-
onClick={ toggleListView }
|
|
103
|
-
shortcut={ listViewShortcut }
|
|
104
|
-
showTooltip={ ! showIconLabels }
|
|
105
|
-
variant={ showIconLabels ? 'tertiary' : undefined }
|
|
106
|
-
aria-expanded={ isListViewOpen }
|
|
107
|
-
ref={ setListViewToggleElement }
|
|
108
|
-
size="compact"
|
|
109
|
-
/>
|
|
110
|
-
</>
|
|
111
|
-
);
|
|
112
|
-
const toggleInserter = useCallback( () => {
|
|
113
|
-
if ( isInserterOpened ) {
|
|
114
|
-
// Focusing the inserter button should close the inserter popover.
|
|
115
|
-
// However, there are some cases it won't close when the focus is lost.
|
|
116
|
-
// See https://github.com/WordPress/gutenberg/issues/43090 for more details.
|
|
117
|
-
inserterButton.current.focus();
|
|
118
|
-
setIsInserterOpened( false );
|
|
119
|
-
} else {
|
|
120
|
-
setIsInserterOpened( true );
|
|
121
|
-
}
|
|
122
|
-
}, [ isInserterOpened, setIsInserterOpened ] );
|
|
123
|
-
|
|
124
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
125
|
-
const longLabel = _x(
|
|
126
|
-
'Toggle block inserter',
|
|
127
|
-
'Generic label for block inserter button'
|
|
128
|
-
);
|
|
129
|
-
const shortLabel = ! isInserterOpened ? __( 'Add' ) : __( 'Close' );
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
<NavigableToolbar
|
|
133
|
-
className="edit-post-header-toolbar"
|
|
134
|
-
aria-label={ toolbarAriaLabel }
|
|
135
|
-
shouldUseKeyboardFocusShortcut={ ! blockToolbarCanBeFocused }
|
|
136
|
-
variant="unstyled"
|
|
137
|
-
>
|
|
138
|
-
<div className="edit-post-header-toolbar__left">
|
|
139
|
-
<ToolbarItem
|
|
140
|
-
ref={ inserterButton }
|
|
141
|
-
as={ Button }
|
|
142
|
-
className="edit-post-header-toolbar__inserter-toggle"
|
|
143
|
-
variant="primary"
|
|
144
|
-
isPressed={ isInserterOpened }
|
|
145
|
-
onMouseDown={ preventDefault }
|
|
146
|
-
onClick={ toggleInserter }
|
|
147
|
-
disabled={ ! isInserterEnabled }
|
|
148
|
-
icon={ plus }
|
|
149
|
-
label={ showIconLabels ? shortLabel : longLabel }
|
|
150
|
-
showTooltip={ ! showIconLabels }
|
|
151
|
-
aria-expanded={ isInserterOpened }
|
|
152
|
-
/>
|
|
153
|
-
{ ( isWideViewport || ! showIconLabels ) && (
|
|
154
|
-
<>
|
|
155
|
-
{ isLargeViewport && ! hasFixedToolbar && (
|
|
156
|
-
<ToolbarItem
|
|
157
|
-
as={ ToolSelector }
|
|
158
|
-
showTooltip={ ! showIconLabels }
|
|
159
|
-
variant={
|
|
160
|
-
showIconLabels ? 'tertiary' : undefined
|
|
161
|
-
}
|
|
162
|
-
disabled={ isTextModeEnabled }
|
|
163
|
-
size="compact"
|
|
164
|
-
/>
|
|
165
|
-
) }
|
|
166
|
-
<ToolbarItem
|
|
167
|
-
as={ EditorHistoryUndo }
|
|
168
|
-
showTooltip={ ! showIconLabels }
|
|
169
|
-
variant={ showIconLabels ? 'tertiary' : undefined }
|
|
170
|
-
size="compact"
|
|
171
|
-
/>
|
|
172
|
-
<ToolbarItem
|
|
173
|
-
as={ EditorHistoryRedo }
|
|
174
|
-
showTooltip={ ! showIconLabels }
|
|
175
|
-
variant={ showIconLabels ? 'tertiary' : undefined }
|
|
176
|
-
size="compact"
|
|
177
|
-
/>
|
|
178
|
-
{ overflowItems }
|
|
179
|
-
</>
|
|
180
|
-
) }
|
|
181
|
-
</div>
|
|
182
|
-
</NavigableToolbar>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export default HeaderToolbar;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
.edit-post-header-toolbar {
|
|
2
|
-
display: inline-flex;
|
|
3
|
-
align-items: center;
|
|
4
|
-
|
|
5
|
-
// Hide all action buttons except the inserter on mobile.
|
|
6
|
-
.edit-post-header-toolbar__left > .components-button {
|
|
7
|
-
display: none;
|
|
8
|
-
|
|
9
|
-
@include break-small() {
|
|
10
|
-
display: inline-flex;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle {
|
|
15
|
-
display: inline-flex;
|
|
16
|
-
|
|
17
|
-
svg {
|
|
18
|
-
transition: transform cubic-bezier(0.165, 0.84, 0.44, 1) 0.2s;
|
|
19
|
-
@include reduce-motion("transition");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&.is-pressed {
|
|
23
|
-
svg {
|
|
24
|
-
transform: rotate(45deg);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Hide table of contents and list view on mobile.
|
|
30
|
-
.block-editor-list-view {
|
|
31
|
-
display: none;
|
|
32
|
-
|
|
33
|
-
@include break-small() {
|
|
34
|
-
display: flex;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// The Toolbar component adds different styles to buttons, so we reset them
|
|
39
|
-
// here to the original button styles
|
|
40
|
-
.edit-post-header-toolbar__left > .components-button.has-icon,
|
|
41
|
-
.edit-post-header-toolbar__left > .components-dropdown > .components-button.has-icon {
|
|
42
|
-
// @todo: override toolbar group inherited paddings from components/block-tools/style.scss.
|
|
43
|
-
// This is best fixed by making the mover control area a proper single toolbar group.
|
|
44
|
-
// It needs specificity due to style inherited from .components-accessible-toolbar .components-button.has-icon.has-icon.
|
|
45
|
-
height: $button-size-compact;
|
|
46
|
-
min-width: $button-size-compact;
|
|
47
|
-
padding: 4px;
|
|
48
|
-
|
|
49
|
-
&.is-pressed {
|
|
50
|
-
background: $gray-900;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&:focus:not(:disabled) {
|
|
54
|
-
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 0 0 $border-width $white;
|
|
55
|
-
outline: $border-width solid transparent;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&::before {
|
|
59
|
-
display: none;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Reduced UI.
|
|
65
|
-
.edit-post-header.has-reduced-ui {
|
|
66
|
-
@include break-small () {
|
|
67
|
-
// Apply transition to every button but the first one.
|
|
68
|
-
.edit-post-header-toolbar__left > * + .components-button,
|
|
69
|
-
.edit-post-header-toolbar__left > * + .components-dropdown > [aria-expanded="false"] {
|
|
70
|
-
transition: opacity 0.1s linear;
|
|
71
|
-
@include reduce-motion("transition");
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Zero out opacity unless hovered.
|
|
75
|
-
&:not(:hover) .edit-post-header-toolbar__left > * + .components-button,
|
|
76
|
-
&:not(:hover) .edit-post-header-toolbar__left > * + .components-dropdown > [aria-expanded="false"] {
|
|
77
|
-
opacity: 0;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.edit-post-header-toolbar__left {
|
|
83
|
-
display: inline-flex;
|
|
84
|
-
align-items: center;
|
|
85
|
-
padding-left: $grid-unit-20;
|
|
86
|
-
gap: $grid-unit-10;
|
|
87
|
-
|
|
88
|
-
// Some plugins add buttons here despite best practices.
|
|
89
|
-
// Push them a bit rightwards to fit the top toolbar.
|
|
90
|
-
margin-right: $grid-unit-10;
|
|
91
|
-
|
|
92
|
-
@include break-medium() {
|
|
93
|
-
padding-left: $grid-unit-50 * 0.5;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@include break-wide() {
|
|
97
|
-
padding-right: $grid-unit-10;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.edit-post-header-toolbar .edit-post-header-toolbar__left > .edit-post-header-toolbar__inserter-toggle.has-icon {
|
|
102
|
-
min-width: $button-size-compact;
|
|
103
|
-
width: $button-size-compact;
|
|
104
|
-
height: $button-size-compact;
|
|
105
|
-
padding: 0;
|
|
106
|
-
|
|
107
|
-
.show-icon-labels & {
|
|
108
|
-
width: auto;
|
|
109
|
-
height: $button-size-compact;
|
|
110
|
-
padding: 0 $grid-unit-10;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.show-icon-labels .edit-post-header-toolbar__left > * + * {
|
|
115
|
-
margin-left: $grid-unit-10;
|
|
116
|
-
}
|