@wordpress/edit-site 4.1.0-next.e230fbab09.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-template/new-template-part.js +2 -9
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +28 -12
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/editor/index.js +9 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +25 -24
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +1 -28
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/header/document-actions/index.js +13 -11
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/index.js +5 -3
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +9 -1
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/more-menu/site-export.js +5 -2
- package/build/components/header/more-menu/site-export.js.map +1 -1
- package/build/components/header/plugin-more-menu-item/index.js +5 -0
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +3 -10
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/preferences-modal/enable-feature.js +40 -0
- package/build/components/preferences-modal/enable-feature.js.map +1 -0
- package/build/components/preferences-modal/index.js +68 -0
- package/build/components/preferences-modal/index.js.map +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +3 -3
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +3 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +3 -10
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +27 -12
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/editor/index.js +8 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +27 -26
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +2 -29
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +13 -11
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/index.js +5 -3
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +8 -1
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/more-menu/site-export.js +5 -2
- package/build-module/components/header/more-menu/site-export.js.map +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +4 -11
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/preferences-modal/enable-feature.js +27 -0
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +57 -0
- package/build-module/components/preferences-modal/index.js.map +1 -0
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +3 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +3 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +35 -1
- package/build-style/style.css +35 -1
- package/package.json +29 -29
- package/src/components/add-new-template/new-template-part.js +3 -12
- package/src/components/add-new-template/new-template.js +49 -12
- package/src/components/editor/index.js +13 -0
- package/src/components/global-styles/border-panel.js +32 -26
- package/src/components/global-styles/dimensions-panel.js +1 -34
- package/src/components/header/document-actions/index.js +14 -10
- package/src/components/header/index.js +6 -1
- package/src/components/header/more-menu/index.js +15 -0
- package/src/components/header/more-menu/site-export.js +13 -2
- package/src/components/header/plugin-more-menu-item/index.js +2 -0
- package/src/components/header/style.scss +45 -0
- package/src/components/list/actions/rename-menu-item.js +3 -13
- package/src/components/preferences-modal/enable-feature.js +24 -0
- package/src/components/preferences-modal/index.js +76 -0
- package/src/index.js +1 -0
- package/src/store/actions.js +4 -4
- package/src/store/selectors.js +10 -0
- package/src/store/test/selectors.js +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/header/plugin-more-menu-item/index.js"],"names":["ActionItem","compose","withPluginContext","context","ownProps","icon","name"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,sBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,iBAAT,QAAkC,oBAAlC;AAEA;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;;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/header/plugin-more-menu-item/index.js"],"names":["ActionItem","compose","MenuItem","withPluginContext","context","ownProps","as","icon","name"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,sBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,iBAAT,QAAkC,oBAAlC;AAEA;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;;AACA,eAAeF,OAAO,CACrBE,iBAAiB,CAAE,CAAEC,OAAF,EAAWC,QAAX,KAAyB;AAAA;;AAC3C,SAAO;AACNC,IAAAA,EAAE,kBAAED,QAAQ,CAACC,EAAX,uDAAiBJ,QADb;AAENK,IAAAA,IAAI,EAAEF,QAAQ,CAACE,IAAT,IAAiBH,OAAO,CAACG,IAFzB;AAGNC,IAAAA,IAAI,EAAE;AAHA,GAAP;AAKA,CANgB,CADI,CAAP,CAQZR,UARY,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ActionItem } from '@wordpress/interface';\nimport { compose } from '@wordpress/compose';\nimport { MenuItem } from '@wordpress/components';\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 [Button](/packages/components/src/button/README.md) component.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var PluginMoreMenuItem = wp.editSite.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-site';\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\tas: ownProps.as ?? MenuItem,\n\t\t\ticon: ownProps.icon || context.icon,\n\t\t\tname: 'core/edit-site/plugin-more-menu',\n\t\t};\n\t} )\n)( ActionItem );\n"]}
|
|
@@ -5,7 +5,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { useState } from '@wordpress/element';
|
|
8
|
-
import { useDispatch
|
|
8
|
+
import { useDispatch } from '@wordpress/data';
|
|
9
9
|
import { Button, Flex, FlexItem, MenuItem, Modal, TextControl } from '@wordpress/components';
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
11
|
import { store as noticesStore } from '@wordpress/notices';
|
|
@@ -16,9 +16,6 @@ export default function RenameMenuItem(_ref) {
|
|
|
16
16
|
} = _ref;
|
|
17
17
|
const [title, setTitle] = useState(() => template.title.rendered);
|
|
18
18
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
19
|
-
const {
|
|
20
|
-
getLastEntitySaveError
|
|
21
|
-
} = useSelect(coreStore);
|
|
22
19
|
const {
|
|
23
20
|
editEntityRecord,
|
|
24
21
|
saveEditedEntityRecord
|
|
@@ -44,13 +41,9 @@ export default function RenameMenuItem(_ref) {
|
|
|
44
41
|
setIsModalOpen(false);
|
|
45
42
|
onClose(); // Persist edited entity.
|
|
46
43
|
|
|
47
|
-
await saveEditedEntityRecord('postType', template.type, template.id
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (lastError) {
|
|
51
|
-
throw lastError;
|
|
52
|
-
}
|
|
53
|
-
|
|
44
|
+
await saveEditedEntityRecord('postType', template.type, template.id, {
|
|
45
|
+
throwOnError: true
|
|
46
|
+
});
|
|
54
47
|
createSuccessNotice(__('Entity renamed.'), {
|
|
55
48
|
type: 'snackbar'
|
|
56
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/actions/rename-menu-item.js"],"names":["__","useState","useDispatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/actions/rename-menu-item.js"],"names":["__","useState","useDispatch","Button","Flex","FlexItem","MenuItem","Modal","TextControl","store","coreStore","noticesStore","RenameMenuItem","template","onClose","title","setTitle","rendered","isModalOpen","setIsModalOpen","editEntityRecord","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","is_custom","onTemplateRename","event","preventDefault","type","id","throwOnError","error","errorMessage","message","code"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,QAHD,EAICC,QAJD,EAKCC,KALD,EAMCC,WAND,QAOO,uBAPP;AAQA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,cAAT,OAAiD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAC/D,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsBf,QAAQ,CAAE,MAAMY,QAAQ,CAACE,KAAT,CAAeE,QAAvB,CAApC;AACA,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkClB,QAAQ,CAAE,KAAF,CAAhD;AAEA,QAAM;AAAEmB,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB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,CAACE,KAAT,CAAeE,QAAjB,CAAR;AACA;AAJF,KAMGjB,EAAE,CAAE,QAAF,CANL,CADD,EASGkB,WAAW,IACZ,cAAC,KAAD;AACC,IAAA,KAAK,EAAGlB,EAAE,CAAE,QAAF,CADX;AAEC,IAAA,UAAU,EAAGA,EAAE,CAAE,OAAF,CAFhB;AAGC,IAAA,cAAc,EAAG,MAAM;AACtBmB,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KALF;AAMC,IAAA,gBAAgB,EAAC;AANlB,KAQC;AAAM,IAAA,QAAQ,EAAGM;AAAjB,KACC,cAAC,IAAD;AAAM,IAAA,KAAK,EAAC,YAAZ;AAAyB,IAAA,GAAG,EAAG;AAA/B,KACC,cAAC,QAAD,QACC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGzB,EAAE,CAAE,MAAF,CADX;AAEC,IAAA,KAAK,EAAGe,KAFT;AAGC,IAAA,QAAQ,EAAGC,QAHZ;AAIC,IAAA,QAAQ;AAJT,IADD,CADD,CADD,EAYC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,OAAO,EAAC,UAFT;AAGC,IAAA,QAAQ,EAAG;AAHZ,KAKC,cAAC,QAAD,QACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,UADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfG,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA;AAJF,KAMGnB,EAAE,CAAE,QAAF,CANL,CADD,CALD,EAeC,cAAC,QAAD,QACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,SAAhB;AAA0B,IAAA,IAAI,EAAC;AAA/B,KACGA,EAAE,CAAE,MAAF,CADL,CADD,CAfD,CAZD,CARD,CAVF,CADD;AAyDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\n\tMenuItem,\n\tModal,\n\tTextControl,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function RenameMenuItem( { template, onClose } ) {\n\tconst [ title, setTitle ] = useState( () => template.title.rendered );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\tconst { editEntityRecord, saveEditedEntityRecord } = useDispatch(\n\t\tcoreStore\n\t);\n\tconst { createSuccessNotice, createErrorNotice } = useDispatch(\n\t\tnoticesStore\n\t);\n\n\tif ( ! template.is_custom ) {\n\t\treturn null;\n\t}\n\n\tasync function onTemplateRename( event ) {\n\t\tevent.preventDefault();\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\ttitle,\n\t\t\t} );\n\n\t\t\t// Update state before saving rerenders the list.\n\t\t\tsetTitle( '' );\n\t\t\tsetIsModalOpen( false );\n\t\t\tonClose();\n\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tcreateSuccessNotice( __( 'Entity renamed.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while renaming the entity.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\tsetTitle( template.title.rendered );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Rename' ) }\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} }\n\t\t\t\t\toverlayClassName=\"edit-site-list__rename-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form onSubmit={ onTemplateRename }>\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\trequired\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-site-list__rename-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} }\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 variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Save' ) }\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"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WordPress dependencies
|
|
6
|
+
*/
|
|
7
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
+
import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
|
|
9
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
10
|
+
export default function EnableFeature(props) {
|
|
11
|
+
const {
|
|
12
|
+
featureName,
|
|
13
|
+
...remainingProps
|
|
14
|
+
} = props;
|
|
15
|
+
const isChecked = useSelect(select => !!select(preferencesStore).get('core/edit-site', featureName), [featureName]);
|
|
16
|
+
const {
|
|
17
|
+
toggle
|
|
18
|
+
} = useDispatch(preferencesStore);
|
|
19
|
+
|
|
20
|
+
const onChange = () => toggle('core/edit-site', featureName);
|
|
21
|
+
|
|
22
|
+
return createElement(BaseOption, _extends({
|
|
23
|
+
onChange: onChange,
|
|
24
|
+
isChecked: isChecked
|
|
25
|
+
}, remainingProps));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=enable-feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/preferences-modal/enable-feature.js"],"names":["useSelect","useDispatch","___unstablePreferencesModalBaseOption","BaseOption","store","preferencesStore","EnableFeature","props","featureName","remainingProps","isChecked","select","get","toggle","onChange"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,qCAAqC,IAAIC,UAAlD,QAAoE,sBAApE;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AAEA,eAAe,SAASC,aAAT,CAAwBC,KAAxB,EAAgC;AAC9C,QAAM;AAAEC,IAAAA,WAAF;AAAe,OAAGC;AAAlB,MAAqCF,KAA3C;AACA,QAAMG,SAAS,GAAGV,SAAS,CACxBW,MAAF,IACC,CAAC,CAAEA,MAAM,CAAEN,gBAAF,CAAN,CAA2BO,GAA3B,CAAgC,gBAAhC,EAAkDJ,WAAlD,CAFsB,EAG1B,CAAEA,WAAF,CAH0B,CAA3B;AAKA,QAAM;AAAEK,IAAAA;AAAF,MAAaZ,WAAW,CAAEI,gBAAF,CAA9B;;AACA,QAAMS,QAAQ,GAAG,MAAMD,MAAM,CAAE,gBAAF,EAAoBL,WAApB,CAA7B;;AACA,SACC,cAAC,UAAD;AACC,IAAA,QAAQ,EAAGM,QADZ;AAEC,IAAA,SAAS,EAAGJ;AAFb,KAGMD,cAHN,EADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function EnableFeature( props ) {\n\tconst { featureName, ...remainingProps } = props;\n\tconst isChecked = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( preferencesStore ).get( 'core/edit-site', featureName ),\n\t\t[ featureName ]\n\t);\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst onChange = () => toggle( 'core/edit-site', featureName );\n\treturn (\n\t\t<BaseOption\n\t\t\tonChange={ onChange }\n\t\t\tisChecked={ isChecked }\n\t\t\t{ ...remainingProps }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { PreferencesModal, PreferencesModalTabs, PreferencesModalSection } from '@wordpress/interface';
|
|
7
|
+
import { useMemo } from '@wordpress/element';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import EnableFeature from './enable-feature';
|
|
14
|
+
export default function EditSitePreferencesModal(_ref) {
|
|
15
|
+
let {
|
|
16
|
+
isModalActive,
|
|
17
|
+
toggleModal
|
|
18
|
+
} = _ref;
|
|
19
|
+
const sections = useMemo(() => [{
|
|
20
|
+
name: 'general',
|
|
21
|
+
tabLabel: __('General'),
|
|
22
|
+
content: createElement(PreferencesModalSection, {
|
|
23
|
+
title: __('Appearance'),
|
|
24
|
+
description: __('Customize options related to the block editor interface and editing flow.')
|
|
25
|
+
}, createElement(EnableFeature, {
|
|
26
|
+
featureName: "focusMode",
|
|
27
|
+
help: __('Highlights the current block and fades other content.'),
|
|
28
|
+
label: __('Spotlight mode')
|
|
29
|
+
}), createElement(EnableFeature, {
|
|
30
|
+
featureName: "showIconLabels",
|
|
31
|
+
label: __('Show button text labels'),
|
|
32
|
+
help: __('Show text instead of icons on buttons')
|
|
33
|
+
}))
|
|
34
|
+
}, {
|
|
35
|
+
name: 'blocks',
|
|
36
|
+
tabLabel: __('Blocks'),
|
|
37
|
+
content: createElement(PreferencesModalSection, {
|
|
38
|
+
title: __('Block interactions'),
|
|
39
|
+
description: __('Customize how you interact with blocks in the block library and editing canvas.')
|
|
40
|
+
}, createElement(EnableFeature, {
|
|
41
|
+
featureName: "keepCaretInsideBlock",
|
|
42
|
+
help: __('Aids screen readers by stopping text caret from leaving blocks.'),
|
|
43
|
+
label: __('Contain text cursor inside block')
|
|
44
|
+
}))
|
|
45
|
+
}]);
|
|
46
|
+
|
|
47
|
+
if (!isModalActive) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return createElement(PreferencesModal, {
|
|
52
|
+
closeModal: toggleModal
|
|
53
|
+
}, createElement(PreferencesModalTabs, {
|
|
54
|
+
sections: sections
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/preferences-modal/index.js"],"names":["PreferencesModal","PreferencesModalTabs","PreferencesModalSection","useMemo","__","EnableFeature","EditSitePreferencesModal","isModalActive","toggleModal","sections","name","tabLabel","content"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,gBADD,EAECC,oBAFD,EAGCC,uBAHD,QAIO,sBAJP;AAKA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,aAAP,MAA0B,kBAA1B;AAEA,eAAe,SAASC,wBAAT,OAGX;AAAA,MAH8C;AACjDC,IAAAA,aADiD;AAEjDC,IAAAA;AAFiD,GAG9C;AACH,QAAMC,QAAQ,GAAGN,OAAO,CAAE,MAAM,CAC/B;AACCO,IAAAA,IAAI,EAAE,SADP;AAECC,IAAAA,QAAQ,EAAEP,EAAE,CAAE,SAAF,CAFb;AAGCQ,IAAAA,OAAO,EACN,cAAC,uBAAD;AACC,MAAA,KAAK,EAAGR,EAAE,CAAE,YAAF,CADX;AAEC,MAAA,WAAW,EAAGA,EAAE,CACf,2EADe;AAFjB,OAMC,cAAC,aAAD;AACC,MAAA,WAAW,EAAC,WADb;AAEC,MAAA,IAAI,EAAGA,EAAE,CACR,uDADQ,CAFV;AAKC,MAAA,KAAK,EAAGA,EAAE,CAAE,gBAAF;AALX,MAND,EAaC,cAAC,aAAD;AACC,MAAA,WAAW,EAAC,gBADb;AAEC,MAAA,KAAK,EAAGA,EAAE,CAAE,yBAAF,CAFX;AAGC,MAAA,IAAI,EAAGA,EAAE,CAAE,uCAAF;AAHV,MAbD;AAJF,GAD+B,EA0B/B;AACCM,IAAAA,IAAI,EAAE,QADP;AAECC,IAAAA,QAAQ,EAAEP,EAAE,CAAE,QAAF,CAFb;AAGCQ,IAAAA,OAAO,EACN,cAAC,uBAAD;AACC,MAAA,KAAK,EAAGR,EAAE,CAAE,oBAAF,CADX;AAEC,MAAA,WAAW,EAAGA,EAAE,CACf,iFADe;AAFjB,OAMC,cAAC,aAAD;AACC,MAAA,WAAW,EAAC,sBADb;AAEC,MAAA,IAAI,EAAGA,EAAE,CACR,iEADQ,CAFV;AAKC,MAAA,KAAK,EAAGA,EAAE,CAAE,kCAAF;AALX,MAND;AAJF,GA1B+B,CAAR,CAAxB;;AA+CA,MAAK,CAAEG,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AACD,SACC,cAAC,gBAAD;AAAkB,IAAA,UAAU,EAAGC;AAA/B,KACC,cAAC,oBAAD;AAAsB,IAAA,QAAQ,EAAGC;AAAjC,IADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPreferencesModal,\n\tPreferencesModalTabs,\n\tPreferencesModalSection,\n} from '@wordpress/interface';\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EnableFeature from './enable-feature';\n\nexport default function EditSitePreferencesModal( {\n\tisModalActive,\n\ttoggleModal,\n} ) {\n\tconst sections = useMemo( () => [\n\t\t{\n\t\t\tname: 'general',\n\t\t\ttabLabel: __( 'General' ),\n\t\t\tcontent: (\n\t\t\t\t<PreferencesModalSection\n\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t'Customize options related to the block editor interface and editing flow.'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\tlabel={ __( 'Show button text labels' ) }\n\t\t\t\t\t\thelp={ __( 'Show text instead of icons on buttons' ) }\n\t\t\t\t\t/>\n\t\t\t\t</PreferencesModalSection>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tname: 'blocks',\n\t\t\ttabLabel: __( 'Blocks' ),\n\t\t\tcontent: (\n\t\t\t\t<PreferencesModalSection\n\t\t\t\t\ttitle={ __( 'Block interactions' ) }\n\t\t\t\t\tdescription={ __(\n\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) }\n\t\t\t\t>\n\t\t\t\t\t<EnableFeature\n\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Aids screen readers by stopping text caret from leaving blocks.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlabel={ __( 'Contain text cursor inside block' ) }\n\t\t\t\t\t/>\n\t\t\t\t</PreferencesModalSection>\n\t\t\t),\n\t\t},\n\t] );\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<PreferencesModal closeModal={ toggleModal }>\n\t\t\t<PreferencesModalTabs sections={ sections } />\n\t\t</PreferencesModal>\n\t);\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","preferencesStore","__","viewportStore","getQueryArgs","editSiteStore","EditSiteApp","getIsListPage","ErrorBoundaryWarning","reinitializeEditor","target","settings","__unstableHomeTemplate","reboot","bind","setDefaults","editorMode","fixedToolbar","focusMode","welcomeGuide","welcomeGuideStyles","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","isViewportMatch","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,iBAAjC;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASd,KAAK,IAAIe,aAAlB,QAAuC,qBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,SAAShB,KAAK,IAAIiB,aAAlB,QAAuC,SAAvC;AACA,OAAOC,WAAP,MAAwB,kBAAxB;AACA,OAAOC,aAAP,MAA0B,0BAA1B;AACA,OAAOC,oBAAP,MAAiC,qCAAjC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BC,MAA7B,EAAqCC,QAArC,EAAgD;AACtD;AACA,MAAK,CAAEA,QAAQ,CAACC,sBAAhB,EAAyC;AACxClB,IAAAA,MAAM,CACL,cAAC,oBAAD;AACC,MAAA,OAAO,EAAGQ,EAAE,CACX,iEADW,CADb;AAIC,MAAA,aAAa,EAAC;AAJf,MADK,EAOLQ,MAPK,CAAN;AASA;AACA,GAbqD,CAetD;;;AACAf,EAAAA,sBAAsB,CAAEe,MAAF,CAAtB;AACA,QAAMG,MAAM,GAAGJ,kBAAkB,CAACK,IAAnB,CAAyB,IAAzB,EAA+BJ,MAA/B,EAAuCC,QAAvC,CAAf,CAjBsD,CAmBtD;AACA;;AACA;AACCnB,IAAAA,QAAQ,CAAES,gBAAF,CAAR,CAA6Bc,WAA7B,CAA0C,gBAA1C,EAA4D;AAC3DC,MAAAA,UAAU,EAAE,QAD+C;AAE3DC,MAAAA,YAAY,EAAE,KAF6C;AAG3DC,MAAAA,SAAS,EAAE,KAHgD;AAI3DC,MAAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","select","render","unmountComponentAtNode","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","preferencesStore","__","viewportStore","getQueryArgs","editSiteStore","EditSiteApp","getIsListPage","ErrorBoundaryWarning","reinitializeEditor","target","settings","__unstableHomeTemplate","reboot","bind","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","isViewportMatch","initializeEditor","id","search","searchOptions","__experimentalFetchRichUrlData","__experimentalSpotlightEntityBlocks","document","getElementById","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","default","__experimentalMainDashboardButton","__experimentalNavigationToggle","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,4CAFD,QAGO,0BAHP;AAIA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,iBAAjC;AACA,SAASC,MAAT,EAAiBC,sBAAjB,QAA+C,oBAA/C;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,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qD,MAAAA,eAAe,EAAE;AAD4B,KAAF,CAA5C;AAGA;;AAEDnC,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA;AAED,SAASkC,OAAO,IAAIC,iCAApB,QAA6D,oCAA7D;AACA,SAASD,OAAO,IAAIE,8BAApB,QAA0D,mDAA1D;AACA,SAASF,OAAO,IAAIG,aAApB,QAAyC,qCAAzC;AACA,SAASH,OAAO,IAAII,yBAApB,QAAqD,mDAArD;AACA,SAASJ,OAAO,IAAIK,kBAApB,QAA8C,2CAA9C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch, select } from '@wordpress/data';\nimport { render, unmountComponentAtNode } from '@wordpress/element';\nimport {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { __ } from '@wordpress/i18n';\nimport { store as viewportStore } from '@wordpress/viewport';\nimport { getQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport EditSiteApp from './components/app';\nimport getIsListPage from './utils/get-is-list-page';\nimport ErrorBoundaryWarning from './components/error-boundary/warning';\n\n/**\n * Reinitializes the editor after the user chooses to reboot the editor after\n * an unhandled error occurs, replacing previously mounted editor element using\n * an initial state from prior to the crash.\n *\n * @param {Element} target DOM node in which editor is rendered.\n * @param {?Object} settings Editor settings object.\n */\nexport function reinitializeEditor( target, settings ) {\n\t// Display warning if editor wasn't able to resolve homepage template.\n\tif ( ! settings.__unstableHomeTemplate ) {\n\t\trender(\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor is unable to find a block template for the homepage.'\n\t\t\t\t) }\n\t\t\t\tdashboardLink=\"index.php\"\n\t\t\t/>,\n\t\t\ttarget\n\t\t);\n\t\treturn;\n\t}\n\n\t// This will be a no-op if the target doesn't have any React nodes.\n\tunmountComponentAtNode( target );\n\tconst reboot = reinitializeEditor.bind( null, target, settings );\n\n\t// We dispatch actions and update the store synchronously before rendering\n\t// so that we won't trigger unnecessary re-renders with useEffect.\n\t{\n\t\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\t\teditorMode: 'visual',\n\t\t\tfixedToolbar: false,\n\t\t\tfocusMode: false,\n\t\t\tkeepCaretInsideBlock: false,\n\t\t\twelcomeGuide: true,\n\t\t\twelcomeGuideStyles: true,\n\t\t} );\n\n\t\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t\t// so that they can be selected with core/editor selectors in any editor.\n\t\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t\t// which internally uses updateEditorSettings as well.\n\t\tdispatch( editorStore ).updateEditorSettings( {\n\t\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t\t} );\n\n\t\tconst isLandingOnListPage = getIsListPage(\n\t\t\tgetQueryArgs( window.location.href )\n\t\t);\n\n\t\tif ( isLandingOnListPage ) {\n\t\t\t// Default the navigation panel to be opened when we're in a bigger\n\t\t\t// screen and land in the list screen.\n\t\t\tdispatch( editSiteStore ).setIsNavigationPanelOpened(\n\t\t\t\tselect( viewportStore ).isViewportMatch( 'medium' )\n\t\t\t);\n\t\t}\n\t}\n\n\trender( <EditSiteApp reboot={ reboot } />, target );\n}\n\n/**\n * Initializes the site editor screen.\n *\n * @param {string} id ID of the root element to render the screen in.\n * @param {Object} settings Editor settings.\n */\nexport function initializeEditor( id, settings ) {\n\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\tsettings.__experimentalSpotlightEntityBlocks = [ 'core/template-part' ];\n\n\tconst target = document.getElementById( id );\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\n\tregisterCoreBlocks();\n\tif ( process.env.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\n\n\treinitializeEditor( target, settings );\n}\n\nexport { default as __experimentalMainDashboardButton } from './components/main-dashboard-button';\nexport { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle';\nexport { default as PluginSidebar } from './components/sidebar/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';\n"]}
|
|
@@ -329,16 +329,16 @@ export const revertTemplate = function (template) {
|
|
|
329
329
|
try {
|
|
330
330
|
var _fileTemplate$content;
|
|
331
331
|
|
|
332
|
-
const
|
|
332
|
+
const templateEntityConfig = registry.select(coreStore).getEntityConfig('postType', template.type);
|
|
333
333
|
|
|
334
|
-
if (!
|
|
334
|
+
if (!templateEntityConfig) {
|
|
335
335
|
registry.dispatch(noticesStore).createErrorNotice(__('The editor has encountered an unexpected error. Please reload.'), {
|
|
336
336
|
type: 'snackbar'
|
|
337
337
|
});
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
-
const fileTemplatePath = addQueryArgs(`${
|
|
341
|
+
const fileTemplatePath = addQueryArgs(`${templateEntityConfig.baseURL}/${template.id}`, {
|
|
342
342
|
context: 'edit',
|
|
343
343
|
source: 'theme'
|
|
344
344
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","getEntityRecord","slug","page","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","id","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","createSuccessNotice","title","rendered","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","revertTemplate","allowUndo","templateEntity","getEntity","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iB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\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate = ( templateId, templateSlug ) => async ( {\n\tdispatch,\n\tregistry,\n} ) => {\n\tif ( ! templateSlug ) {\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\ttemplateSlug = template?.slug;\n\t}\n\n\tdispatch( {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId,\n\t\tpage: { context: { templateSlug } },\n\t} );\n};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate = ( template ) => async ( { dispatch, registry } ) => {\n\tconst newTemplate = await registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\tif ( template.content ) {\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\tnewTemplate.id,\n\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t{ undoIgnore: true }\n\t\t\t);\n\t}\n\n\tdispatch( {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId: newTemplate.id,\n\t\tpage: { context: { templateSlug: newTemplate.slug } },\n\t} );\n};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate = ( template ) => async ( { registry } ) => {\n\ttry {\n\t\tawait registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\tforce: true,\n\t\t\t} );\n\n\t\tconst lastError = registry\n\t\t\t.select( coreStore )\n\t\t\t.getLastEntityDeleteError( 'postType', template.type, template.id );\n\n\t\tif ( lastError ) {\n\t\t\tthrow lastError;\n\t\t}\n\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\ttemplate.title.rendered\n\t\t\t),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t}\n};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Action that sets the home template ID to the template ID of the page resolved\n * from a given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage = ( page ) => async ( { dispatch, registry } ) => {\n\tif ( ! page.path && page.context?.postId ) {\n\t\tconst entity = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpage.context.postType || 'post',\n\t\t\t\tpage.context.postId\n\t\t\t);\n\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\tpage.path = getPathAndQueryString( entity?.link );\n\t}\n\n\tconst template = await registry\n\t\t.resolveSelect( coreStore )\n\t\t.__experimentalGetTemplateForLink( page.path );\n\n\tif ( ! template ) {\n\t\treturn;\n\t}\n\n\tdispatch( {\n\t\ttype: 'SET_PAGE',\n\t\tpage: template.slug\n\t\t\t? {\n\t\t\t\t\t...page,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\ttemplateSlug: template.slug,\n\t\t\t\t\t},\n\t\t\t }\n\t\t\t: page,\n\t\ttemplateId: template.id,\n\t} );\n\n\treturn template.id;\n};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate = (\n\ttemplate,\n\t{ allowUndo = true } = {}\n) => async ( { registry } ) => {\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntity = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntity( 'postType', template.type );\n\n\t\tif ( ! templateEntity ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t),\n\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntity.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: 'theme' }\n\t\t);\n\n\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\tif ( ! fileTemplate ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t),\n\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\n\t\tconst edited = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEditedEntityRecord( 'postType', template.type, template.id );\n\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t} );\n\n\t\tif ( allowUndo ) {\n\t\t\tconst undoRevert = () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.editEntityRecord( 'postType', template.type, edited.id, {\n\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t} );\n\t\t\t};\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t} );\n\t\t} else {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ) );\n\t\t}\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t}\n};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar = ( name ) => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.enableComplementaryArea( editSiteStoreName, name );\n};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editSiteStoreName );\n};\n\nexport const switchEditorMode = ( mode ) => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( 'core/preferences' )\n\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t// Unselect blocks when we switch to a non visual mode.\n\tif ( mode !== 'visual' ) {\n\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t}\n\n\tif ( mode === 'visual' ) {\n\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t} else if ( mode === 'mosaic' ) {\n\t\tspeak( __( 'Mosaic view selected' ), 'assertive' );\n\t}\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/actions.js"],"names":["apiFetch","parse","__unstableSerializeAndClean","deprecated","addQueryArgs","getPathAndQueryString","__","sprintf","store","noticesStore","coreStore","interfaceStore","blockEditorStore","speak","preferencesStore","STORE_NAME","editSiteStoreName","isTemplateRevertable","toggleFeature","featureName","registry","since","alternative","dispatch","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","templateId","templateSlug","template","resolveSelect","getEntityRecord","slug","page","context","addTemplate","newTemplate","saveEntityRecord","content","editEntityRecord","id","blocks","undoIgnore","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","createSuccessNotice","title","rendered","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","setHomeTemplateId","homeTemplateId","setPage","path","postId","entity","postType","link","__experimentalGetTemplateForLink","setNavigationPanelActiveMenu","menu","openNavigationPanelToMenu","setIsNavigationPanelOpened","isOpen","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","revertTemplate","allowUndo","templateEntityConfig","getEntityConfig","fileTemplatePath","baseURL","source","fileTemplate","serializeBlocks","blocksForSerialization","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","enableComplementaryArea","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","clearSelectedBlock"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,KAAT,EAAgBC,2BAAhB,QAAmD,mBAAnD;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,YAAT,EAAuBC,qBAAvB,QAAoD,gBAApD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASF,KAAK,IAAIG,cAAlB,QAAwC,sBAAxC;AACA,SAASH,KAAK,IAAII,gBAAlB,QAA0C,yBAA1C;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASL,KAAK,IAAIM,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SAASC,UAAU,IAAIC,iBAAvB,QAAgD,aAAhD;AACA,OAAOC,oBAAP,MAAiC,iCAAjC;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,aAAT,CAAwBC,WAAxB,EAAsC;AAC5C,SAAO,gBAA0B;AAAA,QAAf;AAAEC,MAAAA;AAAF,KAAe;AAChCjB,IAAAA,UAAU,CAAE,yDAAF,EAA6D;AACtEkB,MAAAA,KAAK,EAAE,KAD+D;AAEtEC,MAAAA,WAAW,EACV;AAHqE,KAA7D,CAAV;AAMAF,IAAAA,QAAQ,CACNG,QADF,CACYT,gBADZ,EAEEU,MAFF,CAEU,gBAFV,EAE4BL,WAF5B;AAGA,GAVD;AAWA;AAED;AACA;AACA;AAC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9C;AAGA,CAJM;AAMP;AACA;AACA;;AACA,OAAO,MAAME,mBAAmB,GAAG,MAAM,SAAoB;AAAA,MAAlB;AAAEhF,IAAAA;AAAF,GAAkB;AAC5DA,EAAAA,QAAQ,CACNG,QADF,CACYZ,cADZ,EAEE0F,wBAFF,CAE4BrF,iBAF5B;AAGA,CAJM;AAMP,OAAO,MAAMsF,gBAAgB,GAAKC,IAAF,IAAY,UAAoB;AAAA,MAAlB;AAAEnF,IAAAA;AAAF,GAAkB;AAC/DA,EAAAA,QAAQ,CACNG,QADF,CACY,kBADZ,EAEEiF,GAFF,CAEO,gBAFP,EAEyB,YAFzB,EAEuCD,IAFvC,EAD+D,CAK/D;;AACA,MAAKA,IAAI,KAAK,QAAd,EAAyB;AACxBnF,IAAAA,QAAQ,CAACG,QAAT,CAAmBX,gBAAnB,EAAsC6F,kBAAtC;AACA;;AAED,MAAKF,IAAI,KAAK,QAAd,EAAyB;AACxB1F,IAAAA,KAAK,CAAEP,EAAE,CAAE,wBAAF,CAAJ,EAAkC,WAAlC,CAAL;AACA,GAFD,MAEO,IAAKiG,IAAI,KAAK,QAAd,EAAyB;AAC/B1F,IAAAA,KAAK,CAAEP,EAAE,CAAE,sBAAF,CAAJ,EAAgC,WAAhC,CAAL;AACA;AACD,CAfM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs, getPathAndQueryString } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\n\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated( \"select( 'core/edit-site' ).toggleFeature( featureName )\", {\n\t\t\tsince: '6.0',\n\t\t\talternative:\n\t\t\t\t\"select( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t} );\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @param {number} templateId The template ID.\n * @param {string} templateSlug The template slug.\n * @return {Object} Action object.\n */\nexport const setTemplate = ( templateId, templateSlug ) => async ( {\n\tdispatch,\n\tregistry,\n} ) => {\n\tif ( ! templateSlug ) {\n\t\tconst template = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getEntityRecord( 'postType', 'wp_template', templateId );\n\t\ttemplateSlug = template?.slug;\n\t}\n\n\tdispatch( {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId,\n\t\tpage: { context: { templateSlug } },\n\t} );\n};\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate = ( template ) => async ( { dispatch, registry } ) => {\n\tconst newTemplate = await registry\n\t\t.dispatch( coreStore )\n\t\t.saveEntityRecord( 'postType', 'wp_template', template );\n\n\tif ( template.content ) {\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\tnewTemplate.id,\n\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t{ undoIgnore: true }\n\t\t\t);\n\t}\n\n\tdispatch( {\n\t\ttype: 'SET_TEMPLATE',\n\t\ttemplateId: newTemplate.id,\n\t\tpage: { context: { templateSlug: newTemplate.slug } },\n\t} );\n};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate = ( template ) => async ( { registry } ) => {\n\ttry {\n\t\tawait registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\tforce: true,\n\t\t\t} );\n\n\t\tconst lastError = registry\n\t\t\t.select( coreStore )\n\t\t\t.getLastEntityDeleteError( 'postType', template.type, template.id );\n\n\t\tif ( lastError ) {\n\t\t\tthrow lastError;\n\t\t}\n\n\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\ttemplate.title.rendered\n\t\t\t),\n\t\t\t{ type: 'snackbar' }\n\t\t);\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'An error occurred while deleting the template.' );\n\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t}\n};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_TEMPLATE_PART',\n\t\ttemplatePartId,\n\t};\n}\n\n/**\n * Action that sets the home template ID to the template ID of the page resolved\n * from a given path.\n *\n * @param {number} homeTemplateId The template ID for the homepage.\n */\nexport function setHomeTemplateId( homeTemplateId ) {\n\treturn {\n\t\ttype: 'SET_HOME_TEMPLATE',\n\t\thomeTemplateId,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @param {Object} page The page object.\n * @param {string} page.type The page type.\n * @param {string} page.slug The page slug.\n * @param {string} page.path The page path.\n * @param {Object} page.context The page context.\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport const setPage = ( page ) => async ( { dispatch, registry } ) => {\n\tif ( ! page.path && page.context?.postId ) {\n\t\tconst entity = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpage.context.postType || 'post',\n\t\t\t\tpage.context.postId\n\t\t\t);\n\t\t// If the entity is undefined for some reason, path will resolve to \"/\"\n\t\tpage.path = getPathAndQueryString( entity?.link );\n\t}\n\n\tconst template = await registry\n\t\t.resolveSelect( coreStore )\n\t\t.__experimentalGetTemplateForLink( page.path );\n\n\tif ( ! template ) {\n\t\treturn;\n\t}\n\n\tdispatch( {\n\t\ttype: 'SET_PAGE',\n\t\tpage: template.slug\n\t\t\t? {\n\t\t\t\t\t...page,\n\t\t\t\t\tcontext: {\n\t\t\t\t\t\t...page.context,\n\t\t\t\t\t\ttemplateSlug: template.slug,\n\t\t\t\t\t},\n\t\t\t }\n\t\t\t: page,\n\t\ttemplateId: template.id,\n\t} );\n\n\treturn template.id;\n};\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @param {string} menu Menu prop of active menu.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu( menu ) {\n\treturn {\n\t\ttype: 'SET_NAVIGATION_PANEL_ACTIVE_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @param {string} menu Identifies the menu to open.\n */\nexport function openNavigationPanelToMenu( menu ) {\n\treturn {\n\t\ttype: 'OPEN_NAVIGATION_PANEL_TO_MENU',\n\t\tmenu,\n\t};\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @param {boolean} isOpen If true, opens the nav panel. If false, closes it. It\n * does not toggle the state, but sets it directly.\n */\nexport function setIsNavigationPanelOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_NAVIGATION_PANEL_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsListViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate = (\n\ttemplate,\n\t{ allowUndo = true } = {}\n) => async ( { registry } ) => {\n\tif ( ! isTemplateRevertable( template ) ) {\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst templateEntityConfig = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\tif ( ! templateEntityConfig ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t),\n\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t{ context: 'edit', source: 'theme' }\n\t\t);\n\n\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\tif ( ! fileTemplate ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice(\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t),\n\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst serializeBlocks = ( { blocks: blocksForSerialization = [] } ) =>\n\t\t\t__unstableSerializeAndClean( blocksForSerialization );\n\n\t\tconst edited = registry\n\t\t\t.select( coreStore )\n\t\t\t.getEditedEntityRecord( 'postType', template.type, template.id );\n\n\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t// the revert in the header toolbar correctly.\n\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplate.type,\n\t\t\ttemplate.id,\n\t\t\t{\n\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t},\n\t\t\t{\n\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t}\n\t\t);\n\n\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\tregistry\n\t\t\t.dispatch( coreStore )\n\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\tcontent: serializeBlocks,\n\t\t\t\tblocks,\n\t\t\t\tsource: 'theme',\n\t\t\t} );\n\n\t\tif ( allowUndo ) {\n\t\t\tconst undoRevert = () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.editEntityRecord( 'postType', template.type, edited.id, {\n\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t} );\n\t\t\t};\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t} );\n\t\t} else {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ) );\n\t\t}\n\t} catch ( error ) {\n\t\tconst errorMessage =\n\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t? error.message\n\t\t\t\t: __( 'Template revert failed. Please reload.' );\n\t\tregistry\n\t\t\t.dispatch( noticesStore )\n\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t}\n};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar = ( name ) => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.enableComplementaryArea( editSiteStoreName, name );\n};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar = () => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( interfaceStore )\n\t\t.disableComplementaryArea( editSiteStoreName );\n};\n\nexport const switchEditorMode = ( mode ) => ( { registry } ) => {\n\tregistry\n\t\t.dispatch( 'core/preferences' )\n\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t// Unselect blocks when we switch to a non visual mode.\n\tif ( mode !== 'visual' ) {\n\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t}\n\n\tif ( mode === 'visual' ) {\n\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t} else if ( mode === 'mosaic' ) {\n\t\tspeak( __( 'Mosaic view selected' ), 'assertive' );\n\t}\n};\n"]}
|
|
@@ -99,6 +99,8 @@ export const getSettings = createSelector((state, setIsInserterOpen) => {
|
|
|
99
99
|
outlineMode: true,
|
|
100
100
|
focusMode: !!__unstableGetPreference(state, 'focusMode'),
|
|
101
101
|
hasFixedToolbar: !!__unstableGetPreference(state, 'fixedToolbar'),
|
|
102
|
+
keepCaretInsideBlock: !!__unstableGetPreference(state, 'keepCaretInsideBlock'),
|
|
103
|
+
showIconLabels: !!__unstableGetPreference(state, 'showIconLabels'),
|
|
102
104
|
__experimentalSetIsInserterOpened: setIsInserterOpen,
|
|
103
105
|
__experimentalReusableBlocks: getReusableBlocks(state),
|
|
104
106
|
__experimentalPreferPatternsOnRoot: 'wp_template' === getEditedPostType(state)
|
|
@@ -127,7 +129,7 @@ export const getSettings = createSelector((state, setIsInserterOpen) => {
|
|
|
127
129
|
};
|
|
128
130
|
|
|
129
131
|
return settings;
|
|
130
|
-
}, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'fixedToolbar'), getReusableBlocks(state), getEditedPostType(state)]);
|
|
132
|
+
}, state => [getCanUserCreateMedia(state), state.settings, __unstableGetPreference(state, 'focusMode'), __unstableGetPreference(state, 'fixedToolbar'), __unstableGetPreference(state, 'keepCaretInsideBlock'), __unstableGetPreference(state, 'showIconLabels'), getReusableBlocks(state), getEditedPostType(state)]);
|
|
131
133
|
/**
|
|
132
134
|
* Returns the current home template ID.
|
|
133
135
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["map","keyBy","createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","isTemplatePart","Platform","preferencesStore","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES_UNUSED","TEMPLATE_PARTS_SUB_MENUS","getTemplateLocation","isTemplateSuperseded","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","type","getEditedPostId","id","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","find","submenu","area","templates","showOnFront","getEditedEntityRecord","show_on_front","slug","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","attributes","theme","templatePartId","getEditorMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,KAAd,QAA2B,QAA3B;AACA,OAAOC,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA,SACCC,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GD,iBAAiB,CAAEO,cAAF,CAAtC;AAEA,WAAO;AACNN,MAAAA,YADM;AAENG,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEF,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAjCmE,CAA9D;AAoCP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASO,aAAT,CAAwB9E,KAAxB,EAAgC;AACtC,SAAOF,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector( ( select ) => () =>\n\tselect( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost;\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select(\n\t\t\tcoreDataStore\n\t\t).getEntityRecords( 'postType', 'wp_template_part', { per_page: -1 } );\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/store/selectors.js"],"names":["map","keyBy","createSelector","store","coreDataStore","createRegistrySelector","deprecated","uploadMedia","isTemplatePart","Platform","preferencesStore","MENU_ROOT","MENU_TEMPLATE_PARTS","MENU_TEMPLATES_UNUSED","TEMPLATE_PARTS_SUB_MENUS","getTemplateLocation","isTemplateSuperseded","__unstableGetPreference","select","state","name","get","isFeatureActive","featureName","since","alternative","__experimentalGetPreviewDeviceType","deviceType","getCanUserCreateMedia","canUser","getReusableBlocks","isWeb","OS","getEntityRecords","per_page","getSettings","setIsInserterOpen","settings","outlineMode","focusMode","hasFixedToolbar","keepCaretInsideBlock","showIconLabels","__experimentalSetIsInserterOpened","__experimentalReusableBlocks","__experimentalPreferPatternsOnRoot","getEditedPostType","canUserCreateMedia","mediaUpload","onError","rest","wpAllowedMimeTypes","allowedMimeTypes","message","getHomeTemplateId","homeTemplateId","getCurrentEditedPost","editedPost","type","getEditedPostId","id","getPage","page","getNavigationPanelActiveMenu","navigationPanel","menu","getCurrentTemplateNavigationPanelSubMenu","templateType","templateId","template","getEntityRecord","find","submenu","area","templates","showOnFront","getEditedEntityRecord","show_on_front","slug","isNavigationOpened","isOpen","isInserterOpened","blockInserterPanel","__experimentalGetInsertionPoint","rootClientId","insertionIndex","filterValue","isListViewOpened","listViewPanel","getCurrentTemplateTemplateParts","templateParts","templatePartsById","templatePart","blocks","filter","block","attributes","theme","templatePartId","getEditorMode"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,KAAd,QAA2B,QAA3B;AACA,OAAOC,cAAP,MAA2B,QAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,WAAT,QAA4B,wBAA5B;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASN,KAAK,IAAIO,gBAAlB,QAA0C,wBAA1C;AAEA;AACA;AACA;;AACA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AAqB,EAArB,EACLC,MADK,CACKC,KAAF,IAAavF,cAAc,CAAEuF,KAAF,CAD9B,EAEL/F,GAFK,CAEE+F,KAAF,IAAa;AAClB,UAAM;AACLC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,KAAF;AAASnB,QAAAA;AAAT;AADP,QAEFiB,KAFJ;AAGA,UAAMG,cAAc,GAAI,GAAGD,KAAO,KAAKnB,IAAM,EAA7C;AACA,UAAMc,YAAY,GAAGD,iBAAiB,CAAEO,cAAF,CAAtC;AAEA,WAAO;AACNN,MAAAA,YADM;AAENG,MAAAA;AAFM,KAAP;AAIA,GAbK,EAcLD,MAdK,CAcG;AAAA,QAAE;AAAEF,MAAAA;AAAF,KAAF;AAAA,WAAwB,CAAC,CAAEA,YAA3B;AAAA,GAdH,CAAP;AAeA,CAjCmE,CAA9D;AAoCP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASO,aAAT,CAAwBhF,KAAxB,EAAgC;AACtC,SAAOF,uBAAuB,CAAEE,KAAF,EAAS,YAAT,CAA9B;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { map, keyBy } from 'lodash';\nimport createSelector from 'rememo';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { isTemplatePart } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMENU_ROOT,\n\tMENU_TEMPLATE_PARTS,\n\tMENU_TEMPLATES_UNUSED,\n\tTEMPLATE_PARTS_SUB_MENUS,\n} from '../components/navigation-sidebar/navigation-panel/constants';\nimport {\n\tgetTemplateLocation,\n\tisTemplateSuperseded,\n} from '../components/navigation-sidebar/navigation-panel/template-hierarchy';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Helper for getting a preference from the preferences store.\n *\n * This is only present so that `getSettings` doesn't need to be made a\n * registry selector.\n *\n * It's unstable because the selector needs to be exported and so part of the\n * public API to work.\n */\nexport const __unstableGetPreference = createRegistrySelector(\n\t( select ) => ( state, name ) =>\n\t\tselect( preferencesStore ).get( 'core/edit-site', name )\n);\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport function isFeatureActive( state, featureName ) {\n\tdeprecated( `select( 'core/interface' ).isFeatureActive`, {\n\t\tsince: '6.0',\n\t\talternative: `select( 'core/preferences' ).get`,\n\t} );\n\n\treturn !! __unstableGetPreference( state, featureName );\n}\n\n/**\n * Returns the current editing canvas device type.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport function __experimentalGetPreviewDeviceType( state ) {\n\treturn state.deviceType;\n}\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector( ( select ) => () =>\n\tselect( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the settings, taking into account active features and permissions.\n *\n * @param {Object} state Global application state.\n * @param {Function} setIsInserterOpen Setter for the open state of the global inserter.\n *\n * @return {Object} Settings.\n */\nexport const getSettings = createSelector(\n\t( state, setIsInserterOpen ) => {\n\t\tconst settings = {\n\t\t\t...state.settings,\n\t\t\toutlineMode: true,\n\t\t\tfocusMode: !! __unstableGetPreference( state, 'focusMode' ),\n\t\t\thasFixedToolbar: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tshowIconLabels: !! __unstableGetPreference(\n\t\t\t\tstate,\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpen,\n\t\t\t__experimentalReusableBlocks: getReusableBlocks( state ),\n\t\t\t__experimentalPreferPatternsOnRoot:\n\t\t\t\t'wp_template' === getEditedPostType( state ),\n\t\t};\n\n\t\tconst canUserCreateMedia = getCanUserCreateMedia( state );\n\t\tif ( ! canUserCreateMedia ) {\n\t\t\treturn settings;\n\t\t}\n\n\t\tsettings.mediaUpload = ( { onError, ...rest } ) => {\n\t\t\tuploadMedia( {\n\t\t\t\twpAllowedMimeTypes: state.settings.allowedMimeTypes,\n\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t...rest,\n\t\t\t} );\n\t\t};\n\t\treturn settings;\n\t},\n\t( state ) => [\n\t\tgetCanUserCreateMedia( state ),\n\t\tstate.settings,\n\t\t__unstableGetPreference( state, 'focusMode' ),\n\t\t__unstableGetPreference( state, 'fixedToolbar' ),\n\t\t__unstableGetPreference( state, 'keepCaretInsideBlock' ),\n\t\t__unstableGetPreference( state, 'showIconLabels' ),\n\t\tgetReusableBlocks( state ),\n\t\tgetEditedPostType( state ),\n\t]\n);\n\n/**\n * Returns the current home template ID.\n *\n * @param {Object} state Global application state.\n *\n * @return {number?} Home template ID.\n */\nexport function getHomeTemplateId( state ) {\n\treturn state.homeTemplateId;\n}\n\nfunction getCurrentEditedPost( state ) {\n\treturn state.editedPost;\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn getCurrentEditedPost( state ).type;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn getCurrentEditedPost( state ).id;\n}\n\n/**\n * Returns the current page object.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn getCurrentEditedPost( state ).page;\n}\n\n/**\n * Returns the active menu in the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Active menu.\n */\nexport function getNavigationPanelActiveMenu( state ) {\n\treturn state.navigationPanel.menu;\n}\n\n/**\n * Returns the current template or template part's corresponding\n * navigation panel's sub menu, to be used with `openNavigationPanelToMenu`.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} The current template or template part's sub menu.\n */\nexport const getCurrentTemplateNavigationPanelSubMenu = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = templateId\n\t\t\t? select( coreDataStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplateType,\n\t\t\t\t\ttemplateId\n\t\t\t )\n\t\t\t: null;\n\n\t\tif ( ! template ) {\n\t\t\treturn MENU_ROOT;\n\t\t}\n\n\t\tif ( 'wp_template_part' === templateType ) {\n\t\t\treturn (\n\t\t\t\tTEMPLATE_PARTS_SUB_MENUS.find(\n\t\t\t\t\t( submenu ) => submenu.area === template?.area\n\t\t\t\t)?.menu || MENU_TEMPLATE_PARTS\n\t\t\t);\n\t\t}\n\n\t\tconst templates = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\t'wp_template'\n\t\t);\n\t\tconst showOnFront = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'root',\n\t\t\t'site'\n\t\t).show_on_front;\n\n\t\tif (\n\t\t\tisTemplateSuperseded(\n\t\t\t\ttemplate.slug,\n\t\t\t\tmap( templates, 'slug' ),\n\t\t\t\tshowOnFront\n\t\t\t)\n\t\t) {\n\t\t\treturn MENU_TEMPLATES_UNUSED;\n\t\t}\n\n\t\treturn getTemplateLocation( template.slug );\n\t}\n);\n\n/**\n * Returns the current opened/closed state of the navigation panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the navigation panel should be open; false if closed.\n */\nexport function isNavigationOpened( state ) {\n\treturn state.navigationPanel.isOpen;\n}\n\n/**\n * Returns the current opened/closed state of the inserter panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the inserter panel should be open; false if closed.\n */\nexport function isInserterOpened( state ) {\n\treturn !! state.blockInserterPanel;\n}\n\n/**\n * Get the insertion point for the inserter.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport function __experimentalGetInsertionPoint( state ) {\n\tconst {\n\t\trootClientId,\n\t\tinsertionIndex,\n\t\tfilterValue,\n\t} = state.blockInserterPanel;\n\treturn { rootClientId, insertionIndex, filterValue };\n}\n\n/**\n * Returns the current opened/closed state of the list view panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the list view panel should be open; false if closed.\n */\nexport function isListViewOpened( state ) {\n\treturn state.listViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst templateType = getEditedPostType( state );\n\t\tconst templateId = getEditedPostId( state );\n\t\tconst template = select( coreDataStore ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\ttemplateType,\n\t\t\ttemplateId\n\t\t);\n\n\t\tconst templateParts = select(\n\t\t\tcoreDataStore\n\t\t).getEntityRecords( 'postType', 'wp_template_part', { per_page: -1 } );\n\t\tconst templatePartsById = keyBy(\n\t\t\ttemplateParts,\n\t\t\t( templatePart ) => templatePart.id\n\t\t);\n\n\t\treturn ( template.blocks ?? [] )\n\t\t\t.filter( ( block ) => isTemplatePart( block ) )\n\t\t\t.map( ( block ) => {\n\t\t\t\tconst {\n\t\t\t\t\tattributes: { theme, slug },\n\t\t\t\t} = block;\n\t\t\t\tconst templatePartId = `${ theme }//${ slug }`;\n\t\t\t\tconst templatePart = templatePartsById[ templatePartId ];\n\n\t\t\t\treturn {\n\t\t\t\t\ttemplatePart,\n\t\t\t\t\tblock,\n\t\t\t\t};\n\t\t\t} )\n\t\t\t.filter( ( { templatePart } ) => !! templatePart );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport function getEditorMode( state ) {\n\treturn __unstableGetPreference( state, 'editorMode' );\n}\n"]}
|
|
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
304
304
|
display: flex;
|
|
305
305
|
flex-direction: column;
|
|
306
306
|
overflow: auto;
|
|
307
|
-
z-index:
|
|
307
|
+
z-index: 20;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
.interface-interface-skeleton__secondary-sidebar,
|
|
@@ -944,6 +944,40 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
|
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
946
|
|
|
947
|
+
.show-icon-labels .edit-site-header .components-button.has-icon {
|
|
948
|
+
width: auto;
|
|
949
|
+
}
|
|
950
|
+
.show-icon-labels .edit-site-header .components-button.has-icon svg {
|
|
951
|
+
display: none;
|
|
952
|
+
}
|
|
953
|
+
.show-icon-labels .edit-site-header .components-button.has-icon::after {
|
|
954
|
+
content: attr(aria-label);
|
|
955
|
+
}
|
|
956
|
+
.show-icon-labels .edit-site-header .components-button.has-icon[aria-disabled=true] {
|
|
957
|
+
background-color: transparent;
|
|
958
|
+
}
|
|
959
|
+
.show-icon-labels .edit-site-header .is-tertiary:active {
|
|
960
|
+
box-shadow: 0 0 0 1.5px var(--wp-admin-theme-color);
|
|
961
|
+
background-color: transparent;
|
|
962
|
+
}
|
|
963
|
+
.show-icon-labels .edit-site-header .edit-site-save-button__button {
|
|
964
|
+
padding-right: 6px;
|
|
965
|
+
padding-left: 6px;
|
|
966
|
+
margin-left: 4px;
|
|
967
|
+
}
|
|
968
|
+
.show-icon-labels .edit-site-header .block-editor-post-preview__button-toggle {
|
|
969
|
+
margin-left: 4px;
|
|
970
|
+
}
|
|
971
|
+
.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle,
|
|
972
|
+
.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info {
|
|
973
|
+
height: 36px;
|
|
974
|
+
padding: 0 6px;
|
|
975
|
+
}
|
|
976
|
+
.show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle::after,
|
|
977
|
+
.show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info::after {
|
|
978
|
+
content: none;
|
|
979
|
+
}
|
|
980
|
+
|
|
947
981
|
.edit-site-document-actions {
|
|
948
982
|
display: flex;
|
|
949
983
|
flex-direction: column;
|