@wordpress/edit-site 4.11.0 → 4.13.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/add-custom-template-modal.js +4 -2
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template.js +29 -4
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +152 -28
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +26 -12
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/global-styles/border-panel.js +3 -3
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +98 -8
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +4 -4
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +1 -1
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +51 -7
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +157 -0
- package/build/components/global-styles/screen-heading-color.js.map +1 -0
- package/build/components/global-styles/screen-typography-element.js +4 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +5 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +82 -14
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +217 -0
- package/build/components/global-styles/typography-utils.js.map +1 -0
- package/build/components/global-styles/ui.js +11 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +102 -49
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +54 -5
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/header/document-actions/index.js +1 -0
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/index.js +20 -6
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +0 -4
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +13 -3
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/undo-redo/redo.js +2 -1
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/list/actions/index.js +1 -1
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/save-button/index.js +2 -3
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/sidebar/default-sidebar.js +11 -1
- package/build/components/sidebar/default-sidebar.js.map +1 -1
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js +2 -2
- package/build/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +11 -1
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/template-card/template-actions.js +1 -1
- package/build/components/sidebar/template-card/template-actions.js.map +1 -1
- package/build/components/template-details/edit-template-title.js +1 -1
- package/build/components/template-details/edit-template-title.js.map +1 -1
- package/build/components/template-details/index.js +19 -9
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +1 -1
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/components/template-details/template-part-area-selector.js +47 -0
- package/build/components/template-details/template-part-area-selector.js.map +1 -0
- package/build/components/template-part-converter/convert-to-template-part.js +4 -1
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +4 -2
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +29 -6
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +147 -26
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +26 -12
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -3
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +96 -9
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +4 -4
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +1 -1
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +51 -7
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +143 -0
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -0
- package/build-module/components/global-styles/screen-typography-element.js +4 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +5 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +83 -15
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +204 -0
- package/build-module/components/global-styles/typography-utils.js.map +1 -0
- package/build-module/components/global-styles/ui.js +10 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +102 -53
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +53 -5
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/header/document-actions/index.js +1 -0
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/index.js +22 -8
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/mode-switcher/index.js +0 -4
- package/build-module/components/header/mode-switcher/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +13 -3
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/undo-redo/redo.js +3 -2
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/list/actions/index.js +1 -1
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/save-button/index.js +3 -4
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/sidebar/default-sidebar.js +9 -1
- package/build-module/components/sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js +3 -3
- package/build-module/components/sidebar/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +9 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/template-card/template-actions.js +1 -1
- package/build-module/components/sidebar/template-card/template-actions.js.map +1 -1
- package/build-module/components/template-details/edit-template-title.js +1 -1
- package/build-module/components/template-details/edit-template-title.js.map +1 -1
- package/build-module/components/template-details/index.js +19 -10
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +1 -1
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/components/template-details/template-part-area-selector.js +35 -0
- package/build-module/components/template-details/template-part-area-selector.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-template-part.js +3 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +15 -8
- package/build-style/style.css +15 -8
- package/package.json +29 -29
- package/src/components/add-new-template/add-custom-template-modal.js +12 -3
- package/src/components/add-new-template/new-template.js +53 -24
- package/src/components/add-new-template/utils.js +145 -16
- package/src/components/block-editor/resizable-editor.js +28 -18
- package/src/components/editor/style.scss +1 -0
- package/src/components/global-styles/border-panel.js +3 -3
- package/src/components/global-styles/dimensions-panel.js +139 -33
- package/src/components/global-styles/hooks.js +4 -3
- package/src/components/global-styles/screen-color-palette.js +1 -1
- package/src/components/global-styles/screen-colors.js +46 -4
- package/src/components/global-styles/screen-heading-color.js +201 -0
- package/src/components/global-styles/screen-typography-element.js +4 -0
- package/src/components/global-styles/screen-typography.js +6 -0
- package/src/components/global-styles/style.scss +14 -6
- package/src/components/global-styles/test/typography-utils.js +130 -0
- package/src/components/global-styles/test/use-global-styles-output.js +79 -3
- package/src/components/global-styles/test/utils.js +68 -8
- package/src/components/global-styles/typography-panel.js +119 -48
- package/src/components/global-styles/typography-utils.js +228 -0
- package/src/components/global-styles/ui.js +13 -0
- package/src/components/global-styles/use-global-styles-output.js +119 -61
- package/src/components/global-styles/utils.js +39 -4
- package/src/components/header/document-actions/index.js +3 -0
- package/src/components/header/index.js +32 -4
- package/src/components/header/mode-switcher/index.js +0 -3
- package/src/components/header/more-menu/index.js +7 -2
- package/src/components/header/undo-redo/redo.js +6 -2
- package/src/components/list/actions/index.js +3 -1
- package/src/components/save-button/index.js +10 -13
- package/src/components/sidebar/default-sidebar.js +12 -0
- package/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js +1 -5
- package/src/components/sidebar/plugin-sidebar/index.js +12 -0
- package/src/components/sidebar/template-card/template-actions.js +3 -1
- package/src/components/template-details/edit-template-title.js +7 -3
- package/src/components/template-details/index.js +23 -8
- package/src/components/template-details/style.scss +0 -5
- package/src/components/template-details/template-areas.js +3 -1
- package/src/components/template-details/template-part-area-selector.js +38 -0
- package/src/components/template-part-converter/convert-to-template-part.js +3 -1
- package/src/index.js +1 -1
|
@@ -9,9 +9,17 @@ var _element = require("@wordpress/element");
|
|
|
9
9
|
|
|
10
10
|
var _interface = require("@wordpress/interface");
|
|
11
11
|
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
|
|
14
|
+
var _store = require("../../store");
|
|
15
|
+
|
|
12
16
|
/**
|
|
13
17
|
* WordPress dependencies
|
|
14
18
|
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Internal dependencies
|
|
22
|
+
*/
|
|
15
23
|
function DefaultSidebar(_ref) {
|
|
16
24
|
let {
|
|
17
25
|
className,
|
|
@@ -24,6 +32,7 @@ function DefaultSidebar(_ref) {
|
|
|
24
32
|
headerClassName,
|
|
25
33
|
panelClassName
|
|
26
34
|
} = _ref;
|
|
35
|
+
const showIconLabels = (0, _data.useSelect)(select => select(_store.store).getSettings().showIconLabels, []);
|
|
27
36
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_interface.ComplementaryArea, {
|
|
28
37
|
className: className,
|
|
29
38
|
scope: "core/edit-site",
|
|
@@ -33,7 +42,8 @@ function DefaultSidebar(_ref) {
|
|
|
33
42
|
closeLabel: closeLabel,
|
|
34
43
|
header: header,
|
|
35
44
|
headerClassName: headerClassName,
|
|
36
|
-
panelClassName: panelClassName
|
|
45
|
+
panelClassName: panelClassName,
|
|
46
|
+
showIconLabels: showIconLabels
|
|
37
47
|
}, children), (0, _element.createElement)(_interface.ComplementaryAreaMoreMenuItem, {
|
|
38
48
|
scope: "core/edit-site",
|
|
39
49
|
identifier: identifier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/default-sidebar.js"],"names":["DefaultSidebar","className","identifier","title","icon","children","closeLabel","header","headerClassName","panelClassName"],"mappings":";;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/default-sidebar.js"],"names":["DefaultSidebar","className","identifier","title","icon","children","closeLabel","header","headerClassName","panelClassName","showIconLabels","select","editSiteStore","getSettings"],"mappings":";;;;;;;;;AAGA;;AAIA;;AAKA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,cAAT,OAUX;AAAA,MAVoC;AACvCC,IAAAA,SADuC;AAEvCC,IAAAA,UAFuC;AAGvCC,IAAAA,KAHuC;AAIvCC,IAAAA,IAJuC;AAKvCC,IAAAA,QALuC;AAMvCC,IAAAA,UANuC;AAOvCC,IAAAA,MAPuC;AAQvCC,IAAAA,eARuC;AASvCC,IAAAA;AATuC,GAUpC;AACH,QAAMC,cAAc,GAAG,qBACpBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAwBC,WAAxB,GAAsCH,cAD9B,EAEtB,EAFsB,CAAvB;AAKA,SACC,qDACC,4BAAC,4BAAD;AACC,IAAA,SAAS,EAAGT,SADb;AAEC,IAAA,KAAK,EAAC,gBAFP;AAGC,IAAA,UAAU,EAAGC,UAHd;AAIC,IAAA,KAAK,EAAGC,KAJT;AAKC,IAAA,IAAI,EAAGC,IALR;AAMC,IAAA,UAAU,EAAGE,UANd;AAOC,IAAA,MAAM,EAAGC,MAPV;AAQC,IAAA,eAAe,EAAGC,eARnB;AASC,IAAA,cAAc,EAAGC,cATlB;AAUC,IAAA,cAAc,EAAGC;AAVlB,KAYGL,QAZH,CADD,EAeC,4BAAC,wCAAD;AACC,IAAA,KAAK,EAAC,gBADP;AAEC,IAAA,UAAU,EAAGH,UAFd;AAGC,IAAA,IAAI,EAAGE;AAHR,KAKGD,KALH,CAfD,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tComplementaryArea,\n\tComplementaryAreaMoreMenuItem,\n} from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function DefaultSidebar( {\n\tclassName,\n\tidentifier,\n\ttitle,\n\ticon,\n\tchildren,\n\tcloseLabel,\n\theader,\n\theaderClassName,\n\tpanelClassName,\n} ) {\n\tconst showIconLabels = useSelect(\n\t\t( select ) => select( editSiteStore ).getSettings().showIconLabels,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<ComplementaryArea\n\t\t\t\tclassName={ className }\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ icon }\n\t\t\t\tcloseLabel={ closeLabel }\n\t\t\t\theader={ header }\n\t\t\t\theaderClassName={ headerClassName }\n\t\t\t\tpanelClassName={ panelClassName }\n\t\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</ComplementaryArea>\n\t\t\t<ComplementaryAreaMoreMenuItem\n\t\t\t\tscope=\"core/edit-site\"\n\t\t\t\tidentifier={ identifier }\n\t\t\t\ticon={ icon }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</ComplementaryAreaMoreMenuItem>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -43,8 +43,8 @@ function NavigationMenu(_ref) {
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
}, [updateBlockListSettings, innerBlocks]);
|
|
46
|
-
return (0, _element.createElement)(
|
|
46
|
+
return (0, _element.createElement)(_blockEditor.__experimentalListView, {
|
|
47
47
|
id: id
|
|
48
|
-
})
|
|
48
|
+
});
|
|
49
49
|
}
|
|
50
50
|
//# sourceMappingURL=navigation-menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js"],"names":["ALLOWED_BLOCKS","NavigationMenu","innerBlocks","id","updateBlockListSettings","blockEditorStore","allowedBlocks","forEach","block","name","clientId"],"mappings":";;;;;;;AAOA;;AAJA;;AAKA;;AARA;AACA;AACA;AAQA,MAAMA,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB;AAjBF,CAAvB;;AAuBe,SAASC,cAAT,OAA+C;AAAA,MAAtB;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAAsB;AAC7D,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaC,kBAAb,CAApC,CAD6D,CAG7D;AACA;;AACA,0BAAW,MAAM;AAChBD,IAAAA,uBAAuB,CAAE,EAAF,EAAM;AAC5BE,MAAAA,aAAa,EAAEN,cAAc,CAAE,iBAAF;AADD,KAAN,CAAvB;AAGAE,IAAAA,WAAW,CAACK,OAAZ,CAAuBC,KAAF,IAAa;AACjC,UAAKR,cAAc,CAAEQ,KAAK,CAACC,IAAR,CAAnB,EAAoC;AACnCL,QAAAA,uBAAuB,CAAEI,KAAK,CAACE,QAAR,EAAkB;AACxCJ,UAAAA,aAAa,EAAEN,cAAc,CAAEQ,KAAK,CAACC,IAAR;AADW,SAAlB,CAAvB;AAGA;AACD,KAND;AAOA,GAXD,EAWG,CAAEL,uBAAF,EAA2BF,WAA3B,CAXH;AAYA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/navigation-menu-sidebar/navigation-menu.js"],"names":["ALLOWED_BLOCKS","NavigationMenu","innerBlocks","id","updateBlockListSettings","blockEditorStore","allowedBlocks","forEach","block","name","clientId"],"mappings":";;;;;;;AAOA;;AAJA;;AAKA;;AARA;AACA;AACA;AAQA,MAAMA,cAAc,GAAG;AACtB,qBAAmB,CAClB,sBADkB,EAElB,aAFkB,EAGlB,mBAHkB,EAIlB,gBAJkB,EAKlB,aALkB,EAMlB,gBANkB,EAOlB,iBAPkB,EAQlB,gBARkB,EASlB,yBATkB,CADG;AAYtB,uBAAqB,CAAE,kBAAF,CAZC;AAatB,6BAA2B,CAC1B,sBAD0B,EAE1B,yBAF0B,CAbL;AAiBtB,0BAAwB,CACvB,sBADuB,EAEvB,yBAFuB;AAjBF,CAAvB;;AAuBe,SAASC,cAAT,OAA+C;AAAA,MAAtB;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAAsB;AAC7D,QAAM;AAAEC,IAAAA;AAAF,MAA8B,uBAAaC,kBAAb,CAApC,CAD6D,CAG7D;AACA;;AACA,0BAAW,MAAM;AAChBD,IAAAA,uBAAuB,CAAE,EAAF,EAAM;AAC5BE,MAAAA,aAAa,EAAEN,cAAc,CAAE,iBAAF;AADD,KAAN,CAAvB;AAGAE,IAAAA,WAAW,CAACK,OAAZ,CAAuBC,KAAF,IAAa;AACjC,UAAKR,cAAc,CAAEQ,KAAK,CAACC,IAAR,CAAnB,EAAoC;AACnCL,QAAAA,uBAAuB,CAAEI,KAAK,CAACE,QAAR,EAAkB;AACxCJ,UAAAA,aAAa,EAAEN,cAAc,CAAEQ,KAAK,CAACC,IAAR;AADW,SAAlB,CAAvB;AAGA;AACD,KAND;AAOA,GAXD,EAWG,CAAEL,uBAAF,EAA2BF,WAA3B,CAXH;AAYA,SAAO,4BAAC,mCAAD;AAAU,IAAA,EAAE,EAAGC;AAAf,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalListView as ListView,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\n\nconst ALLOWED_BLOCKS = {\n\t'core/navigation': [\n\t\t'core/navigation-link',\n\t\t'core/search',\n\t\t'core/social-links',\n\t\t'core/page-list',\n\t\t'core/spacer',\n\t\t'core/home-link',\n\t\t'core/site-title',\n\t\t'core/site-logo',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/social-links': [ 'core/social-link' ],\n\t'core/navigation-submenu': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n\t'core/navigation-link': [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t],\n};\n\nexport default function NavigationMenu( { innerBlocks, id } ) {\n\tconst { updateBlockListSettings } = useDispatch( blockEditorStore );\n\n\t//TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList\n\t//Think through a better way of doing this, possible with adding allowed blocks to block library metadata\n\tuseEffect( () => {\n\t\tupdateBlockListSettings( '', {\n\t\t\tallowedBlocks: ALLOWED_BLOCKS[ 'core/navigation' ],\n\t\t} );\n\t\tinnerBlocks.forEach( ( block ) => {\n\t\t\tif ( ALLOWED_BLOCKS[ block.name ] ) {\n\t\t\t\tupdateBlockListSettings( block.clientId, {\n\t\t\t\t\tallowedBlocks: ALLOWED_BLOCKS[ block.name ],\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}, [ updateBlockListSettings, innerBlocks ] );\n\treturn <ListView id={ id } />;\n}\n"]}
|
|
@@ -13,10 +13,18 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
|
|
14
14
|
var _interface = require("@wordpress/interface");
|
|
15
15
|
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _store = require("../../../store");
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* WordPress dependencies
|
|
18
22
|
*/
|
|
19
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
|
|
20
28
|
/**
|
|
21
29
|
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
22
30
|
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
@@ -87,10 +95,12 @@ function PluginSidebarEditSite(_ref) {
|
|
|
87
95
|
className,
|
|
88
96
|
...props
|
|
89
97
|
} = _ref;
|
|
98
|
+
const showIconLabels = (0, _data.useSelect)(select => select(_store.store).getSettings().showIconLabels, []);
|
|
90
99
|
return (0, _element.createElement)(_interface.ComplementaryArea, (0, _extends2.default)({
|
|
91
100
|
panelClassName: className,
|
|
92
101
|
className: "edit-site-sidebar",
|
|
93
|
-
scope: "core/edit-site"
|
|
102
|
+
scope: "core/edit-site",
|
|
103
|
+
showIconLabels: showIconLabels
|
|
94
104
|
}, props));
|
|
95
105
|
}
|
|
96
106
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/plugin-sidebar/index.js"],"names":["PluginSidebarEditSite","className","props"],"mappings":";;;;;;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/plugin-sidebar/index.js"],"names":["PluginSidebarEditSite","className","props","showIconLabels","select","editSiteStore","getSettings"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAT,OAA0D;AAAA,MAA1B;AAAEC,IAAAA,SAAF;AAAa,OAAGC;AAAhB,GAA0B;AACxE,QAAMC,cAAc,GAAG,qBACpBC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAAwBC,WAAxB,GAAsCH,cAD9B,EAEtB,EAFsB,CAAvB;AAKA,SACC,4BAAC,4BAAD;AACC,IAAA,cAAc,EAAGF,SADlB;AAEC,IAAA,SAAS,EAAC,mBAFX;AAGC,IAAA,KAAK,EAAC,gBAHP;AAIC,IAAA,cAAc,EAAGE;AAJlB,KAKMD,KALN,EADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ComplementaryArea } from '@wordpress/interface';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\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 when the sidebar is pinned to toolbar.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = wp.element.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editSite.PluginSidebar;\n * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/edit-site';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebarEditSite( { className, ...props } ) {\n\tconst showIconLabels = useSelect(\n\t\t( select ) => select( editSiteStore ).getSettings().showIconLabels,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"edit-site-sidebar\"\n\t\t\tscope=\"core/edit-site\"\n\t\t\tshowIconLabels={ showIconLabels }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -53,7 +53,7 @@ function Actions(_ref) {
|
|
|
53
53
|
onClose
|
|
54
54
|
} = _ref2;
|
|
55
55
|
return (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
|
|
56
|
-
info: (0, _i18n.__)('
|
|
56
|
+
info: (0, _i18n.__)('Use the template as supplied by the theme.'),
|
|
57
57
|
onClick: () => {
|
|
58
58
|
revertTemplate(template);
|
|
59
59
|
onClose();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/template-card/template-actions.js"],"names":["Actions","template","revertTemplate","editSiteStore","isRevertable","moreVertical","isSmall","onClose"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIe,SAASA,OAAT,OAAiC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC/C,QAAM;AAAEC,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AACA,QAAMC,YAAY,GAAG,mCAAsBH,QAAtB,CAArB;;AACA,MAAK,CAAEG,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SACC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAGC,mBADR;AAEC,IAAA,KAAK,EAAG,cAAI,SAAJ,CAFT;AAGC,IAAA,SAAS,EAAC,kCAHX;AAIC,IAAA,WAAW,EAAG;AAAEC,MAAAA,OAAO,EAAE;AAAX;AAJf,KAMG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/template-card/template-actions.js"],"names":["Actions","template","revertTemplate","editSiteStore","isRevertable","moreVertical","isSmall","onClose"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAZA;AACA;AACA;;AAMA;AACA;AACA;AAIe,SAASA,OAAT,OAAiC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AAC/C,QAAM;AAAEC,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AACA,QAAMC,YAAY,GAAG,mCAAsBH,QAAtB,CAArB;;AACA,MAAK,CAAEG,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SACC,4BAAC,wBAAD;AACC,IAAA,IAAI,EAAGC,mBADR;AAEC,IAAA,KAAK,EAAG,cAAI,SAAJ,CAFT;AAGC,IAAA,SAAS,EAAC,kCAHX;AAIC,IAAA,WAAW,EAAG;AAAEC,MAAAA,OAAO,EAAE;AAAX;AAJf,KAMG;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,MAAA,IAAI,EAAG,cACN,4CADM,CADR;AAIC,MAAA,OAAO,EAAG,MAAM;AACfL,QAAAA,cAAc,CAAED,QAAF,CAAd;AACAM,QAAAA,OAAO;AACP;AAPF,OASG,cAAI,sBAAJ,CATH,CADD,CADC;AAAA,GANH,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport isTemplateRevertable from '../../../utils/is-template-revertable';\n\nexport default function Actions( { template } ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst isRevertable = isTemplateRevertable( template );\n\tif ( ! isRevertable ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\ttoggleProps={ { isSmall: true } }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\trevertTemplate( template );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
|
|
@@ -25,7 +25,7 @@ function EditTemplateTitle(_ref) {
|
|
|
25
25
|
return (0, _element.createElement)(_components.TextControl, {
|
|
26
26
|
label: (0, _i18n.__)('Title'),
|
|
27
27
|
value: forceEmpty ? '' : title,
|
|
28
|
-
help: (0, _i18n.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
|
|
28
|
+
help: template.type !== 'wp_template_part' ? (0, _i18n.__)('Give the template a title that indicates its purpose, e.g. "Full Width".') : null,
|
|
29
29
|
onChange: newTitle => {
|
|
30
30
|
if (!newTitle && !forceEmpty) {
|
|
31
31
|
setForceEmpty(true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/edit-template-title.js"],"names":["EditTemplateTitle","template","forceEmpty","setForceEmpty","title","setTitle","type","id","newTitle"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AALA;AACA;AACA;AAMe,SAASA,iBAAT,OAA2C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACzD,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,KAAV,CAAtC;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,6BAC3B,UAD2B,EAE3BJ,QAAQ,CAACK,IAFkB,EAG3B,OAH2B,EAI3BL,QAAQ,CAACM,EAJkB,CAA5B;AAOA,SACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGL,UAAU,GAAG,EAAH,GAAQE,KAF3B;AAGC,IAAA,IAAI,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/edit-template-title.js"],"names":["EditTemplateTitle","template","forceEmpty","setForceEmpty","title","setTitle","type","id","newTitle"],"mappings":";;;;;;;AAMA;;AAHA;;AACA;;AACA;;AALA;AACA;AACA;AAMe,SAASA,iBAAT,OAA2C;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACzD,QAAM,CAAEC,UAAF,EAAcC,aAAd,IAAgC,uBAAU,KAAV,CAAtC;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,6BAC3B,UAD2B,EAE3BJ,QAAQ,CAACK,IAFkB,EAG3B,OAH2B,EAI3BL,QAAQ,CAACM,EAJkB,CAA5B;AAOA,SACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGL,UAAU,GAAG,EAAH,GAAQE,KAF3B;AAGC,IAAA,IAAI,EACHH,QAAQ,CAACK,IAAT,KAAkB,kBAAlB,GACG,cACA,0EADA,CADH,GAIG,IARL;AAUC,IAAA,QAAQ,EAAKE,QAAF,IAAgB;AAC1B,UAAK,CAAEA,QAAF,IAAc,CAAEN,UAArB,EAAkC;AACjCC,QAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AACA;;AACDA,MAAAA,aAAa,CAAE,KAAF,CAAb;AACAE,MAAAA,QAAQ,CAAEG,QAAF,CAAR;AACA,KAjBF;AAkBC,IAAA,MAAM,EAAG,MAAML,aAAa,CAAE,KAAF;AAlB7B,IADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\nexport default function EditTemplateTitle( { template } ) {\n\tconst [ forceEmpty, setForceEmpty ] = useState( false );\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\ttemplate.type,\n\t\t'title',\n\t\ttemplate.id\n\t);\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ forceEmpty ? '' : title }\n\t\t\thelp={\n\t\t\t\ttemplate.type !== 'wp_template_part'\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t\t\t )\n\t\t\t\t\t: null\n\t\t\t}\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tif ( ! newTitle && ! forceEmpty ) {\n\t\t\t\t\tsetForceEmpty( true );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsetForceEmpty( false );\n\t\t\t\tsetTitle( newTitle );\n\t\t\t} }\n\t\t\tonBlur={ () => setForceEmpty( false ) }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -29,6 +29,8 @@ var _editTemplateTitle = _interopRequireDefault(require("./edit-template-title")
|
|
|
29
29
|
|
|
30
30
|
var _link = require("../routes/link");
|
|
31
31
|
|
|
32
|
+
var _templatePartAreaSelector = _interopRequireDefault(require("./template-part-area-selector"));
|
|
33
|
+
|
|
32
34
|
/**
|
|
33
35
|
* WordPress dependencies
|
|
34
36
|
*/
|
|
@@ -52,9 +54,11 @@ function TemplateDetails(_ref) {
|
|
|
52
54
|
// TODO: We should update this to filter by template part's areas as well.
|
|
53
55
|
postType: template.type,
|
|
54
56
|
postId: undefined
|
|
55
|
-
});
|
|
57
|
+
});
|
|
58
|
+
const isTemplatePart = template.type === 'wp_template_part'; // Only user-created and non-default templates can change the name.
|
|
59
|
+
// But any user-created template part can be renamed.
|
|
56
60
|
|
|
57
|
-
const canEditTitle = template.is_custom && !template.has_theme_file;
|
|
61
|
+
const canEditTitle = isTemplatePart ? !template.has_theme_file : template.is_custom && !template.has_theme_file;
|
|
58
62
|
|
|
59
63
|
if (!template) {
|
|
60
64
|
return null;
|
|
@@ -67,25 +71,31 @@ function TemplateDetails(_ref) {
|
|
|
67
71
|
|
|
68
72
|
return (0, _element.createElement)("div", {
|
|
69
73
|
className: "edit-site-template-details"
|
|
70
|
-
}, (0, _element.createElement)(
|
|
71
|
-
className: "edit-site-template-details__group"
|
|
74
|
+
}, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
75
|
+
className: "edit-site-template-details__group",
|
|
76
|
+
spacing: 3
|
|
72
77
|
}, canEditTitle ? (0, _element.createElement)(_editTemplateTitle.default, {
|
|
73
78
|
template: template
|
|
74
|
-
}) : (0, _element.createElement)(_components.
|
|
75
|
-
|
|
79
|
+
}) : (0, _element.createElement)(_components.__experimentalText, {
|
|
80
|
+
size: 16,
|
|
76
81
|
weight: 600,
|
|
77
|
-
className: "edit-site-template-details__title"
|
|
82
|
+
className: "edit-site-template-details__title",
|
|
83
|
+
as: "p"
|
|
78
84
|
}, title), description && (0, _element.createElement)(_components.__experimentalText, {
|
|
79
85
|
size: "body",
|
|
80
86
|
className: "edit-site-template-details__description",
|
|
81
87
|
as: "p"
|
|
82
|
-
}, description)), (0, _element.createElement)(
|
|
88
|
+
}, description)), isTemplatePart && (0, _element.createElement)("div", {
|
|
89
|
+
className: "edit-site-template-details__group"
|
|
90
|
+
}, (0, _element.createElement)(_templatePartAreaSelector.default, {
|
|
91
|
+
id: template.id
|
|
92
|
+
})), (0, _element.createElement)(_templateAreas.default, {
|
|
83
93
|
closeTemplateDetailsDropdown: onClose
|
|
84
94
|
}), (0, _isTemplateRevertable.default)(template) && (0, _element.createElement)(_components.MenuGroup, {
|
|
85
95
|
className: "edit-site-template-details__group edit-site-template-details__revert"
|
|
86
96
|
}, (0, _element.createElement)(_components.MenuItem, {
|
|
87
97
|
className: "edit-site-template-details__revert-button",
|
|
88
|
-
info: (0, _i18n.__)('
|
|
98
|
+
info: (0, _i18n.__)('Use the template as supplied by the theme.'),
|
|
89
99
|
onClick: revert
|
|
90
100
|
}, (0, _i18n.__)('Clear customizations'))), (0, _element.createElement)(_components.Button, (0, _extends2.default)({
|
|
91
101
|
className: "edit-site-template-details__show-all-button"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","browseAllLinkProps","postType","type","postId","undefined","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["TemplateDetails","template","onClose","title","description","select","editorStore","__experimentalGetTemplateInfo","revertTemplate","editSiteStore","browseAllLinkProps","postType","type","postId","undefined","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AAOA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAYA;AACA;AACA;AAQe,SAASA,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyB,qBAC5BC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,6BAAtB,CAAqDN,QAArD,CAF6B,EAG9B,EAH8B,CAA/B;AAKA,QAAM;AAAEO,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;A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,KACD,4BAAC,qBAAD;AAAW,IAAA,SAAS,EAAC;AAArB,KACC,4BAAC,oBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAG,cACN,4CADM,CAFR;AAKC,IAAA,OAAO,EAAGkB;AALX,KAOG,cAAI,sBAAJ,CAPH,CADD,CAnCF,EAgDC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC;AADX,KAEMT,kBAFN,GAIG,CAAAT,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEW,IAAV,MAAmB,aAAnB,GACC,cAAI,sBAAJ,CADD,GAEC,cAAI,2BAAJ,CANJ,CAhDD,CADD;AA2DA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport TemplateAreas from './template-areas';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\tconst browseAllLinkProps = useLink( {\n\t\t// TODO: We should update this to filter by template part's areas as well.\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t<TemplateAreas closeTemplateDetailsDropdown={ onClose } />\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Browse all templates' )\n\t\t\t\t\t: __( 'Browse all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -76,7 +76,7 @@ function TemplatePartItemMore(_ref) {
|
|
|
76
76
|
}), (0, _i18n.sprintf)(
|
|
77
77
|
/* translators: %s: template part title */
|
|
78
78
|
(0, _i18n.__)('Edit %s'), (_templatePart$title = templatePart.title) === null || _templatePart$title === void 0 ? void 0 : _templatePart$title.rendered))), (0, _isTemplateRevertable.default)(templatePart) && (0, _element.createElement)(_components.MenuGroup, null, (0, _element.createElement)(_components.MenuItem, {
|
|
79
|
-
info: (0, _i18n.__)('
|
|
79
|
+
info: (0, _i18n.__)('Use the template part as supplied by the theme.'),
|
|
80
80
|
onClick: clearCustomizations
|
|
81
81
|
}, (0, _i18n.__)('Clear customizations'))));
|
|
82
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["TemplatePartItemMore","onClose","templatePart","closeTemplateDetailsDropdown","revertTemplate","editSiteStore","params","editLinkProps","postId","id","postType","type","fromTemplateId","editTemplatePart","event","onClick","clearCustomizations","title","rendered","TemplatePartItem","clientId","selectBlock","toggleBlockHighlight","blockEditorStore","templatePartArea","select","defaultAreas","editorStore","__experimentalGetDefaultTemplatePartAreas","find","defaultArea","area","highlightBlock","cancelHighlightBlock","icon","label","moreVertical","TemplateAreas","templateParts","getCurrentTemplateTemplateParts","length","map","block","slug"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMA,SAASA,oBAAT,OAII;AAAA;;AAAA,MAJ2B;AAC9BC,IAAAA,OAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA;AAH8B,GAI3B;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,aAAa,GAAG,mBACrB;AACCC,IAAAA,MAAM,EAAEN,YAAY,CAACO,EADtB;AAECC,IAAAA,QAAQ,EAAER,YAAY,CAACS;AAFxB,GADqB,EAKrB;AACCC,IAAAA,cAAc,EAAEN,MAAM,CAACE;AADxB,GALqB,CAAtB;;AAUA,WAASK,gBAAT,CAA2BC,KAA3B,EAAmC;AAClCP,IAAAA,aAAa,CAACQ,OAAd,CAAuBD,KAAvB;AACAb,IAAAA,OAAO;AACPE,IAAAA,4BAA4B;AAC5B;;AAED,WAASa,mBAAT,GAA+B;AAC9BZ,IAAAA,cAAc,CAAEF,YAAF,CAAd;AACAD,IAAAA,OAAO;AACPE,IAAAA,4BAA4B;AAC5B;;AAED,SACC,qDACC,4BAAC,qBAAD,QACC,4BAAC,oBAAD,6BAAeI,aAAf;AAA+B,IAAA,OAAO,EAAGM;AAAzC,MACG;AACD;AACA,gBAAI,SAAJ,CAFC,yBAGDX,YAAY,CAACe,KAHZ,wDAGD,oBAAoBC,QAHnB,CADH,CADD,CADD,EAUG,mCAAsBhB,YAAtB,KACD,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-areas.js"],"names":["TemplatePartItemMore","onClose","templatePart","closeTemplateDetailsDropdown","revertTemplate","editSiteStore","params","editLinkProps","postId","id","postType","type","fromTemplateId","editTemplatePart","event","onClick","clearCustomizations","title","rendered","TemplatePartItem","clientId","selectBlock","toggleBlockHighlight","blockEditorStore","templatePartArea","select","defaultAreas","editorStore","__experimentalGetDefaultTemplatePartAreas","find","defaultArea","area","highlightBlock","cancelHighlightBlock","icon","label","moreVertical","TemplateAreas","templateParts","getCurrentTemplateTemplateParts","length","map","block","slug"],"mappings":";;;;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAQA;AACA;AACA;AAMA,SAASA,oBAAT,OAII;AAAA;;AAAA,MAJ2B;AAC9BC,IAAAA,OAD8B;AAE9BC,IAAAA,YAF8B;AAG9BC,IAAAA;AAH8B,GAI3B;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAqB,uBAAaC,YAAb,CAA3B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAa,0BAAnB;AACA,QAAMC,aAAa,GAAG,mBACrB;AACCC,IAAAA,MAAM,EAAEN,YAAY,CAACO,EADtB;AAECC,IAAAA,QAAQ,EAAER,YAAY,CAACS;AAFxB,GADqB,EAKrB;AACCC,IAAAA,cAAc,EAAEN,MAAM,CAACE;AADxB,GALqB,CAAtB;;AAUA,WAASK,gBAAT,CAA2BC,KAA3B,EAAmC;AAClCP,IAAAA,aAAa,CAACQ,OAAd,CAAuBD,KAAvB;AACAb,IAAAA,OAAO;AACPE,IAAAA,4BAA4B;AAC5B;;AAED,WAASa,mBAAT,GAA+B;AAC9BZ,IAAAA,cAAc,CAAEF,YAAF,CAAd;AACAD,IAAAA,OAAO;AACPE,IAAAA,4BAA4B;AAC5B;;AAED,SACC,qDACC,4BAAC,qBAAD,QACC,4BAAC,oBAAD,6BAAeI,aAAf;AAA+B,IAAA,OAAO,EAAGM;AAAzC,MACG;AACD;AACA,gBAAI,SAAJ,CAFC,yBAGDX,YAAY,CAACe,KAHZ,wDAGD,oBAAoBC,QAHnB,CADH,CADD,CADD,EAUG,mCAAsBhB,YAAtB,KACD,4BAAC,qBAAD,QACC,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAG,cACN,iDADM,CADR;AAIC,IAAA,OAAO,EAAGc;AAJX,KAMG,cAAI,sBAAJ,CANH,CADD,CAXF,CADD;AAyBA;;AAED,SAASG,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AAC;AAHX,KAKG;AAAA,QAAE;AAAEnC,MAAAA;AAAF,KAAF;AAAA,WACD,4BAAC,oBAAD;AACC,MAAA,OAAO,EAAGA,OADX;AAEC,MAAA,YAAY,EAAGC,YAFhB;AAGC,MAAA,4BAA4B,EAC3BC;AAJF,MADC;AAAA,GALH,CAnBD,CADD;AAqCA;;AAEc,SAASkC,aAAT,QAA2D;AAAA,MAAnC;AAAElC,IAAAA;AAAF,GAAmC;AACzE,QAAMmC,aAAa,GAAG,qBACnBb,MAAF,IAAcA,MAAM,CAAEpB,YAAF,CAAN,CAAwBkC,+BAAxB,EADO,EAErB,EAFqB,CAAtB;;AAKA,MAAK,CAAED,aAAa,CAACE,MAArB,EAA8B;AAC7B,WAAO,IAAP;AACA;;AAED,SACC,4BAAC,qBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGF,aAAa,CAACG,GAAd,CAAmB;AAAA,QAAE;AAAEvC,MAAAA,YAAF;AAAgBwC,MAAAA;AAAhB,KAAF;AAAA,WACpB,4BAAC,gBAAD;AACC,MAAA,GAAG,EAAGxC,YAAY,CAACyC,IADpB;AAEC,MAAA,QAAQ,EAAGD,KAAK,CAACtB,QAFlB;AAGC,MAAA,YAAY,EAAGlB,YAHhB;AAIC,MAAA,4BAA4B,EAC3BC;AALF,MADoB;AAAA,GAAnB,CAJH,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { useLocation } from '../routes';\nimport { useLink } from '../routes/link';\n\nfunction TemplatePartItemMore( {\n\tonClose,\n\ttemplatePart,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\tconst { params } = useLocation();\n\tconst editLinkProps = useLink(\n\t\t{\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: templatePart.type,\n\t\t},\n\t\t{\n\t\t\tfromTemplateId: params.postId,\n\t\t}\n\t);\n\n\tfunction editTemplatePart( event ) {\n\t\teditLinkProps.onClick( event );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\tfunction clearCustomizations() {\n\t\trevertTemplate( templatePart );\n\t\tonClose();\n\t\tcloseTemplateDetailsDropdown();\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuGroup>\n\t\t\t\t<MenuItem { ...editLinkProps } onClick={ editTemplatePart }>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\t\ttemplatePart.title?.rendered\n\t\t\t\t\t) }\n\t\t\t\t</MenuItem>\n\t\t\t</MenuGroup>\n\t\t\t{ isTemplateRevertable( templatePart ) && (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template part as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ clearCustomizations }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction TemplatePartItem( {\n\ttemplatePart,\n\tclientId,\n\tcloseTemplateDetailsDropdown,\n} ) {\n\tconst { selectBlock, toggleBlockHighlight } =\n\t\tuseDispatch( blockEditorStore );\n\tconst templatePartArea = useSelect(\n\t\t( select ) => {\n\t\t\tconst defaultAreas =\n\t\t\t\tselect(\n\t\t\t\t\teditorStore\n\t\t\t\t).__experimentalGetDefaultTemplatePartAreas();\n\n\t\t\treturn defaultAreas.find(\n\t\t\t\t( defaultArea ) => defaultArea.area === templatePart.area\n\t\t\t);\n\t\t},\n\t\t[ templatePart.area ]\n\t);\n\tconst highlightBlock = () => toggleBlockHighlight( clientId, true );\n\tconst cancelHighlightBlock = () => toggleBlockHighlight( clientId, false );\n\n\treturn (\n\t\t<div\n\t\t\trole=\"menuitem\"\n\t\t\tclassName=\"edit-site-template-details__template-areas-item\"\n\t\t>\n\t\t\t<MenuItem\n\t\t\t\trole=\"button\"\n\t\t\t\ticon={ templatePartArea?.icon }\n\t\t\t\ticonPosition=\"left\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tselectBlock( clientId );\n\t\t\t\t} }\n\t\t\t\tonMouseOver={ highlightBlock }\n\t\t\t\tonMouseLeave={ cancelHighlightBlock }\n\t\t\t\tonFocus={ highlightBlock }\n\t\t\t\tonBlur={ cancelHighlightBlock }\n\t\t\t>\n\t\t\t\t{ templatePartArea?.label }\n\t\t\t</MenuItem>\n\n\t\t\t<DropdownMenu\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More options' ) }\n\t\t\t\tclassName=\"edit-site-template-details__template-areas-item-more\"\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<TemplatePartItemMore\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t</div>\n\t);\n}\n\nexport default function TemplateAreas( { closeTemplateDetailsDropdown } ) {\n\tconst templateParts = useSelect(\n\t\t( select ) => select( editSiteStore ).getCurrentTemplateTemplateParts(),\n\t\t[]\n\t);\n\n\tif ( ! templateParts.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuGroup\n\t\t\tlabel={ __( 'Areas' ) }\n\t\t\tclassName=\"edit-site-template-details__group edit-site-template-details__template-areas\"\n\t\t>\n\t\t\t{ templateParts.map( ( { templatePart, block } ) => (\n\t\t\t\t<TemplatePartItem\n\t\t\t\t\tkey={ templatePart.slug }\n\t\t\t\t\tclientId={ block.clientId }\n\t\t\t\t\ttemplatePart={ templatePart }\n\t\t\t\t\tcloseTemplateDetailsDropdown={\n\t\t\t\t\t\tcloseTemplateDetailsDropdown\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</MenuGroup>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = TemplatePartAreaSelector;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
|
|
12
|
+
var _components = require("@wordpress/components");
|
|
13
|
+
|
|
14
|
+
var _coreData = require("@wordpress/core-data");
|
|
15
|
+
|
|
16
|
+
var _data = require("@wordpress/data");
|
|
17
|
+
|
|
18
|
+
var _editor = require("@wordpress/editor");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
function TemplatePartAreaSelector(_ref) {
|
|
24
|
+
let {
|
|
25
|
+
id
|
|
26
|
+
} = _ref;
|
|
27
|
+
const [area, setArea] = (0, _coreData.useEntityProp)('postType', 'wp_template_part', 'area', id);
|
|
28
|
+
const definedAreas = (0, _data.useSelect)(select => select(_editor.store).__experimentalGetDefaultTemplatePartAreas(), []);
|
|
29
|
+
const areaOptions = definedAreas.map(_ref2 => {
|
|
30
|
+
let {
|
|
31
|
+
label,
|
|
32
|
+
area: _area
|
|
33
|
+
} = _ref2;
|
|
34
|
+
return {
|
|
35
|
+
label,
|
|
36
|
+
value: _area
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
return (0, _element.createElement)(_components.SelectControl, {
|
|
40
|
+
label: (0, _i18n.__)('Area'),
|
|
41
|
+
labelPosition: "top",
|
|
42
|
+
options: areaOptions,
|
|
43
|
+
value: area,
|
|
44
|
+
onChange: setArea
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=template-part-area-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/template-part-area-selector.js"],"names":["TemplatePartAreaSelector","id","area","setArea","definedAreas","select","editorStore","__experimentalGetDefaultTemplatePartAreas","areaOptions","map","label","_area","value"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAPA;AACA;AACA;AAOe,SAASA,wBAAT,OAA4C;AAAA,MAAT;AAAEC,IAAAA;AAAF,GAAS;AAC1D,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoB,6BACzB,UADyB,EAEzB,kBAFyB,EAGzB,MAHyB,EAIzBF,EAJyB,CAA1B;AAOA,QAAMG,YAAY,GAAG,qBAClBC,MAAF,IACCA,MAAM,CAAEC,aAAF,CAAN,CAAsBC,yCAAtB,EAFmB,EAGpB,EAHoB,CAArB;AAMA,QAAMC,WAAW,GAAGJ,YAAY,CAACK,GAAb,CAAkB;AAAA,QAAE;AAAEC,MAAAA,KAAF;AAASR,MAAAA,IAAI,EAAES;AAAf,KAAF;AAAA,WAAgC;AACrED,MAAAA,KADqE;AAErEE,MAAAA,KAAK,EAAED;AAF8D,KAAhC;AAAA,GAAlB,CAApB;AAKA,SACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAG,cAAI,MAAJ,CADT;AAEC,IAAA,aAAa,EAAC,KAFf;AAGC,IAAA,OAAO,EAAGH,WAHX;AAIC,IAAA,KAAK,EAAGN,IAJT;AAKC,IAAA,QAAQ,EAAGC;AALZ,IADD;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { SelectControl } from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\n\nexport default function TemplatePartAreaSelector( { id } ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\tid\n\t);\n\n\tconst definedAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tconst areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {\n\t\tlabel,\n\t\tvalue: _area,\n\t} ) );\n\n\treturn (\n\t\t<SelectControl\n\t\t\tlabel={ __( 'Area' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\toptions={ areaOptions }\n\t\t\tvalue={ area }\n\t\t\tonChange={ setArea }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -25,6 +25,8 @@ var _coreData = require("@wordpress/core-data");
|
|
|
25
25
|
|
|
26
26
|
var _notices = require("@wordpress/notices");
|
|
27
27
|
|
|
28
|
+
var _icons = require("@wordpress/icons");
|
|
29
|
+
|
|
28
30
|
var _createTemplatePartModal = _interopRequireDefault(require("../create-template-part-modal"));
|
|
29
31
|
|
|
30
32
|
/**
|
|
@@ -79,10 +81,11 @@ function ConvertToTemplatePart(_ref) {
|
|
|
79
81
|
};
|
|
80
82
|
|
|
81
83
|
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_blockEditor.BlockSettingsMenuControls, null, () => (0, _element.createElement)(_components.MenuItem, {
|
|
84
|
+
icon: _icons.symbolFilled,
|
|
82
85
|
onClick: () => {
|
|
83
86
|
setIsModalOpen(true);
|
|
84
87
|
}
|
|
85
|
-
}, (0, _i18n.__)('
|
|
88
|
+
}, (0, _i18n.__)('Create Template part'))), isModalOpen && (0, _element.createElement)(_createTemplatePartModal.default, {
|
|
86
89
|
closeModal: () => {
|
|
87
90
|
setIsModalOpen(false);
|
|
88
91
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","blockEditorStore","saveEntityRecord","coreStore","createSuccessNotice","noticesStore","onConvert","title","area","cleanSlug","replace","templatePart","slug","content","theme","type"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-template-part.js"],"names":["ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","replaceBlocks","blockEditorStore","saveEntityRecord","coreStore","createSuccessNotice","noticesStore","onConvert","title","area","cleanSlug","replace","templatePart","slug","content","theme","type","symbolFilled"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAKA;;AACA;;AAIA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAKA;;AAxBA;AACA;AACA;;AAGA;AACA;AACA;;AAcA;AACA;AACA;AAGe,SAASA,qBAAT,OAAwD;AAAA,MAAxB;AAAEC,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAAwB;AACtE,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkC,uBAAU,KAAV,CAAxC;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,uBAAaC,kBAAb,CAA1B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAuB,uBAAaC,eAAb,CAA7B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA0B,uBAAaC,cAAb,CAAhC;;AAEA,QAAMC,SAAS,GAAG,eAA6B;AAAA,QAArB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAqB;AAC9C;AACA;AACA,UAAMC,SAAS,GACd,uBAAWF,KAAX,EAAmBG,OAAnB,CAA4B,UAA5B,EAAwC,EAAxC,KAAgD,gBADjD;AAGA,UAAMC,YAAY,GAAG,MAAMT,gBAAgB,CAC1C,UAD0C,EAE1C,kBAF0C,EAG1C;AACCU,MAAAA,IAAI,EAAEH,SADP;AAECF,MAAAA,KAFD;AAGCM,MAAAA,OAAO,EAAE,uBAAWhB,MAAX,CAHV;AAICW,MAAAA;AAJD,KAH0C,CAA3C;AAUAR,IAAAA,aAAa,CACZJ,SADY,EAEZ,yBAAa,oBAAb,EAAmC;AAClCgB,MAAAA,IAAI,EAAED,YAAY,CAACC,IADe;AAElCE,MAAAA,KAAK,EAAEH,YAAY,CAACG;AAFc,KAAnC,CAFY,CAAb;AAOAV,IAAAA,mBAAmB,CAAE,cAAI,wBAAJ,CAAF,EAAkC;AACpDW,MAAAA,IAAI,EAAE;AAD8C,KAAlC,CAAnB,CAvB8C,CA2B9C;AACA;AACA,GA7BD;;AA+BA,SACC,qDACC,4BAAC,sCAAD,QACG,MACD,4BAAC,oBAAD;AACC,IAAA,IAAI,EAAGC,mBADR;AAEC,IAAA,OAAO,EAAG,MAAM;AACfjB,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAJF,KAMG,cAAI,sBAAJ,CANH,CAFF,CADD,EAaGD,WAAW,IACZ,4BAAC,gCAAD;AACC,IAAA,UAAU,EAAG,MAAM;AAClBC,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA,KAHF;AAIC,IAAA,QAAQ,EAAGO;AAJZ,IAdF,CADD;AAwBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock, serialize } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { symbolFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst onConvert = async ( { title, area } ) => {\n\t\t// Currently template parts only allow latin chars.\n\t\t// Fallback slug will receive suffix by default.\n\t\tconst cleanSlug =\n\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) || 'wp-custom-part';\n\n\t\tconst templatePart = await saveEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t{\n\t\t\t\tslug: cleanSlug,\n\t\t\t\ttitle,\n\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\tarea,\n\t\t\t}\n\t\t);\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ () => (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Create Template part' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t) }\n\t\t\t</BlockSettingsMenuControls>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonCreate={ onConvert }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
package/build/index.js
CHANGED
|
@@ -119,7 +119,7 @@ function reinitializeEditor(target, settings) {
|
|
|
119
119
|
keepCaretInsideBlock: false,
|
|
120
120
|
welcomeGuide: true,
|
|
121
121
|
welcomeGuideStyles: true,
|
|
122
|
-
|
|
122
|
+
showListViewByDefault: false
|
|
123
123
|
}); // Check if the block list view should be open by default.
|
|
124
124
|
|
|
125
125
|
if ((0, _data.select)(_preferences.store).get('core/edit-site', 'showListViewByDefault')) {
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","__unstableHomeTemplate","reboot","bind","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["reinitializeEditor","target","settings","__unstableHomeTemplate","reboot","bind","preferencesStore","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","get","editSiteStore","setIsListViewOpened","interfaceStore","setDefaultComplementaryArea","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","isLandingOnListPage","window","location","href","setIsNavigationPanelOpened","viewportStore","isViewportMatch","initializeEditor","id","__experimentalFetchLinkSuggestions","search","searchOptions","__experimentalFetchRichUrlData","fetchUrlData","document","getElementById","blocksStore","__experimentalReapplyBlockTypeFilters","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAAUmB,aAAV,EAAwBC,oBAAxB,CAA8C;AAC7CC,MAAAA,oBAAoB,EAAErB,QAAQ,CAACqB,oBADc;AAE7CC,MAAAA,wBAAwB,EAAEtB,QAAQ,CAACsB;AAFU,KAA9C;AAKA,UAAMC,mBAAmB,GAAG,4BAC3B,uBAAcC,MAAM,CAACC,QAAP,CAAgBC,IAA9B,CAD2B,CAA5B;;AAIA,QAAKH,mBAAL,EAA2B;AAC1B;AACA;AACA,0BAAUT,YAAV,EAA0Ba,0BAA1B,CACC,kBAAQC,eAAR,EAAwBC,eAAxB,CAAyC,QAAzC,CADD;AAGA;AACD;AAED,uBAAQ,4BAAC,YAAD;AAAa,IAAA,MAAM,EAAG3B;AAAtB,IAAR,EAA2CH,MAA3C;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAAS+B,gBAAT,CAA2BC,EAA3B,EAA+B/B,QAA/B,EAA0C;AAChDA,EAAAA,QAAQ,CAACgC,kCAAT,GAA8C,CAAEC,MAAF,EAAUC,aAAV,KAC7C,kDAAsBD,MAAtB,EAA8BC,aAA9B,EAA6ClC,QAA7C,CADD;;AAEAA,EAAAA,QAAQ,CAACmC,8BAAT,GAA0CC,oCAA1C;AAEA,QAAMrC,MAAM,GAAGsC,QAAQ,CAACC,cAAT,CAAyBP,EAAzB,CAAf;;AAEA,sBAAUQ,aAAV,EAAwBC,qCAAxB;;AACA;;AACA,MAAKC,OAAO,CAACC,GAAR,CAAYC,mBAAjB,EAAuC;AACtC,oEAA8C;AAC7CC,MAAAA,eAAe,EAAE;AAD4B,KAA9C;AAGA;;AAED9C,EAAAA,kBAAkB,CAAEC,MAAF,EAAUC,QAAV,CAAlB;AACA","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 interfaceStore } from '@wordpress/interface';\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\tshowListViewByDefault: false,\n\t\t} );\n\n\t\t// Check if the block list view should be open by default.\n\t\tif (\n\t\t\tselect( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showListViewByDefault'\n\t\t\t)\n\t\t) {\n\t\t\tdispatch( editSiteStore ).setIsListViewOpened( true );\n\t\t}\n\n\t\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t\t'core/edit-site',\n\t\t\t'edit-site/template'\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\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"]}
|
|
@@ -153,12 +153,14 @@ function AddCustomTemplateModal(_ref3) {
|
|
|
153
153
|
const {
|
|
154
154
|
slug,
|
|
155
155
|
title,
|
|
156
|
-
description
|
|
156
|
+
description,
|
|
157
|
+
templatePrefix
|
|
157
158
|
} = entityForSuggestions.template;
|
|
158
159
|
onSelect({
|
|
159
160
|
slug,
|
|
160
161
|
title,
|
|
161
|
-
description
|
|
162
|
+
description,
|
|
163
|
+
templatePrefix
|
|
162
164
|
});
|
|
163
165
|
}
|
|
164
166
|
}, createElement(Text, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-template-modal.js"],"names":["useState","useMemo","useEffect","__","sprintf","Button","Flex","FlexItem","Modal","SearchControl","TextHighlight","__experimentalText","Text","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","useDebounce","useEntityRecords","mapToIHasNameAndId","EMPTY_ARRAY","SuggestionListItem","suggestion","search","onSelect","entityForSuggestions","composite","baseCssClass","config","getSpecificTemplate","name","link","useDebouncedInput","input","setInput","debounced","setter","setDebounced","useSearchSuggestions","query","order","context","per_page","queryArgs","records","searchResults","hasResolved","searchHasResolved","type","slug","suggestions","setSuggestions","newSuggestions","length","recordNamePath","SuggestionList","orientation","setSearch","debouncedSearch","labels","showSearchControl","setShowSearchControl","search_items","map","not_found","AddCustomTemplateModal","onClose","showSearchEntities","setShowSearchEntities","hasGeneralTemplate","singular_name","title","description","template","all_items"],"mappings":";;;A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["/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\n\tModal,\n\tSearchControl,\n\tTextHighlight,\n\t__experimentalText as Text,\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\nimport { useEntityRecords } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { mapToIHasNameAndId } from './utils';\n\nconst EMPTY_ARRAY = [];\n\nfunction SuggestionListItem( {\n\tsuggestion,\n\tsearch,\n\tonSelect,\n\tentityForSuggestions,\n\tcomposite,\n} ) {\n\tconst baseCssClass =\n\t\t'edit-site-custom-template-modal__suggestions_list__list-item';\n\treturn (\n\t\t<CompositeItem\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName={ baseCssClass }\n\t\t\tonClick={ () =>\n\t\t\t\tonSelect(\n\t\t\t\t\tentityForSuggestions.config.getSpecificTemplate(\n\t\t\t\t\t\tsuggestion\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<span className={ `${ baseCssClass }__title` }>\n\t\t\t\t<TextHighlight text={ suggestion.name } highlight={ search } />\n\t\t\t</span>\n\t\t\t{ suggestion.link && (\n\t\t\t\t<span className={ `${ baseCssClass }__info` }>\n\t\t\t\t\t{ suggestion.link }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</CompositeItem>\n\t);\n}\n\nfunction useDebouncedInput() {\n\tconst [ input, setInput ] = useState( '' );\n\tconst [ debounced, setter ] = useState( '' );\n\tconst setDebounced = useDebounce( setter, 250 );\n\tuseEffect( () => {\n\t\tif ( debounced !== input ) {\n\t\t\tsetDebounced( input );\n\t\t}\n\t}, [ debounced, input ] );\n\treturn [ input, setInput, debounced ];\n}\n\nfunction useSearchSuggestions( entityForSuggestions, search ) {\n\tconst { config } = entityForSuggestions;\n\tconst query = useMemo(\n\t\t() => ( {\n\t\t\torder: 'asc',\n\t\t\tcontext: 'view',\n\t\t\tsearch,\n\t\t\tper_page: search ? 20 : 10,\n\t\t\t...config.queryArgs( search ),\n\t\t} ),\n\t\t[ search, config ]\n\t);\n\tconst { records: searchResults, hasResolved: searchHasResolved } =\n\t\tuseEntityRecords(\n\t\t\tentityForSuggestions.type,\n\t\t\tentityForSuggestions.slug,\n\t\t\tquery\n\t\t);\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) return;\n\t\tlet newSuggestions = EMPTY_ARRAY;\n\t\tif ( searchResults?.length ) {\n\t\t\tnewSuggestions = searchResults;\n\t\t\tif ( config.recordNamePath ) {\n\t\t\t\tnewSuggestions = mapToIHasNameAndId(\n\t\t\t\t\tnewSuggestions,\n\t\t\t\t\tconfig.recordNamePath\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// Update suggestions only when the query has resolved, so as to keep\n\t\t// the previous results in the UI.\n\t\tsetSuggestions( newSuggestions );\n\t}, [ searchResults, searchHasResolved ] );\n\treturn suggestions;\n}\n\nfunction SuggestionList( { entityForSuggestions, onSelect } ) {\n\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\tconst [ search, setSearch, debouncedSearch ] = useDebouncedInput();\n\tconst suggestions = useSearchSuggestions(\n\t\tentityForSuggestions,\n\t\tdebouncedSearch\n\t);\n\tconst { labels } = entityForSuggestions;\n\tconst [ showSearchControl, setShowSearchControl ] = useState( false );\n\tif ( ! showSearchControl && suggestions?.length > 9 ) {\n\t\tsetShowSearchControl( true );\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ showSearchControl && (\n\t\t\t\t<SearchControl\n\t\t\t\t\tonChange={ setSearch }\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tlabel={ labels.search_items }\n\t\t\t\t\tplaceholder={ labels.search_items }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! suggestions?.length && (\n\t\t\t\t<Composite\n\t\t\t\t\t{ ...composite }\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\tclassName=\"edit-site-custom-template-modal__suggestions_list\"\n\t\t\t\t\taria-label={ __( 'Suggestions list' ) }\n\t\t\t\t>\n\t\t\t\t\t{ suggestions.map( ( suggestion ) => (\n\t\t\t\t\t\t<SuggestionListItem\n\t\t\t\t\t\t\tkey={ suggestion.slug }\n\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\tsearch={ debouncedSearch }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</Composite>\n\t\t\t) }\n\t\t\t{ debouncedSearch && ! suggestions?.length && (\n\t\t\t\t<p className=\"edit-site-custom-template-modal__no-results\">\n\t\t\t\t\t{ labels.not_found }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction AddCustomTemplateModal( { onClose, onSelect, entityForSuggestions } ) {\n\tconst [ showSearchEntities, setShowSearchEntities ] = useState(\n\t\tentityForSuggestions.hasGeneralTemplate\n\t);\n\tconst baseCssClass = 'edit-site-custom-template-modal';\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t__( 'Add template: %s' ),\n\t\t\t\tentityForSuggestions.labels.singular_name\n\t\t\t) }\n\t\t\tclassName={ baseCssClass }\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t{ ! showSearchEntities && (\n\t\t\t\t<>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select whether to create a single template for all items or a specific one.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<Flex\n\t\t\t\t\t\tclassName={ `${ baseCssClass }__contents` }\n\t\t\t\t\t\tgap=\"4\"\n\t\t\t\t\t\talign=\"initial\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst { slug, title, description } =\n\t\t\t\t\t\t\t\t\tentityForSuggestions.template;\n\t\t\t\t\t\t\t\tonSelect( { slug, title, description } );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text as=\"span\" weight={ 600 }>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.all_items }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text as=\"span\">\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For all items' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetShowSearchEntities( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text as=\"span\" weight={ 600 }>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.singular_name }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text as=\"span\">\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For a specific item' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ showSearchEntities && (\n\t\t\t\t<>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This template will be used only for the specific item chosen.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<SuggestionList\n\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nexport default AddCustomTemplateModal;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/add-custom-template-modal.js"],"names":["useState","useMemo","useEffect","__","sprintf","Button","Flex","FlexItem","Modal","SearchControl","TextHighlight","__experimentalText","Text","__unstableComposite","Composite","__unstableUseCompositeState","useCompositeState","__unstableCompositeItem","CompositeItem","useDebounce","useEntityRecords","mapToIHasNameAndId","EMPTY_ARRAY","SuggestionListItem","suggestion","search","onSelect","entityForSuggestions","composite","baseCssClass","config","getSpecificTemplate","name","link","useDebouncedInput","input","setInput","debounced","setter","setDebounced","useSearchSuggestions","query","order","context","per_page","queryArgs","records","searchResults","hasResolved","searchHasResolved","type","slug","suggestions","setSuggestions","newSuggestions","length","recordNamePath","SuggestionList","orientation","setSearch","debouncedSearch","labels","showSearchControl","setShowSearchControl","search_items","map","not_found","AddCustomTemplateModal","onClose","showSearchEntities","setShowSearchEntities","hasGeneralTemplate","singular_name","title","description","templatePrefix","template","all_items"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,EAA4BC,SAA5B,QAA6C,oBAA7C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,QAHD,EAICC,KAJD,EAKCC,aALD,EAM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AAA,IADK;AAELsB,QAAAA,KAFK;AAGLC,QAAAA,WAHK;AAILC,QAAAA;AAJK,UAKFhD,oBAAoB,CAACiD,QALzB;AAMAlD,MAAAA,QAAQ,CAAE;AACTyB,QAAAA,IADS;AAETsB,QAAAA,KAFS;AAGTC,QAAAA,WAHS;AAITC,QAAAA;AAJS,OAAF,CAAR;AAMA;AAhBF,KAkBC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC,MAAT;AAAgB,IAAA,MAAM,EAAG;AAAzB,KACGhD,oBAAoB,CAACkC,MAArB,CAA4BgB,SAD/B,CAlBD,EAqBC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAEE;AACA1E,EAAAA,EAAE,CAAE,eAAF,CAHJ,CArBD,CALD,EAiCC,cAAC,QAAD;AACC,IAAA,OAAO,MADR;AAEC,IAAA,EAAE,EAAGE,MAFN;AAGC,IAAA,OAAO,EAAG,MAAM;AACfiE,MAAAA,qBAAqB,CAAE,IAAF,CAArB;AACA;AALF,KAOC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC,MAAT;AAAgB,IAAA,MAAM,EAAG;AAAzB,KACG3C,oBAAoB,CAACkC,MAArB,CAA4BW,aAD/B,CAPD,EAUC,cAAC,IAAD;AAAM,IAAA,EAAE,EAAC;AAAT,KAEE;AACArE,EAAAA,EAAE,CAAE,qBAAF,CAHJ,CAVD,CAjCD,CAND,CAXF,EAsEGkE,kBAAkB,IACnB,8BACC,yBACGlE,EAAE,CACH,+DADG,CADL,CADD,EAMC,cAAC,cAAD;AACC,IAAA,oBAAoB,EAAGwB,oBADxB;AAEC,IAAA,QAAQ,EAAGD;AAFZ,IAND,CAvEF,CADD;AAsFA;;AAED,eAAeyC,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo, useEffect } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\n\tModal,\n\tSearchControl,\n\tTextHighlight,\n\t__experimentalText as Text,\n\t__unstableComposite as Composite,\n\t__unstableUseCompositeState as useCompositeState,\n\t__unstableCompositeItem as CompositeItem,\n} from '@wordpress/components';\nimport { useDebounce } from '@wordpress/compose';\nimport { useEntityRecords } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { mapToIHasNameAndId } from './utils';\n\nconst EMPTY_ARRAY = [];\n\nfunction SuggestionListItem( {\n\tsuggestion,\n\tsearch,\n\tonSelect,\n\tentityForSuggestions,\n\tcomposite,\n} ) {\n\tconst baseCssClass =\n\t\t'edit-site-custom-template-modal__suggestions_list__list-item';\n\treturn (\n\t\t<CompositeItem\n\t\t\trole=\"option\"\n\t\t\tas={ Button }\n\t\t\t{ ...composite }\n\t\t\tclassName={ baseCssClass }\n\t\t\tonClick={ () =>\n\t\t\t\tonSelect(\n\t\t\t\t\tentityForSuggestions.config.getSpecificTemplate(\n\t\t\t\t\t\tsuggestion\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<span className={ `${ baseCssClass }__title` }>\n\t\t\t\t<TextHighlight text={ suggestion.name } highlight={ search } />\n\t\t\t</span>\n\t\t\t{ suggestion.link && (\n\t\t\t\t<span className={ `${ baseCssClass }__info` }>\n\t\t\t\t\t{ suggestion.link }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</CompositeItem>\n\t);\n}\n\nfunction useDebouncedInput() {\n\tconst [ input, setInput ] = useState( '' );\n\tconst [ debounced, setter ] = useState( '' );\n\tconst setDebounced = useDebounce( setter, 250 );\n\tuseEffect( () => {\n\t\tif ( debounced !== input ) {\n\t\t\tsetDebounced( input );\n\t\t}\n\t}, [ debounced, input ] );\n\treturn [ input, setInput, debounced ];\n}\n\nfunction useSearchSuggestions( entityForSuggestions, search ) {\n\tconst { config } = entityForSuggestions;\n\tconst query = useMemo(\n\t\t() => ( {\n\t\t\torder: 'asc',\n\t\t\tcontext: 'view',\n\t\t\tsearch,\n\t\t\tper_page: search ? 20 : 10,\n\t\t\t...config.queryArgs( search ),\n\t\t} ),\n\t\t[ search, config ]\n\t);\n\tconst { records: searchResults, hasResolved: searchHasResolved } =\n\t\tuseEntityRecords(\n\t\t\tentityForSuggestions.type,\n\t\t\tentityForSuggestions.slug,\n\t\t\tquery\n\t\t);\n\tconst [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );\n\tuseEffect( () => {\n\t\tif ( ! searchHasResolved ) return;\n\t\tlet newSuggestions = EMPTY_ARRAY;\n\t\tif ( searchResults?.length ) {\n\t\t\tnewSuggestions = searchResults;\n\t\t\tif ( config.recordNamePath ) {\n\t\t\t\tnewSuggestions = mapToIHasNameAndId(\n\t\t\t\t\tnewSuggestions,\n\t\t\t\t\tconfig.recordNamePath\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// Update suggestions only when the query has resolved, so as to keep\n\t\t// the previous results in the UI.\n\t\tsetSuggestions( newSuggestions );\n\t}, [ searchResults, searchHasResolved ] );\n\treturn suggestions;\n}\n\nfunction SuggestionList( { entityForSuggestions, onSelect } ) {\n\tconst composite = useCompositeState( { orientation: 'vertical' } );\n\tconst [ search, setSearch, debouncedSearch ] = useDebouncedInput();\n\tconst suggestions = useSearchSuggestions(\n\t\tentityForSuggestions,\n\t\tdebouncedSearch\n\t);\n\tconst { labels } = entityForSuggestions;\n\tconst [ showSearchControl, setShowSearchControl ] = useState( false );\n\tif ( ! showSearchControl && suggestions?.length > 9 ) {\n\t\tsetShowSearchControl( true );\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ showSearchControl && (\n\t\t\t\t<SearchControl\n\t\t\t\t\tonChange={ setSearch }\n\t\t\t\t\tvalue={ search }\n\t\t\t\t\tlabel={ labels.search_items }\n\t\t\t\t\tplaceholder={ labels.search_items }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! suggestions?.length && (\n\t\t\t\t<Composite\n\t\t\t\t\t{ ...composite }\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\tclassName=\"edit-site-custom-template-modal__suggestions_list\"\n\t\t\t\t\taria-label={ __( 'Suggestions list' ) }\n\t\t\t\t>\n\t\t\t\t\t{ suggestions.map( ( suggestion ) => (\n\t\t\t\t\t\t<SuggestionListItem\n\t\t\t\t\t\t\tkey={ suggestion.slug }\n\t\t\t\t\t\t\tsuggestion={ suggestion }\n\t\t\t\t\t\t\tsearch={ debouncedSearch }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\t\tcomposite={ composite }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</Composite>\n\t\t\t) }\n\t\t\t{ debouncedSearch && ! suggestions?.length && (\n\t\t\t\t<p className=\"edit-site-custom-template-modal__no-results\">\n\t\t\t\t\t{ labels.not_found }\n\t\t\t\t</p>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction AddCustomTemplateModal( { onClose, onSelect, entityForSuggestions } ) {\n\tconst [ showSearchEntities, setShowSearchEntities ] = useState(\n\t\tentityForSuggestions.hasGeneralTemplate\n\t);\n\tconst baseCssClass = 'edit-site-custom-template-modal';\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ sprintf(\n\t\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t\t__( 'Add template: %s' ),\n\t\t\t\tentityForSuggestions.labels.singular_name\n\t\t\t) }\n\t\t\tclassName={ baseCssClass }\n\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t>\n\t\t\t{ ! showSearchEntities && (\n\t\t\t\t<>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select whether to create a single template for all items or a specific one.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<Flex\n\t\t\t\t\t\tclassName={ `${ baseCssClass }__contents` }\n\t\t\t\t\t\tgap=\"4\"\n\t\t\t\t\t\talign=\"initial\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\ttemplatePrefix,\n\t\t\t\t\t\t\t\t} = entityForSuggestions.template;\n\t\t\t\t\t\t\t\tonSelect( {\n\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\ttemplatePrefix,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text as=\"span\" weight={ 600 }>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.all_items }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text as=\"span\">\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For all items' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t<FlexItem\n\t\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t\tas={ Button }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetShowSearchEntities( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Text as=\"span\" weight={ 600 }>\n\t\t\t\t\t\t\t\t{ entityForSuggestions.labels.singular_name }\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Text as=\"span\">\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t// translators: The user is given the choice to set up a template for all items of a post type or taxonomy, or just a specific one.\n\t\t\t\t\t\t\t\t\t__( 'For a specific item' )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t</Flex>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ showSearchEntities && (\n\t\t\t\t<>\n\t\t\t\t\t<p>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'This template will be used only for the specific item chosen.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</p>\n\t\t\t\t\t<SuggestionList\n\t\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nexport default AddCustomTemplateModal;\n"]}
|