@wordpress/edit-site 6.0.4 → 6.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 +10 -6
- package/build/components/add-new-page/index.js +2 -0
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +1 -0
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/app/index.js +17 -1
- package/build/components/app/index.js.map +1 -1
- package/build/components/editor/index.js +12 -13
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +18 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-families.js +17 -17
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +2 -2
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +25 -19
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +1 -0
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +1 -0
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/layout/index.js +8 -37
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -0
- package/build/components/page/header.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/posts-app/index.js +50 -0
- package/build/components/posts-app/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +64 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -0
- package/build/index.js +15 -2
- package/build/index.js.map +1 -1
- package/build/posts.js +34 -0
- package/build/posts.js.map +1 -0
- package/build-module/components/add-new-page/index.js +2 -0
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +1 -0
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/app/index.js +17 -1
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/editor/index.js +13 -14
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +19 -8
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +18 -18
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +2 -2
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +25 -19
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +1 -0
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +1 -0
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/layout/index.js +10 -39
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -0
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/posts-app/index.js +43 -0
- package/build-module/components/posts-app/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +57 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
- package/build-module/index.js +8 -2
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +27 -0
- package/build-module/posts.js.map +1 -0
- package/build-style/posts-rtl.css +1707 -0
- package/build-style/posts.css +1707 -0
- package/build-style/style-rtl.css +18 -20
- package/build-style/style.css +18 -20
- package/lib/inflate.js +3188 -3937
- package/lib/lib-font.browser.js +32 -2
- package/lib/unbrotli.js +1818 -2458
- package/package.json +41 -41
- package/src/components/add-new-page/index.js +6 -1
- package/src/components/add-new-pattern/index.js +1 -0
- package/src/components/app/index.js +17 -1
- package/src/components/editor/index.js +13 -22
- package/src/components/editor-canvas-container/index.js +20 -8
- package/src/components/global-styles/font-families.js +28 -19
- package/src/components/global-styles/font-library-modal/context.js +2 -2
- package/src/components/global-styles/style.scss +3 -8
- package/src/components/global-styles/variations/variation.js +37 -22
- package/src/components/global-styles/variations/variations-color.js +1 -0
- package/src/components/global-styles/variations/variations-typography.js +1 -0
- package/src/components/global-styles-sidebar/style.scss +0 -1
- package/src/components/layout/index.js +24 -70
- package/src/components/page/header.js +1 -0
- package/src/components/page/style.scss +6 -0
- package/src/components/page-patterns/header.js +8 -2
- package/src/components/page-patterns/rename-category-menu-item.js +2 -0
- package/src/components/page-patterns/style.scss +6 -0
- package/src/components/posts-app/index.js +39 -0
- package/src/components/sidebar/style.scss +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +6 -1
- package/src/hooks/commands/use-set-command-context.js +49 -0
- package/src/index.js +10 -2
- package/src/posts.js +29 -0
- package/src/posts.scss +46 -0
- package/build/components/block-editor/block-inspector-button.js +0 -57
- package/build/components/block-editor/block-inspector-button.js.map +0 -1
- package/build/components/block-editor/inserter-media-categories.js +0 -183
- package/build/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build/components/template-part-converter/convert-to-regular.js +0 -38
- package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build/components/template-part-converter/convert-to-template-part.js +0 -84
- package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build/components/template-part-converter/index.js +0 -67
- package/build/components/template-part-converter/index.js.map +0 -1
- package/build-module/components/block-editor/block-inspector-button.js +0 -50
- package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
- package/build-module/components/block-editor/inserter-media-categories.js +0 -177
- package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
- package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
- package/build-module/components/template-part-converter/index.js +0 -59
- package/build-module/components/template-part-converter/index.js.map +0 -1
- package/src/components/block-editor/block-inspector-button.js +0 -60
- package/src/components/block-editor/inserter-media-categories.js +0 -225
- package/src/components/template-part-converter/convert-to-regular.js +0 -32
- package/src/components/template-part-converter/convert-to-template-part.js +0 -78
- package/src/components/template-part-converter/index.js +0 -59
|
@@ -28,6 +28,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
28
|
level: 3,
|
|
29
29
|
weight: 500,
|
|
30
30
|
className: "edit-site-page-header__title",
|
|
31
|
+
truncate: true,
|
|
31
32
|
children: title
|
|
32
33
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
33
34
|
className: "edit-site-page-header__actions",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_jsxRuntime","Header","title","subTitle","actions","jsxs","__experimentalVStack","className","as","spacing","children","__experimentalHStack","jsx","__experimentalHeading","level","weight","FlexItem","__experimentalText","variant"],"sources":["@wordpress/edit-site/src/components/page/header.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tFlexItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\n\nexport default function Header( { title, subTitle, actions } ) {\n\treturn (\n\t\t<VStack className=\"edit-site-page-header\" as=\"header\" spacing={ 0 }>\n\t\t\t<HStack className=\"edit-site-page-header__page-title\">\n\t\t\t\t<Heading\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlevel={ 3 }\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tclassName=\"edit-site-page-header__title\"\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</Heading>\n\t\t\t\t<FlexItem className=\"edit-site-page-header__actions\">\n\t\t\t\t\t{ actions }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t\t{ subTitle && (\n\t\t\t\t<Text\n\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tclassName=\"edit-site-page-header__sub-title\"\n\t\t\t\t>\n\t\t\t\t\t{ subTitle }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAM+B,IAAAC,WAAA,GAAAD,OAAA;AAT/B;AACA;AACA;;AASA;AACA;AACA,GAEe,SAASE,MAAMA,CAAE;EAAEC,KAAK;EAAEC,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EAC9D,oBACC,IAAAJ,WAAA,CAAAK,IAAA,EAACP,WAAA,CAAAQ,oBAAM;IAACC,SAAS,EAAC,uBAAuB;IAACC,EAAE,EAAC,QAAQ;IAACC,OAAO,EAAG,CAAG;IAAAC,QAAA,gBAClE,IAAAV,WAAA,CAAAK,IAAA,EAACP,WAAA,CAAAa,oBAAM;MAACJ,SAAS,EAAC,mCAAmC;MAAAG,QAAA,gBACpD,IAAAV,WAAA,CAAAY,GAAA,EAACd,WAAA,CAAAe,qBAAO;QACPL,EAAE,EAAC,IAAI;QACPM,KAAK,EAAG,CAAG;QACXC,MAAM,EAAG,GAAK;QACdR,SAAS,EAAC,8BAA8B;
|
|
1
|
+
{"version":3,"names":["_components","require","_jsxRuntime","Header","title","subTitle","actions","jsxs","__experimentalVStack","className","as","spacing","children","__experimentalHStack","jsx","__experimentalHeading","level","weight","truncate","FlexItem","__experimentalText","variant"],"sources":["@wordpress/edit-site/src/components/page/header.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tFlexItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\n\nexport default function Header( { title, subTitle, actions } ) {\n\treturn (\n\t\t<VStack className=\"edit-site-page-header\" as=\"header\" spacing={ 0 }>\n\t\t\t<HStack className=\"edit-site-page-header__page-title\">\n\t\t\t\t<Heading\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlevel={ 3 }\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tclassName=\"edit-site-page-header__title\"\n\t\t\t\t\ttruncate\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</Heading>\n\t\t\t\t<FlexItem className=\"edit-site-page-header__actions\">\n\t\t\t\t\t{ actions }\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t\t{ subTitle && (\n\t\t\t\t<Text\n\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tclassName=\"edit-site-page-header__sub-title\"\n\t\t\t\t>\n\t\t\t\t\t{ subTitle }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAM+B,IAAAC,WAAA,GAAAD,OAAA;AAT/B;AACA;AACA;;AASA;AACA;AACA,GAEe,SAASE,MAAMA,CAAE;EAAEC,KAAK;EAAEC,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EAC9D,oBACC,IAAAJ,WAAA,CAAAK,IAAA,EAACP,WAAA,CAAAQ,oBAAM;IAACC,SAAS,EAAC,uBAAuB;IAACC,EAAE,EAAC,QAAQ;IAACC,OAAO,EAAG,CAAG;IAAAC,QAAA,gBAClE,IAAAV,WAAA,CAAAK,IAAA,EAACP,WAAA,CAAAa,oBAAM;MAACJ,SAAS,EAAC,mCAAmC;MAAAG,QAAA,gBACpD,IAAAV,WAAA,CAAAY,GAAA,EAACd,WAAA,CAAAe,qBAAO;QACPL,EAAE,EAAC,IAAI;QACPM,KAAK,EAAG,CAAG;QACXC,MAAM,EAAG,GAAK;QACdR,SAAS,EAAC,8BAA8B;QACxCS,QAAQ;QAAAN,QAAA,EAENR;MAAK,CACC,CAAC,eACV,IAAAF,WAAA,CAAAY,GAAA,EAACd,WAAA,CAAAmB,QAAQ;QAACV,SAAS,EAAC,gCAAgC;QAAAG,QAAA,EACjDN;MAAO,CACA,CAAC;IAAA,CACJ,CAAC,EACPD,QAAQ,iBACT,IAAAH,WAAA,CAAAY,GAAA,EAACd,WAAA,CAAAoB,kBAAI;MACJC,OAAO,EAAC,OAAO;MACfX,EAAE,EAAC,GAAG;MACND,SAAS,EAAC,kCAAkC;MAAAG,QAAA,EAE1CP;IAAQ,CACL,CACN;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
@@ -49,7 +49,7 @@ function PatternsHeader({
|
|
|
49
49
|
}
|
|
50
50
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
51
51
|
className: "edit-site-patterns__section-header",
|
|
52
|
-
spacing:
|
|
52
|
+
spacing: 1,
|
|
53
53
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
54
54
|
justify: "space-between",
|
|
55
55
|
className: "edit-site-patterns__title",
|
|
@@ -58,6 +58,7 @@ function PatternsHeader({
|
|
|
58
58
|
level: 3,
|
|
59
59
|
id: titleId,
|
|
60
60
|
weight: 500,
|
|
61
|
+
truncate: true,
|
|
61
62
|
children: title
|
|
62
63
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
63
64
|
expanded: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_editor","_data","_i18n","_icons","_addNewPattern","_interopRequireDefault","_renameCategoryMenuItem","_deleteCategoryMenuItem","_usePatternCategories","_constants","_jsxRuntime","PatternsHeader","categoryId","type","titleId","descriptionId","patternCategories","usePatternCategories","templatePartAreas","useSelect","select","editorStore","__experimentalGetDefaultTemplatePartAreas","title","description","patternCategory","TEMPLATE_PART_POST_TYPE","templatePartArea","find","area","label","__","PATTERN_TYPES","user","category","name","jsxs","__experimentalVStack","className","spacing","children","__experimentalHStack","justify","jsx","__experimentalHeading","as","level","id","weight","expanded","default","DropdownMenu","icon","moreVertical","toggleProps","describedBy","sprintf","size","onClose","MenuGroup","__experimentalText","variant"],"sources":["@wordpress/edit-site/src/components/page-patterns/header.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport RenameCategoryMenuItem from './rename-category-menu-item';\nimport DeleteCategoryMenuItem from './delete-category-menu-item';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\nimport { TEMPLATE_PART_POST_TYPE, PATTERN_TYPES } from '../../utils/constants';\n\nexport default function PatternsHeader( {\n\tcategoryId,\n\ttype,\n\ttitleId,\n\tdescriptionId,\n} ) {\n\tconst { patternCategories } = usePatternCategories();\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tlet title, description, patternCategory;\n\tif ( type === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === categoryId\n\t\t);\n\t\ttitle = templatePartArea?.label || __( 'All Template Parts' );\n\t\tdescription =\n\t\t\ttemplatePartArea?.description ||\n\t\t\t__( 'Includes every template part defined for any area.' );\n\t} else if ( type === PATTERN_TYPES.user && !! categoryId ) {\n\t\tpatternCategory = patternCategories.find(\n\t\t\t( category ) => category.name === categoryId\n\t\t);\n\t\ttitle = patternCategory?.label;\n\t\tdescription = patternCategory?.description;\n\t}\n\n\tif ( ! title ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack className=\"edit-site-patterns__section-header\" spacing={
|
|
1
|
+
{"version":3,"names":["_components","require","_editor","_data","_i18n","_icons","_addNewPattern","_interopRequireDefault","_renameCategoryMenuItem","_deleteCategoryMenuItem","_usePatternCategories","_constants","_jsxRuntime","PatternsHeader","categoryId","type","titleId","descriptionId","patternCategories","usePatternCategories","templatePartAreas","useSelect","select","editorStore","__experimentalGetDefaultTemplatePartAreas","title","description","patternCategory","TEMPLATE_PART_POST_TYPE","templatePartArea","find","area","label","__","PATTERN_TYPES","user","category","name","jsxs","__experimentalVStack","className","spacing","children","__experimentalHStack","justify","jsx","__experimentalHeading","as","level","id","weight","truncate","expanded","default","DropdownMenu","icon","moreVertical","toggleProps","describedBy","sprintf","size","onClose","MenuGroup","__experimentalText","variant"],"sources":["@wordpress/edit-site/src/components/page-patterns/header.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport AddNewPattern from '../add-new-pattern';\nimport RenameCategoryMenuItem from './rename-category-menu-item';\nimport DeleteCategoryMenuItem from './delete-category-menu-item';\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\nimport { TEMPLATE_PART_POST_TYPE, PATTERN_TYPES } from '../../utils/constants';\n\nexport default function PatternsHeader( {\n\tcategoryId,\n\ttype,\n\ttitleId,\n\tdescriptionId,\n} ) {\n\tconst { patternCategories } = usePatternCategories();\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\n\tlet title, description, patternCategory;\n\tif ( type === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === categoryId\n\t\t);\n\t\ttitle = templatePartArea?.label || __( 'All Template Parts' );\n\t\tdescription =\n\t\t\ttemplatePartArea?.description ||\n\t\t\t__( 'Includes every template part defined for any area.' );\n\t} else if ( type === PATTERN_TYPES.user && !! categoryId ) {\n\t\tpatternCategory = patternCategories.find(\n\t\t\t( category ) => category.name === categoryId\n\t\t);\n\t\ttitle = patternCategory?.label;\n\t\tdescription = patternCategory?.description;\n\t}\n\n\tif ( ! title ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack className=\"edit-site-patterns__section-header\" spacing={ 1 }>\n\t\t\t<HStack\n\t\t\t\tjustify=\"space-between\"\n\t\t\t\tclassName=\"edit-site-patterns__title\"\n\t\t\t>\n\t\t\t\t<Heading\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlevel={ 3 }\n\t\t\t\t\tid={ titleId }\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\ttruncate\n\t\t\t\t>\n\t\t\t\t\t{ title }\n\t\t\t\t</Heading>\n\t\t\t\t<HStack expanded={ false }>\n\t\t\t\t\t<AddNewPattern />\n\t\t\t\t\t{ !! patternCategory?.id && (\n\t\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\t\tclassName: 'edit-site-patterns__button',\n\t\t\t\t\t\t\t\tdescribedBy: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: pattern category name */\n\t\t\t\t\t\t\t\t\t__( 'Action menu for %s pattern category' ),\n\t\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tsize: 'compact',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<RenameCategoryMenuItem\n\t\t\t\t\t\t\t\t\t\tcategory={ patternCategory }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<DeleteCategoryMenuItem\n\t\t\t\t\t\t\t\t\t\tcategory={ patternCategory }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</DropdownMenu>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t</HStack>\n\t\t\t{ description ? (\n\t\t\t\t<Text\n\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\tas=\"p\"\n\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\tclassName=\"edit-site-patterns__sub-title\"\n\t\t\t\t>\n\t\t\t\t\t{ description }\n\t\t\t\t</Text>\n\t\t\t) : null }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAQA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAKA,IAAAK,cAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IA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GA;YAAS,CACnB,CAAC,eACF,IAAAjD,WAAA,CAAAiC,GAAA,EAACpC,uBAAA,CAAA4C,OAAsB;cACtBjB,QAAQ,EAAGT,eAAiB;cAC5BkC,OAAO,EAAGA;YAAS,CACnB,CAAC;UAAA,CACQ;QACX,CACY,CACd;MAAA,CACM,CAAC;IAAA,CACF,CAAC,EACPnC,WAAW,gBACZ,IAAAd,WAAA,CAAAiC,GAAA,EAAC7C,WAAA,CAAA+D,kBAAI;MACJC,OAAO,EAAC,OAAO;MACfjB,EAAE,EAAC,GAAG;MACNE,EAAE,EAAGhC,aAAe;MACpBuB,SAAS,EAAC,+BAA+B;MAAAE,QAAA,EAEvChB;IAAW,CACR,CAAC,GACJ,IAAI;EAAA,CACD,CAAC;AAEX","ignoreList":[]}
|
|
@@ -64,7 +64,9 @@ function RenameModal({
|
|
|
64
64
|
category: normalizedCategory,
|
|
65
65
|
existingCategories: existingCategories,
|
|
66
66
|
onClose: onClose,
|
|
67
|
-
overlayClassName: "edit-site-list__rename-modal"
|
|
67
|
+
overlayClassName: "edit-site-list__rename-modal",
|
|
68
|
+
focusOnMount: "firstContentElement",
|
|
69
|
+
size: "small"
|
|
68
70
|
});
|
|
69
71
|
}
|
|
70
72
|
//# sourceMappingURL=rename-category-menu-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_i18n","_patterns","_usePatternCategories","_interopRequireDefault","_lockUnlock","_jsxRuntime","RenamePatternCategoryModal","unlock","patternsPrivateApis","RenameCategoryMenuItem","category","onClose","isModalOpen","setIsModalOpen","useState","jsxs","Fragment","children","jsx","MenuItem","onClick","__","RenameModal","normalizedCategory","id","slug","name","label","existingCategories","usePatternCategories","overlayClassName"],"sources":["@wordpress/edit-site/src/components/page-patterns/rename-category-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\n/**\n * Internal dependencies\n */\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { RenamePatternCategoryModal } = unlock( patternsPrivateApis );\n\nexport default function RenameCategoryMenuItem( { category, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tcategory={ category }\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction RenameModal( { category, onClose } ) {\n\t// User created pattern categories have their properties updated when\n\t// retrieved via `getUserPatternCategories`. The rename modal expects an\n\t// object that will match the pattern category entity.\n\tconst normalizedCategory = {\n\t\tid: category.id,\n\t\tslug: category.slug,\n\t\tname: category.label,\n\t};\n\n\t// Optimization - only use pattern categories when the modal is open.\n\tconst existingCategories = usePatternCategories();\n\n\treturn (\n\t\t<RenamePatternCategoryModal\n\t\t\tcategory={ normalizedCategory }\n\t\t\texistingCategories={ existingCategories }\n\t\t\tonClose={ onClose }\n\t\t\toverlayClassName=\"edit-site-list__rename-modal\"\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAIA,IAAAI,qBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAf3C;AAC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"version":3,"names":["_components","require","_element","_i18n","_patterns","_usePatternCategories","_interopRequireDefault","_lockUnlock","_jsxRuntime","RenamePatternCategoryModal","unlock","patternsPrivateApis","RenameCategoryMenuItem","category","onClose","isModalOpen","setIsModalOpen","useState","jsxs","Fragment","children","jsx","MenuItem","onClick","__","RenameModal","normalizedCategory","id","slug","name","label","existingCategories","usePatternCategories","overlayClassName","focusOnMount","size"],"sources":["@wordpress/edit-site/src/components/page-patterns/rename-category-menu-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\n/**\n * Internal dependencies\n */\nimport usePatternCategories from '../sidebar-navigation-screen-patterns/use-pattern-categories';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { RenamePatternCategoryModal } = unlock( patternsPrivateApis );\n\nexport default function RenameCategoryMenuItem( { category, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tcategory={ category }\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction RenameModal( { category, onClose } ) {\n\t// User created pattern categories have their properties updated when\n\t// retrieved via `getUserPatternCategories`. The rename modal expects an\n\t// object that will match the pattern category entity.\n\tconst normalizedCategory = {\n\t\tid: category.id,\n\t\tslug: category.slug,\n\t\tname: category.label,\n\t};\n\n\t// Optimization - only use pattern categories when the modal is open.\n\tconst existingCategories = usePatternCategories();\n\n\treturn (\n\t\t<RenamePatternCategoryModal\n\t\t\tcategory={ normalizedCategory }\n\t\t\texistingCategories={ existingCategories }\n\t\t\tonClose={ onClose }\n\t\t\toverlayClassName=\"edit-site-list__rename-modal\"\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAIA,IAAAI,qBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AAA2C,IAAAO,WAAA,GAAAP,OAAA;AAf3C;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAM;EAAEQ;AAA2B,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;AAErD,SAASC,sBAAsBA,CAAE;EAAEC,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EACvE,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EAEzD,oBACC,IAAAT,WAAA,CAAAU,IAAA,EAAAV,WAAA,CAAAW,QAAA;IAAAC,QAAA,gBACC,IAAAZ,WAAA,CAAAa,GAAA,EAACrB,WAAA,CAAAsB,QAAQ;MAACC,OAAO,EAAGA,CAAA,KAAMP,cAAc,CAAE,IAAK,CAAG;MAAAI,QAAA,EAC/C,IAAAI,QAAE,EAAE,QAAS;IAAC,CACP,CAAC,EACTT,WAAW,iBACZ,IAAAP,WAAA,CAAAa,GAAA,EAACI,WAAW;MACXZ,QAAQ,EAAGA,QAAU;MACrBC,OAAO,EAAGA,CAAA,KAAM;QACfE,cAAc,CAAE,KAAM,CAAC;QACvBF,OAAO,CAAC,CAAC;MACV;IAAG,CACH,CACD;EAAA,CACA,CAAC;AAEL;AAEA,SAASW,WAAWA,CAAE;EAAEZ,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EAC7C;EACA;EACA;EACA,MAAMY,kBAAkB,GAAG;IAC1BC,EAAE,EAAEd,QAAQ,CAACc,EAAE;IACfC,IAAI,EAAEf,QAAQ,CAACe,IAAI;IACnBC,IAAI,EAAEhB,QAAQ,CAACiB;EAChB,CAAC;;EAED;EACA,MAAMC,kBAAkB,GAAG,IAAAC,6BAAoB,EAAC,CAAC;EAEjD,oBACC,IAAAxB,WAAA,CAAAa,GAAA,EAACZ,0BAA0B;IAC1BI,QAAQ,EAAGa,kBAAoB;IAC/BK,kBAAkB,EAAGA,kBAAoB;IACzCjB,OAAO,EAAGA,OAAS;IACnBmB,gBAAgB,EAAC,8BAA8B;IAC/CC,YAAY,EAAC,qBAAqB;IAClCC,IAAI,EAAC;EAAO,CACZ,CAAC;AAEJ","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = PostsApp;
|
|
8
|
+
var _editor = require("@wordpress/editor");
|
|
9
|
+
var _router = require("@wordpress/router");
|
|
10
|
+
var _layout = _interopRequireDefault(require("../layout"));
|
|
11
|
+
var _page = _interopRequireDefault(require("../page"));
|
|
12
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Internal dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
RouterProvider
|
|
24
|
+
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
25
|
+
const {
|
|
26
|
+
GlobalStylesProvider
|
|
27
|
+
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
28
|
+
const defaultRoute = {
|
|
29
|
+
key: 'index',
|
|
30
|
+
areas: {
|
|
31
|
+
sidebar: 'Empty Sidebar',
|
|
32
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_page.default, {
|
|
33
|
+
children: "Welcome to Posts"
|
|
34
|
+
}),
|
|
35
|
+
preview: undefined,
|
|
36
|
+
mobile: /*#__PURE__*/(0, _jsxRuntime.jsx)(_page.default, {
|
|
37
|
+
children: "Welcome to Posts"
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function PostsApp() {
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GlobalStylesProvider, {
|
|
43
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.UnsavedChangesWarning, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(RouterProvider, {
|
|
44
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_layout.default, {
|
|
45
|
+
route: defaultRoute
|
|
46
|
+
})
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_editor","require","_router","_layout","_interopRequireDefault","_page","_lockUnlock","_jsxRuntime","RouterProvider","unlock","routerPrivateApis","GlobalStylesProvider","editorPrivateApis","defaultRoute","key","areas","sidebar","content","jsx","default","children","preview","undefined","mobile","PostsApp","jsxs","UnsavedChangesWarning","route"],"sources":["@wordpress/edit-site/src/components/posts-app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport Page from '../page';\nimport { unlock } from '../../lock-unlock';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nconst defaultRoute = {\n\tkey: 'index',\n\tareas: {\n\t\tsidebar: 'Empty Sidebar',\n\t\tcontent: <Page>Welcome to Posts</Page>,\n\t\tpreview: undefined,\n\t\tmobile: <Page>Welcome to Posts</Page>,\n\t},\n};\n\nexport default function PostsApp() {\n\treturn (\n\t\t<GlobalStylesProvider>\n\t\t\t<UnsavedChangesWarning />\n\t\t\t<RouterProvider>\n\t\t\t\t<Layout route={ defaultRoute } />\n\t\t\t</RouterProvider>\n\t\t</GlobalStylesProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAAE,OAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAA2C,IAAAM,WAAA,GAAAN,OAAA;AAd3C;AACA;AACA;;AAOA;AACA;AACA;;AAKA,MAAM;EAAEO;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AACtD,MAAM;EAAEC;AAAqB,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;AAE5D,MAAMC,YAAY,GAAG;EACpBC,GAAG,EAAE,OAAO;EACZC,KAAK,EAAE;IACNC,OAAO,EAAE,eAAe;IACxBC,OAAO,eAAE,IAAAV,WAAA,CAAAW,GAAA,EAACb,KAAA,CAAAc,OAAI;MAAAC,QAAA,EAAC;IAAgB,CAAM,CAAC;IACtCC,OAAO,EAAEC,SAAS;IAClBC,MAAM,eAAE,IAAAhB,WAAA,CAAAW,GAAA,EAACb,KAAA,CAAAc,OAAI;MAAAC,QAAA,EAAC;IAAgB,CAAM;EACrC;AACD,CAAC;AAEc,SAASI,QAAQA,CAAA,EAAG;EAClC,oBACC,IAAAjB,WAAA,CAAAkB,IAAA,EAACd,oBAAoB;IAAAS,QAAA,gBACpB,IAAAb,WAAA,CAAAW,GAAA,EAAClB,OAAA,CAAA0B,qBAAqB,IAAE,CAAC,eACzB,IAAAnB,WAAA,CAAAW,GAAA,EAACV,cAAc;MAAAY,QAAA,eACd,IAAAb,WAAA,CAAAW,GAAA,EAACf,OAAA,CAAAgB,OAAM;QAACQ,KAAK,EAAGd;MAAc,CAAE;IAAC,CAClB,CAAC;EAAA,CACI,CAAC;AAEzB","ignoreList":[]}
|
|
@@ -24,6 +24,8 @@ function RenameModal({
|
|
|
24
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Modal, {
|
|
25
25
|
title: (0, _i18n.__)('Rename'),
|
|
26
26
|
onRequestClose: onClose,
|
|
27
|
+
focusOnMount: "firstContentElement",
|
|
28
|
+
size: "small",
|
|
27
29
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
|
|
28
30
|
className: "sidebar-navigation__rename-modal-form",
|
|
29
31
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","_jsxRuntime","notEmptyString","testString","trim","length","RenameModal","menuTitle","onClose","onSave","editedMenuTitle","setEditedMenuTitle","useState","titleHasChanged","isEditedMenuTitleValid","jsx","Modal","title","__","onRequestClose","children","className","jsxs","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","placeholder","onChange","__experimentalHStack","justify","Button","variant","onClick","__experimentalIsFocusable","disabled","type","e","preventDefault"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\nconst notEmptyString = ( testString ) => testString?.trim()?.length > 0;\n\nexport default function RenameModal( { menuTitle, onClose, onSave } ) {\n\tconst [ editedMenuTitle, setEditedMenuTitle ] = useState( menuTitle );\n\n\tconst titleHasChanged = editedMenuTitle !== menuTitle;\n\n\tconst isEditedMenuTitleValid =\n\t\ttitleHasChanged && notEmptyString( editedMenuTitle );\n\n\treturn (\n\t\t<Modal
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","_jsxRuntime","notEmptyString","testString","trim","length","RenameModal","menuTitle","onClose","onSave","editedMenuTitle","setEditedMenuTitle","useState","titleHasChanged","isEditedMenuTitleValid","jsx","Modal","title","__","onRequestClose","focusOnMount","size","children","className","jsxs","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","value","placeholder","onChange","__experimentalHStack","justify","Button","variant","onClick","__experimentalIsFocusable","disabled","type","e","preventDefault"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\nconst notEmptyString = ( testString ) => testString?.trim()?.length > 0;\n\nexport default function RenameModal( { menuTitle, onClose, onSave } ) {\n\tconst [ editedMenuTitle, setEditedMenuTitle ] = useState( menuTitle );\n\n\tconst titleHasChanged = editedMenuTitle !== menuTitle;\n\n\tconst isEditedMenuTitleValid =\n\t\ttitleHasChanged && notEmptyString( editedMenuTitle );\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form className=\"sidebar-navigation__rename-modal-form\">\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvalue={ editedMenuTitle }\n\t\t\t\t\t\tplaceholder={ __( 'Navigation title' ) }\n\t\t\t\t\t\tonChange={ setEditedMenuTitle }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t\t\tdisabled={ ! isEditedMenuTitleValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t\t\t\tif ( ! isEditedMenuTitleValid ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSave( { title: editedMenuTitle } );\n\n\t\t\t\t\t\t\t\t// Immediate close avoids ability to hit save multiple times.\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAA8C,IAAAG,WAAA,GAAAH,OAAA;AAX9C;AACA;AACA;;AAWA,MAAMI,cAAc,GA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QAAS;UAAC,CACT,CAAC,eAET,IAAAjB,WAAA,CAAAc,GAAA,EAAClB,WAAA,CAAAsC,MAAM;YACNN,qBAAqB;YACrBS,yBAAyB;YACzBC,QAAQ,EAAG,CAAEzB,sBAAwB;YACrCsB,OAAO,EAAC,SAAS;YACjBI,IAAI,EAAC,QAAQ;YACbH,OAAO,EAAKI,CAAC,IAAM;cAClBA,CAAC,CAACC,cAAc,CAAC,CAAC;cAElB,IAAK,CAAE5B,sBAAsB,EAAG;gBAC/B;cACD;cACAL,MAAM,CAAE;gBAAEQ,KAAK,EAAEP;cAAgB,CAAE,CAAC;;cAEpC;cACAF,OAAO,CAAC,CAAC;YACV,CAAG;YAAAc,QAAA,EAED,IAAAJ,QAAE,EAAE,MAAO;UAAC,CACP,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useSetCommandContext;
|
|
7
|
+
var _data = require("@wordpress/data");
|
|
8
|
+
var _commands = require("@wordpress/commands");
|
|
9
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
+
var _store = require("../../store");
|
|
11
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
12
|
+
var _editorCanvasContainer = require("../../components/editor-canvas-container");
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
useCommandContext
|
|
23
|
+
} = (0, _lockUnlock.unlock)(_commands.privateApis);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* React hook used to set the correct command context based on the current state.
|
|
27
|
+
*/
|
|
28
|
+
function useSetCommandContext() {
|
|
29
|
+
const {
|
|
30
|
+
hasBlockSelected,
|
|
31
|
+
canvasMode
|
|
32
|
+
} = (0, _data.useSelect)(select => {
|
|
33
|
+
const {
|
|
34
|
+
getCanvasMode
|
|
35
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
36
|
+
const {
|
|
37
|
+
getBlockSelectionStart
|
|
38
|
+
} = select(_blockEditor.store);
|
|
39
|
+
return {
|
|
40
|
+
canvasMode: getCanvasMode(),
|
|
41
|
+
hasBlockSelected: getBlockSelectionStart()
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
const hasEditorCanvasContainer = (0, _editorCanvasContainer.useHasEditorCanvasContainer)();
|
|
45
|
+
|
|
46
|
+
// Sets the right context for the command palette
|
|
47
|
+
let commandContext = 'site-editor';
|
|
48
|
+
if (canvasMode === 'edit') {
|
|
49
|
+
commandContext = 'entity-edit';
|
|
50
|
+
}
|
|
51
|
+
if (hasBlockSelected) {
|
|
52
|
+
commandContext = 'block-selection-edit';
|
|
53
|
+
}
|
|
54
|
+
if (hasEditorCanvasContainer) {
|
|
55
|
+
/*
|
|
56
|
+
* The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context
|
|
57
|
+
* to remove the suggested commands that may not make sense with Style Book or Style Revisions open.
|
|
58
|
+
* See https://github.com/WordPress/gutenberg/issues/62216.
|
|
59
|
+
*/
|
|
60
|
+
commandContext = '';
|
|
61
|
+
}
|
|
62
|
+
useCommandContext(commandContext);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=use-set-command-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_commands","_blockEditor","_store","_lockUnlock","_editorCanvasContainer","useCommandContext","unlock","commandsPrivateApis","useSetCommandContext","hasBlockSelected","canvasMode","useSelect","select","getCanvasMode","editSiteStore","getBlockSelectionStart","blockEditorStore","hasEditorCanvasContainer","useHasEditorCanvasContainer","commandContext"],"sources":["@wordpress/edit-site/src/hooks/commands/use-set-command-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { privateApis as commandsPrivateApis } from '@wordpress/commands';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useHasEditorCanvasContainer } from '../../components/editor-canvas-container';\n\nconst { useCommandContext } = unlock( commandsPrivateApis );\n\n/**\n * React hook used to set the correct command context based on the current state.\n */\nexport default function useSetCommandContext() {\n\tconst { hasBlockSelected, canvasMode } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode } = unlock( select( editSiteStore ) );\n\t\tconst { getBlockSelectionStart } = select( blockEditorStore );\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\thasBlockSelected: getBlockSelectionStart(),\n\t\t};\n\t}, [] );\n\n\tconst hasEditorCanvasContainer = useHasEditorCanvasContainer();\n\n\t// Sets the right context for the command palette\n\tlet commandContext = 'site-editor';\n\tif ( canvasMode === 'edit' ) {\n\t\tcommandContext = 'entity-edit';\n\t}\n\tif ( hasBlockSelected ) {\n\t\tcommandContext = 'block-selection-edit';\n\t}\n\tif ( hasEditorCanvasContainer ) {\n\t\t/*\n\t\t * The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context\n\t\t * to remove the suggested commands that may not make sense with Style Book or Style Revisions open.\n\t\t * See https://github.com/WordPress/gutenberg/issues/62216.\n\t\t */\n\t\tcommandContext = '';\n\t}\n\tuseCommandContext( commandContext );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAKA;AACA;AACA;;AAKA,MAAM;EAAEM;AAAkB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;;AAE3D;AACA;AACA;AACe,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAM;IAAEC,gBAAgB;IAAEC;EAAW,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACjE,MAAM;MAAEC;IAAc,CAAC,GAAG,IAAAP,kBAAM,EAAEM,MAAM,CAAEE,YAAc,CAAE,CAAC;IAC3D,MAAM;MAAEC;IAAuB,CAAC,GAAGH,MAAM,CAAEI,kBAAiB,CAAC;IAC7D,OAAO;MACNN,UAAU,EAAEG,aAAa,CAAC,CAAC;MAC3BJ,gBAAgB,EAAEM,sBAAsB,CAAC;IAC1C,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAME,wBAAwB,GAAG,IAAAC,kDAA2B,EAAC,CAAC;;EAE9D;EACA,IAAIC,cAAc,GAAG,aAAa;EAClC,IAAKT,UAAU,KAAK,MAAM,EAAG;IAC5BS,cAAc,GAAG,aAAa;EAC/B;EACA,IAAKV,gBAAgB,EAAG;IACvBU,cAAc,GAAG,sBAAsB;EACxC;EACA,IAAKF,wBAAwB,EAAG;IAC/B;AACF;AACA;AACA;AACA;IACEE,cAAc,GAAG,EAAE;EACpB;EACAd,iBAAiB,CAAEc,cAAe,CAAC;AACpC","ignoreList":[]}
|
package/build/index.js
CHANGED
|
@@ -8,7 +8,8 @@ var _exportNames = {
|
|
|
8
8
|
initializeEditor: true,
|
|
9
9
|
reinitializeEditor: true,
|
|
10
10
|
store: true,
|
|
11
|
-
PluginTemplateSettingPanel: true
|
|
11
|
+
PluginTemplateSettingPanel: true,
|
|
12
|
+
initializePostsDashboard: true
|
|
12
13
|
};
|
|
13
14
|
Object.defineProperty(exports, "PluginTemplateSettingPanel", {
|
|
14
15
|
enumerable: true,
|
|
@@ -17,6 +18,12 @@ Object.defineProperty(exports, "PluginTemplateSettingPanel", {
|
|
|
17
18
|
}
|
|
18
19
|
});
|
|
19
20
|
exports.initializeEditor = initializeEditor;
|
|
21
|
+
Object.defineProperty(exports, "initializePostsDashboard", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _posts.initializePostsDashboard;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
20
27
|
exports.reinitializeEditor = reinitializeEditor;
|
|
21
28
|
Object.defineProperty(exports, "store", {
|
|
22
29
|
enumerable: true,
|
|
@@ -49,6 +56,7 @@ Object.keys(_deprecated2).forEach(function (key) {
|
|
|
49
56
|
}
|
|
50
57
|
});
|
|
51
58
|
});
|
|
59
|
+
var _posts = require("./posts");
|
|
52
60
|
/**
|
|
53
61
|
* WordPress dependencies
|
|
54
62
|
*/
|
|
@@ -118,7 +126,9 @@ function initializeEditor(id, settings) {
|
|
|
118
126
|
// Prevent the default browser action for files dropped outside of dropzones.
|
|
119
127
|
window.addEventListener('dragover', e => e.preventDefault(), false);
|
|
120
128
|
window.addEventListener('drop', e => e.preventDefault(), false);
|
|
121
|
-
root.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
129
|
+
root.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.StrictMode, {
|
|
130
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_app.default, {})
|
|
131
|
+
}));
|
|
122
132
|
return root;
|
|
123
133
|
}
|
|
124
134
|
function reinitializeEditor() {
|
|
@@ -127,4 +137,7 @@ function reinitializeEditor() {
|
|
|
127
137
|
version: '6.3'
|
|
128
138
|
});
|
|
129
139
|
}
|
|
140
|
+
|
|
141
|
+
// Temporary: While the posts dashboard is being iterated on
|
|
142
|
+
// it's being built in the same package as the site editor.
|
|
130
143
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_app","_jsxRuntime","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","jsx","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\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\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\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\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(
|
|
1
|
+
{"version":3,"names":["_blocks","require","_blockLibrary","_data","_deprecated","_interopRequireDefault","_element","_editor","_preferences","_widgets","_store","_app","_jsxRuntime","_pluginTemplateSettingPanel","_deprecated2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_posts","initializeEditor","id","settings","target","document","getElementById","root","createRoot","dispatch","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","name","registerCoreBlocks","setFreeformFallbackBlockName","registerLegacyWidgetBlock","inserter","registerWidgetGroupBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","preferencesStore","setDefaults","welcomeGuide","welcomeGuideStyles","welcomeGuidePage","welcomeGuideTemplate","allowRightClickOverrides","distractionFree","editorMode","fixedToolbar","focusMode","inactivePanels","keepCaretInsideBlock","openPanels","showBlockBreadcrumbs","showListViewByDefault","editSiteStore","updateSettings","editorStore","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","jsx","StrictMode","children","default","reinitializeEditor","deprecated","since","version"],"sources":["@wordpress/edit-site/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport { dispatch } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { createRoot, StrictMode } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\nimport { store as editSiteStore } from './store';\nimport App from './components/app';\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\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter(\n\t\t( { name } ) => name !== 'core/freeform'\n\t);\n\tregisterCoreBlocks( coreBlocks );\n\tdispatch( blocksStore ).setFreeformFallbackBlockName( 'core/html' );\n\tregisterLegacyWidgetBlock( { inserter: false } );\n\tregisterWidgetGroupBlock( { inserter: false } );\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: true,\n\t\t} );\n\t}\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\tdispatch( preferencesStore ).setDefaults( 'core/edit-site', {\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\twelcomeGuidePage: true,\n\t\twelcomeGuideTemplate: true,\n\t} );\n\n\tdispatch( preferencesStore ).setDefaults( 'core', {\n\t\tallowRightClickOverrides: true,\n\t\tdistractionFree: false,\n\t\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tinactivePanels: [],\n\t\tkeepCaretInsideBlock: false,\n\t\topenPanels: [ 'post-status' ],\n\t\tshowBlockBreadcrumbs: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( editSiteStore ).updateSettings( settings );\n\n\t// Keep the defaultTemplateTypes in the core/editor settings too,\n\t// so that they can be selected with core/editor selectors in any editor.\n\t// This is needed because edit-site doesn't initialize with EditorProvider,\n\t// which internally uses updateEditorSettings as well.\n\tdispatch( editorStore ).updateEditorSettings( {\n\t\tdefaultTemplateTypes: settings.defaultTemplateTypes,\n\t\tdefaultTemplatePartAreas: settings.defaultTemplatePartAreas,\n\t} );\n\n\t// Prevent the default browser action for files dropped outside of dropzones.\n\twindow.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );\n\twindow.addEventListener( 'drop', ( e ) => e.preventDefault(), false );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<App />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n\nexport function reinitializeEditor() {\n\tdeprecated( 'wp.editSite.reinitializeEditor', {\n\t\tsince: '6.2',\n\t\tversion: '6.3',\n\t} );\n}\n\nexport { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';\nexport { store } from './store';\nexport * from './deprecated';\n\n// Temporary: While the posts dashboard is being iterated on\n// it's being built in the same package as the site editor.\nexport { initializePostsDashboard } from './posts';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAQAA,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAAmC,IAAAW,WAAA,GAAAX,OAAA;AA+EnC,IAAAY,2BAAA,GAAAR,sBAAA,CAAAJ,OAAA;AAEA,IAAAa,YAAA,GAAAb,OAAA;AAAAc,MAAA,CAAAC,IAAA,CAAAF,YAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,YAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,YAAA,CA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BC,YAAY,EAAE,KAAK;IACnBC,SAAS,EAAE,KAAK;IAChBC,cAAc,EAAE,EAAE;IAClBC,oBAAoB,EAAE,KAAK;IAC3BC,UAAU,EAAE,CAAE,aAAa,CAAE;IAC7BC,oBAAoB,EAAE,IAAI;IAC1BC,qBAAqB,EAAE;EACxB,CAAE,CAAC;EAEH,IAAA/B,cAAQ,EAAEgC,YAAc,CAAC,CAACC,cAAc,CAAEvC,QAAS,CAAC;;EAEpD;EACA;EACA;EACA;EACA,IAAAM,cAAQ,EAAEkC,aAAY,CAAC,CAACC,oBAAoB,CAAE;IAC7CC,oBAAoB,EAAE1C,QAAQ,CAAC0C,oBAAoB;IACnDC,wBAAwB,EAAE3C,QAAQ,CAAC2C;EACpC,CAAE,CAAC;;EAEH;EACAC,MAAM,CAACC,gBAAgB,CAAE,UAAU,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EACzEH,MAAM,CAACC,gBAAgB,CAAE,MAAM,EAAIC,CAAC,IAAMA,CAAC,CAACC,cAAc,CAAC,CAAC,EAAE,KAAM,CAAC;EAErE3C,IAAI,CAAC4C,MAAM,eACV,IAAAlE,WAAA,CAAAmE,GAAA,EAACzE,QAAA,CAAA0E,UAAU;IAAAC,QAAA,eACV,IAAArE,WAAA,CAAAmE,GAAA,EAACpE,IAAA,CAAAuE,OAAG,IAAE;EAAC,CACI,CACb,CAAC;EAED,OAAOhD,IAAI;AACZ;AAEO,SAASiD,kBAAkBA,CAAA,EAAG;EACpC,IAAAC,mBAAU,EAAE,gCAAgC,EAAE;IAC7CC,KAAK,EAAE,KAAK;IACZC,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAMA;AACA","ignoreList":[]}
|
package/build/posts.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.initializePostsDashboard = initializePostsDashboard;
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
var _postsApp = _interopRequireDefault(require("./components/posts-app"));
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Initializes the "Posts Dashboard"
|
|
21
|
+
* @param {string} id DOM element id.
|
|
22
|
+
*/
|
|
23
|
+
function initializePostsDashboard(id) {
|
|
24
|
+
if (!globalThis.IS_GUTENBERG_PLUGIN) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const target = document.getElementById(id);
|
|
28
|
+
const root = (0, _element.createRoot)(target);
|
|
29
|
+
root.render( /*#__PURE__*/(0, _jsxRuntime.jsx)(_element.StrictMode, {
|
|
30
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_postsApp.default, {})
|
|
31
|
+
}));
|
|
32
|
+
return root;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=posts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_element","require","_postsApp","_interopRequireDefault","_jsxRuntime","initializePostsDashboard","id","globalThis","IS_GUTENBERG_PLUGIN","target","document","getElementById","root","createRoot","render","jsx","StrictMode","children","default"],"sources":["@wordpress/edit-site/src/posts.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRoot, StrictMode } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PostsApp from './components/posts-app';\n\n/**\n * Initializes the \"Posts Dashboard\"\n * @param {string} id DOM element id.\n */\nexport function initializePostsDashboard( id ) {\n\tif ( ! globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\treturn;\n\t}\n\tconst target = document.getElementById( id );\n\tconst root = createRoot( target );\n\n\troot.render(\n\t\t<StrictMode>\n\t\t\t<PostsApp />\n\t\t</StrictMode>\n\t);\n\n\treturn root;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,SAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8C,IAAAG,WAAA,GAAAH,OAAA;AAR9C;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,SAASI,wBAAwBA,CAAEC,EAAE,EAAG;EAC9C,IAAK,CAAEC,UAAU,CAACC,mBAAmB,EAAG;IACvC;EACD;EACA,MAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAc,CAAEL,EAAG,CAAC;EAC5C,MAAMM,IAAI,GAAG,IAAAC,mBAAU,EAAEJ,MAAO,CAAC;EAEjCG,IAAI,CAACE,MAAM,eACV,IAAAV,WAAA,CAAAW,GAAA,EAACf,QAAA,CAAAgB,UAAU;IAAAC,QAAA,eACV,IAAAb,WAAA,CAAAW,GAAA,EAACb,SAAA,CAAAgB,OAAQ,IAAE;EAAC,CACD,CACb,CAAC;EAED,OAAON,IAAI;AACZ","ignoreList":[]}
|
|
@@ -61,6 +61,8 @@ export default function AddNewPageModal({
|
|
|
61
61
|
return /*#__PURE__*/_jsx(Modal, {
|
|
62
62
|
title: __('Draft a new page'),
|
|
63
63
|
onRequestClose: onClose,
|
|
64
|
+
focusOnMount: "firstContentElement",
|
|
65
|
+
size: "small",
|
|
64
66
|
children: /*#__PURE__*/_jsx("form", {
|
|
65
67
|
onSubmit: createPage,
|
|
66
68
|
children: /*#__PURE__*/_jsxs(VStack, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useRegistry","useState","store","coreStore","noticesStore","decodeEntities","serialize","synchronizeBlocksWithTemplate","jsx","_jsx","jsxs","_jsxs","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","resolveSelect","createPage","event","preventDefault","pagePostType","getPostType","newPage","status","slug","content","template","length","undefined","throwOnError","rendered","type","error","errorMessage","message","code","onRequestClose","children","onSubmit","spacing","__next40pxDefaultSize","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\nexport default function AddNewPageModal( { onSave, onClose } ) {\n\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { resolveSelect } = useRegistry();\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPage ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPage( true );\n\t\ttry {\n\t\t\tconst pagePostType =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( 'page' );\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t!! pagePostType.template && pagePostType.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpagePostType.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\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 creating the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPage( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal
|
|
1
|
+
{"version":3,"names":["Button","Modal","__experimentalHStack","HStack","__experimentalVStack","VStack","TextControl","__","sprintf","useDispatch","useRegistry","useState","store","coreStore","noticesStore","decodeEntities","serialize","synchronizeBlocksWithTemplate","jsx","_jsx","jsxs","_jsxs","AddNewPageModal","onSave","onClose","isCreatingPage","setIsCreatingPage","title","setTitle","saveEntityRecord","createErrorNotice","createSuccessNotice","resolveSelect","createPage","event","preventDefault","pagePostType","getPostType","newPage","status","slug","content","template","length","undefined","throwOnError","rendered","type","error","errorMessage","message","code","onRequestClose","focusOnMount","size","children","onSubmit","spacing","__next40pxDefaultSize","label","onChange","placeholder","value","justify","variant","onClick","isBusy"],"sources":["@wordpress/edit-site/src/components/add-new-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useRegistry } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { serialize, synchronizeBlocksWithTemplate } from '@wordpress/blocks';\n\nexport default function AddNewPageModal( { onSave, onClose } ) {\n\tconst [ isCreatingPage, setIsCreatingPage ] = useState( false );\n\tconst [ title, setTitle ] = useState( '' );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { resolveSelect } = useRegistry();\n\n\tasync function createPage( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isCreatingPage ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingPage( true );\n\t\ttry {\n\t\t\tconst pagePostType =\n\t\t\t\tawait resolveSelect( coreStore ).getPostType( 'page' );\n\t\t\tconst newPage = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'page',\n\t\t\t\t{\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\ttitle,\n\t\t\t\t\tslug: title || __( 'No title' ),\n\t\t\t\t\tcontent:\n\t\t\t\t\t\t!! pagePostType.template && pagePostType.template.length\n\t\t\t\t\t\t\t? serialize(\n\t\t\t\t\t\t\t\t\tsynchronizeBlocksWithTemplate(\n\t\t\t\t\t\t\t\t\t\t[],\n\t\t\t\t\t\t\t\t\t\tpagePostType.template\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\tonSave( newPage );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newPage.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\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 creating the page.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingPage( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Draft a new page' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"small\"\n\t\t>\n\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Page title' ) }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'No title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tisBusy={ isCreatingPage }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AAC,qBAAqB;IAClCC,IAAI,EAAC,OAAO;IAAAC,QAAA,eAEZpC,IAAA;MAAMqC,QAAQ,EAAGvB,UAAY;MAAAsB,QAAA,eAC5BlC,KAAA,CAAChB,MAAM;QAACoD,OAAO,EAAG,CAAG;QAAAF,QAAA,gBACpBpC,IAAA,CAACb,WAAW;UACXoD,qBAAqB;UACrBC,KAAK,EAAGpD,EAAE,CAAE,YAAa,CAAG;UAC5BqD,QAAQ,EAAGhC,QAAU;UACrBiC,WAAW,EAAGtD,EAAE,CAAE,UAAW,CAAG;UAChCuD,KAAK,EAAGnC;QAAO,CACf,CAAC,eACFN,KAAA,CAAClB,MAAM;UAACsD,OAAO,EAAG,CAAG;UAACM,OAAO,EAAC,KAAK;UAAAR,QAAA,gBAClCpC,IAAA,CAACnB,MAAM;YACN0D,qBAAqB;YACrBM,OAAO,EAAC,UAAU;YAClBC,OAAO,EAAGzC,OAAS;YAAA+B,QAAA,EAEjBhD,EAAE,CAAE,QAAS;UAAC,CACT,CAAC,eACTY,IAAA,CAACnB,MAAM;YACN0D,qBAAqB;YACrBM,OAAO,EAAC,SAAS;YACjBjB,IAAI,EAAC,QAAQ;YACbmB,MAAM,EAAGzC,cAAgB;YACzB,iBAAgBA,cAAgB;YAAA8B,QAAA,EAE9BhD,EAAE,CAAE,cAAe;UAAC,CACf,CAAC;QAAA,CACF,CAAC;MAAA,CACF;IAAC,CACJ;EAAC,CACD,CAAC;AAEV","ignoreList":[]}
|
|
@@ -59,6 +59,7 @@ export default function AddNewPattern() {
|
|
|
59
59
|
isBlockBasedTheme: getCurrentTheme()?.is_block_theme,
|
|
60
60
|
addNewPatternLabel: getPostType(PATTERN_TYPES.user)?.labels?.add_new_item,
|
|
61
61
|
addNewTemplatePartLabel: getPostType(TEMPLATE_PART_POST_TYPE)?.labels?.add_new_item,
|
|
62
|
+
// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
|
|
62
63
|
canCreatePattern: canUser('create', 'blocks'),
|
|
63
64
|
canCreateTemplatePart: canUser('create', 'template-parts')
|
|
64
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DropdownMenu","useState","useRef","__","sprintf","symbol","symbolFilled","upload","useSelect","useDispatch","privateApis","routerPrivateApis","editPatternsPrivateApis","store","patternsStore","noticesStore","coreStore","editorPrivateApis","unlock","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useHistory","CreatePatternModal","useAddPatternCategory","CreateTemplatePartModal","AddNewPattern","history","showPatternModal","setShowPatternModal","showTemplatePartModal","setShowTemplatePartModal","createPatternFromFile","createSuccessNotice","createErrorNotice","patternUploadInputRef","isBlockBasedTheme","addNewPatternLabel","addNewTemplatePartLabel","canCreatePattern","canCreateTemplatePart","select","getCurrentTheme","getPostType","canUser","is_block_theme","user","labels","add_new_item","handleCreatePattern","pattern","push","postId","id","postType","canvas","handleCreateTemplatePart","templatePart","handleError","controls","icon","onClick","title","current","click","categoryMap","findOrCreateTerm","length","children","toggleProps","variant","showTooltip","__next40pxDefaultSize","text","label","onClose","onSuccess","onError","closeModal","blocks","onCreate","type","accept","hidden","ref","onChange","event","file","target","files","params","categoryId","getLocationWithParams","currentCategoryId","currentCategory","values","find","term","name","undefined","raw","err","message","value"],"sources":["@wordpress/edit-site/src/components/add-new-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { symbol, symbolFilled, upload } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tprivateApis as editPatternsPrivateApis,\n\tstore as patternsStore,\n} from '@wordpress/patterns';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst { useHistory } = unlock( routerPrivateApis );\nconst { CreatePatternModal, useAddPatternCategory } = unlock(\n\teditPatternsPrivateApis\n);\nconst { CreateTemplatePartModal } = unlock( editorPrivateApis );\n\nexport default function AddNewPattern() {\n\tconst history = useHistory();\n\tconst [ showPatternModal, setShowPatternModal ] = useState( false );\n\tconst [ showTemplatePartModal, setShowTemplatePartModal ] =\n\t\tuseState( false );\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { createPatternFromFile } = unlock( useDispatch( patternsStore ) );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst patternUploadInputRef = useRef();\n\tconst {\n\t\tisBlockBasedTheme,\n\t\taddNewPatternLabel,\n\t\taddNewTemplatePartLabel,\n\t\tcanCreatePattern,\n\t\tcanCreateTemplatePart,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getPostType, canUser } = select( coreStore );\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\taddNewPatternLabel: getPostType( PATTERN_TYPES.user )?.labels\n\t\t\t\t?.add_new_item,\n\t\t\taddNewTemplatePartLabel: getPostType( TEMPLATE_PART_POST_TYPE )\n\t\t\t\t?.labels?.add_new_item,\n\t\t\tcanCreatePattern: canUser( 'create', 'blocks' ),\n\t\t\tcanCreateTemplatePart: canUser( 'create', 'template-parts' ),\n\t\t};\n\t}, [] );\n\n\tfunction handleCreatePattern( { pattern } ) {\n\t\tsetShowPatternModal( false );\n\n\t\thistory.push( {\n\t\t\tpostId: pattern.id,\n\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleCreateTemplatePart( templatePart ) {\n\t\tsetShowTemplatePartModal( false );\n\n\t\t// Navigate to the created template part editor.\n\t\thistory.push( {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleError() {\n\t\tsetShowPatternModal( false );\n\t\tsetShowTemplatePartModal( false );\n\t}\n\n\tconst controls = [];\n\tif ( canCreatePattern ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbol,\n\t\t\tonClick: () => setShowPatternModal( true ),\n\t\t\ttitle: addNewPatternLabel,\n\t\t} );\n\t}\n\n\tif ( isBlockBasedTheme && canCreateTemplatePart ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbolFilled,\n\t\t\tonClick: () => setShowTemplatePartModal( true ),\n\t\t\ttitle: addNewTemplatePartLabel,\n\t\t} );\n\t}\n\n\tif ( canCreatePattern ) {\n\t\tcontrols.push( {\n\t\t\ticon: upload,\n\t\t\tonClick: () => {\n\t\t\t\tpatternUploadInputRef.current.click();\n\t\t\t},\n\t\t\ttitle: __( 'Import pattern from JSON' ),\n\t\t} );\n\t}\n\n\tconst { categoryMap, findOrCreateTerm } = useAddPatternCategory();\n\tif ( controls.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ addNewPatternLabel && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\tcontrols={ controls }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tvariant: 'primary',\n\t\t\t\t\t\tshowTooltip: false,\n\t\t\t\t\t\t__next40pxDefaultSize: true,\n\t\t\t\t\t} }\n\t\t\t\t\ttext={ addNewPatternLabel }\n\t\t\t\t\tlabel={ addNewPatternLabel }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showPatternModal && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tonClose={ () => setShowPatternModal( false ) }\n\t\t\t\t\tonSuccess={ handleCreatePattern }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showTemplatePartModal && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setShowTemplatePartModal( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ handleCreateTemplatePart }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept=\".json\"\n\t\t\t\thidden\n\t\t\t\tref={ patternUploadInputRef }\n\t\t\t\tonChange={ async ( event ) => {\n\t\t\t\t\tconst file = event.target.files?.[ 0 ];\n\t\t\t\t\tif ( ! file ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tparams: { postType, categoryId },\n\t\t\t\t\t\t} = history.getLocationWithParams();\n\t\t\t\t\t\tlet currentCategoryId;\n\t\t\t\t\t\t// When we're not handling template parts, we should\n\t\t\t\t\t\t// add or create the proper pattern category.\n\t\t\t\t\t\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\t\t\t\t\tconst currentCategory = categoryMap\n\t\t\t\t\t\t\t\t.values()\n\t\t\t\t\t\t\t\t.find( ( term ) => term.name === categoryId );\n\t\t\t\t\t\t\tif ( currentCategory ) {\n\t\t\t\t\t\t\t\tcurrentCategoryId =\n\t\t\t\t\t\t\t\t\tcurrentCategory.id ||\n\t\t\t\t\t\t\t\t\t( await findOrCreateTerm(\n\t\t\t\t\t\t\t\t\t\tcurrentCategory.label\n\t\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\tconst pattern = await createPatternFromFile(\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\tcurrentCategoryId\n\t\t\t\t\t\t\t\t? [ currentCategoryId ]\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Navigate to the All patterns category for the newly created pattern\n\t\t\t\t\t\t// if we're not on that page already and if we're not in the `my-patterns`\n\t\t\t\t\t\t// category.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! currentCategoryId &&\n\t\t\t\t\t\t\tcategoryId !== 'my-patterns'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\t\t\t\t\t\tcategoryId: PATTERN_DEFAULT_CATEGORY,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The imported pattern's title.\n\t\t\t\t\t\t\t\t__( 'Imported \"%s\" from JSON.' ),\n\t\t\t\t\t\t\t\tpattern.title.raw\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'import-pattern-success',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\tcreateErrorNotice( err.message, {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'import-pattern-error',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tevent.target.value = '';\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,YAAY,EAAEC,MAAM,QAAQ,kBAAkB;AAC/D,SAASC,SAAS,EAAEC,WAAW,Q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CAACiC,IAAI;cAC5B6C,UAAU,EAAE7E;YACb,CAAE,CAAC;UACJ;UAEAmB,mBAAmB,CAClBnC,OAAO;UACN;UACAD,EAAE,CAAE,0BAA2B,CAAC,EAChCqD,OAAO,CAACY,KAAK,CAACsC,GACf,CAAC,EACD;YACCnB,IAAI,EAAE,UAAU;YAChB5B,EAAE,EAAE;UACL,CACD,CAAC;QACF,CAAC,CAAC,OAAQgD,GAAG,EAAG;UACfnE,iBAAiB,CAAEmE,GAAG,CAACC,OAAO,EAAE;YAC/BrB,IAAI,EAAE,UAAU;YAChB5B,EAAE,EAAE;UACL,CAAE,CAAC;QACJ,CAAC,SAAS;UACTiC,KAAK,CAACE,MAAM,CAACe,KAAK,GAAG,EAAE;QACxB;MACD;IAAG,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["DropdownMenu","useState","useRef","__","sprintf","symbol","symbolFilled","upload","useSelect","useDispatch","privateApis","routerPrivateApis","editPatternsPrivateApis","store","patternsStore","noticesStore","coreStore","editorPrivateApis","unlock","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","TEMPLATE_PART_POST_TYPE","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useHistory","CreatePatternModal","useAddPatternCategory","CreateTemplatePartModal","AddNewPattern","history","showPatternModal","setShowPatternModal","showTemplatePartModal","setShowTemplatePartModal","createPatternFromFile","createSuccessNotice","createErrorNotice","patternUploadInputRef","isBlockBasedTheme","addNewPatternLabel","addNewTemplatePartLabel","canCreatePattern","canCreateTemplatePart","select","getCurrentTheme","getPostType","canUser","is_block_theme","user","labels","add_new_item","handleCreatePattern","pattern","push","postId","id","postType","canvas","handleCreateTemplatePart","templatePart","handleError","controls","icon","onClick","title","current","click","categoryMap","findOrCreateTerm","length","children","toggleProps","variant","showTooltip","__next40pxDefaultSize","text","label","onClose","onSuccess","onError","closeModal","blocks","onCreate","type","accept","hidden","ref","onChange","event","file","target","files","params","categoryId","getLocationWithParams","currentCategoryId","currentCategory","values","find","term","name","undefined","raw","err","message","value"],"sources":["@wordpress/edit-site/src/components/add-new-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { useState, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { symbol, symbolFilled, upload } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tprivateApis as editPatternsPrivateApis,\n\tstore as patternsStore,\n} from '@wordpress/patterns';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tTEMPLATE_PART_POST_TYPE,\n} from '../../utils/constants';\n\nconst { useHistory } = unlock( routerPrivateApis );\nconst { CreatePatternModal, useAddPatternCategory } = unlock(\n\teditPatternsPrivateApis\n);\nconst { CreateTemplatePartModal } = unlock( editorPrivateApis );\n\nexport default function AddNewPattern() {\n\tconst history = useHistory();\n\tconst [ showPatternModal, setShowPatternModal ] = useState( false );\n\tconst [ showTemplatePartModal, setShowTemplatePartModal ] =\n\t\tuseState( false );\n\t// eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\tconst { createPatternFromFile } = unlock( useDispatch( patternsStore ) );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst patternUploadInputRef = useRef();\n\tconst {\n\t\tisBlockBasedTheme,\n\t\taddNewPatternLabel,\n\t\taddNewTemplatePartLabel,\n\t\tcanCreatePattern,\n\t\tcanCreateTemplatePart,\n\t} = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getPostType, canUser } = select( coreStore );\n\t\treturn {\n\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\taddNewPatternLabel: getPostType( PATTERN_TYPES.user )?.labels\n\t\t\t\t?.add_new_item,\n\t\t\taddNewTemplatePartLabel: getPostType( TEMPLATE_PART_POST_TYPE )\n\t\t\t\t?.labels?.add_new_item,\n\t\t\t// Blocks refers to the wp_block post type, this checks the ability to create a post of that type.\n\t\t\tcanCreatePattern: canUser( 'create', 'blocks' ),\n\t\t\tcanCreateTemplatePart: canUser( 'create', 'template-parts' ),\n\t\t};\n\t}, [] );\n\n\tfunction handleCreatePattern( { pattern } ) {\n\t\tsetShowPatternModal( false );\n\n\t\thistory.push( {\n\t\t\tpostId: pattern.id,\n\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleCreateTemplatePart( templatePart ) {\n\t\tsetShowTemplatePartModal( false );\n\n\t\t// Navigate to the created template part editor.\n\t\thistory.push( {\n\t\t\tpostId: templatePart.id,\n\t\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t}\n\n\tfunction handleError() {\n\t\tsetShowPatternModal( false );\n\t\tsetShowTemplatePartModal( false );\n\t}\n\n\tconst controls = [];\n\tif ( canCreatePattern ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbol,\n\t\t\tonClick: () => setShowPatternModal( true ),\n\t\t\ttitle: addNewPatternLabel,\n\t\t} );\n\t}\n\n\tif ( isBlockBasedTheme && canCreateTemplatePart ) {\n\t\tcontrols.push( {\n\t\t\ticon: symbolFilled,\n\t\t\tonClick: () => setShowTemplatePartModal( true ),\n\t\t\ttitle: addNewTemplatePartLabel,\n\t\t} );\n\t}\n\n\tif ( canCreatePattern ) {\n\t\tcontrols.push( {\n\t\t\ticon: upload,\n\t\t\tonClick: () => {\n\t\t\t\tpatternUploadInputRef.current.click();\n\t\t\t},\n\t\t\ttitle: __( 'Import pattern from JSON' ),\n\t\t} );\n\t}\n\n\tconst { categoryMap, findOrCreateTerm } = useAddPatternCategory();\n\tif ( controls.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t{ addNewPatternLabel && (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\tcontrols={ controls }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\tvariant: 'primary',\n\t\t\t\t\t\tshowTooltip: false,\n\t\t\t\t\t\t__next40pxDefaultSize: true,\n\t\t\t\t\t} }\n\t\t\t\t\ttext={ addNewPatternLabel }\n\t\t\t\t\tlabel={ addNewPatternLabel }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showPatternModal && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tonClose={ () => setShowPatternModal( false ) }\n\t\t\t\t\tonSuccess={ handleCreatePattern }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showTemplatePartModal && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setShowTemplatePartModal( false ) }\n\t\t\t\t\tblocks={ [] }\n\t\t\t\t\tonCreate={ handleCreateTemplatePart }\n\t\t\t\t\tonError={ handleError }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<input\n\t\t\t\ttype=\"file\"\n\t\t\t\taccept=\".json\"\n\t\t\t\thidden\n\t\t\t\tref={ patternUploadInputRef }\n\t\t\t\tonChange={ async ( event ) => {\n\t\t\t\t\tconst file = event.target.files?.[ 0 ];\n\t\t\t\t\tif ( ! file ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tparams: { postType, categoryId },\n\t\t\t\t\t\t} = history.getLocationWithParams();\n\t\t\t\t\t\tlet currentCategoryId;\n\t\t\t\t\t\t// When we're not handling template parts, we should\n\t\t\t\t\t\t// add or create the proper pattern category.\n\t\t\t\t\t\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\t\t\t\t\t\tconst currentCategory = categoryMap\n\t\t\t\t\t\t\t\t.values()\n\t\t\t\t\t\t\t\t.find( ( term ) => term.name === categoryId );\n\t\t\t\t\t\t\tif ( currentCategory ) {\n\t\t\t\t\t\t\t\tcurrentCategoryId =\n\t\t\t\t\t\t\t\t\tcurrentCategory.id ||\n\t\t\t\t\t\t\t\t\t( await findOrCreateTerm(\n\t\t\t\t\t\t\t\t\t\tcurrentCategory.label\n\t\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\tconst pattern = await createPatternFromFile(\n\t\t\t\t\t\t\tfile,\n\t\t\t\t\t\t\tcurrentCategoryId\n\t\t\t\t\t\t\t\t? [ currentCategoryId ]\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Navigate to the All patterns category for the newly created pattern\n\t\t\t\t\t\t// if we're not on that page already and if we're not in the `my-patterns`\n\t\t\t\t\t\t// category.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t! currentCategoryId &&\n\t\t\t\t\t\t\tcategoryId !== 'my-patterns'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpostType: PATTERN_TYPES.user,\n\t\t\t\t\t\t\t\tcategoryId: PATTERN_DEFAULT_CATEGORY,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The imported pattern's title.\n\t\t\t\t\t\t\t\t__( 'Imported \"%s\" from JSON.' ),\n\t\t\t\t\t\t\t\tpattern.title.raw\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'import-pattern-success',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t} catch ( err ) {\n\t\t\t\t\t\tcreateErrorNotice( err.message, {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'import-pattern-error',\n\t\t\t\t\t\t} );\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tevent.target.value = '';\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,uBAAuB;AACpD,SAASC,QAAQ,EAAEC,MAAM,QAAQ,oBAAoB;AACrD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,YAAY,EAAEC,MAAM,QAAQ,kBAAkB;AAC/D,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SACCD,WAAW,IAAIE,uBAAuB,EACtCC,KAAK,IAAIC,aAAa,QAChB,qBAAqB;AAC5B,SAASD,KAAK,IAAIE,YAAY,QAAQ,oBAAoB;AAC1D,SAASF,KAAK,IAAIG,SAAS,QAAQ,sBAAsB;AACzD,SAASN,WAAW,IAAIO,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SACCC,aAAa,EACbC,wBAAwB,EACxBC,uBAAuB,QACjB,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE/B,MAAM;EAAEC;AAAW,CAAC,GAAGV,MAAM,CAAEP,iBAAkB,CAAC;AAClD,MAAM;EAAEkB,kBAAkB;EAAEC;AAAsB,CAAC,GAAGZ,MAAM,CAC3DN,uBACD,CAAC;AACD,MAAM;EAAEmB;AAAwB,CAAC,GAAGb,MAAM,CAAED,iBAAkB,CAAC;AAE/D,eAAe,SAASe,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e,GAAG7B,WAAW,CACjC8B,MAAM,CAAC,CAAC,CACRC,IAAI,CAAIC,IAAI,IAAMA,IAAI,CAACC,IAAI,KAAKP,UAAW,CAAC;YAC9C,IAAKG,eAAe,EAAG;cACtBD,iBAAiB,GAChBC,eAAe,CAACzC,EAAE,KAChB,MAAMa,gBAAgB,CACvB4B,eAAe,CAACpB,KACjB,CAAC,CAAE;YACL;UACD;UACA,MAAMxB,OAAO,GAAG,MAAMlB,qBAAqB,CAC1CuD,IAAI,EACJM,iBAAiB,GACd,CAAEA,iBAAiB,CAAE,GACrBM,SACJ,CAAC;;UAED;UACA;UACA;UACA,IACC,CAAEN,iBAAiB,IACnBF,UAAU,KAAK,aAAa,EAC3B;YACDhE,OAAO,CAACwB,IAAI,CAAE;cACbG,QAAQ,EAAEzC,aAAa,CAACiC,IAAI;cAC5B6C,UAAU,EAAE7E;YACb,CAAE,CAAC;UACJ;UAEAmB,mBAAmB,CAClBnC,OAAO;UACN;UACAD,EAAE,CAAE,0BAA2B,CAAC,EAChCqD,OAAO,CAACY,KAAK,CAACsC,GACf,CAAC,EACD;YACCnB,IAAI,EAAE,UAAU;YAChB5B,EAAE,EAAE;UACL,CACD,CAAC;QACF,CAAC,CAAC,OAAQgD,GAAG,EAAG;UACfnE,iBAAiB,CAAEmE,GAAG,CAACC,OAAO,EAAE;YAC/BrB,IAAI,EAAE,UAAU;YAChB5B,EAAE,EAAE;UACL,CAAE,CAAC;QACJ,CAAC,SAAS;UACTiC,KAAK,CAACE,MAAM,CAACe,KAAK,GAAG,EAAE;QACxB;MACD;IAAG,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -14,6 +14,11 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
14
14
|
*/
|
|
15
15
|
import Layout from '../layout';
|
|
16
16
|
import { unlock } from '../../lock-unlock';
|
|
17
|
+
import { useCommonCommands } from '../../hooks/commands/use-common-commands';
|
|
18
|
+
import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
|
|
19
|
+
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
20
|
+
import useLayoutAreas from '../layout/router';
|
|
21
|
+
import useSetCommandContext from '../../hooks/commands/use-set-command-context';
|
|
17
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
23
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
24
|
const {
|
|
@@ -22,6 +27,17 @@ const {
|
|
|
22
27
|
const {
|
|
23
28
|
GlobalStylesProvider
|
|
24
29
|
} = unlock(editorPrivateApis);
|
|
30
|
+
function AppLayout() {
|
|
31
|
+
// This ensures the edited entity id and type are initialized properly.
|
|
32
|
+
useInitEditedEntityFromURL();
|
|
33
|
+
useEditModeCommands();
|
|
34
|
+
useCommonCommands();
|
|
35
|
+
useSetCommandContext();
|
|
36
|
+
const route = useLayoutAreas();
|
|
37
|
+
return /*#__PURE__*/_jsx(Layout, {
|
|
38
|
+
route: route
|
|
39
|
+
});
|
|
40
|
+
}
|
|
25
41
|
export default function App() {
|
|
26
42
|
const {
|
|
27
43
|
createErrorNotice
|
|
@@ -33,7 +49,7 @@ export default function App() {
|
|
|
33
49
|
return /*#__PURE__*/_jsx(SlotFillProvider, {
|
|
34
50
|
children: /*#__PURE__*/_jsxs(GlobalStylesProvider, {
|
|
35
51
|
children: [/*#__PURE__*/_jsx(UnsavedChangesWarning, {}), /*#__PURE__*/_jsxs(RouterProvider, {
|
|
36
|
-
children: [/*#__PURE__*/_jsx(
|
|
52
|
+
children: [/*#__PURE__*/_jsx(AppLayout, {}), /*#__PURE__*/_jsx(PluginArea, {
|
|
37
53
|
onError: onPluginAreaError
|
|
38
54
|
})]
|
|
39
55
|
})]
|