@wordpress/edit-post 5.1.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +10 -4
- package/build/components/block-manager/index.js +18 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/header/plugin-more-menu-item/index.js +1 -1
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/layout/index.js +14 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +13 -5
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/template/actions.js +5 -2
- package/build/components/sidebar/template/actions.js.map +1 -1
- package/build/components/sidebar/template/index.js +23 -12
- package/build/components/sidebar/template/index.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build-module/components/block-manager/index.js +17 -2
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/layout/index.js +14 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +13 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/template/actions.js +5 -2
- package/build-module/components/sidebar/template/actions.js.map +1 -1
- package/build-module/components/sidebar/template/index.js +24 -13
- package/build-module/components/sidebar/template/index.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +8 -0
- package/build-style/style.css +8 -0
- package/package.json +26 -29
- package/src/components/block-manager/index.js +18 -1
- package/src/components/header/plugin-more-menu-item/index.js +1 -1
- package/src/components/layout/index.js +16 -2
- package/src/components/preferences-modal/index.js +22 -4
- package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +1 -1
- package/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +1 -1
- package/src/components/sidebar/template/actions.js +12 -7
- package/src/components/sidebar/template/index.js +55 -31
- package/src/components/sidebar/template/style.scss +8 -0
- package/src/components/visual-editor/style.scss +1 -0
- package/src/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 6.0.0 (2022-02-10)
|
|
6
|
+
|
|
7
|
+
### Breaking Change
|
|
8
|
+
|
|
9
|
+
- The `GUTENBERG_PHASE` environment variable has been renamed to `IS_GUTENBERG_PLUGIN` and is now a boolean ([#38202](https://github.com/WordPress/gutenberg/pull/38202)).
|
|
10
|
+
|
|
11
|
+
### Bug Fix
|
|
12
|
+
|
|
13
|
+
- Removed unused `@wordpress/api-fetch`, `@wordpress/primitives` and `uuid` dependencies ([#38388](https://github.com/WordPress/gutenberg/pull/38388)).
|
|
14
|
+
|
|
5
15
|
## 5.1.0 (2022-01-27)
|
|
6
16
|
|
|
7
17
|
## 5.0.0 (2021-07-29)
|
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@ _This package assumes that your code will run in an **ES2015+** environment. If
|
|
|
18
18
|
|
|
19
19
|
Extending the editor UI can be accomplished with the `registerPlugin` API, allowing you to define all your plugin's UI elements in one place.
|
|
20
20
|
|
|
21
|
-
Refer to [the plugins module documentation](/packages/plugins/README.md) for more information.
|
|
21
|
+
Refer to [the plugins module documentation](https://github.com/WordPress/gutenberg/tree/HEAD/packages/plugins/README.md) for more information.
|
|
22
22
|
|
|
23
|
-
The components exported through the API can be used with the `registerPlugin` ([see documentation](/packages/plugins/README.md)) API.
|
|
23
|
+
The components exported through the API can be used with the `registerPlugin` ([see documentation](https://github.com/WordPress/gutenberg/tree/HEAD/packages/plugins/README.md)) API.
|
|
24
24
|
They can be found in the global variable `wp.editPost` when defining `wp-edit-post` as a script dependency.
|
|
25
25
|
|
|
26
26
|
## API
|
|
@@ -207,7 +207,7 @@ _Parameters_
|
|
|
207
207
|
- _props.href_ `[string]`: When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
|
|
208
208
|
- _props.icon_ `[WPBlockTypeIconRender]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
|
|
209
209
|
- _props.onClick_ `[Function]`: The callback function to be executed when the user clicks the menu item.
|
|
210
|
-
- _props.other_ `[...*]`: Any additional props are passed through to the underlying [MenuItem](/packages/components/src/menu-item/README.md) component.
|
|
210
|
+
- _props.other_ `[...*]`: Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.
|
|
211
211
|
|
|
212
212
|
_Returns_
|
|
213
213
|
|
|
@@ -504,4 +504,10 @@ _Type_
|
|
|
504
504
|
|
|
505
505
|
<!-- END TOKEN(Autogenerated API docs) -->
|
|
506
506
|
|
|
507
|
-
|
|
507
|
+
## Contributing to this package
|
|
508
|
+
|
|
509
|
+
This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
|
|
510
|
+
|
|
511
|
+
To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
|
|
512
|
+
|
|
513
|
+
<br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
|
|
@@ -19,6 +19,10 @@ var _components = require("@wordpress/components");
|
|
|
19
19
|
|
|
20
20
|
var _i18n = require("@wordpress/i18n");
|
|
21
21
|
|
|
22
|
+
var _compose = require("@wordpress/compose");
|
|
23
|
+
|
|
24
|
+
var _a11y = require("@wordpress/a11y");
|
|
25
|
+
|
|
22
26
|
var _category = _interopRequireDefault(require("./category"));
|
|
23
27
|
|
|
24
28
|
var _store = require("../../store");
|
|
@@ -42,11 +46,24 @@ function BlockManager(_ref) {
|
|
|
42
46
|
isMatchingSearchTerm,
|
|
43
47
|
numberOfHiddenBlocks
|
|
44
48
|
} = _ref;
|
|
49
|
+
const debouncedSpeak = (0, _compose.useDebounce)(_a11y.speak, 500);
|
|
45
50
|
const [search, setSearch] = (0, _element.useState)(''); // Filtering occurs here (as opposed to `withSelect`) to avoid
|
|
46
51
|
// wasted renders by consequence of `Array#filter` producing
|
|
47
52
|
// a new value reference on each call.
|
|
48
53
|
|
|
49
|
-
blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || (0, _lodash.includes)(blockType.parent, 'core/post-content')));
|
|
54
|
+
blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || (0, _lodash.includes)(blockType.parent, 'core/post-content'))); // Announce search results on change
|
|
55
|
+
|
|
56
|
+
(0, _element.useEffect)(() => {
|
|
57
|
+
if (!search) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const count = blockTypes.length;
|
|
62
|
+
const resultsFoundMessage = (0, _i18n.sprintf)(
|
|
63
|
+
/* translators: %d: number of results. */
|
|
64
|
+
(0, _i18n._n)('%d result found.', '%d results found.', count), count);
|
|
65
|
+
debouncedSpeak(resultsFoundMessage);
|
|
66
|
+
}, [blockTypes.length, search, debouncedSpeak]);
|
|
50
67
|
return (0, _element.createElement)("div", {
|
|
51
68
|
className: "edit-post-block-manager__content"
|
|
52
69
|
}, !!numberOfHiddenBlocks && (0, _element.createElement)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","search","setSearch","filter","blockType","parent","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/block-manager/index.js"],"names":["BlockManager","blockTypes","categories","hasBlockSupport","isMatchingSearchTerm","numberOfHiddenBlocks","debouncedSpeak","speak","search","setSearch","filter","blockType","parent","count","length","resultsFoundMessage","nextSearch","map","category","slug","title","select","getBlockTypes","getCategories","blocksStore","getPreference","editPostStore","hiddenBlockTypes"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;AAIA,SAASA,YAAT,OAMI;AAAA,MANmB;AACtBC,IAAAA,UADsB;AAEtBC,IAAAA,UAFsB;AAGtBC,IAAAA,eAHsB;AAItBC,IAAAA,oBAJsB;AAKtBC,IAAAA;AALsB,GAMnB;AACH,QAAMC,cAAc,GAAG,0BAAaC,WAAb,EAAoB,GAApB,CAAvB;AACA,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,EAAV,CAA9B,CAFG,CAIH;AACA;AACA;;AACAR,EAAAA,UAAU,GAAGA,UAAU,CAACS,MAAX,CACVC,SAAF,IACCR,eAAe,CAAEQ,SAAF,EAAa,UAAb,EAAyB,IAAzB,CAAf,KACE,CAAEH,MAAF,IAAYJ,oBAAoB,CAAEO,SAAF,EAAaH,MAAb,CADlC,MAEE,CAAEG,SAAS,CAACC,MAAZ,IACD,sBAAUD,SAAS,CAACC,MAApB,EAA4B,mBAA5B,CAHD,CAFW,CAAb,CAPG,CAeH;;AACA,0BAAW,MAAM;AAChB,QAAK,CAAEJ,MAAP,EAAgB;AACf;AACA;;AACD,UAAMK,KAAK,GAAGZ,UAAU,CAACa,MAAzB;AACA,UAAMC,mBAAmB,GAAG;AAC3B;AACA,kBAAI,kBAAJ,EAAwB,mBAAxB,EAA6CF,KAA7C,CAF2B,EAG3BA,KAH2B,CAA5B;AAKAP,IAAAA,cAAc,CAAES,mBAAF,CAAd;AACA,GAXD,EAWG,CAAEd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C,QAAM;AACLC,IAAAA,aADK;AAELC,IAAAA,aAFK;AAGLpB,IAAAA,eAHK;AAILC,IAAAA;AAJK,MAKFiB,MAAM,CAAEG,aAAF,CALV;AAMA,QAAM;AAAEC,IAAAA;AAAF,MAAoBJ,MAAM,CAAEK,YAAF,CAAhC;AACA,QAAMC,gBAAgB,GAAGF,aAAa,CAAE,kBAAF,CAAtC;AACA,QAAMpB,oBAAoB,GACzB,qBAASsB,gBAAT,KAA+BA,gBAAgB,CAACb,MADjD;AAGA,SAAO;AACNb,IAAAA,UAAU,EAAEqB,aAAa,EADnB;AAENpB,IAAAA,UAAU,EAAEqB,aAAa,EAFnB;AAGNpB,IAAAA,eAHM;AAINC,IAAAA,oBAJM;AAKNC,IAAAA;AALM,GAAP;AAOA,CAnBc,EAmBVL,YAnBU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, includes, isArray } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { withSelect } from '@wordpress/data';\nimport { SearchControl } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { useEffect, useState } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport BlockManagerCategory from './category';\nimport { store as editPostStore } from '../../store';\n\nfunction BlockManager( {\n\tblockTypes,\n\tcategories,\n\thasBlockSupport,\n\tisMatchingSearchTerm,\n\tnumberOfHiddenBlocks,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst [ search, setSearch ] = useState( '' );\n\n\t// Filtering occurs here (as opposed to `withSelect`) to avoid\n\t// wasted renders by consequence of `Array#filter` producing\n\t// a new value reference on each call.\n\tblockTypes = blockTypes.filter(\n\t\t( blockType ) =>\n\t\t\thasBlockSupport( blockType, 'inserter', true ) &&\n\t\t\t( ! search || isMatchingSearchTerm( blockType, search ) ) &&\n\t\t\t( ! blockType.parent ||\n\t\t\t\tincludes( blockType.parent, 'core/post-content' ) )\n\t);\n\n\t// Announce search results on change\n\tuseEffect( () => {\n\t\tif ( ! search ) {\n\t\t\treturn;\n\t\t}\n\t\tconst count = blockTypes.length;\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results. */\n\t\t\t_n( '%d result found.', '%d results found.', count ),\n\t\t\tcount\n\t\t);\n\t\tdebouncedSpeak( resultsFoundMessage );\n\t}, [ blockTypes.length, search, debouncedSpeak ] );\n\n\treturn (\n\t\t<div className=\"edit-post-block-manager__content\">\n\t\t\t{ !! numberOfHiddenBlocks && (\n\t\t\t\t<div className=\"edit-post-block-manager__disabled-blocks-count\">\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d block is hidden.',\n\t\t\t\t\t\t\t'%d blocks are hidden.',\n\t\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t\t),\n\t\t\t\t\t\tnumberOfHiddenBlocks\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<SearchControl\n\t\t\t\tlabel={ __( 'Search for a block' ) }\n\t\t\t\tplaceholder={ __( 'Search for a block' ) }\n\t\t\t\tvalue={ search }\n\t\t\t\tonChange={ ( nextSearch ) => setSearch( nextSearch ) }\n\t\t\t\tclassName=\"edit-post-block-manager__search\"\n\t\t\t/>\n\t\t\t<div\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"region\"\n\t\t\t\taria-label={ __( 'Available block types' ) }\n\t\t\t\tclassName=\"edit-post-block-manager__results\"\n\t\t\t>\n\t\t\t\t{ blockTypes.length === 0 && (\n\t\t\t\t\t<p className=\"edit-post-block-manager__no-results\">\n\t\t\t\t\t\t{ __( 'No blocks found.' ) }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ categories.map( ( category ) => (\n\t\t\t\t\t<BlockManagerCategory\n\t\t\t\t\t\tkey={ category.slug }\n\t\t\t\t\t\ttitle={ category.title }\n\t\t\t\t\t\tblockTypes={ filter( blockTypes, {\n\t\t\t\t\t\t\tcategory: category.slug,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t\t<BlockManagerCategory\n\t\t\t\t\ttitle={ __( 'Uncategorized' ) }\n\t\t\t\t\tblockTypes={ filter(\n\t\t\t\t\t\tblockTypes,\n\t\t\t\t\t\t( { category } ) => ! category\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst {\n\t\tgetBlockTypes,\n\t\tgetCategories,\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t} = select( blocksStore );\n\tconst { getPreference } = select( editPostStore );\n\tconst hiddenBlockTypes = getPreference( 'hiddenBlockTypes' );\n\tconst numberOfHiddenBlocks =\n\t\tisArray( hiddenBlockTypes ) && hiddenBlockTypes.length;\n\n\treturn {\n\t\tblockTypes: getBlockTypes(),\n\t\tcategories: getCategories(),\n\t\thasBlockSupport,\n\t\tisMatchingSearchTerm,\n\t\tnumberOfHiddenBlocks,\n\t};\n} )( BlockManager );\n"]}
|
|
@@ -23,7 +23,7 @@ var _plugins = require("@wordpress/plugins");
|
|
|
23
23
|
* @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
|
|
24
24
|
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
|
|
25
25
|
* @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
|
|
26
|
-
* @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](/packages/components/src/menu-item/README.md) component.
|
|
26
|
+
* @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```js
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/header/plugin-more-menu-item/index.js"],"names":["context","ownProps","icon","name","ActionItem"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eACe,sBACd,gCAAmB,CAAEA,OAAF,EAAWC,QAAX,KAAyB;AAC3C,SAAO;AACNC,IAAAA,IAAI,EAAED,QAAQ,CAACC,IAAT,IAAiBF,OAAO,CAACE,IADzB;AAENC,IAAAA,IAAI,EAAE;AAFA,GAAP;AAIA,CALD,CADc,EAOZC,qBAPY,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ActionItem } from '@wordpress/interface';\nimport { compose } from '@wordpress/compose';\nimport { withPluginContext } from '@wordpress/plugins';\n\n/**\n * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.\n * The text within the component appears as the menu item label.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.\n * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.\n * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](/packages/components/src/menu-item/README.md) component.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;\n * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * function MyButtonMoreMenuItem() {\n * \treturn wp.element.createElement(\n * \t\tPluginMoreMenuItem,\n * \t\t{\n * \t\t\ticon: moreIcon,\n * \t\t\tonClick: onButtonClick,\n * \t\t},\n * \t\t__( 'My button title' )\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginMoreMenuItem } from '@wordpress/edit-post';\n * import { more } from '@wordpress/icons';\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * const MyButtonMoreMenuItem = () => (\n * \t<PluginMoreMenuItem\n * \t\ticon={ more }\n * \t\tonClick={ onButtonClick }\n * \t>\n * \t\t{ __( 'My button title' ) }\n * \t</PluginMoreMenuItem>\n * );\n * ```\n *\n * @return {WPComponent} The component to be rendered.\n */\nexport default compose(\n\twithPluginContext( ( context, ownProps ) => {\n\t\treturn {\n\t\t\ticon: ownProps.icon || context.icon,\n\t\t\tname: 'core/edit-post/plugin-more-menu',\n\t\t};\n\t} )\n)( ActionItem );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/header/plugin-more-menu-item/index.js"],"names":["context","ownProps","icon","name","ActionItem"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;eACe,sBACd,gCAAmB,CAAEA,OAAF,EAAWC,QAAX,KAAyB;AAC3C,SAAO;AACNC,IAAAA,IAAI,EAAED,QAAQ,CAACC,IAAT,IAAiBF,OAAO,CAACE,IADzB;AAENC,IAAAA,IAAI,EAAE;AAFA,GAAP;AAIA,CALD,CADc,EAOZC,qBAPY,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ActionItem } from '@wordpress/interface';\nimport { compose } from '@wordpress/compose';\nimport { withPluginContext } from '@wordpress/plugins';\n\n/**\n * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.\n * The text within the component appears as the menu item label.\n *\n * @param {Object} props Component properties.\n * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.\n * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.\n * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;\n * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * function MyButtonMoreMenuItem() {\n * \treturn wp.element.createElement(\n * \t\tPluginMoreMenuItem,\n * \t\t{\n * \t\t\ticon: moreIcon,\n * \t\t\tonClick: onButtonClick,\n * \t\t},\n * \t\t__( 'My button title' )\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PluginMoreMenuItem } from '@wordpress/edit-post';\n * import { more } from '@wordpress/icons';\n *\n * function onButtonClick() {\n * \talert( 'Button clicked.' );\n * }\n *\n * const MyButtonMoreMenuItem = () => (\n * \t<PluginMoreMenuItem\n * \t\ticon={ more }\n * \t\tonClick={ onButtonClick }\n * \t>\n * \t\t{ __( 'My button title' ) }\n * \t</PluginMoreMenuItem>\n * );\n * ```\n *\n * @return {WPComponent} The component to be rendered.\n */\nexport default compose(\n\twithPluginContext( ( context, ownProps ) => {\n\t\treturn {\n\t\t\ticon: ownProps.icon || context.icon,\n\t\t\tname: 'core/edit-post/plugin-more-menu',\n\t\t};\n\t} )\n)( ActionItem );\n"]}
|
|
@@ -29,6 +29,8 @@ var _interface = require("@wordpress/interface");
|
|
|
29
29
|
|
|
30
30
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
31
31
|
|
|
32
|
+
var _notices = require("@wordpress/notices");
|
|
33
|
+
|
|
32
34
|
var _textEditor = _interopRequireDefault(require("../text-editor"));
|
|
33
35
|
|
|
34
36
|
var _visualEditor = _interopRequireDefault(require("../visual-editor"));
|
|
@@ -98,6 +100,9 @@ function Layout(_ref) {
|
|
|
98
100
|
closeGeneralSidebar,
|
|
99
101
|
setIsInserterOpened
|
|
100
102
|
} = (0, _data.useDispatch)(_store.store);
|
|
103
|
+
const {
|
|
104
|
+
createErrorNotice
|
|
105
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
101
106
|
const {
|
|
102
107
|
mode,
|
|
103
108
|
isFullscreenActive,
|
|
@@ -184,6 +189,12 @@ function Layout(_ref) {
|
|
|
184
189
|
return null;
|
|
185
190
|
};
|
|
186
191
|
|
|
192
|
+
function onPluginAreaError(name) {
|
|
193
|
+
createErrorNotice((0, _i18n.sprintf)(
|
|
194
|
+
/* translators: %s: plugin name */
|
|
195
|
+
(0, _i18n.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
|
|
196
|
+
}
|
|
197
|
+
|
|
187
198
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.FullscreenMode, {
|
|
188
199
|
isActive: isFullscreenActive
|
|
189
200
|
}), (0, _element.createElement)(_browserUrl.default, null), (0, _element.createElement)(_editor.UnsavedChangesWarning, null), (0, _element.createElement)(_editor.AutosaveMonitor, null), (0, _element.createElement)(_editor.LocalAutosaveMonitor, null), (0, _element.createElement)(_keyboardShortcuts2.default, null), (0, _element.createElement)(_editor.EditorKeyboardShortcutsRegister, null), (0, _element.createElement)(_settingsSidebar.default, null), (0, _element.createElement)(_interface.InterfaceSkeleton, {
|
|
@@ -229,7 +240,9 @@ function Layout(_ref) {
|
|
|
229
240
|
previous: previousShortcut,
|
|
230
241
|
next: nextShortcut
|
|
231
242
|
}
|
|
232
|
-
}), (0, _element.createElement)(_preferencesModal.default, null), (0, _element.createElement)(_keyboardShortcutHelpModal.default, null), (0, _element.createElement)(_welcomeGuide.default, null), (0, _element.createElement)(_components.Popover.Slot, null), (0, _element.createElement)(_plugins.PluginArea,
|
|
243
|
+
}), (0, _element.createElement)(_preferencesModal.default, null), (0, _element.createElement)(_keyboardShortcutHelpModal.default, null), (0, _element.createElement)(_welcomeGuide.default, null), (0, _element.createElement)(_components.Popover.Slot, null), (0, _element.createElement)(_plugins.PluginArea, {
|
|
244
|
+
onError: onPluginAreaError
|
|
245
|
+
}));
|
|
233
246
|
}
|
|
234
247
|
|
|
235
248
|
var _default = Layout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["interfaceLabels","secondarySidebar","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","editPostStore","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","hasReducedUI","showBlockBreadcrumbs","isTemplateMode","documentLabel","select","getEditorSettings","getPostTypeLabel","editorStore","editorSettings","postTypeLabel","isEditingTemplate","isFeatureActive","interfaceStore","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","keyboardShortcutsStore","getAllShortcutKeyCombinations","className","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","previous","next"],"mappings":";;;;;;;;;AA6BA;;AA1BA;;AAKA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhDA;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;AAgBA,MAAMA,eAAe,GAAG;AACvBC,EAAAA,gBAAgB,EAAE,cAAI,eAAJ,CADK;;AAEvB;AACAC,EAAAA,MAAM,EAAE,cAAI,gBAAJ,CAHe;;AAIvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CALiB;;AAMvB;AACAC,EAAAA,OAAO,EAAE,cAAI,iBAAJ,CAPc;;AAQvB;AACAC,EAAAA,OAAO,EAAE,cAAI,gBAAJ,CATc;;AAUvB;AACAC,EAAAA,MAAM,EAAE,cAAI,eAAJ;AAXe,CAAxB;;AAcA,SAASC,MAAT,OAA8B;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC7B,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAMC,cAAc,GAAG,+BAAkB,MAAlB,EAA0B,IAA1B,CAAvB;AACA,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA;AAHK,MAIF,uBAAaC,YAAb,CAJJ;AAKA,QAAM;AACLC,IAAAA,IADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,eAJK;AAKLC,IAAAA,kBALK;AAMLC,IAAAA,eANK;AAOLC,IAAAA,gBAPK;AAQLC,IAAAA,YARK;AASLC,IAA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,4BAAC,kCAAD,OA3FD,EA4FC,4BAAC,qBAAD,OA5FD,EA6FC,4BAAC,mBAAD,CAAS,IAAT,OA7FD,EA8FC,4BAAC,mBAAD,OA9FD,CADD;AAkGA;;eAEcf,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorNotices,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockBreadcrumb, BlockStyles } from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tFullscreenMode,\n\tInterfaceSkeleton,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport PreferencesModal from '../preferences-modal';\nimport BrowserURL from '../browser-url';\nimport Header from '../header';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport SettingsSidebar from '../sidebar/settings-sidebar';\nimport MetaBoxes from '../meta-boxes';\nimport WelcomeGuide from '../welcome-guide';\nimport ActionsPanel from './actions-panel';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\n\tsecondarySidebar: __( 'Block library' ),\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nfunction Layout( { styles } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tsetIsInserterOpened,\n\t} = useDispatch( editPostStore );\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\tisRichEditingEnabled,\n\t\tsidebarIsOpened,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\thasBlockSelected,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tshowIconLabels,\n\t\thasReducedUI,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t\tdocumentLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar: select( editPostStore ).isFeatureActive(\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditPostStore.name\n\t\t\t\t) || select( editPostStore ).isPublishSidebarOpened()\n\t\t\t),\n\t\t\tisFullscreenActive: select( editPostStore ).isFeatureActive(\n\t\t\t\t'fullscreenMode'\n\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editPostStore ).isListViewOpened(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\thasReducedUI: select( editPostStore ).isFeatureActive(\n\t\t\t\t'reducedUI'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t};\n\t}, [] );\n\tconst className = classnames( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'is-sidebar-opened': sidebarIsOpened,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t\t'show-icon-labels': showIconLabels,\n\t} );\n\tconst openSidebarPanel = () =>\n\t\topenGeneralSidebar(\n\t\t\thasBlockSelected ? 'edit-post/block' : 'edit-post/document'\n\t\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( sidebarIsOpened && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t}\n\t}, [ sidebarIsOpened, isHugeViewport ] );\n\tuseEffect( () => {\n\t\tif ( isInserterOpened && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isHugeViewport ] );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [\n\t\tentitiesSavedStatesCallback,\n\t\tsetEntitiesSavedStatesCallback,\n\t] = useState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\tconst secondarySidebar = () => {\n\t\tif ( mode === 'visual' && isInserterOpened ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( mode === 'visual' && isListViewOpened ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\t\treturn null;\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t<BrowserURL />\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<AutosaveMonitor />\n\t\t\t<LocalAutosaveMonitor />\n\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ interfaceLabels }\n\t\t\t\theader={\n\t\t\t\t\t<Header\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\tsidebar={\n\t\t\t\t\t( ! isMobileViewport || sidebarIsOpened ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isMobileViewport && ! sidebarIsOpened && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-layout__toggle-sidebar-panel\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-post-layout__toggle-sidebar-panel-button\"\n\t\t\t\t\t\t\t\t\t\tonClick={ openSidebarPanel }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ hasBlockSelected\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Open block settings' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Open document settings' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t{ ( mode === 'text' || ! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t<TextEditor />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isRichEditingEnabled && mode === 'visual' && (\n\t\t\t\t\t\t\t<VisualEditor styles={ styles } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-layout__metaboxes\">\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isMobileViewport && sidebarIsOpened && (\n\t\t\t\t\t\t\t<ScrollLock />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<BlockStyles.Slot scope=\"core/block-inspector\" />\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t! hasReducedUI &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t<div className=\"edit-post-layout__footer\">\n\t\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<ActionsPanel\n\t\t\t\t\t\tcloseEntitiesSavedStates={ closeEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tshortcuts={ {\n\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<PreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/layout/index.js"],"names":["interfaceLabels","secondarySidebar","header","body","sidebar","actions","footer","Layout","styles","isMobileViewport","isHugeViewport","openGeneralSidebar","closeGeneralSidebar","setIsInserterOpened","editPostStore","createErrorNotice","noticesStore","mode","isFullscreenActive","isRichEditingEnabled","sidebarIsOpened","hasActiveMetaboxes","hasFixedToolbar","previousShortcut","nextShortcut","hasBlockSelected","isInserterOpened","isListViewOpened","showIconLabels","hasReducedUI","showBlockBreadcrumbs","isTemplateMode","documentLabel","select","getEditorSettings","getPostTypeLabel","editorStore","editorSettings","postTypeLabel","isEditingTemplate","isFeatureActive","interfaceStore","getActiveComplementaryArea","name","isPublishSidebarOpened","getEditorMode","richEditingEnabled","hasMetaBoxes","keyboardShortcutsStore","getAllShortcutKeyCombinations","className","openSidebarPanel","entitiesSavedStatesCallback","setEntitiesSavedStatesCallback","closeEntitiesSavedStates","arg","onPluginAreaError","previous","next"],"mappings":";;;;;;;;;AA6BA;;AA1BA;;AAKA;;AASA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAjDA;AACA;AACA;;AAGA;AACA;AACA;;AA0BA;AACA;AACA;AAgBA,MAAMA,eAAe,GAAG;AACvBC,EAAAA,gBAAgB,EAAE,cAAI,eAAJ,CADK;;AAEvB;AACAC,EAAAA,MAAM,EAAE,cAAI,gBAAJ,CAHe;;AAIvB;AACAC,EAAAA,IAAI,EAAE,cAAI,gBAAJ,CALiB;;AAMvB;AACAC,EAAAA,OAAO,EAAE,cAAI,iBAAJ,CAPc;;AAQvB;AACAC,EAAAA,OAAO,EAAE,cAAI,gBAAJ,CATc;;AAUvB;AACAC,EAAAA,MAAM,EAAE,cAAI,eAAJ;AAXe,CAAxB;;AAcA,SAASC,MAAT,OAA8B;AAAA,MAAb;AAAEC,IAAAA;AAAF,GAAa;AAC7B,QAAMC,gBAAgB,GAAG,+BAAkB,QAAlB,EAA4B,GAA5B,CAAzB;AACA,QAAMC,cAAc,GAAG,+BAAkB,MAAlB,EAA0B,IAA1B,CAAvB;AACA,QAAM;AACLC,IAAAA,kBADK;AAELC,IAAAA,mBAFK;AAGLC,IAAAA;AAHK,MAIF,uBAAaC,YAAb,CAJJ;AAKA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,uBAAaC,cAAb,CAA9B;AACA,QAAM;AACLC,IAAAA,IADK;AAELC,IAAAA,kBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,eAJK;AAKLC,IAAAA,kBALK;AAMLC,IAAAA,eANK;AAOLC,IAAAA,gBAPK;AAQLC,IAAAA,YARK;AASLC,IAAAA,gBATK;AAULC,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EAAG;AACXI,MAAAA,QAAQ,EAAElC,gBADC;AAEXmC,MAAAA,IAAI,EAAElC;AAFK;AA5Eb,IATD,EA0FC,4BAAC,yBAAD,OA1FD,EA2FC,4BAAC,kCAAD,OA3FD,EA4FC,4BAAC,qBAAD,OA5FD,EA6FC,4BAAC,mBAAD,CAAS,IAAT,OA7FD,EA8FC,4BAAC,mBAAD;AAAY,IAAA,OAAO,EAAGgC;AAAtB,IA9FD,CADD;AAkGA;;eAEcjD,M","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tAutosaveMonitor,\n\tLocalAutosaveMonitor,\n\tUnsavedChangesWarning,\n\tEditorNotices,\n\tEditorKeyboardShortcutsRegister,\n\tEditorSnackbars,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { BlockBreadcrumb, BlockStyles } from '@wordpress/block-editor';\nimport { Button, ScrollLock, Popover } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { PluginArea } from '@wordpress/plugins';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport {\n\tComplementaryArea,\n\tFullscreenMode,\n\tInterfaceSkeleton,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { useState, useEffect, useCallback } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport TextEditor from '../text-editor';\nimport VisualEditor from '../visual-editor';\nimport EditPostKeyboardShortcuts from '../keyboard-shortcuts';\nimport KeyboardShortcutHelpModal from '../keyboard-shortcut-help-modal';\nimport PreferencesModal from '../preferences-modal';\nimport BrowserURL from '../browser-url';\nimport Header from '../header';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport SettingsSidebar from '../sidebar/settings-sidebar';\nimport MetaBoxes from '../meta-boxes';\nimport WelcomeGuide from '../welcome-guide';\nimport ActionsPanel from './actions-panel';\nimport { store as editPostStore } from '../../store';\n\nconst interfaceLabels = {\n\tsecondarySidebar: __( 'Block library' ),\n\t/* translators: accessibility text for the editor top bar landmark region. */\n\theader: __( 'Editor top bar' ),\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nfunction Layout( { styles } ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isHugeViewport = useViewportMatch( 'huge', '>=' );\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\tsetIsInserterOpened,\n\t} = useDispatch( editPostStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tmode,\n\t\tisFullscreenActive,\n\t\tisRichEditingEnabled,\n\t\tsidebarIsOpened,\n\t\thasActiveMetaboxes,\n\t\thasFixedToolbar,\n\t\tpreviousShortcut,\n\t\tnextShortcut,\n\t\thasBlockSelected,\n\t\tisInserterOpened,\n\t\tisListViewOpened,\n\t\tshowIconLabels,\n\t\thasReducedUI,\n\t\tshowBlockBreadcrumbs,\n\t\tisTemplateMode,\n\t\tdocumentLabel,\n\t} = useSelect( ( select ) => {\n\t\tconst { getEditorSettings, getPostTypeLabel } = select( editorStore );\n\t\tconst editorSettings = getEditorSettings();\n\t\tconst postTypeLabel = getPostTypeLabel();\n\n\t\treturn {\n\t\t\tisTemplateMode: select( editPostStore ).isEditingTemplate(),\n\t\t\thasFixedToolbar: select( editPostStore ).isFeatureActive(\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\t\teditPostStore.name\n\t\t\t\t) || select( editPostStore ).isPublishSidebarOpened()\n\t\t\t),\n\t\t\tisFullscreenActive: select( editPostStore ).isFeatureActive(\n\t\t\t\t'fullscreenMode'\n\t\t\t),\n\t\t\tisInserterOpened: select( editPostStore ).isInserterOpened(),\n\t\t\tisListViewOpened: select( editPostStore ).isListViewOpened(),\n\t\t\tmode: select( editPostStore ).getEditorMode(),\n\t\t\tisRichEditingEnabled: editorSettings.richEditingEnabled,\n\t\t\thasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),\n\t\t\tpreviousShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),\n\t\t\tnextShortcut: select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),\n\t\t\tshowIconLabels: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\thasReducedUI: select( editPostStore ).isFeatureActive(\n\t\t\t\t'reducedUI'\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( editPostStore ).isFeatureActive(\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\t// translators: Default label for the Document in the Block Breadcrumb.\n\t\t\tdocumentLabel: postTypeLabel || _x( 'Document', 'noun' ),\n\t\t};\n\t}, [] );\n\tconst className = classnames( 'edit-post-layout', 'is-mode-' + mode, {\n\t\t'is-sidebar-opened': sidebarIsOpened,\n\t\t'has-fixed-toolbar': hasFixedToolbar,\n\t\t'has-metaboxes': hasActiveMetaboxes,\n\t\t'show-icon-labels': showIconLabels,\n\t} );\n\tconst openSidebarPanel = () =>\n\t\topenGeneralSidebar(\n\t\t\thasBlockSelected ? 'edit-post/block' : 'edit-post/document'\n\t\t);\n\n\t// Inserter and Sidebars are mutually exclusive\n\tuseEffect( () => {\n\t\tif ( sidebarIsOpened && ! isHugeViewport ) {\n\t\t\tsetIsInserterOpened( false );\n\t\t}\n\t}, [ sidebarIsOpened, isHugeViewport ] );\n\tuseEffect( () => {\n\t\tif ( isInserterOpened && ! isHugeViewport ) {\n\t\t\tcloseGeneralSidebar();\n\t\t}\n\t}, [ isInserterOpened, isHugeViewport ] );\n\n\t// Local state for save panel.\n\t// Note 'truthy' callback implies an open panel.\n\tconst [\n\t\tentitiesSavedStatesCallback,\n\t\tsetEntitiesSavedStatesCallback,\n\t] = useState( false );\n\tconst closeEntitiesSavedStates = useCallback(\n\t\t( arg ) => {\n\t\t\tif ( typeof entitiesSavedStatesCallback === 'function' ) {\n\t\t\t\tentitiesSavedStatesCallback( arg );\n\t\t\t}\n\t\t\tsetEntitiesSavedStatesCallback( false );\n\t\t},\n\t\t[ entitiesSavedStatesCallback ]\n\t);\n\n\tconst secondarySidebar = () => {\n\t\tif ( mode === 'visual' && isInserterOpened ) {\n\t\t\treturn <InserterSidebar />;\n\t\t}\n\t\tif ( mode === 'visual' && isListViewOpened ) {\n\t\t\treturn <ListViewSidebar />;\n\t\t}\n\t\treturn null;\n\t};\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<FullscreenMode isActive={ isFullscreenActive } />\n\t\t\t<BrowserURL />\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<AutosaveMonitor />\n\t\t\t<LocalAutosaveMonitor />\n\t\t\t<EditPostKeyboardShortcuts />\n\t\t\t<EditorKeyboardShortcutsRegister />\n\t\t\t<SettingsSidebar />\n\t\t\t<InterfaceSkeleton\n\t\t\t\tclassName={ className }\n\t\t\t\tlabels={ interfaceLabels }\n\t\t\t\theader={\n\t\t\t\t\t<Header\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tsecondarySidebar={ secondarySidebar() }\n\t\t\t\tsidebar={\n\t\t\t\t\t( ! isMobileViewport || sidebarIsOpened ) && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isMobileViewport && ! sidebarIsOpened && (\n\t\t\t\t\t\t\t\t<div className=\"edit-post-layout__toggle-sidebar-panel\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"edit-post-layout__toggle-sidebar-panel-button\"\n\t\t\t\t\t\t\t\t\t\tonClick={ openSidebarPanel }\n\t\t\t\t\t\t\t\t\t\taria-expanded={ false }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ hasBlockSelected\n\t\t\t\t\t\t\t\t\t\t\t? __( 'Open block settings' )\n\t\t\t\t\t\t\t\t\t\t\t: __( 'Open document settings' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-post\" />\n\t\t\t\t\t\t</>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\t\tcontent={\n\t\t\t\t\t<>\n\t\t\t\t\t\t<EditorNotices />\n\t\t\t\t\t\t{ ( mode === 'text' || ! isRichEditingEnabled ) && (\n\t\t\t\t\t\t\t<TextEditor />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isRichEditingEnabled && mode === 'visual' && (\n\t\t\t\t\t\t\t<VisualEditor styles={ styles } />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! isTemplateMode && (\n\t\t\t\t\t\t\t<div className=\"edit-post-layout__metaboxes\">\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"normal\" />\n\t\t\t\t\t\t\t\t<MetaBoxes location=\"advanced\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ isMobileViewport && sidebarIsOpened && (\n\t\t\t\t\t\t\t<ScrollLock />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<BlockStyles.Slot scope=\"core/block-inspector\" />\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tfooter={\n\t\t\t\t\t! hasReducedUI &&\n\t\t\t\t\tshowBlockBreadcrumbs &&\n\t\t\t\t\t! isMobileViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual' && (\n\t\t\t\t\t\t<div className=\"edit-post-layout__footer\">\n\t\t\t\t\t\t\t<BlockBreadcrumb rootLabelText={ documentLabel } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<ActionsPanel\n\t\t\t\t\t\tcloseEntitiesSavedStates={ closeEntitiesSavedStates }\n\t\t\t\t\t\tisEntitiesSavedStatesOpen={\n\t\t\t\t\t\t\tentitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tshortcuts={ {\n\t\t\t\t\tprevious: previousShortcut,\n\t\t\t\t\tnext: nextShortcut,\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<PreferencesModal />\n\t\t\t<KeyboardShortcutHelpModal />\n\t\t\t<WelcomeGuide />\n\t\t\t<Popover.Slot />\n\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t</>\n\t);\n}\n\nexport default Layout;\n"]}
|
|
@@ -58,11 +58,19 @@ function NavigationButton(_ref) {
|
|
|
58
58
|
...props
|
|
59
59
|
} = _ref;
|
|
60
60
|
const {
|
|
61
|
-
|
|
61
|
+
goTo
|
|
62
62
|
} = (0, _components.__experimentalUseNavigator)();
|
|
63
|
+
const dataAttrName = 'data-navigator-focusable-id';
|
|
64
|
+
const dataAttrValue = path;
|
|
65
|
+
const dataAttrCssSelector = `[${dataAttrName}="${dataAttrValue}"]`;
|
|
66
|
+
const tagProps = { ...props,
|
|
67
|
+
[dataAttrName]: dataAttrValue
|
|
68
|
+
};
|
|
63
69
|
return (0, _element.createElement)(Tag, (0, _extends2.default)({
|
|
64
|
-
onClick: () =>
|
|
65
|
-
|
|
70
|
+
onClick: () => goTo(path, {
|
|
71
|
+
focusTargetSelector: dataAttrCssSelector
|
|
72
|
+
})
|
|
73
|
+
}, tagProps));
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
function NavigationBackButton(_ref2) {
|
|
@@ -71,10 +79,10 @@ function NavigationBackButton(_ref2) {
|
|
|
71
79
|
...props
|
|
72
80
|
} = _ref2;
|
|
73
81
|
const {
|
|
74
|
-
|
|
82
|
+
goBack
|
|
75
83
|
} = (0, _components.__experimentalUseNavigator)();
|
|
76
84
|
return (0, _element.createElement)(Tag, (0, _extends2.default)({
|
|
77
|
-
onClick:
|
|
85
|
+
onClick: goBack
|
|
78
86
|
}, props));
|
|
79
87
|
}
|
|
80
88
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/preferences-modal/index.js"],"names":["MODAL_NAME","PREFERENCES_MENU","NavigationButton","as","Tag","Button","path","props","push","NavigationBackButton","pop","PreferencesModal","isLargeViewport","closeModal","editPostStore","isModalActive","isViewable","select","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","showBlockBreadcrumbsOption","getEditorSettings","getEditorMode","isFeatureActive","mode","isRichEditingEnabled","richEditingEnabled","hasReducedUI","sections","name","tabLabel","content","taxonomy","slug","activeMenu","setActiveMenu","tabs","sectionsContentMap","reduce","accumulator","title","getCurrentTab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AY,MAAlB;AAAmB,QAAA,IAAI,EAAC;AAAxB,SACC,4BAAC,sBAAD;AACC,QAAA,YAAY,EAAG,KADhB;AAEC,QAAA,OAAO,EAAC,MAFT;AAGC,QAAA,IAAI,EAAC,OAHN;AAIC,QAAA,GAAG,EAAC;AAJL,SAMC,4BAAC,oBAAD;AACC,QAAA,IAAI,EACH,qBAAUmB,mBAAV,GAAyBD,kBAF3B;AAIC,sBAAa,cACZ,+BADY;AAJd,QAND,EAcC,4BAAC,8BAAD;AAAM,QAAA,IAAI,EAAC;AAAX,SAAkBE,OAAO,CAACnB,QAA1B,CAdD,CADD,EAiBC,4BAAC,oBAAD,QAAYmB,OAAO,CAAClB,OAApB,CAjBD,CAJD,CADD;AA0BA,KA3BC,CApCH,CADD;AAmEA;;AACD,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,KAAK,EAAG,cAAI,aAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,cAAI,OAAJ,CAHd;AAIC,IAAA,cAAc,EAAGrB;AAJlB,KAMGiC,YANH,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\tFlexItem,\n\tModal,\n\tTabPanel,\n\tButton,\n\tCard,\n\tCardHeader,\n\tCardBody,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport {\n\tPostTaxonomies,\n\tPostExcerptCheck,\n\tPageAttributesCheck,\n\tPostFeaturedImageCheck,\n\tPostTypeSupportCheck,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Section from './section';\nimport {\n\tEnablePluginDocumentSettingPanelOption,\n\tEnablePublishSidebarOption,\n\tEnablePanelOption,\n\tEnableFeature,\n} from './options';\nimport MetaBoxesSection from './meta-boxes-section';\nimport { store as editPostStore } from '../../store';\nimport BlockManager from '../block-manager';\n\nconst MODAL_NAME = 'edit-post/preferences';\nconst PREFERENCES_MENU = 'preferences-menu';\n\nfunction NavigationButton( { as: Tag = Button, path, ...props } ) {\n\tconst { push } = useNavigator();\n\treturn <Tag onClick={ () => push( path ) } { ...props } />;\n}\n\nfunction NavigationBackButton( { as: Tag = Button, ...props } ) {\n\tconst { pop } = useNavigator();\n\treturn <Tag onClick={ pop } { ...props } />;\n}\n\nexport default function PreferencesModal() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { closeModal } = useDispatch( editPostStore );\n\tconst { isModalActive, isViewable } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tisModalActive: select( editPostStore ).isModalActive( MODAL_NAME ),\n\t\t\tisViewable: get( postType, [ 'viewable' ], false ),\n\t\t};\n\t}, [] );\n\tconst showBlockBreadcrumbsOption = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getEditorMode, isFeatureActive } = select( editPostStore );\n\t\t\tconst mode = getEditorMode();\n\t\t\tconst isRichEditingEnabled = getEditorSettings().richEditingEnabled;\n\t\t\tconst hasReducedUI = isFeatureActive( 'reducedUI' );\n\t\t\treturn (\n\t\t\t\t! hasReducedUI &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\tisRichEditingEnabled &&\n\t\t\t\tmode === 'visual'\n\t\t\t);\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\tconst sections = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'general',\n\t\t\t\ttabLabel: __( 'General' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\t\ttitle={ __( 'Publishing' ) }\n\t\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\t'Change options related to publishing.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePublishSidebarOption\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Review settings, such as visibility and tags.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t'Include pre-publish checklist'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Section>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Customize options related to the block editor interface and editing flow.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"reducedUI\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Compacts options and outlines in the toolbar.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Reduce the interface' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\t\t\thelp={ __( 'Shows text instead of icons.' ) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Display button labels' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ showBlockBreadcrumbsOption && (\n\t\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\t\tfeatureName=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Section>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'blocks',\n\t\t\t\ttabLabel: __( 'Blocks' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\ttitle={ __( 'Block interactions' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Customize how you interact with blocks in the block library and editing canvas.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"mostUsedBlocks\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Places the most frequent blocks in the block library.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Show most used blocks' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Section>\n\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\ttitle={ __( 'Visible blocks' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.\"\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockManager />\n\t\t\t\t\t\t</Section>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'panels',\n\t\t\t\ttabLabel: __( 'Panels' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\ttitle={ __( 'Document settings' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Choose what displays in the panel.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnablePluginDocumentSettingPanelOption.Slot />\n\t\t\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Permalink' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"post-link\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"template\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<PostTaxonomies\n\t\t\t\t\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => (\n\t\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\t\tlabel={ get( taxonomy, [\n\t\t\t\t\t\t\t\t\t\t\t'labels',\n\t\t\t\t\t\t\t\t\t\t\t'menu_name',\n\t\t\t\t\t\t\t\t\t\t] ) }\n\t\t\t\t\t\t\t\t\t\tpanelName={ `taxonomy-panel-${ taxonomy.slug }` }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFeaturedImageCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Featured image' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"featured-image\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostFeaturedImageCheck>\n\t\t\t\t\t\t\t<PostExcerptCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Excerpt' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"post-excerpt\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostExcerptCheck>\n\t\t\t\t\t\t\t<PostTypeSupportCheck\n\t\t\t\t\t\t\t\tsupportKeys={ [ 'comments', 'trackbacks' ] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Discussion' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"discussion-panel\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t\t\t\t<PageAttributesCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Page attributes' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"page-attributes\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PageAttributesCheck>\n\t\t\t\t\t\t</Section>\n\t\t\t\t\t\t<MetaBoxesSection\n\t\t\t\t\t\t\ttitle={ __( 'Additional' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Add extra areas to the editor.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t],\n\t\t[ isViewable, isLargeViewport, showBlockBreadcrumbsOption ]\n\t);\n\n\t// This is also used to sync the two different rendered components\n\t// between small and large viewports.\n\tconst [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );\n\t/**\n\t * Create helper objects from `sections` for easier data handling.\n\t * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`\n\t * is used for easier access to active tab's content.\n\t */\n\tconst { tabs, sectionsContentMap } = useMemo(\n\t\t() =>\n\t\t\tsections.reduce(\n\t\t\t\t( accumulator, { name, tabLabel: title, content } ) => {\n\t\t\t\t\taccumulator.tabs.push( { name, title } );\n\t\t\t\t\taccumulator.sectionsContentMap[ name ] = content;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ tabs: [], sectionsContentMap: {} }\n\t\t\t),\n\t\t[ sections ]\n\t);\n\tconst getCurrentTab = useCallback(\n\t\t( tab ) => sectionsContentMap[ tab.name ] || null,\n\t\t[ sectionsContentMap ]\n\t);\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\tlet modalContent;\n\t// We render different components based on the viewport size.\n\tif ( isLargeViewport ) {\n\t\tmodalContent = (\n\t\t\t<TabPanel\n\t\t\t\tclassName=\"edit-post-preferences__tabs\"\n\t\t\t\ttabs={ tabs }\n\t\t\t\tinitialTabName={\n\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t}\n\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\torientation=\"vertical\"\n\t\t\t>\n\t\t\t\t{ getCurrentTab }\n\t\t\t</TabPanel>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<NavigatorProvider initialPath=\"/\">\n\t\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t\t<Card isBorderless size=\"small\">\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<NavigationButton\n\t\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tpath={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tas={ Item }\n\t\t\t\t\t\t\t\t\t\t\tisAction\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t</NavigationButton>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t</Card>\n\t\t\t\t</NavigatorScreen>\n\t\t\t\t{ sections.map( ( section ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<NavigatorScreen\n\t\t\t\t\t\t\tkey={ `${ section.name }-menu` }\n\t\t\t\t\t\t\tpath={ section.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Card isBorderless size=\"large\">\n\t\t\t\t\t\t\t\t<CardHeader\n\t\t\t\t\t\t\t\t\tisBorderless={ false }\n\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tgap=\"6\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<NavigationBackButton\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronRight : chevronLeft\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Navigate to the previous view'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Text size=\"16\">{ section.tabLabel }</Text>\n\t\t\t\t\t\t\t\t</CardHeader>\n\t\t\t\t\t\t\t\t<CardBody>{ section.content }</CardBody>\n\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t</NavigatorScreen>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</NavigatorProvider>\n\t\t);\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-post-preferences-modal\"\n\t\t\ttitle={ __( 'Preferences' ) }\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t>\n\t\t\t{ modalContent }\n\t\t</Modal>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/preferences-modal/index.js"],"names":["MODAL_NAME","PREFERENCES_MENU","NavigationButton","as","Tag","Button","path","props","goTo","dataAttrName","dataAttrValue","dataAttrCssSelector","tagProps","focusTargetSelector","NavigationBackButton","goBack","PreferencesModal","isLargeViewport","closeModal","editPostStore","isModalActive","isViewable","select","getEditedPostAttribute","editorStore","getPostType","coreStore","postType","showBlockBreadcrumbsOption","getEditorSettings","getEditorMode","isFeatureActive","mode","isRichEditingEnabled","richEditingEnabled","hasReducedUI","sections","name","tabLabel","content","taxonomy","slug","activeMenu","setActiveMenu","tabs","sectionsContentMap","reduce","accumulator","title","push","getCurrentTab","tab","modalContent","undefined","map","Item","chevronLeft","chevronRight","section"],"mappings":";;;;;;;;;AA4BA;;;;AAzBA;;AAKA;;AAiBA;;AACA;;AACA;;AAEA;;AAQA;;AACA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AApDA;AACA;AACA;;AAGA;AACA;AACA;;AAiCA;AACA;AACA;AAYA,MAAMA,UAAU,GAAG,uBAAnB;AACA,MAAMC,gBAAgB,GAAG,kBAAzB;;AAEA,SAASC,gBAAT,OAAkE;AAAA,MAAvC;AAAEC,IAAAA,EAAE,EAAEC,GAAG,GAAGC,kBAAZ;AAAoBC,IAAAA,IAApB;AAA0B,OAAGC;AAA7B,GAAuC;AACjE,QAAM;AAAEC,IAAAA;AAAF,MAAW,6CAAjB;AAEA,QAAMC,YAAY,GAAG,6BAArB;AACA,QAAMC,aAAa,GAAGJ,IAAtB;AA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Z,+BADY;AAJd,QAND,EAcC,4BAAC,8BAAD;AAAM,QAAA,IAAI,EAAC;AAAX,SAAkBE,OAAO,CAACpB,QAA1B,CAdD,CADD,EAiBC,4BAAC,oBAAD,QAAYoB,OAAO,CAACnB,OAApB,CAjBD,CAJD,CADD;AA0BA,KA3BC,CApCH,CADD;AAmEA;;AACD,SACC,4BAAC,iBAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,KAAK,EAAG,cAAI,aAAJ,CAFT;AAGC,IAAA,UAAU,EAAG,cAAI,OAAJ,CAHd;AAIC,IAAA,cAAc,EAAGrB;AAJlB,KAMGkC,YANH,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalNavigatorProvider as NavigatorProvider,\n\t__experimentalNavigatorScreen as NavigatorScreen,\n\t__experimentalUseNavigator as useNavigator,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n\t__experimentalTruncate as Truncate,\n\tFlexItem,\n\tModal,\n\tTabPanel,\n\tButton,\n\tCard,\n\tCardHeader,\n\tCardBody,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo, useCallback, useState } from '@wordpress/element';\nimport {\n\tPostTaxonomies,\n\tPostExcerptCheck,\n\tPageAttributesCheck,\n\tPostFeaturedImageCheck,\n\tPostTypeSupportCheck,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { chevronLeft, chevronRight, Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Section from './section';\nimport {\n\tEnablePluginDocumentSettingPanelOption,\n\tEnablePublishSidebarOption,\n\tEnablePanelOption,\n\tEnableFeature,\n} from './options';\nimport MetaBoxesSection from './meta-boxes-section';\nimport { store as editPostStore } from '../../store';\nimport BlockManager from '../block-manager';\n\nconst MODAL_NAME = 'edit-post/preferences';\nconst PREFERENCES_MENU = 'preferences-menu';\n\nfunction NavigationButton( { as: Tag = Button, path, ...props } ) {\n\tconst { goTo } = useNavigator();\n\n\tconst dataAttrName = 'data-navigator-focusable-id';\n\tconst dataAttrValue = path;\n\n\tconst dataAttrCssSelector = `[${ dataAttrName }=\"${ dataAttrValue }\"]`;\n\n\tconst tagProps = {\n\t\t...props,\n\t\t[ dataAttrName ]: dataAttrValue,\n\t};\n\n\treturn (\n\t\t<Tag\n\t\t\tonClick={ () =>\n\t\t\t\tgoTo( path, { focusTargetSelector: dataAttrCssSelector } )\n\t\t\t}\n\t\t\t{ ...tagProps }\n\t\t/>\n\t);\n}\n\nfunction NavigationBackButton( { as: Tag = Button, ...props } ) {\n\tconst { goBack } = useNavigator();\n\treturn <Tag onClick={ goBack } { ...props } />;\n}\n\nexport default function PreferencesModal() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { closeModal } = useDispatch( editPostStore );\n\tconst { isModalActive, isViewable } = useSelect( ( select ) => {\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\tconst { getPostType } = select( coreStore );\n\t\tconst postType = getPostType( getEditedPostAttribute( 'type' ) );\n\t\treturn {\n\t\t\tisModalActive: select( editPostStore ).isModalActive( MODAL_NAME ),\n\t\t\tisViewable: get( postType, [ 'viewable' ], false ),\n\t\t};\n\t}, [] );\n\tconst showBlockBreadcrumbsOption = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getEditorMode, isFeatureActive } = select( editPostStore );\n\t\t\tconst mode = getEditorMode();\n\t\t\tconst isRichEditingEnabled = getEditorSettings().richEditingEnabled;\n\t\t\tconst hasReducedUI = isFeatureActive( 'reducedUI' );\n\t\t\treturn (\n\t\t\t\t! hasReducedUI &&\n\t\t\t\tisLargeViewport &&\n\t\t\t\tisRichEditingEnabled &&\n\t\t\t\tmode === 'visual'\n\t\t\t);\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\tconst sections = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'general',\n\t\t\t\ttabLabel: __( 'General' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\t\ttitle={ __( 'Publishing' ) }\n\t\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\t'Change options related to publishing.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePublishSidebarOption\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Review settings, such as visibility and tags.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t'Include pre-publish checklist'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Section>\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Customize options related to the block editor interface and editing flow.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"reducedUI\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Compacts options and outlines in the toolbar.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Reduce the interface' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\t\t\thelp={ __( 'Shows text instead of icons.' ) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Display button labels' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ showBlockBreadcrumbsOption && (\n\t\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\t\tfeatureName=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Shows block breadcrumbs at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Display block breadcrumbs' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Section>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'blocks',\n\t\t\t\ttabLabel: __( 'Blocks' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\ttitle={ __( 'Block interactions' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Customize how you interact with blocks in the block library and editing canvas.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"mostUsedBlocks\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Places the most frequent blocks in the block library.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Show most used blocks' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Section>\n\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\ttitle={ __( 'Visible blocks' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.\"\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockManager />\n\t\t\t\t\t\t</Section>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'panels',\n\t\t\t\ttabLabel: __( 'Panels' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Section\n\t\t\t\t\t\t\ttitle={ __( 'Document settings' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Choose what displays in the panel.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnablePluginDocumentSettingPanelOption.Slot />\n\t\t\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Permalink' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"post-link\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ isViewable && (\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Template' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"template\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<PostTaxonomies\n\t\t\t\t\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => (\n\t\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\t\tlabel={ get( taxonomy, [\n\t\t\t\t\t\t\t\t\t\t\t'labels',\n\t\t\t\t\t\t\t\t\t\t\t'menu_name',\n\t\t\t\t\t\t\t\t\t\t] ) }\n\t\t\t\t\t\t\t\t\t\tpanelName={ `taxonomy-panel-${ taxonomy.slug }` }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFeaturedImageCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Featured image' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"featured-image\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostFeaturedImageCheck>\n\t\t\t\t\t\t\t<PostExcerptCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Excerpt' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"post-excerpt\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostExcerptCheck>\n\t\t\t\t\t\t\t<PostTypeSupportCheck\n\t\t\t\t\t\t\t\tsupportKeys={ [ 'comments', 'trackbacks' ] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Discussion' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"discussion-panel\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t\t\t\t<PageAttributesCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Page attributes' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"page-attributes\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PageAttributesCheck>\n\t\t\t\t\t\t</Section>\n\t\t\t\t\t\t<MetaBoxesSection\n\t\t\t\t\t\t\ttitle={ __( 'Additional' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Add extra areas to the editor.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t],\n\t\t[ isViewable, isLargeViewport, showBlockBreadcrumbsOption ]\n\t);\n\n\t// This is also used to sync the two different rendered components\n\t// between small and large viewports.\n\tconst [ activeMenu, setActiveMenu ] = useState( PREFERENCES_MENU );\n\t/**\n\t * Create helper objects from `sections` for easier data handling.\n\t * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`\n\t * is used for easier access to active tab's content.\n\t */\n\tconst { tabs, sectionsContentMap } = useMemo(\n\t\t() =>\n\t\t\tsections.reduce(\n\t\t\t\t( accumulator, { name, tabLabel: title, content } ) => {\n\t\t\t\t\taccumulator.tabs.push( { name, title } );\n\t\t\t\t\taccumulator.sectionsContentMap[ name ] = content;\n\t\t\t\t\treturn accumulator;\n\t\t\t\t},\n\t\t\t\t{ tabs: [], sectionsContentMap: {} }\n\t\t\t),\n\t\t[ sections ]\n\t);\n\tconst getCurrentTab = useCallback(\n\t\t( tab ) => sectionsContentMap[ tab.name ] || null,\n\t\t[ sectionsContentMap ]\n\t);\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\tlet modalContent;\n\t// We render different components based on the viewport size.\n\tif ( isLargeViewport ) {\n\t\tmodalContent = (\n\t\t\t<TabPanel\n\t\t\t\tclassName=\"edit-post-preferences__tabs\"\n\t\t\t\ttabs={ tabs }\n\t\t\t\tinitialTabName={\n\t\t\t\t\tactiveMenu !== PREFERENCES_MENU ? activeMenu : undefined\n\t\t\t\t}\n\t\t\t\tonSelect={ setActiveMenu }\n\t\t\t\torientation=\"vertical\"\n\t\t\t>\n\t\t\t\t{ getCurrentTab }\n\t\t\t</TabPanel>\n\t\t);\n\t} else {\n\t\tmodalContent = (\n\t\t\t<NavigatorProvider initialPath=\"/\">\n\t\t\t\t<NavigatorScreen path=\"/\">\n\t\t\t\t\t<Card isBorderless size=\"small\">\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t{ tabs.map( ( tab ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<NavigationButton\n\t\t\t\t\t\t\t\t\t\t\tkey={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tpath={ tab.name }\n\t\t\t\t\t\t\t\t\t\t\tas={ Item }\n\t\t\t\t\t\t\t\t\t\t\tisAction\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t\t\t</NavigationButton>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t</Card>\n\t\t\t\t</NavigatorScreen>\n\t\t\t\t{ sections.map( ( section ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<NavigatorScreen\n\t\t\t\t\t\t\tkey={ `${ section.name }-menu` }\n\t\t\t\t\t\t\tpath={ section.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Card isBorderless size=\"large\">\n\t\t\t\t\t\t\t\t<CardHeader\n\t\t\t\t\t\t\t\t\tisBorderless={ false }\n\t\t\t\t\t\t\t\t\tjustify=\"left\"\n\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\tgap=\"6\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<NavigationBackButton\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? chevronRight : chevronLeft\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Navigate to the previous view'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<Text size=\"16\">{ section.tabLabel }</Text>\n\t\t\t\t\t\t\t\t</CardHeader>\n\t\t\t\t\t\t\t\t<CardBody>{ section.content }</CardBody>\n\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t</NavigatorScreen>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</NavigatorProvider>\n\t\t);\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-post-preferences-modal\"\n\t\t\ttitle={ __( 'Preferences' ) }\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ closeModal }\n\t\t>\n\t\t\t{ modalContent }\n\t\t</Modal>\n\t);\n}\n"]}
|
|
@@ -34,7 +34,10 @@ var _blocks = require("@wordpress/blocks");
|
|
|
34
34
|
/**
|
|
35
35
|
* Internal dependencies
|
|
36
36
|
*/
|
|
37
|
-
function PostTemplateActions() {
|
|
37
|
+
function PostTemplateActions(_ref) {
|
|
38
|
+
let {
|
|
39
|
+
isPostsPage
|
|
40
|
+
} = _ref;
|
|
38
41
|
const [isModalOpen, setIsModalOpen] = (0, _element.useState)(false);
|
|
39
42
|
const [isBusy, setIsBusy] = (0, _element.useState)(false);
|
|
40
43
|
const [title, setTitle] = (0, _element.useState)('');
|
|
@@ -116,7 +119,7 @@ function PostTemplateActions() {
|
|
|
116
119
|
}, !!template && (0, _element.createElement)(_components.Button, {
|
|
117
120
|
variant: "link",
|
|
118
121
|
onClick: () => __unstableSwitchToTemplateMode()
|
|
119
|
-
}, (0, _i18n.__)('Edit')), (0, _element.createElement)(_components.Button, {
|
|
122
|
+
}, (0, _i18n.__)('Edit')), !isPostsPage && (0, _element.createElement)(_components.Button, {
|
|
120
123
|
variant: "link",
|
|
121
124
|
onClick: () => setIsModalOpen(true)
|
|
122
125
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/template/actions.js"],"names":["PostTemplateActions","isModalOpen","setIsModalOpen","isBusy","setIsBusy","title","setTitle","template","supportsTemplateMode","defaultTemplate","select","getCurrentPostType","getEditorSettings","editorStore","getPostType","coreStore","getEditedPostTemplate","editPostStore","isViewable","viewable","_supportsTemplateMode","defaultBlockTemplate","__unstableCreateTemplate","__unstableSwitchToTemplateMode","defaultTitle","onCreateTemplate","event","preventDefault","newTemplateContent","tagName","layout","inherit","slug","content"],"mappings":";;;;;;;AAiBA;;AAdA;;AAKA;;AACA;;AAOA;;AAEA;;AACA;;AAKA;;AACA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAIA,SAASA,mBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-post/src/components/sidebar/template/actions.js"],"names":["PostTemplateActions","isPostsPage","isModalOpen","setIsModalOpen","isBusy","setIsBusy","title","setTitle","template","supportsTemplateMode","defaultTemplate","select","getCurrentPostType","getEditorSettings","editorStore","getPostType","coreStore","getEditedPostTemplate","editPostStore","isViewable","viewable","_supportsTemplateMode","defaultBlockTemplate","__unstableCreateTemplate","__unstableSwitchToTemplateMode","defaultTitle","onCreateTemplate","event","preventDefault","newTemplateContent","tagName","layout","inherit","slug","content"],"mappings":";;;;;;;AAiBA;;AAdA;;AAKA;;AACA;;AAOA;;AAEA;;AACA;;AAKA;;AACA;;AAzBA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAIA,SAASA,mBAAT,OAAgD;AAAA,MAAlB;AAAEC,IAAAA;AAAF,GAAkB;AAC/C,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,KAAV,CAAxC;AACA,QAAM,CAAEC,MAAF,EAAUC,SAAV,IAAwB,uBAAU,KAAV,CAA9B;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAAU,EAAV,CAA5B;AACA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,oBAAZ;AAAkCC,IAAAA;AAAlC,MAAsD,qBACzDC,MAAF,IAAc;AAAA;;AACb,UAAM;AAAEC,MAAAA,kBAAF;AAAsBC,MAAAA;AAAtB,QAA4CF,MAAM,CACvDG,aADuD,CAAxD;AAGA,UAAM;AAAEC,MAAAA;AAAF,QAAkBJ,MAAM,CAAEK,eAAF,CAA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AAA,GAAG,EAAG;AAA/B,KACC,4BAAC,oBAAD,QACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,MAAJ,CADT;AAEC,IAAA,KAAK,EAAGpB,KAFT;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,WAAW,EAAGkB,YAJf;AAKC,IAAA,QAAQ,EAAGrB,MALZ;AAMC,IAAA,IAAI,EAAG,cACN,+GADM;AANR,IADD,CADD,CADD,EAgBC,4BAAC,gBAAD;AACC,IAAA,SAAS,EAAC,mCADX;AAEC,IAAA,OAAO,EAAC,UAFT;AAGC,IAAA,QAAQ,EAAG;AAHZ,KAKC,4BAAC,oBAAD,QACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfD,MAAAA,cAAc,CAAE,KAAF,CAAd;AACAI,MAAAA,QAAQ,CAAE,EAAF,CAAR;AACA;AALF,KAOG,cAAI,QAAJ,CAPH,CADD,CALD,EAgBC,4BAAC,oBAAD,QACC,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,MAAM,EAAGH,MAHV;AAIC,qBAAgBA;AAJjB,KAMG,cAAI,QAAJ,CANH,CADD,CAhBD,CAhBD,CATD,CAvBF,CADD;AAiFA;;eAEcJ,mB","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tModal,\n\tTextControl,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { createBlock, serialize } from '@wordpress/blocks';\n\nfunction PostTemplateActions( { isPostsPage } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst { template, supportsTemplateMode, defaultTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getEditorSettings } = select(\n\t\t\t\teditorStore\n\t\t\t);\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( getCurrentPostType() )?.viewable ?? false;\n\t\t\tconst _supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode && isViewable;\n\n\t\t\treturn {\n\t\t\t\ttemplate: _supportsTemplateMode && getEditedPostTemplate(),\n\t\t\t\tsupportsTemplateMode: _supportsTemplateMode,\n\t\t\t\tdefaultTemplate: getEditorSettings().defaultBlockTemplate,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst {\n\t\t__unstableCreateTemplate,\n\t\t__unstableSwitchToTemplateMode,\n\t} = useDispatch( editPostStore );\n\n\tif ( ! supportsTemplateMode ) {\n\t\treturn null;\n\t}\n\n\tconst defaultTitle = __( 'Custom Template' );\n\n\tasync function onCreateTemplate( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst newTemplateContent =\n\t\t\tdefaultTemplate ??\n\t\t\tserialize( [\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'header',\n\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock( 'core/site-title' ),\n\t\t\t\t\t\tcreateBlock( 'core/site-tagline' ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t\tcreateBlock( 'core/separator' ),\n\t\t\t\tcreateBlock(\n\t\t\t\t\t'core/group',\n\t\t\t\t\t{\n\t\t\t\t\t\ttagName: 'main',\n\t\t\t\t\t},\n\t\t\t\t\t[\n\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t'core/group',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t[ createBlock( 'core/post-title' ) ]\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcreateBlock( 'core/post-content', {\n\t\t\t\t\t\t\tlayout: { inherit: true },\n\t\t\t\t\t\t} ),\n\t\t\t\t\t]\n\t\t\t\t),\n\t\t\t] );\n\n\t\tawait __unstableCreateTemplate( {\n\t\t\tslug: 'wp-custom-template-' + kebabCase( title || defaultTitle ),\n\t\t\tcontent: newTemplateContent,\n\t\t\ttitle: title || defaultTitle,\n\t\t} );\n\n\t\tsetIsBusy( false );\n\t\tsetIsModalOpen( false );\n\n\t\t__unstableSwitchToTemplateMode( true );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-post-template__actions\">\n\t\t\t\t{ !! template && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => __unstableSwitchToTemplateMode() }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\t{ ! isPostsPage && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\tonClick={ () => setIsModalOpen( true ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/* translators: button to create a new template */\n\t\t\t\t\t\t\t_x( 'New', 'action' )\n\t\t\t\t\t\t}\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Create custom template' ) }\n\t\t\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"edit-post-template__modal\"\n\t\t\t\t>\n\t\t\t\t\t<form onSubmit={ onCreateTemplate }>\n\t\t\t\t\t\t<Flex align=\"flex-start\" gap={ 8 }>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\t\tplaceholder={ defaultTitle }\n\t\t\t\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the template, e.g. \"Full Width\". Custom templates can be applied to any post or page.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tclassName=\"edit-post-template__modal-actions\"\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\t\t\t\taria-disabled={ isBusy }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PostTemplateActions;\n"]}
|
|
@@ -47,6 +47,7 @@ function TemplatePanel() {
|
|
|
47
47
|
const {
|
|
48
48
|
isEnabled,
|
|
49
49
|
isOpened,
|
|
50
|
+
isPostsPage,
|
|
50
51
|
selectedTemplate,
|
|
51
52
|
availableTemplates,
|
|
52
53
|
fetchedTemplates,
|
|
@@ -65,36 +66,34 @@ function TemplatePanel() {
|
|
|
65
66
|
const {
|
|
66
67
|
getEditedPostAttribute,
|
|
67
68
|
getEditorSettings,
|
|
69
|
+
getCurrentPostId,
|
|
68
70
|
getCurrentPostType
|
|
69
71
|
} = select(_editor.store);
|
|
70
72
|
const {
|
|
71
73
|
getPostType,
|
|
74
|
+
getEntityRecord,
|
|
72
75
|
getEntityRecords,
|
|
73
76
|
canUser
|
|
74
77
|
} = select(_coreData.store);
|
|
78
|
+
const currentPostId = getCurrentPostId();
|
|
75
79
|
const currentPostType = getCurrentPostType();
|
|
80
|
+
const settings = getEntityRecord('root', 'site');
|
|
76
81
|
|
|
77
82
|
const _isViewable = (_getPostType$viewable = (_getPostType = getPostType(currentPostType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
|
|
78
83
|
|
|
79
84
|
const _supportsTemplateMode = select(_editor.store).getEditorSettings().supportsTemplateMode && _isViewable;
|
|
80
85
|
|
|
81
|
-
const
|
|
86
|
+
const templateRecords = getEntityRecords('postType', 'wp_template', {
|
|
82
87
|
post_type: currentPostType,
|
|
83
88
|
per_page: -1
|
|
84
89
|
});
|
|
85
|
-
const newAvailableTemplates = (0, _lodash.fromPairs)((wpTemplates || []).map(_ref => {
|
|
86
|
-
let {
|
|
87
|
-
slug,
|
|
88
|
-
title
|
|
89
|
-
} = _ref;
|
|
90
|
-
return [slug, title.rendered];
|
|
91
|
-
}));
|
|
92
90
|
return {
|
|
93
91
|
isEnabled: isEditorPanelEnabled(PANEL_NAME),
|
|
94
92
|
isOpened: isEditorPanelOpened(PANEL_NAME),
|
|
93
|
+
isPostsPage: currentPostId === (settings === null || settings === void 0 ? void 0 : settings.page_for_posts),
|
|
95
94
|
selectedTemplate: getEditedPostAttribute('template'),
|
|
96
95
|
availableTemplates: getEditorSettings().availableTemplates,
|
|
97
|
-
fetchedTemplates:
|
|
96
|
+
fetchedTemplates: templateRecords,
|
|
98
97
|
template: _supportsTemplateMode && getEditedPostTemplate(),
|
|
99
98
|
isViewable: _isViewable,
|
|
100
99
|
supportsTemplateMode: _supportsTemplateMode,
|
|
@@ -103,7 +102,13 @@ function TemplatePanel() {
|
|
|
103
102
|
}, []);
|
|
104
103
|
const templates = (0, _element.useMemo)(() => {
|
|
105
104
|
return { ...availableTemplates,
|
|
106
|
-
...fetchedTemplates
|
|
105
|
+
...(0, _lodash.fromPairs)((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(_ref => {
|
|
106
|
+
let {
|
|
107
|
+
slug,
|
|
108
|
+
title
|
|
109
|
+
} = _ref;
|
|
110
|
+
return [slug, title.rendered];
|
|
111
|
+
}))
|
|
107
112
|
};
|
|
108
113
|
}, [availableTemplates, fetchedTemplates]);
|
|
109
114
|
const {
|
|
@@ -132,7 +137,11 @@ function TemplatePanel() {
|
|
|
132
137
|
title: panelTitle,
|
|
133
138
|
opened: isOpened,
|
|
134
139
|
onToggle: onTogglePanel
|
|
135
|
-
}, (0, _element.createElement)(_components.
|
|
140
|
+
}, isPostsPage ? (0, _element.createElement)(_components.Notice, {
|
|
141
|
+
className: "edit-post-template__notice",
|
|
142
|
+
status: "warning",
|
|
143
|
+
isDismissible: false
|
|
144
|
+
}, (0, _i18n.__)('The posts page template cannot be changed.')) : (0, _element.createElement)(_components.SelectControl, {
|
|
136
145
|
hideLabelFromVision: true,
|
|
137
146
|
label: (0, _i18n.__)('Template:'),
|
|
138
147
|
value: Object.keys(templates).includes(selectedTemplate) ? selectedTemplate : '',
|
|
@@ -145,7 +154,9 @@ function TemplatePanel() {
|
|
|
145
154
|
value: templateSlug,
|
|
146
155
|
label: templateName
|
|
147
156
|
}))
|
|
148
|
-
}), canUserCreate && (0, _element.createElement)(_actions.default,
|
|
157
|
+
}), canUserCreate && (0, _element.createElement)(_actions.default, {
|
|
158
|
+
isPostsPage: isPostsPage
|
|
159
|
+
}));
|
|
149
160
|
}
|
|
150
161
|
|
|
151
162
|
var _default = TemplatePanel;
|