@wordpress/edit-site 5.3.4 → 5.3.6
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/build/components/add-new-template/add-custom-template-modal.js +12 -3
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -7
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +3 -6
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/editor/index.js +3 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/screen-border.js +1 -1
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +1 -1
- package/build/components/global-styles/screen-variations.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +6 -4
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +1 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build/components/keyboard-shortcuts/global.js +48 -0
- package/build/components/keyboard-shortcuts/global.js.map +1 -0
- package/build/components/keyboard-shortcuts/register.js +153 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -0
- package/build/components/layout/index.js +5 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +41 -42
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/table.js +3 -2
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +4 -2
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-button/index.js +5 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-panel/index.js +11 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +28 -35
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +30 -0
- package/build/components/sidebar-button/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +10 -10
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +17 -16
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +9 -19
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +25 -15
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -7
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/style-book/index.js +17 -2
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +65 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +7 -9
- package/build/components/template-details/index.js.map +1 -1
- package/build/index.js +10 -22
- package/build/index.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +8 -7
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +3 -6
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/editor/index.js +3 -3
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +1 -1
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +1 -1
- package/build-module/components/global-styles/screen-variations.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +1 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/global.js +37 -0
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/register.js +141 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
- package/build-module/components/layout/index.js +3 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +43 -44
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/table.js +3 -2
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-button/index.js +5 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +8 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +25 -35
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +18 -0
- package/build-module/components/sidebar-button/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +8 -11
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +16 -17
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +1 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +8 -18
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +23 -16
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -7
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/style-book/index.js +17 -3
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +63 -18
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +7 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/index.js +12 -22
- package/build-module/index.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +41 -38
- package/build-style/style.css +41 -38
- package/package.json +21 -21
- package/src/components/add-new-template/add-custom-template-modal.js +14 -10
- package/src/components/add-new-template/new-template-part.js +7 -9
- package/src/components/add-new-template/new-template.js +3 -6
- package/src/components/add-new-template/style.scss +0 -5
- package/src/components/block-editor/style.scss +1 -1
- package/src/components/editor/index.js +4 -3
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/screen-border.js +1 -1
- package/src/components/global-styles/screen-variations.js +0 -1
- package/src/components/global-styles/shadow-panel.js +4 -3
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
- package/src/components/keyboard-shortcuts/global.js +35 -0
- package/src/components/keyboard-shortcuts/register.js +157 -0
- package/src/components/layout/index.js +4 -0
- package/src/components/layout/style.scss +8 -1
- package/src/components/list/added-by.js +48 -55
- package/src/components/list/style.scss +5 -13
- package/src/components/list/table.js +4 -5
- package/src/components/navigation-inspector/navigation-menu.js +8 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +34 -29
- package/src/components/sidebar-button/index.js +21 -0
- package/src/components/sidebar-button/style.scss +23 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
- package/src/components/sidebar-edit-mode/style.scss +16 -0
- package/src/components/sidebar-navigation-screen/index.js +31 -38
- package/src/components/sidebar-navigation-screen/style.scss +1 -9
- package/src/components/sidebar-navigation-screen-main/index.js +3 -3
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +24 -20
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +0 -2
- package/src/components/sidebar-navigation-screen-template/index.js +7 -19
- package/src/components/sidebar-navigation-screen-templates/index.js +22 -14
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +6 -11
- package/src/components/style-book/index.js +25 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +72 -17
- package/src/components/template-details/index.js +5 -6
- package/src/index.js +6 -21
- package/src/style.scss +1 -0
- package/src/utils/get-is-list-page.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"names":["classnames","Button","TabPanel","createSlotFill","__experimentalUseSlotFills","useSlotFills","__","sprintf","getCategories","getBlockTypes","getBlockFromExample","createBlock","BlockPreview","privateApis","blockEditorPrivateApis","closeSmall","useResizeObserver","useMemo","memo","unlock","useGlobalStyle","SLOT_FILL_NAME","Slot","StyleBookSlot","Fill","StyleBookFill","getExamples","headingsExample","name","title","category","blocks","content","level","otherExamples","filter","blockType","example","supports","inserter","map","StyleBook","isSelected","onSelect","onClose","resizeObserver","sizes","textColor","backgroundColor","examples","tabs","some","slug","icon","width","color","background","tab","Examples","Example","onClick","css","useHasStyleBook","fills","length"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,cAHD,EAICC,0BAA0B,IAAIC,YAJ/B,QAKO,uBALP;AAMA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,mBAHD,EAICC,WAJD,QAKO,mBALP;AAMA,SACCC,YADD,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SAASC,iBAAT,QAAkC,oBAAlC;AACA,SAASC,OAAT,EAAkBC,IAAlB,QAA8B,oBAA9B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqBD,MAAM,CAAEL,sBAAF,CAAjC;AAEA,MAAMO,cAAc,GAAG,mBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IACLtB,cAAc,CAAEkB,cAAF,CADf;;AAGA,SAASK,WAAT,GAAuB;AACtB;AACA;AACA,QAAMC,eAAe,GAAG;AACvBC,IAAAA,IAAI,EAAE,cADiB;AAEvBC,IAAAA,KAAK,EAAEvB,EAAE,CAAE,UAAF,CAFc;AAGvBwB,IAAAA,QAAQ,EAAE,MAHa;AAIvBC,IAAAA,MAAM,EAAE,CACPpB,WAAW,CAAE,cAAF,EAAkB;AAC5BqB,MAAAA,OAAO,EAAE1B,EAAE,CAAE,gBAAF,CADiB;AAE5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nBuB,KAHmB,CAJrB;AASC,IAAA,OAAO,EAAG+B;AATX,KAWC;AAAM,IAAA,SAAS,EAAC;AAAhB,KAAwD/B,KAAxD,CAXD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,YAAD;AACC,IAAA,MAAM,EAAGE,MADV;AAEC,IAAA,aAAa,EAAG,CAFjB;AAGC,IAAA,gBAAgB,EAAG,CAClB;AACC8B,MAAAA,GAAG,EACF,6CACA;AAHF,KADkB;AAHpB,IADD,CAZD,CADqB;AAAA,CAAF,CAApB;;AA6BA,SAASC,eAAT,GAA2B;AAC1B,QAAMC,KAAK,GAAG1D,YAAY,CAAEgB,cAAF,CAA1B;AACA,SAAO,CAAC,EAAE0C,KAAF,aAAEA,KAAF,eAAEA,KAAK,CAAEC,MAAT,CAAR;AACA;;AAEDvB,SAAS,CAACnB,IAAV,GAAiBC,aAAjB;AACA,eAAekB,SAAf;AACA,SAASqB,eAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tTabPanel,\n\tcreateSlotFill,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { closeSmall } from '@wordpress/icons';\nimport { useResizeObserver } from '@wordpress/compose';\nimport { useMemo, memo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst SLOT_FILL_NAME = 'EditSiteStyleBook';\nconst { Slot: StyleBookSlot, Fill: StyleBookFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( { isSelected, onSelect, onClose } ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\n\t);\n\treturn (\n\t\t<StyleBookFill>\n\t\t\t<section\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t\taria-label={ __( 'Style Book' ) }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"edit-site-style-book__close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close Style Book' ) }\n\t\t\t\t\tonClick={ onClose }\n\t\t\t\t/>\n\t\t\t\t<TabPanel\n\t\t\t\t\tclassName=\"edit-site-style-book__tab-panel\"\n\t\t\t\t\ttabs={ tabs }\n\t\t\t\t>\n\t\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t\t<Examples\n\t\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TabPanel>\n\t\t\t</section>\n\t\t</StyleBookFill>\n\t);\n}\n\nconst Examples = memo( ( { examples, category, isSelected, onSelect } ) => (\n\t<div className=\"edit-site-style-book__examples\">\n\t\t{ examples\n\t\t\t.filter( ( example ) => example.category === category )\n\t\t\t.map( ( example ) => (\n\t\t\t\t<Example\n\t\t\t\t\tkey={ example.name }\n\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonSelect( example.name );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t</div>\n) );\n\nconst Example = memo( ( { title, blocks, isSelected, onClick } ) => (\n\t<button\n\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t'is-selected': isSelected,\n\t\t} ) }\n\t\taria-label={ sprintf(\n\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\ttitle\n\t\t) }\n\t\tonClick={ onClick }\n\t>\n\t\t<span className=\"edit-site-style-book__example-title\">{ title }</span>\n\t\t<div className=\"edit-site-style-book__example-preview\">\n\t\t\t<BlockPreview\n\t\t\t\tblocks={ blocks }\n\t\t\t\tviewportWidth={ 0 }\n\t\t\t\tadditionalStyles={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tcss:\n\t\t\t\t\t\t\t'.wp-block:first-child { margin-top: 0; }' +\n\t\t\t\t\t\t\t'.wp-block:last-child { margin-bottom: 0; }',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t</div>\n\t</button>\n) );\n\nfunction useHasStyleBook() {\n\tconst fills = useSlotFills( SLOT_FILL_NAME );\n\treturn !! fills?.length;\n}\n\nStyleBook.Slot = StyleBookSlot;\nexport default StyleBook;\nexport { useHasStyleBook };\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/style-book/index.js"],"names":["classnames","Button","TabPanel","createSlotFill","__experimentalUseSlotFills","useSlotFills","__","sprintf","getCategories","getBlockTypes","getBlockFromExample","createBlock","BlockPreview","privateApis","blockEditorPrivateApis","closeSmall","useResizeObserver","useFocusOnMount","useFocusReturn","useMergeRefs","useMemo","memo","ESCAPE","unlock","useGlobalStyle","SLOT_FILL_NAME","Slot","StyleBookSlot","Fill","StyleBookFill","getExamples","headingsExample","name","title","category","blocks","content","level","otherExamples","filter","blockType","example","supports","inserter","map","StyleBook","isSelected","onSelect","onClose","resizeObserver","sizes","focusOnMountRef","sectionFocusReturnRef","textColor","backgroundColor","examples","tabs","some","slug","icon","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","width","color","background","tab","Examples","Example","onClick","css","useHasStyleBook","fills","length"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,MADD,EAECC,QAFD,EAGCC,cAHD,EAICC,0BAA0B,IAAIC,YAJ/B,QAKO,uBALP;AAMA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,mBAHD,EAICC,WAJD,QAKO,mBALP;AAMA,SACCC,YADD,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SAASC,UAAT,QAA2B,kBAA3B;AACA,SACCC,iBADD,EAECC,eAFD,EAGCC,cAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SAASC,OAAT,EAAkBC,IAAlB,QAA8B,oBAA9B;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqBD,MAAM,CAAET,sBAAF,CAAjC;AAEA,MAAMW,cAAc,GAAG,mBAAvB;AACA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IACL1B,cAAc,CAAEsB,cAAF,CADf;;AAGA,SAASK,WAAT,GAAuB;AACtB;AACA;AACA,QAAMC,eAAe,GAAG;AACvBC,IAAAA,IAAI,EAAE,cADiB;AAEvBC,IAAAA,KAAK,EAAE3B,EAAE,CAAE,UAAF,CAFc;AAGvB4B,IAAAA,QAAQ,EAAE,MAHa;AAIvBC,IAAAA,MAAM,EAAE,CACPxB,WAAW,CAAE,cAAF,EAAkB;AAC5ByB,MAAAA,OAAO,EAAE9B,EAAE,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AEL,OAAO,CAACT,IAAV,CAJxB;AAKC,IAAA,OAAO,EAAG,MAAM;AACfe,MAAAA,QAAQ,CAAEN,OAAO,CAACT,IAAV,CAAR;AACA;AAPF,IAHA,CADH,CADsB;AAAA,CAAF,CAArB;AAkBA,MAAMsC,OAAO,GAAGjD,IAAI,CAAE;AAAA,MAAE;AAAEY,IAAAA,KAAF;AAASE,IAAAA,MAAT;AAAiBW,IAAAA,UAAjB;AAA6ByB,IAAAA;AAA7B,GAAF;AAAA,SACrB;AACC,IAAA,SAAS,EAAGvE,UAAU,CAAE,+BAAF,EAAmC;AACxD,qBAAe8C;AADyC,KAAnC,CADvB;AAIC,kBAAavC,OAAO,EACnB;AACAD,IAAAA,EAAE,CAAE,gCAAF,CAFiB,EAGnB2B,KAHmB,CAJrB;AASC,IAAA,OAAO,EAAGsC;AATX,KAWC;AAAM,IAAA,SAAS,EAAC;AAAhB,KAAwDtC,KAAxD,CAXD,EAYC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,YAAD;AACC,IAAA,MAAM,EAAGE,MADV;AAEC,IAAA,aAAa,EAAG,CAFjB;AAGC,IAAA,gBAAgB,EAAG,CAClB;AACCqC,MAAAA,GAAG,EACF,6CACA;AAHF,KADkB;AAHpB,IADD,CAZD,CADqB;AAAA,CAAF,CAApB;;AA6BA,SAASC,eAAT,GAA2B;AAC1B,QAAMC,KAAK,GAAGrE,YAAY,CAAEoB,cAAF,CAA1B;AACA,SAAO,CAAC,EAAEiD,KAAF,aAAEA,KAAF,eAAEA,KAAK,CAAEC,MAAT,CAAR;AACA;;AAED9B,SAAS,CAACnB,IAAV,GAAiBC,aAAjB;AACA,eAAekB,SAAf;AACA,SAAS4B,eAAT","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tTabPanel,\n\tcreateSlotFill,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tgetCategories,\n\tgetBlockTypes,\n\tgetBlockFromExample,\n\tcreateBlock,\n} from '@wordpress/blocks';\nimport {\n\tBlockPreview,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { closeSmall } from '@wordpress/icons';\nimport {\n\tuseResizeObserver,\n\tuseFocusOnMount,\n\tuseFocusReturn,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { useMemo, memo } from '@wordpress/element';\nimport { ESCAPE } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nconst SLOT_FILL_NAME = 'EditSiteStyleBook';\nconst { Slot: StyleBookSlot, Fill: StyleBookFill } =\n\tcreateSlotFill( SLOT_FILL_NAME );\n\nfunction getExamples() {\n\t// Use our own example for the Heading block so that we can show multiple\n\t// heading levels.\n\tconst headingsExample = {\n\t\tname: 'core/heading',\n\t\ttitle: __( 'Headings' ),\n\t\tcategory: 'text',\n\t\tblocks: [\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 1,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 2,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 3,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 4,\n\t\t\t} ),\n\t\t\tcreateBlock( 'core/heading', {\n\t\t\t\tcontent: __( 'Code Is Poetry' ),\n\t\t\t\tlevel: 5,\n\t\t\t} ),\n\t\t],\n\t};\n\n\tconst otherExamples = getBlockTypes()\n\t\t.filter( ( blockType ) => {\n\t\t\tconst { name, example, supports } = blockType;\n\t\t\treturn (\n\t\t\t\tname !== 'core/heading' &&\n\t\t\t\t!! example &&\n\t\t\t\tsupports.inserter !== false\n\t\t\t);\n\t\t} )\n\t\t.map( ( blockType ) => ( {\n\t\t\tname: blockType.name,\n\t\t\ttitle: blockType.title,\n\t\t\tcategory: blockType.category,\n\t\t\tblocks: getBlockFromExample( blockType.name, blockType.example ),\n\t\t} ) );\n\n\treturn [ headingsExample, ...otherExamples ];\n}\n\nfunction StyleBook( { isSelected, onSelect, onClose } ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\n\tconst [ textColor ] = useGlobalStyle( 'color.text' );\n\tconst [ backgroundColor ] = useGlobalStyle( 'color.background' );\n\tconst examples = useMemo( getExamples, [] );\n\tconst tabs = useMemo(\n\t\t() =>\n\t\t\tgetCategories()\n\t\t\t\t.filter( ( category ) =>\n\t\t\t\t\texamples.some(\n\t\t\t\t\t\t( example ) => example.category === category.slug\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t\t.map( ( category ) => ( {\n\t\t\t\t\tname: category.slug,\n\t\t\t\t\ttitle: category.title,\n\t\t\t\t\ticon: category.icon,\n\t\t\t\t} ) ),\n\t\t[ examples ]\n\t);\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonClose();\n\t\t}\n\t}\n\n\treturn (\n\t\t<StyleBookFill>\n\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t<section\n\t\t\t\tclassName={ classnames( 'edit-site-style-book', {\n\t\t\t\t\t'is-wide': sizes.width > 600,\n\t\t\t\t} ) }\n\t\t\t\tstyle={ {\n\t\t\t\t\tcolor: textColor,\n\t\t\t\t\tbackground: backgroundColor,\n\t\t\t\t} }\n\t\t\t\taria-label={ __( 'Style Book' ) }\n\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\tsectionFocusReturnRef,\n\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t] ) }\n\t\t\t>\n\t\t\t\t{ resizeObserver }\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"edit-site-style-book__close-button\"\n\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\tlabel={ __( 'Close Style Book' ) }\n\t\t\t\t\tonClick={ onClose }\n\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t/>\n\t\t\t\t<TabPanel\n\t\t\t\t\tclassName=\"edit-site-style-book__tab-panel\"\n\t\t\t\t\ttabs={ tabs }\n\t\t\t\t>\n\t\t\t\t\t{ ( tab ) => (\n\t\t\t\t\t\t<Examples\n\t\t\t\t\t\t\texamples={ examples }\n\t\t\t\t\t\t\tcategory={ tab.name }\n\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</TabPanel>\n\t\t\t</section>\n\t\t</StyleBookFill>\n\t);\n}\n\nconst Examples = memo( ( { examples, category, isSelected, onSelect } ) => (\n\t<div className=\"edit-site-style-book__examples\">\n\t\t{ examples\n\t\t\t.filter( ( example ) => example.category === category )\n\t\t\t.map( ( example ) => (\n\t\t\t\t<Example\n\t\t\t\t\tkey={ example.name }\n\t\t\t\t\ttitle={ example.title }\n\t\t\t\t\tblocks={ example.blocks }\n\t\t\t\t\tisSelected={ isSelected( example.name ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tonSelect( example.name );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) ) }\n\t</div>\n) );\n\nconst Example = memo( ( { title, blocks, isSelected, onClick } ) => (\n\t<button\n\t\tclassName={ classnames( 'edit-site-style-book__example', {\n\t\t\t'is-selected': isSelected,\n\t\t} ) }\n\t\taria-label={ sprintf(\n\t\t\t// translators: %s: Title of a block, e.g. Heading.\n\t\t\t__( 'Open %s styles in Styles panel' ),\n\t\t\ttitle\n\t\t) }\n\t\tonClick={ onClick }\n\t>\n\t\t<span className=\"edit-site-style-book__example-title\">{ title }</span>\n\t\t<div className=\"edit-site-style-book__example-preview\">\n\t\t\t<BlockPreview\n\t\t\t\tblocks={ blocks }\n\t\t\t\tviewportWidth={ 0 }\n\t\t\t\tadditionalStyles={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tcss:\n\t\t\t\t\t\t\t'.wp-block:first-child { margin-top: 0; }' +\n\t\t\t\t\t\t\t'.wp-block:last-child { margin-bottom: 0; }',\n\t\t\t\t\t},\n\t\t\t\t] }\n\t\t\t/>\n\t\t</div>\n\t</button>\n) );\n\nfunction useHasStyleBook() {\n\tconst fills = useSlotFills( SLOT_FILL_NAME );\n\treturn !! fills?.length;\n}\n\nStyleBook.Slot = StyleBookSlot;\nexport default StyleBook;\nexport { useHasStyleBook };\n"]}
|
|
@@ -14,13 +14,13 @@ export default function useInitEditedEntityFromURL() {
|
|
|
14
14
|
const {
|
|
15
15
|
params: {
|
|
16
16
|
postId,
|
|
17
|
-
postType
|
|
18
|
-
path = '/'
|
|
17
|
+
postType
|
|
19
18
|
} = {}
|
|
20
19
|
} = useLocation();
|
|
21
20
|
const {
|
|
22
21
|
isRequestingSite,
|
|
23
|
-
homepageId
|
|
22
|
+
homepageId,
|
|
23
|
+
url
|
|
24
24
|
} = useSelect(select => {
|
|
25
25
|
const {
|
|
26
26
|
getSite
|
|
@@ -28,7 +28,8 @@ export default function useInitEditedEntityFromURL() {
|
|
|
28
28
|
const siteData = getSite();
|
|
29
29
|
return {
|
|
30
30
|
isRequestingSite: !siteData,
|
|
31
|
-
homepageId: (siteData === null || siteData === void 0 ? void 0 : siteData.show_on_front) === 'page' ? siteData.page_on_front : null
|
|
31
|
+
homepageId: (siteData === null || siteData === void 0 ? void 0 : siteData.show_on_front) === 'page' ? siteData.page_on_front : null,
|
|
32
|
+
url: siteData === null || siteData === void 0 ? void 0 : siteData.url
|
|
32
33
|
};
|
|
33
34
|
}, []);
|
|
34
35
|
const {
|
|
@@ -37,40 +38,41 @@ export default function useInitEditedEntityFromURL() {
|
|
|
37
38
|
setPage
|
|
38
39
|
} = useDispatch(editSiteStore);
|
|
39
40
|
useEffect(() => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
if (postType && postId) {
|
|
42
|
+
switch (postType) {
|
|
43
|
+
case 'wp_template':
|
|
44
|
+
setTemplate(postId);
|
|
45
|
+
break;
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
case 'wp_template_part':
|
|
48
|
+
setTemplatePart(postId);
|
|
49
|
+
break;
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
default:
|
|
52
|
+
setPage({
|
|
53
|
+
context: {
|
|
54
|
+
postType,
|
|
55
|
+
postId
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} else if (!isRequestingSite) {
|
|
68
|
-
setPage({
|
|
69
|
-
path: '/'
|
|
70
|
-
});
|
|
71
|
-
}
|
|
60
|
+
return;
|
|
61
|
+
} // In all other cases, we need to set the home page in the site editor view.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if (homepageId) {
|
|
65
|
+
setPage({
|
|
66
|
+
context: {
|
|
67
|
+
postType: 'page',
|
|
68
|
+
postId: homepageId
|
|
72
69
|
}
|
|
70
|
+
});
|
|
71
|
+
} else if (!isRequestingSite) {
|
|
72
|
+
setPage({
|
|
73
|
+
path: url
|
|
74
|
+
});
|
|
73
75
|
}
|
|
74
|
-
}, [
|
|
76
|
+
}, [url, postId, postType, homepageId, isRequestingSite, setPage, setTemplate, setTemplatePart]);
|
|
75
77
|
}
|
|
76
78
|
//# sourceMappingURL=use-init-edited-entity-from-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"names":["useEffect","useSelect","useDispatch","store","coreDataStore","useLocation","editSiteStore","useInitEditedEntityFromURL","params","postId","postType","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"names":["useEffect","useSelect","useDispatch","store","coreDataStore","useLocation","editSiteStore","useInitEditedEntityFromURL","params","postId","postType","isRequestingSite","homepageId","url","select","getSite","siteData","show_on_front","page_on_front","setTemplate","setTemplatePart","setPage","context","path"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,0BAAT,GAAsC;AACpD,QAAM;AAAEC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV,QAAuB;AAAjC,MAAwCL,WAAW,EAAzD;AACA,QAAM;AAAEM,IAAAA,gBAAF;AAAoBC,IAAAA,UAApB;AAAgCC,IAAAA;AAAhC,MAAwCZ,SAAS,CAAIa,MAAF,IAAc;AACtE,UAAM;AAAEC,MAAAA;AAAF,QAAcD,MAAM,CAAEV,aAAF,CAA1B;AACA,UAAMY,QAAQ,GAAGD,OAAO,EAAxB;AAEA,WAAO;AACNJ,MAAAA,gBAAgB,EAAE,CAAEK,QADd;AAENJ,MAAAA,UAAU,EACT,CAAAI,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEC,aAAV,MAA4B,MAA5B,GACGD,QAAQ,CAACE,aADZ,GAEG,IALE;AAMNL,MAAAA,GAAG,EAAEG,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEH;AANT,KAAP;AAQA,GAZsD,EAYpD,EAZoD,CAAvD;AAcA,QAAM;AAAEM,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA;AAAhC,MACLnB,WAAW,CAAEI,aAAF,CADZ;AAGAN,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKU,QAAQ,IAAID,MAAjB,EAA0B;AACzB,cAASC,QAAT;AACC,aAAK,aAAL;AACCS,UAAAA,WAAW,CAAEV,MAAF,CAAX;AACA;;AACD,aAAK,kBAAL;AACCW,UAAAA,eAAe,CAAEX,MAAF,CAAf;AACA;;AACD;AACCY,UAAAA,OAAO,CAAE;AACRC,YAAAA,OAAO,EAAE;AAAEZ,cAAAA,QAAF;AAAYD,cAAAA;AAAZ;AADD,WAAF,CAAP;AARF;;AAaA;AACA,KAhBe,CAkBhB;;;AACA,QAAKG,UAAL,EAAkB;AACjBS,MAAAA,OAAO,CAAE;AACRC,QAAAA,OAAO,EAAE;AAAEZ,UAAAA,QAAQ,EAAE,MAAZ;AAAoBD,UAAAA,MAAM,EAAEG;AAA5B;AADD,OAAF,CAAP;AAGA,KAJD,MAIO,IAAK,CAAED,gBAAP,EAA0B;AAChCU,MAAAA,OAAO,CAAE;AACRE,QAAAA,IAAI,EAAEV;AADE,OAAF,CAAP;AAGA;AACD,GA5BQ,EA4BN,CACFA,GADE,EAEFJ,MAFE,EAGFC,QAHE,EAIFE,UAJE,EAKFD,gBALE,EAMFU,OANE,EAOFF,WAPE,EAQFC,eARE,CA5BM,CAAT;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params: { postId, postType } = {} } = useLocation();\n\tconst { isRequestingSite, homepageId, url } = useSelect( ( select ) => {\n\t\tconst { getSite } = select( coreDataStore );\n\t\tconst siteData = getSite();\n\n\t\treturn {\n\t\t\tisRequestingSite: ! siteData,\n\t\t\thomepageId:\n\t\t\t\tsiteData?.show_on_front === 'page'\n\t\t\t\t\t? siteData.page_on_front\n\t\t\t\t\t: null,\n\t\t\turl: siteData?.url,\n\t\t};\n\t}, [] );\n\n\tconst { setTemplate, setTemplatePart, setPage } =\n\t\tuseDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( postType && postId ) {\n\t\t\tswitch ( postType ) {\n\t\t\t\tcase 'wp_template':\n\t\t\t\t\tsetTemplate( postId );\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'wp_template_part':\n\t\t\t\t\tsetTemplatePart( postId );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tsetPage( {\n\t\t\t\t\t\tcontext: { postType, postId },\n\t\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// In all other cases, we need to set the home page in the site editor view.\n\t\tif ( homepageId ) {\n\t\t\tsetPage( {\n\t\t\t\tcontext: { postType: 'page', postId: homepageId },\n\t\t\t} );\n\t\t} else if ( ! isRequestingSite ) {\n\t\t\tsetPage( {\n\t\t\t\tpath: url,\n\t\t\t} );\n\t\t}\n\t}, [\n\t\turl,\n\t\tpostId,\n\t\tpostType,\n\t\thomepageId,\n\t\tisRequestingSite,\n\t\tsetPage,\n\t\tsetTemplate,\n\t\tsetTemplatePart,\n\t] );\n}\n"]}
|
|
@@ -8,36 +8,81 @@ import { useEffect, useRef } from '@wordpress/element';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useLocation, useHistory } from '../routes';
|
|
11
|
+
export function getPathFromURL(urlParams) {
|
|
12
|
+
var _urlParams$path;
|
|
13
|
+
|
|
14
|
+
let path = (_urlParams$path = urlParams === null || urlParams === void 0 ? void 0 : urlParams.path) !== null && _urlParams$path !== void 0 ? _urlParams$path : '/'; // Compute the navigator path based on the URL params.
|
|
15
|
+
|
|
16
|
+
if (urlParams !== null && urlParams !== void 0 && urlParams.postType && urlParams !== null && urlParams !== void 0 && urlParams.postId) {
|
|
17
|
+
switch (urlParams.postType) {
|
|
18
|
+
case 'wp_template':
|
|
19
|
+
case 'wp_template_part':
|
|
20
|
+
path = `/${encodeURIComponent(urlParams.postType)}/${encodeURIComponent(urlParams.postId)}`;
|
|
21
|
+
break;
|
|
22
|
+
|
|
23
|
+
default:
|
|
24
|
+
path = `/navigation/${encodeURIComponent(urlParams.postType)}/${encodeURIComponent(urlParams.postId)}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return path;
|
|
29
|
+
}
|
|
11
30
|
export default function useSyncPathWithURL() {
|
|
12
31
|
const history = useHistory();
|
|
13
32
|
const {
|
|
14
|
-
params
|
|
33
|
+
params: urlParams
|
|
15
34
|
} = useLocation();
|
|
16
35
|
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
location,
|
|
36
|
+
location: navigatorLocation,
|
|
37
|
+
params: navigatorParams,
|
|
21
38
|
goTo
|
|
22
39
|
} = useNavigator();
|
|
23
|
-
const
|
|
24
|
-
const
|
|
40
|
+
const currentUrlParams = useRef(urlParams);
|
|
41
|
+
const currentPath = useRef(navigatorLocation.path);
|
|
25
42
|
useEffect(() => {
|
|
26
|
-
|
|
43
|
+
function updateUrlParams(newUrlParams) {
|
|
44
|
+
if (Object.entries(newUrlParams).every(_ref => {
|
|
45
|
+
let [key, value] = _ref;
|
|
46
|
+
return currentUrlParams.current[key] === value;
|
|
47
|
+
})) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
27
50
|
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
const updatedParams = { ...currentUrlParams.current,
|
|
52
|
+
...newUrlParams
|
|
53
|
+
};
|
|
54
|
+
currentUrlParams.current = updatedParams;
|
|
55
|
+
history.push(updatedParams);
|
|
30
56
|
}
|
|
31
|
-
}, [path]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
currentNavigatorLocation.current = location.path;
|
|
34
57
|
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
58
|
+
if (navigatorParams !== null && navigatorParams !== void 0 && navigatorParams.postType && navigatorParams !== null && navigatorParams !== void 0 && navigatorParams.postId) {
|
|
59
|
+
updateUrlParams({
|
|
60
|
+
postType: navigatorParams === null || navigatorParams === void 0 ? void 0 : navigatorParams.postType,
|
|
61
|
+
postId: navigatorParams === null || navigatorParams === void 0 ? void 0 : navigatorParams.postId,
|
|
62
|
+
path: undefined
|
|
63
|
+
});
|
|
64
|
+
} else if (navigatorParams !== null && navigatorParams !== void 0 && navigatorParams.postType && !(navigatorParams !== null && navigatorParams !== void 0 && navigatorParams.postId)) {
|
|
65
|
+
updateUrlParams({
|
|
66
|
+
postType: navigatorParams === null || navigatorParams === void 0 ? void 0 : navigatorParams.postType,
|
|
67
|
+
path: navigatorLocation.path,
|
|
68
|
+
postId: undefined
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
updateUrlParams({
|
|
72
|
+
postType: undefined,
|
|
73
|
+
postId: undefined,
|
|
74
|
+
path: navigatorLocation.path
|
|
38
75
|
});
|
|
39
76
|
}
|
|
40
|
-
}, [
|
|
41
|
-
|
|
77
|
+
}, [navigatorLocation === null || navigatorLocation === void 0 ? void 0 : navigatorLocation.path, navigatorParams, history]);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
currentUrlParams.current = urlParams;
|
|
80
|
+
const path = getPathFromURL(urlParams);
|
|
81
|
+
|
|
82
|
+
if (currentPath.current !== path) {
|
|
83
|
+
currentPath.current = path;
|
|
84
|
+
goTo(path);
|
|
85
|
+
}
|
|
86
|
+
}, [urlParams, goTo]);
|
|
42
87
|
}
|
|
43
88
|
//# sourceMappingURL=use-sync-path-with-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js"],"names":["__experimentalUseNavigator","useNavigator","useEffect","useRef","useLocation","useHistory","useSyncPathWithURL","history","params","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js"],"names":["__experimentalUseNavigator","useNavigator","useEffect","useRef","useLocation","useHistory","getPathFromURL","urlParams","path","postType","postId","encodeURIComponent","useSyncPathWithURL","history","params","location","navigatorLocation","navigatorParams","goTo","currentUrlParams","currentPath","updateUrlParams","newUrlParams","Object","entries","every","key","value","current","updatedParams","push","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,UAAtB,QAAwC,WAAxC;AAEA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAAA;;AAC3C,MAAIC,IAAI,sBAAGD,SAAH,aAAGA,SAAH,uBAAGA,SAAS,CAAEC,IAAd,6DAAsB,GAA9B,CAD2C,CAG3C;;AACA,MAAKD,SAAS,SAAT,IAAAA,SAAS,WAAT,IAAAA,SAAS,CAAEE,QAAX,IAAuBF,SAAvB,aAAuBA,SAAvB,eAAuBA,SAAS,CAAEG,MAAvC,EAAgD;AAC/C,YAASH,SAAS,CAACE,QAAnB;AACC,WAAK,aAAL;AACA,WAAK,kBAAL;AACCD,QAAAA,IAAI,GAAI,IAAIG,kBAAkB,CAC7BJ,SAAS,CAACE,QADmB,CAE3B,IAAIE,kBAAkB,CAAEJ,SAAS,CAACG,MAAZ,CAAsB,EAF/C;AAGA;;AACD;AACC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Navigator as useNavigator } from '@wordpress/components';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useLocation, useHistory } from '../routes';\n\nexport function getPathFromURL( urlParams ) {\n\tlet path = urlParams?.path ?? '/';\n\n\t// Compute the navigator path based on the URL params.\n\tif ( urlParams?.postType && urlParams?.postId ) {\n\t\tswitch ( urlParams.postType ) {\n\t\t\tcase 'wp_template':\n\t\t\tcase 'wp_template_part':\n\t\t\t\tpath = `/${ encodeURIComponent(\n\t\t\t\t\turlParams.postType\n\t\t\t\t) }/${ encodeURIComponent( urlParams.postId ) }`;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tpath = `/navigation/${ encodeURIComponent(\n\t\t\t\t\turlParams.postType\n\t\t\t\t) }/${ encodeURIComponent( urlParams.postId ) }`;\n\t\t}\n\t}\n\n\treturn path;\n}\n\nexport default function useSyncPathWithURL() {\n\tconst history = useHistory();\n\tconst { params: urlParams } = useLocation();\n\tconst {\n\t\tlocation: navigatorLocation,\n\t\tparams: navigatorParams,\n\t\tgoTo,\n\t} = useNavigator();\n\tconst currentUrlParams = useRef( urlParams );\n\tconst currentPath = useRef( navigatorLocation.path );\n\n\tuseEffect( () => {\n\t\tfunction updateUrlParams( newUrlParams ) {\n\t\t\tif (\n\t\t\t\tObject.entries( newUrlParams ).every( ( [ key, value ] ) => {\n\t\t\t\t\treturn currentUrlParams.current[ key ] === value;\n\t\t\t\t} )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst updatedParams = {\n\t\t\t\t...currentUrlParams.current,\n\t\t\t\t...newUrlParams,\n\t\t\t};\n\t\t\tcurrentUrlParams.current = updatedParams;\n\t\t\thistory.push( updatedParams );\n\t\t}\n\n\t\tif ( navigatorParams?.postType && navigatorParams?.postId ) {\n\t\t\tupdateUrlParams( {\n\t\t\t\tpostType: navigatorParams?.postType,\n\t\t\t\tpostId: navigatorParams?.postId,\n\t\t\t\tpath: undefined,\n\t\t\t} );\n\t\t} else if ( navigatorParams?.postType && ! navigatorParams?.postId ) {\n\t\t\tupdateUrlParams( {\n\t\t\t\tpostType: navigatorParams?.postType,\n\t\t\t\tpath: navigatorLocation.path,\n\t\t\t\tpostId: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tupdateUrlParams( {\n\t\t\t\tpostType: undefined,\n\t\t\t\tpostId: undefined,\n\t\t\t\tpath: navigatorLocation.path,\n\t\t\t} );\n\t\t}\n\t}, [ navigatorLocation?.path, navigatorParams, history ] );\n\n\tuseEffect( () => {\n\t\tcurrentUrlParams.current = urlParams;\n\t\tconst path = getPathFromURL( urlParams );\n\t\tif ( currentPath.current !== path ) {\n\t\t\tcurrentPath.current = path;\n\t\t\tgoTo( path );\n\t\t}\n\t}, [ urlParams, goTo ] );\n}\n"]}
|
|
@@ -15,7 +15,6 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
15
15
|
|
|
16
16
|
import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
17
17
|
import { store as editSiteStore } from '../../store';
|
|
18
|
-
import TemplateAreas from './template-areas';
|
|
19
18
|
import EditTemplateTitle from './edit-template-title';
|
|
20
19
|
import { useLink } from '../routes/link';
|
|
21
20
|
import TemplatePartAreaSelector from './template-part-area-selector';
|
|
@@ -30,11 +29,13 @@ export default function TemplateDetails(_ref) {
|
|
|
30
29
|
} = useSelect(select => select(editorStore).__experimentalGetTemplateInfo(template), []);
|
|
31
30
|
const {
|
|
32
31
|
revertTemplate
|
|
33
|
-
} = useDispatch(editSiteStore);
|
|
32
|
+
} = useDispatch(editSiteStore); // TODO: We should update this to filter by template part's areas as well.
|
|
33
|
+
|
|
34
34
|
const browseAllLinkProps = useLink({
|
|
35
|
-
|
|
35
|
+
canvas: 'view',
|
|
36
36
|
postType: template.type,
|
|
37
|
-
postId: undefined
|
|
37
|
+
postId: undefined,
|
|
38
|
+
path: '/' + template.type + '/all'
|
|
38
39
|
});
|
|
39
40
|
const isTemplatePart = template.type === 'wp_template_part'; // Only user-created and non-default templates can change the name.
|
|
40
41
|
// But any user-created template part can be renamed.
|
|
@@ -70,9 +71,7 @@ export default function TemplateDetails(_ref) {
|
|
|
70
71
|
className: "edit-site-template-details__group"
|
|
71
72
|
}, createElement(TemplatePartAreaSelector, {
|
|
72
73
|
id: template.id
|
|
73
|
-
})), createElement(
|
|
74
|
-
closeTemplateDetailsDropdown: onClose
|
|
75
|
-
}), isTemplateRevertable(template) && createElement(MenuGroup, {
|
|
74
|
+
})), isTemplateRevertable(template) && createElement(MenuGroup, {
|
|
76
75
|
className: "edit-site-template-details__group edit-site-template-details__revert"
|
|
77
76
|
}, createElement(MenuItem, {
|
|
78
77
|
className: "edit-site-template-details__revert-button",
|
|
@@ -80,6 +79,6 @@ export default function TemplateDetails(_ref) {
|
|
|
80
79
|
onClick: revert
|
|
81
80
|
}, __('Clear customizations'))), createElement(Button, _extends({
|
|
82
81
|
className: "edit-site-template-details__show-all-button"
|
|
83
|
-
}, browseAllLinkProps), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? __('
|
|
82
|
+
}, browseAllLinkProps), (template === null || template === void 0 ? void 0 : template.type) === 'wp_template' ? __('Manage all templates') : __('Manage all template parts')));
|
|
84
83
|
}
|
|
85
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalVStack","VStack","__experimentalText","Text","useDispatch","useSelect","store","editorStore","decodeEntities","isTemplateRevertable","editSiteStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/template-details/index.js"],"names":["__","Button","MenuGroup","MenuItem","__experimentalVStack","VStack","__experimentalText","Text","useDispatch","useSelect","store","editorStore","decodeEntities","isTemplateRevertable","editSiteStore","EditTemplateTitle","useLink","TemplatePartAreaSelector","TemplateDetails","template","onClose","title","description","select","__experimentalGetTemplateInfo","revertTemplate","browseAllLinkProps","canvas","postType","type","postId","undefined","path","isTemplatePart","canEditTitle","has_theme_file","is_custom","revert","id"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,kBAAkB,IAAIC,IALvB,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,oCAAjC;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,wBAAP,MAAqC,+BAArC;AAEA,eAAe,SAASC,eAAT,OAAkD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyBb,SAAS,CACrCc,MAAF,IACCA,MAAM,CAAEZ,WAAF,CAAN,CAAsBa,6BAAtB,CAAqDL,QAArD,CAFsC,EAGvC,EAHuC,CAAxC;AAKA,QAAM;AAAEM,IAAAA;AAAF,MAAqBjB,WAAW,CAAEM,aAAF,CAAtC,CANgE,CAQhE;;AACA,QAAMY,kBAAkB,GAAGV,OAAO,CAAE;AACnCW,IAAAA,MAAM,EAAE,MAD2B;AAEnCC,IAAAA,QAAQ,EAAET,QAAQ,CAACU,IAFgB;AAGnCC,IAAAA,MAAM,EAAEC,SAH2B;AAInCC,IAAAA,IAAI,EAAE,MAAMb,QAAQ,CAACU,IAAf,GAAsB;AAJO,GAAF,CAAlC;AAOA,QAAMI,cAAc,GAAGd,QAAQ,CAACU,IAAT,KAAkB,kBAAzC,CAhBgE,CAkBhE;AACA;;AACA,QAA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A,SAAS,EAAC;AADX,KAEM0B,kBAFN,GAIG,CAAAP,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEU,IAAV,MAAmB,aAAnB,GACC7B,EAAE,CAAE,sBAAF,CADH,GAECA,EAAE,CAAE,2BAAF,CANN,CA9CD,CADD;AAyDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tButton,\n\tMenuGroup,\n\tMenuItem,\n\t__experimentalVStack as VStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { store as editSiteStore } from '../../store';\nimport EditTemplateTitle from './edit-template-title';\nimport { useLink } from '../routes/link';\nimport TemplatePartAreaSelector from './template-part-area-selector';\n\nexport default function TemplateDetails( { template, onClose } ) {\n\tconst { title, description } = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetTemplateInfo( template ),\n\t\t[]\n\t);\n\tconst { revertTemplate } = useDispatch( editSiteStore );\n\n\t// TODO: We should update this to filter by template part's areas as well.\n\tconst browseAllLinkProps = useLink( {\n\t\tcanvas: 'view',\n\t\tpostType: template.type,\n\t\tpostId: undefined,\n\t\tpath: '/' + template.type + '/all',\n\t} );\n\n\tconst isTemplatePart = template.type === 'wp_template_part';\n\n\t// Only user-created and non-default templates can change the name.\n\t// But any user-created template part can be renamed.\n\tconst canEditTitle = isTemplatePart\n\t\t? ! template.has_theme_file\n\t\t: template.is_custom && ! template.has_theme_file;\n\n\tif ( ! template ) {\n\t\treturn null;\n\t}\n\n\tconst revert = () => {\n\t\trevertTemplate( template );\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<div className=\"edit-site-template-details\">\n\t\t\t<VStack className=\"edit-site-template-details__group\" spacing={ 3 }>\n\t\t\t\t{ canEditTitle ? (\n\t\t\t\t\t<EditTemplateTitle template={ template } />\n\t\t\t\t) : (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize={ 16 }\n\t\t\t\t\t\tweight={ 600 }\n\t\t\t\t\t\tclassName=\"edit-site-template-details__title\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( title ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\n\t\t\t\t{ description && (\n\t\t\t\t\t<Text\n\t\t\t\t\t\tsize=\"body\"\n\t\t\t\t\t\tclassName=\"edit-site-template-details__description\"\n\t\t\t\t\t\tas=\"p\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ decodeEntities( description ) }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\n\t\t\t{ isTemplatePart && (\n\t\t\t\t<div className=\"edit-site-template-details__group\">\n\t\t\t\t\t<TemplatePartAreaSelector id={ template.id } />\n\t\t\t\t</div>\n\t\t\t) }\n\n\t\t\t{ isTemplateRevertable( template ) && (\n\t\t\t\t<MenuGroup className=\"edit-site-template-details__group edit-site-template-details__revert\">\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tclassName=\"edit-site-template-details__revert-button\"\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Use the template as supplied by the theme.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ revert }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-template-details__show-all-button\"\n\t\t\t\t{ ...browseAllLinkProps }\n\t\t\t>\n\t\t\t\t{ template?.type === 'wp_template'\n\t\t\t\t\t? __( 'Manage all templates' )\n\t\t\t\t\t: __( 'Manage all template parts' ) }\n\t\t\t</Button>\n\t\t</div>\n\t);\n}\n"]}
|
package/build-module/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
7
|
-
import { registerCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
|
|
7
|
+
import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegisterExperimentalCoreBlocks } from '@wordpress/block-library';
|
|
8
8
|
import { dispatch } from '@wordpress/data';
|
|
9
9
|
import deprecated from '@wordpress/deprecated';
|
|
10
10
|
import { createRoot } from '@wordpress/element';
|
|
@@ -12,7 +12,6 @@ import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimen
|
|
|
12
12
|
import { store as editorStore } from '@wordpress/editor';
|
|
13
13
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
14
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
|
-
import { addFilter } from '@wordpress/hooks';
|
|
16
15
|
import { registerLegacyWidgetBlock } from '@wordpress/widgets';
|
|
17
16
|
/**
|
|
18
17
|
* Internal dependencies
|
|
@@ -38,7 +37,15 @@ export function initializeEditor(id, settings) {
|
|
|
38
37
|
|
|
39
38
|
dispatch(blocksStore).__experimentalReapplyBlockTypeFilters();
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
const coreBlocks = __experimentalGetCoreBlocks().filter(_ref => {
|
|
41
|
+
let {
|
|
42
|
+
name
|
|
43
|
+
} = _ref;
|
|
44
|
+
return name !== 'core/freeform';
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
registerCoreBlocks(coreBlocks);
|
|
48
|
+
dispatch(blocksStore).setFreeformFallbackBlockName('core/html');
|
|
42
49
|
registerLegacyWidgetBlock({
|
|
43
50
|
inserter: false
|
|
44
51
|
});
|
|
@@ -47,27 +54,10 @@ export function initializeEditor(id, settings) {
|
|
|
47
54
|
__experimentalRegisterExperimentalCoreBlocks({
|
|
48
55
|
enableFSEBlocks: true
|
|
49
56
|
});
|
|
50
|
-
}
|
|
51
|
-
/*
|
|
52
|
-
* Prevent adding the Clasic block in the site editor.
|
|
53
|
-
* Only add the filter when the site editor is initialized, not imported.
|
|
54
|
-
* Also only add the filter(s) after registerCoreBlocks()
|
|
55
|
-
* so that common filters in the block library are not overwritten.
|
|
56
|
-
*
|
|
57
|
-
* This usage here is inspired by previous usage of the filter in the post editor:
|
|
58
|
-
* https://github.com/WordPress/gutenberg/pull/37157
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
addFilter('blockEditor.__unstableCanInsertBlockType', 'removeClassicBlockFromInserter', (canInsert, blockType) => {
|
|
63
|
-
if (blockType.name === 'core/freeform') {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return canInsert;
|
|
68
|
-
}); // We dispatch actions and update the store synchronously before rendering
|
|
57
|
+
} // We dispatch actions and update the store synchronously before rendering
|
|
69
58
|
// so that we won't trigger unnecessary re-renders with useEffect.
|
|
70
59
|
|
|
60
|
+
|
|
71
61
|
dispatch(preferencesStore).setDefaults('core/edit-site', {
|
|
72
62
|
editorMode: 'visual',
|
|
73
63
|
fixedToolbar: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/index.js"],"names":["store","blocksStore","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","dispatch","deprecated","createRoot","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","editorStore","interfaceStore","preferencesStore","registerLegacyWidgetBlock","editSiteStore","App","initializeEditor","id","settings","target","document","getElementById","root","search","searchOptions","__experimentalFetchRichUrlData","__experimentalReapplyBlockTypeFilters","coreBlocks","filter","name","setFreeformFallbackBlockName","inserter","process","env","IS_GUTENBERG_PLUGIN","enableFSEBlocks","setDefaults","editorMode","fixedToolbar","focusMode","keepCaretInsideBlock","welcomeGuide","welcomeGuideStyles","showListViewByDefault","setDefaultComplementaryArea","updateSettings","updateEditorSettings","defaultTemplateTypes","defaultTemplatePartAreas","window","addEventListener","e","preventDefault","render","reinitializeEditor","since","version","default","PluginSidebar","PluginSidebarMoreMenuItem","PluginMoreMenuItem"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SACCC,kBADD,EAECC,2BAFD,EAGCC,4CAHD,QAIO,0BAJP;AAKA,SAASC,QAAT,QAAyB,iBAAzB;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SACCC,kCAAkC,IAAIC,oBADvC,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,sBAHP;AAIA,SAASX,KAAK,IAAIY,WAAlB,QAAqC,mBAArC;AACA,SAASZ,KAAK,IAAIa,cAAlB,QAAwC,sBAAxC;AACA,SAASb,KAAK,IAAIc,gBAAlB,QAA0C,wBAA1C;AACA,SAASC,yBAAT,QAA0C,oBAA1C;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AACA,SAASf,KAAK,IAAIgB,aAAlB,QAAuC,SAAvC;AACA,OAAOC,GAAP,MAAgB,kBAAhB;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA2BC,EAA3B,EAA+BC,QAA/B,EAA0C;AAChD,QAAMC,MAAM,GAAGC,QAAQ,CAACC,cAAT,CAAyBJ,EAAzB,CAAf;AACA,QAAMK,IAAI,GAAGjB,UAAU,CAAEc,MAAF,CAAvB;;AAEAD,EAAAA,QAAQ,CAACZ,kCAAT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CgD,CAwChD;AACA;AACA;AACA;;AACAf,EAAAA,QAAQ,CAAEO,WAAF,CAAR,CAAwBoC,oBAAxB,CAA8C;AAC7CC,IAAAA,oBAAoB,EAAE7B,QAAQ,CAAC6B,oBADc;AAE7CC,IAAAA,wBAAwB,EAAE9B,QAAQ,CAAC8B;AAFU,GAA9C,EA5CgD,CAiDhD;;AACAC,EAAAA,MAAM,CAACC,gBAAP,CAAyB,UAAzB,EAAuCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA9C,EAAkE,KAAlE;AACAH,EAAAA,MAAM,CAACC,gBAAP,CAAyB,MAAzB,EAAmCC,CAAF,IAASA,CAAC,CAACC,cAAF,EAA1C,EAA8D,KAA9D;AAEA9B,EAAAA,IAAI,CAAC+B,MAAL,CAAa,cAAC,GAAD,OAAb;AAEA,SAAO/B,IAAP;AACA;AAED,OAAO,SAASgC,kBAAT,GAA8B;AACpClD,EAAAA,UAAU,CAAE,gCAAF,EAAoC;AAC7CmD,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,OAAO,EAAE;AAFoC,GAApC,CAAV;AAIA;AAED,SAASC,OAAO,IAAIC,aAApB,QAAyC,+CAAzC;AACA,SAASD,OAAO,IAAIE,yBAApB,QAAqD,6DAArD;AACA,SAASF,OAAO,IAAIG,kBAApB,QAA8C,qDAA9C","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 {\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { registerLegacyWidgetBlock } 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\tsettings.__experimentalFetchLinkSuggestions = ( search, searchOptions ) =>\n\t\tfetchLinkSuggestions( search, searchOptions, settings );\n\tsettings.__experimentalFetchRichUrlData = fetchUrlData;\n\n\tdispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();\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\tif ( process.env.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\teditorMode: 'visual',\n\t\tfixedToolbar: false,\n\t\tfocusMode: false,\n\t\tkeepCaretInsideBlock: false,\n\t\twelcomeGuide: true,\n\t\twelcomeGuideStyles: true,\n\t\tshowListViewByDefault: false,\n\t} );\n\n\tdispatch( interfaceStore ).setDefaultComplementaryArea(\n\t\t'core/edit-site',\n\t\t'edit-site/template'\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( <App /> );\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 PluginSidebar } from './components/sidebar-edit-mode/plugin-sidebar';\nexport { default as PluginSidebarMoreMenuItem } from './components/header-edit-mode/plugin-sidebar-more-menu-item';\nexport { default as PluginMoreMenuItem } from './components/header-edit-mode/plugin-more-menu-item';\n"]}
|
|
@@ -10,6 +10,6 @@ export default function getIsListPage(_ref) {
|
|
|
10
10
|
let {
|
|
11
11
|
path
|
|
12
12
|
} = _ref;
|
|
13
|
-
return path === '/
|
|
13
|
+
return path === '/wp_template/all' || path === '/wp_template_part/all';
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=get-is-list-page.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"names":["getIsListPage","path"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,aAAT,OAAmC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACjD,SAAOA,IAAI,KAAK,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"names":["getIsListPage","path"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,aAAT,OAAmC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACjD,SAAOA,IAAI,KAAK,kBAAT,IAA+BA,IAAI,KAAK,uBAA/C;AACA","sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage( { path } ) {\n\treturn path === '/wp_template/all' || path === '/wp_template_part/all';\n}\n"]}
|