@wordpress/edit-site 3.0.1-next.253d9b6e21.0 → 3.0.3
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/README.md +1 -1
- package/build/components/block-editor/back-button.js +60 -0
- package/build/components/block-editor/back-button.js.map +1 -0
- package/build/components/block-editor/index.js +20 -5
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/edit-template-part-menu-button/index.js +63 -0
- package/build/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build/components/editor/global-styles-provider.js +15 -2
- package/build/components/editor/global-styles-provider.js.map +1 -1
- package/build/components/editor/global-styles-renderer.js +8 -8
- package/build/components/editor/global-styles-renderer.js.map +1 -1
- package/build/components/editor/index.js +7 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/utils.js +4 -9
- package/build/components/editor/utils.js.map +1 -1
- package/build/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/build/components/global-styles/border-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -0
- package/build/components/{sidebar → global-styles}/color-panel.js +24 -21
- package/build/components/global-styles/color-panel.js.map +1 -0
- package/build/components/global-styles/context-menu.js +58 -0
- package/build/components/global-styles/context-menu.js.map +1 -0
- package/build/components/{sidebar → global-styles}/dimensions-panel.js +58 -8
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/header.js +54 -0
- package/build/components/global-styles/header.js.map +1 -0
- package/build/components/global-styles/index.js +89 -0
- package/build/components/global-styles/index.js.map +1 -0
- package/build/components/global-styles/navigation-button.js +43 -0
- package/build/components/global-styles/navigation-button.js.map +1 -0
- package/build/components/global-styles/palette.js +57 -0
- package/build/components/global-styles/palette.js.map +1 -0
- package/build/components/global-styles/preview.js +59 -0
- package/build/components/global-styles/preview.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +76 -0
- package/build/components/global-styles/screen-block-list.js.map +1 -0
- package/build/components/global-styles/screen-block.js +45 -0
- package/build/components/global-styles/screen-block.js.map +1 -0
- package/build/components/global-styles/screen-color-palette.js +48 -0
- package/build/components/global-styles/screen-color-palette.js.map +1 -0
- package/build/components/global-styles/screen-colors.js +51 -0
- package/build/components/global-styles/screen-colors.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +60 -0
- package/build/components/global-styles/screen-layout.js.map +1 -0
- package/build/components/global-styles/screen-root.js +44 -0
- package/build/components/global-styles/screen-root.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +50 -0
- package/build/components/global-styles/screen-typography.js.map +1 -0
- package/build/components/global-styles/subtitle.js +25 -0
- package/build/components/global-styles/subtitle.js.map +1 -0
- package/build/components/{sidebar → global-styles}/typography-panel.js +1 -3
- package/build/components/global-styles/typography-panel.js.map +1 -0
- package/build/components/header/document-actions/index.js +1 -1
- package/build/components/header/document-actions/index.js.map +1 -1
- package/build/components/header/plugin-more-menu-item/index.js +82 -0
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +75 -0
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/header/undo-redo/redo.js +1 -1
- package/build/components/header/undo-redo/redo.js.map +1 -1
- package/build/components/header/undo-redo/undo.js +1 -1
- package/build/components/header/undo-redo/undo.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -10
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +1 -1
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +10 -10
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -3
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build/components/save-button/index.js +1 -1
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +11 -161
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +1 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +95 -0
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build/components/template-details/index.js +12 -6
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +73 -0
- package/build/components/template-details/template-areas.js.map +1 -0
- package/build/components/template-part-converter/convert-to-regular.js +3 -3
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/index.js +1 -1
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/url-query-controller/index.js +1 -1
- package/build/components/url-query-controller/index.js.map +1 -1
- package/build/index.js +24 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +60 -7
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +19 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/reducer.js +16 -7
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +91 -9
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +48 -0
- package/build-module/components/block-editor/back-button.js.map +1 -0
- package/build-module/components/block-editor/index.js +17 -5
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/edit-template-part-menu-button/index.js +49 -0
- package/build-module/components/edit-template-part-menu-button/index.js.map +1 -0
- package/build-module/components/editor/global-styles-provider.js +16 -3
- package/build-module/components/editor/global-styles-provider.js.map +1 -1
- package/build-module/components/editor/global-styles-renderer.js +8 -8
- package/build-module/components/editor/global-styles-renderer.js.map +1 -1
- package/build-module/components/editor/index.js +4 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/utils.js +2 -7
- package/build-module/components/editor/utils.js.map +1 -1
- package/build-module/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/build-module/components/global-styles/border-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-palette-panel.js +4 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/color-panel.js +25 -22
- package/build-module/components/global-styles/color-panel.js.map +1 -0
- package/build-module/components/global-styles/context-menu.js +41 -0
- package/build-module/components/global-styles/context-menu.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/dimensions-panel.js +58 -9
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/header.js +41 -0
- package/build-module/components/global-styles/header.js.map +1 -0
- package/build-module/components/global-styles/index.js +70 -0
- package/build-module/components/global-styles/index.js.map +1 -0
- package/build-module/components/global-styles/navigation-button.js +31 -0
- package/build-module/components/global-styles/navigation-button.js.map +1 -0
- package/build-module/components/global-styles/palette.js +43 -0
- package/build-module/components/global-styles/palette.js.map +1 -0
- package/build-module/components/global-styles/preview.js +50 -0
- package/build-module/components/global-styles/preview.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +58 -0
- package/build-module/components/global-styles/screen-block-list.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +32 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -0
- package/build-module/components/global-styles/screen-color-palette.js +35 -0
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -0
- package/build-module/components/global-styles/screen-colors.js +38 -0
- package/build-module/components/global-styles/screen-colors.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +44 -0
- package/build-module/components/global-styles/screen-layout.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +29 -0
- package/build-module/components/global-styles/screen-root.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +37 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -0
- package/build-module/components/global-styles/subtitle.js +17 -0
- package/build-module/components/global-styles/subtitle.js.map +1 -0
- package/build-module/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +1 -0
- package/build-module/components/header/document-actions/index.js +1 -1
- package/build-module/components/header/document-actions/index.js.map +1 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +70 -0
- package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/header/undo-redo/redo.js +1 -1
- package/build-module/components/header/undo-redo/redo.js.map +1 -1
- package/build-module/components/header/undo-redo/undo.js +1 -1
- package/build-module/components/header/undo-redo/undo.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +3 -11
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +1 -1
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +5 -3
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -3
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +1 -1
- package/build-module/components/save-button/index.js +1 -1
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +13 -159
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -7
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +84 -0
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/template-details/index.js +13 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +60 -0
- package/build-module/components/template-details/template-areas.js.map +1 -0
- package/build-module/components/template-part-converter/convert-to-regular.js +3 -3
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +1 -1
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/url-query-controller/index.js +1 -1
- package/build-module/components/url-query-controller/index.js.map +1 -1
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +51 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js +13 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/reducer.js +16 -7
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +85 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +158 -19
- package/build-style/style.css +158 -19
- package/package.json +26 -26
- package/src/components/block-editor/back-button.js +44 -0
- package/src/components/block-editor/index.js +18 -2
- package/src/components/block-editor/style.scss +26 -0
- package/src/components/edit-template-part-menu-button/index.js +57 -0
- package/src/components/editor/global-styles-provider.js +19 -3
- package/src/components/editor/global-styles-renderer.js +8 -5
- package/src/components/editor/index.js +5 -8
- package/src/components/editor/test/global-styles-provider.js +131 -0
- package/src/components/editor/test/global-styles-renderer.js +1 -1
- package/src/components/editor/test/utils.js +146 -0
- package/src/components/editor/utils.js +2 -7
- package/src/components/{sidebar → global-styles}/border-panel.js +2 -2
- package/src/components/{sidebar → global-styles}/color-palette-panel.js +13 -11
- package/src/components/{sidebar → global-styles}/color-panel.js +43 -28
- package/src/components/global-styles/context-menu.js +54 -0
- package/src/components/{sidebar → global-styles}/dimensions-panel.js +60 -9
- package/src/components/global-styles/header.js +50 -0
- package/src/components/global-styles/index.js +81 -0
- package/src/components/global-styles/navigation-button.js +35 -0
- package/src/components/global-styles/palette.js +67 -0
- package/src/components/global-styles/preview.js +41 -0
- package/src/components/global-styles/screen-block-list.js +59 -0
- package/src/components/global-styles/screen-block.js +28 -0
- package/src/components/global-styles/screen-color-palette.js +33 -0
- package/src/components/global-styles/screen-colors.js +36 -0
- package/src/components/global-styles/screen-layout.js +45 -0
- package/src/components/global-styles/screen-root.js +43 -0
- package/src/components/global-styles/screen-typography.js +33 -0
- package/src/components/global-styles/style.scss +35 -0
- package/src/components/global-styles/subtitle.js +10 -0
- package/src/components/{sidebar → global-styles}/typography-panel.js +1 -2
- package/src/components/header/document-actions/index.js +1 -1
- package/src/components/header/plugin-more-menu-item/index.js +71 -0
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +64 -0
- package/src/components/header/undo-redo/redo.js +4 -1
- package/src/components/header/undo-redo/undo.js +4 -1
- package/src/components/keyboard-shortcuts/index.js +25 -40
- package/src/components/navigation-sidebar/index.js +1 -1
- package/src/components/navigation-sidebar/navigation-panel/constants.js +9 -4
- package/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js +1 -1
- package/src/components/navigation-sidebar/navigation-panel/style.scss +1 -0
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +3 -2
- package/src/components/save-button/index.js +1 -1
- package/src/components/secondary-sidebar/inserter-sidebar.js +1 -0
- package/src/components/sidebar/global-styles-sidebar.js +14 -187
- package/src/components/sidebar/index.js +2 -7
- package/src/components/sidebar/plugin-sidebar/index.js +80 -0
- package/src/components/sidebar/style.scss +40 -0
- package/src/components/template-details/index.js +17 -7
- package/src/components/template-details/style.scss +36 -27
- package/src/components/template-details/template-areas.js +66 -0
- package/src/components/template-part-converter/convert-to-regular.js +2 -8
- package/src/components/template-part-converter/index.js +1 -1
- package/src/components/url-query-controller/index.js +1 -1
- package/src/index.js +3 -0
- package/src/store/actions.js +59 -7
- package/src/store/constants.js +15 -0
- package/src/store/reducer.js +26 -12
- package/src/store/selectors.js +96 -9
- package/src/store/test/reducer.js +40 -23
- package/src/store/test/selectors.js +34 -3
- package/src/style.scss +1 -0
- package/build/components/sidebar/border-panel.js.map +0 -1
- package/build/components/sidebar/color-palette-panel.js.map +0 -1
- package/build/components/sidebar/color-panel.js.map +0 -1
- package/build/components/sidebar/dimensions-panel.js.map +0 -1
- package/build/components/sidebar/typography-panel.js.map +0 -1
- package/build-module/components/sidebar/border-panel.js.map +0 -1
- package/build-module/components/sidebar/color-palette-panel.js.map +0 -1
- package/build-module/components/sidebar/color-panel.js.map +0 -1
- package/build-module/components/sidebar/dimensions-panel.js.map +0 -1
- package/build-module/components/sidebar/typography-panel.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcuts/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/keyboard-shortcuts/index.js"],"names":["useEffect","useShortcut","store","keyboardShortcutsStore","useDispatch","useSelect","__","coreStore","interfaceStore","editSiteStore","SIDEBAR_BLOCK","STORE_NAME","KeyboardShortcuts","isListViewOpen","select","isListViewOpened","isBlockInspectorOpen","getActiveComplementaryArea","name","redo","undo","setIsListViewOpened","enableComplementaryArea","disableComplementaryArea","event","preventDefault","KeyboardShortcutsRegister","registerShortcut","category","description","keyCombination","modifier","character","Register"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SACCC,WADD,EAECC,KAAK,IAAIC,sBAFV,QAGO,+BAHP;AAIA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASJ,KAAK,IAAIK,SAAlB,QAAmC,sBAAnC;AACA,SAASL,KAAK,IAAIM,cAAlB,QAAwC,sBAAxC;AAEA;AACA;AACA;;AACA,SAASN,KAAK,IAAIO,aAAlB,QAAuC,aAAvC;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,UAAT,QAA2B,uBAA3B;;AAEA,SAASC,iBAAT,GAA6B;AAC5B,QAAMC,cAAc,GAAGR,SAAS,CAC7BS,MAAF,IAAcA,MAAM,CAAEL,aAAF,CAAN,CAAwBM,gBAAxB,EADiB,EAE/B,EAF+B,CAAhC;AAIA,QAAMC,oBAAoB,GAAGX,SAAS,CACnCS,MAAF,IACCA,M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AAGjBC,MAAAA,WAAW,EAAEvB,EAAE,CAAE,yBAAF,CAHE;AAIjBwB,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,SADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAL,IAAAA,gBAAgB,CAAE;AACjBT,MAAAA,IAAI,EAAE,qBADW;AAEjBU,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAEvB,EAAE,CAAE,sBAAF,CAHE;AAIjBwB,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,cADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAL,IAAAA,gBAAgB,CAAE;AACjBT,MAAAA,IAAI,EAAE,iCADW;AAEjBU,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAEvB,EAAE,CAAE,2BAAF,CAHE;AAIjBwB,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,QADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AAUAL,IAAAA,gBAAgB,CAAE;AACjBT,MAAAA,IAAI,EAAE,8CADW;AAEjBU,MAAAA,QAAQ,EAAE,QAFO;AAGjBC,MAAAA,WAAW,EAAEvB,EAAE,CAAE,0CAAF,CAHE;AAIjBwB,MAAAA,cAAc,EAAE;AACfC,QAAAA,QAAQ,EAAE,cADK;AAEfC,QAAAA,SAAS,EAAE;AAFI;AAJC,KAAF,CAAhB;AASA,GAxCQ,EAwCN,CAAEL,gBAAF,CAxCM,CAAT;AA0CA,SAAO,IAAP;AACA;;AAEDf,iBAAiB,CAACqB,QAAlB,GAA6BP,yBAA7B;AACA,eAAed,iBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseShortcut,\n\tstore as keyboardShortcutsStore,\n} from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { SIDEBAR_BLOCK } from '../sidebar/constants';\nimport { STORE_NAME } from '../../store/constants';\n\nfunction KeyboardShortcuts() {\n\tconst isListViewOpen = useSelect(\n\t\t( select ) => select( editSiteStore ).isListViewOpened(),\n\t\t[]\n\t);\n\tconst isBlockInspectorOpen = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t) === SIDEBAR_BLOCK,\n\t\t[]\n\t);\n\tconst { redo, undo } = useDispatch( coreStore );\n\tconst { setIsListViewOpened } = useDispatch( editSiteStore );\n\tconst { enableComplementaryArea, disableComplementaryArea } = useDispatch(\n\t\tinterfaceStore\n\t);\n\n\tuseShortcut( 'core/edit-site/undo', ( event ) => {\n\t\tundo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-site/redo', ( event ) => {\n\t\tredo();\n\t\tevent.preventDefault();\n\t} );\n\n\tuseShortcut( 'core/edit-site/toggle-list-view', () => {\n\t\tsetIsListViewOpened( ! isListViewOpen );\n\t} );\n\n\tuseShortcut( 'core/edit-site/toggle-block-settings-sidebar', ( event ) => {\n\t\t// This shortcut has no known clashes, but use preventDefault to prevent any\n\t\t// obscure shortcuts from triggering.\n\t\tevent.preventDefault();\n\n\t\tif ( isBlockInspectorOpen ) {\n\t\t\tdisableComplementaryArea( STORE_NAME );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t}\n\t} );\n\n\treturn null;\n}\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-site/undo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Undo your last changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-site/redo',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Redo your last undo.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-site/toggle-list-view',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Open the block list view.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'o',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-site/toggle-block-settings-sidebar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Show or hide the block settings sidebar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: ',',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\nexport default KeyboardShortcuts;\n"]}
|
|
@@ -19,7 +19,7 @@ export const {
|
|
|
19
19
|
export default function NavigationSidebar() {
|
|
20
20
|
const isNavigationOpen = useSelect(select => {
|
|
21
21
|
return select(editSiteStore).isNavigationOpened();
|
|
22
|
-
});
|
|
22
|
+
}, []);
|
|
23
23
|
return createElement(Fragment, null, createElement(NavigationToggle, {
|
|
24
24
|
isOpen: isNavigationOpen
|
|
25
25
|
}), createElement(NavigationPanel, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/index.js"],"names":["createSlotFill","useSelect","NavigationPanel","NavigationToggle","store","editSiteStore","Fill","NavigationPanelPreviewFill","Slot","NavigationPanelPreviewSlot","NavigationSidebar","isNavigationOpen","select","isNavigationOpened"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,uBAA/B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,OAAO,MAAM;AACZC,EAAAA,IAAI,EAAEC,0BADM;AAEZC,EAAAA,IAAI,EAAEC;AAFM,IAGTT,cAAc,CAAE,gCAAF,CAHX;AAKP,eAAe,SAASU,iBAAT,GAA6B;AAC3C,QAAMC,gBAAgB,GAAGV,SAAS,CAAIW,MAAF,IAAc;AACjD,WAAOA,MAAM,CAAEP,aAAF,CAAN,CAAwBQ,kBAAxB,EAAP;AACA,GAFiC,CAAlC;AAIA,SACC,8BACC,cAAC,gBAAD;AAAkB,IAAA,MAAM,EAAGF;AAA3B,IADD,EAEC,cAAC,eAAD;AAAiB,IAAA,MAAM,EAAGA;AAA1B,IAFD,EAGC,cAAC,0BAAD,OAHD,CADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport NavigationPanel from './navigation-panel';\nimport NavigationToggle from './navigation-toggle';\nimport { store as editSiteStore } from '../../store';\n\nexport const {\n\tFill: NavigationPanelPreviewFill,\n\tSlot: NavigationPanelPreviewSlot,\n} = createSlotFill( 'EditSiteNavigationPanelPreview' );\n\nexport default function NavigationSidebar() {\n\tconst isNavigationOpen = useSelect( ( select ) => {\n\t\treturn select( editSiteStore ).isNavigationOpened();\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigationToggle isOpen={ isNavigationOpen } />\n\t\t\t<NavigationPanel isOpen={ isNavigationOpen } />\n\t\t\t<NavigationPanelPreviewSlot />\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/index.js"],"names":["createSlotFill","useSelect","NavigationPanel","NavigationToggle","store","editSiteStore","Fill","NavigationPanelPreviewFill","Slot","NavigationPanelPreviewSlot","NavigationSidebar","isNavigationOpen","select","isNavigationOpened"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,uBAA/B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,gBAAP,MAA6B,qBAA7B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,OAAO,MAAM;AACZC,EAAAA,IAAI,EAAEC,0BADM;AAEZC,EAAAA,IAAI,EAAEC;AAFM,IAGTT,cAAc,CAAE,gCAAF,CAHX;AAKP,eAAe,SAASU,iBAAT,GAA6B;AAC3C,QAAMC,gBAAgB,GAAGV,SAAS,CAAIW,MAAF,IAAc;AACjD,WAAOA,MAAM,CAAEP,aAAF,CAAN,CAAwBQ,kBAAxB,EAAP;AACA,GAFiC,EAE/B,EAF+B,CAAlC;AAIA,SACC,8BACC,cAAC,gBAAD;AAAkB,IAAA,MAAM,EAAGF;AAA3B,IADD,EAEC,cAAC,eAAD;AAAiB,IAAA,MAAM,EAAGA;AAA1B,IAFD,EAGC,cAAC,0BAAD,OAHD,CADD;AAOA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport NavigationPanel from './navigation-panel';\nimport NavigationToggle from './navigation-toggle';\nimport { store as editSiteStore } from '../../store';\n\nexport const {\n\tFill: NavigationPanelPreviewFill,\n\tSlot: NavigationPanelPreviewSlot,\n} = createSlotFill( 'EditSiteNavigationPanelPreview' );\n\nexport default function NavigationSidebar() {\n\tconst isNavigationOpen = useSelect( ( select ) => {\n\t\treturn select( editSiteStore ).isNavigationOpened();\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<NavigationToggle isOpen={ isNavigationOpen } />\n\t\t\t<NavigationPanel isOpen={ isNavigationOpen } />\n\t\t\t<NavigationPanelPreviewSlot />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { TEMPLATE_PART_AREA_HEADER, TEMPLATE_PART_AREA_FOOTER, TEMPLATE_PART_AREA_SIDEBAR } from '../../../store/constants';
|
|
5
10
|
export const TEMPLATES_PRIMARY = ['index', 'singular', 'archive', 'single', 'page', 'home', '404', 'search'];
|
|
6
11
|
export const TEMPLATES_SECONDARY = ['author', 'category', 'taxonomy', 'date', 'tag', 'attachment', 'single-post', 'front-page'];
|
|
7
12
|
export const TEMPLATES_TOP_LEVEL = [...TEMPLATES_PRIMARY, ...TEMPLATES_SECONDARY];
|
|
@@ -29,9 +34,6 @@ export const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';
|
|
|
29
34
|
export const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';
|
|
30
35
|
export const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';
|
|
31
36
|
export const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general';
|
|
32
|
-
export const TEMPLATE_PART_AREA_HEADER = 'header';
|
|
33
|
-
export const TEMPLATE_PART_AREA_FOOTER = 'footer';
|
|
34
|
-
export const TEMPLATE_PART_AREA_SIDEBAR = 'sidebar';
|
|
35
37
|
export const TEMPLATE_PARTS_SUB_MENUS = [{
|
|
36
38
|
area: TEMPLATE_PART_AREA_HEADER,
|
|
37
39
|
menu: MENU_TEMPLATE_PARTS_HEADERS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/constants.js"],"names":["__","TEMPLATES_PRIMARY","TEMPLATES_SECONDARY","TEMPLATES_TOP_LEVEL","TEMPLATES_GENERAL","TEMPLATES_POSTS_PREFIXES","TEMPLATES_PAGES_PREFIXES","TEMPLATES_NEW_OPTIONS","TEMPLATE_OVERRIDES","singular","index","home","MENU_ROOT","MENU_CONTENT_CATEGORIES","MENU_CONTENT_PAGES","MENU_CONTENT_POSTS","MENU_TEMPLATE_PARTS","MENU_TEMPLATES","MENU_TEMPLATES_GENERAL","MENU_TEMPLATES_PAGES","MENU_TEMPLATES_POSTS","MENU_TEMPLATES_UNUSED","SEARCH_DEBOUNCE_IN_MS","MENU_TEMPLATE_PARTS_HEADERS","MENU_TEMPLATE_PARTS_FOOTERS","MENU_TEMPLATE_PARTS_SIDEBARS","MENU_TEMPLATE_PARTS_GENERAL","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/constants.js"],"names":["__","TEMPLATE_PART_AREA_HEADER","TEMPLATE_PART_AREA_FOOTER","TEMPLATE_PART_AREA_SIDEBAR","TEMPLATES_PRIMARY","TEMPLATES_SECONDARY","TEMPLATES_TOP_LEVEL","TEMPLATES_GENERAL","TEMPLATES_POSTS_PREFIXES","TEMPLATES_PAGES_PREFIXES","TEMPLATES_NEW_OPTIONS","TEMPLATE_OVERRIDES","singular","index","home","MENU_ROOT","MENU_CONTENT_CATEGORIES","MENU_CONTENT_PAGES","MENU_CONTENT_POSTS","MENU_TEMPLATE_PARTS","MENU_TEMPLATES","MENU_TEMPLATES_GENERAL","MENU_TEMPLATES_PAGES","MENU_TEMPLATES_POSTS","MENU_TEMPLATES_UNUSED","SEARCH_DEBOUNCE_IN_MS","MENU_TEMPLATE_PARTS_HEADERS","MENU_TEMPLATE_PARTS_FOOTERS","MENU_TEMPLATE_PARTS_SIDEBARS","MENU_TEMPLATE_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,OAAO,MAAMC,kBAAkB,GAAG,eAA3B;AACP,OAAO,MAAMC,kBAAkB,GAAG,eAA3B;AACP,OAAO,MAAMC,mBAAmB,GAAG,gBAA5B;AACP,OAAO,MAAMC,cAAc,GAAG,WAAvB;AACP,OAAO,MAAMC,sBAAsB,GAAG,mBAA/B;AACP,OAAO,MAAMC,oBAAoB,GAAG,iBAA7B;AACP,OAAO,MAAMC,oBAAoB,GAAG,iBAA7B;AACP,OAAO,MAAMC,qBAAqB,GAAG,kBAA9B;AAEP,OAAO,MAAMC,qBAAqB,GAAG,EAA9B;AAEP,OAAO,MAAMC,2BAA2B,GAAG,wBAApC;AACP,OAAO,MAAMC,2BAA2B,GAAG,wBAApC;AACP,OAAO,MAAMC,4BAA4B,GAAG,yBAArC;AACP,OAAO,MAAMC,2BAA2B,GAAG,wBAApC;AAEP,OAAO,MAAMC,wBAAwB,GAAG,CACvC;AACCC,EAAAA,IAAI,EAAE9B,yBADP;AAEC+B,EAAAA,IAAI,EAAEN,2BAFP;AAGCO,EAAAA,KAAK,EAAEjC,EAAE,CAAE,SAAF;AAHV,CADuC,EAMvC;AACC+B,EAAAA,IAAI,EAAE7B,yBADP;AAEC8B,EAAAA,IAAI,EAAEL,2BAFP;AAGCM,EAAAA,KAAK,EAAEjC,EAAE,CAAE,SAAF;AAHV,CANuC,EAWvC;AACC+B,EAAAA,IAAI,EAAE5B,0BADP;AAEC6B,EAAAA,IAAI,EAAEJ,4BAFP;AAGCK,EAAAA,KAAK,EAAEjC,EAAE,CAAE,UAAF;AAHV,CAXuC,EAgBvC;AACC+B,EAAAA,IAAI,EAAE,eADP;AAECC,EAAAA,IAAI,EAAEH,2BAFP;AAGCI,EAAAA,KAAK,EAAEjC,EAAE,CAAE,SAAF;AAHV,CAhBuC,CAAjC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_PART_AREA_HEADER,\n\tTEMPLATE_PART_AREA_FOOTER,\n\tTEMPLATE_PART_AREA_SIDEBAR,\n} from '../../../store/constants';\n\nexport const TEMPLATES_PRIMARY = [\n\t'index',\n\t'singular',\n\t'archive',\n\t'single',\n\t'page',\n\t'home',\n\t'404',\n\t'search',\n];\n\nexport const TEMPLATES_SECONDARY = [\n\t'author',\n\t'category',\n\t'taxonomy',\n\t'date',\n\t'tag',\n\t'attachment',\n\t'single-post',\n\t'front-page',\n];\n\nexport const TEMPLATES_TOP_LEVEL = [\n\t...TEMPLATES_PRIMARY,\n\t...TEMPLATES_SECONDARY,\n];\n\nexport const TEMPLATES_GENERAL = [ 'page-home' ];\n\nexport const TEMPLATES_POSTS_PREFIXES = [\n\t'post-',\n\t'author-',\n\t'single-post-',\n\t'tag-',\n];\n\nexport const TEMPLATES_PAGES_PREFIXES = [ 'page-' ];\n\nexport const TEMPLATES_NEW_OPTIONS = [\n\t'front-page',\n\t'single-post',\n\t'page',\n\t'archive',\n\t'search',\n\t'404',\n\t'index',\n];\n\nexport const TEMPLATE_OVERRIDES = {\n\tsingular: [ 'single', 'page' ],\n\tindex: [ 'archive', '404', 'search', 'singular', 'home' ],\n\thome: [ 'front-page' ],\n};\n\nexport const MENU_ROOT = 'root';\nexport const MENU_CONTENT_CATEGORIES = 'content-categories';\nexport const MENU_CONTENT_PAGES = 'content-pages';\nexport const MENU_CONTENT_POSTS = 'content-posts';\nexport const MENU_TEMPLATE_PARTS = 'template-parts';\nexport const MENU_TEMPLATES = 'templates';\nexport const MENU_TEMPLATES_GENERAL = 'templates-general';\nexport const MENU_TEMPLATES_PAGES = 'templates-pages';\nexport const MENU_TEMPLATES_POSTS = 'templates-posts';\nexport const MENU_TEMPLATES_UNUSED = 'templates-unused';\n\nexport const SEARCH_DEBOUNCE_IN_MS = 75;\n\nexport const MENU_TEMPLATE_PARTS_HEADERS = 'template-parts-headers';\nexport const MENU_TEMPLATE_PARTS_FOOTERS = 'template-parts-footers';\nexport const MENU_TEMPLATE_PARTS_SIDEBARS = 'template-parts-sidebars';\nexport const MENU_TEMPLATE_PARTS_GENERAL = 'template-parts-general';\n\nexport const TEMPLATE_PARTS_SUB_MENUS = [\n\t{\n\t\tarea: TEMPLATE_PART_AREA_HEADER,\n\t\tmenu: MENU_TEMPLATE_PARTS_HEADERS,\n\t\ttitle: __( 'Headers' ),\n\t},\n\t{\n\t\tarea: TEMPLATE_PART_AREA_FOOTER,\n\t\tmenu: MENU_TEMPLATE_PARTS_FOOTERS,\n\t\ttitle: __( 'Footers' ),\n\t},\n\t{\n\t\tarea: TEMPLATE_PART_AREA_SIDEBAR,\n\t\tmenu: MENU_TEMPLATE_PARTS_SIDEBARS,\n\t\ttitle: __( 'Sidebars' ),\n\t},\n\t{\n\t\tarea: 'uncategorized',\n\t\tmenu: MENU_TEMPLATE_PARTS_GENERAL,\n\t\ttitle: __( 'General' ),\n\t},\n];\n"]}
|
package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js
CHANGED
|
@@ -32,15 +32,13 @@ export default function ContentNavigationItem({
|
|
|
32
32
|
}) {
|
|
33
33
|
const [isPreviewVisible, setIsPreviewVisible] = useState(false);
|
|
34
34
|
const previewContent = useSelect(select => {
|
|
35
|
-
var _template$content;
|
|
36
|
-
|
|
37
35
|
if (!isPreviewVisible) {
|
|
38
36
|
return null;
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
const template = select(coreStore).__experimentalGetTemplateForLink(item.link);
|
|
42
40
|
|
|
43
|
-
return template === null || template === void 0 ? void 0 :
|
|
41
|
+
return template === null || template === void 0 ? void 0 : template.content;
|
|
44
42
|
}, [isPreviewVisible]);
|
|
45
43
|
const {
|
|
46
44
|
setPage,
|
package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js"],"names":["__experimentalNavigationItem","NavigationItem","useDispatch","useSelect","useCallback","useState","__","getPathAndQueryString","store","coreStore","NavigationPanelPreviewFill","TemplatePreview","editSiteStore","getTitle","entity","title","taxonomy","name","rendered","titleElement","document","createElement","innerHTML","textContent","innerText","ContentNavigationItem","item","isPreviewVisible","setIsPreviewVisible","previewContent","select","template","__experimentalGetTemplateForLink","link","content","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js"],"names":["__experimentalNavigationItem","NavigationItem","useDispatch","useSelect","useCallback","useState","__","getPathAndQueryString","store","coreStore","NavigationPanelPreviewFill","TemplatePreview","editSiteStore","getTitle","entity","title","taxonomy","name","rendered","titleElement","document","createElement","innerHTML","textContent","innerText","ContentNavigationItem","item","isPreviewVisible","setIsPreviewVisible","previewContent","select","template","__experimentalGetTemplateForLink","link","content","setPage","setIsNavigationPanelOpened","onActivateItem","type","slug","id","path","context","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,4BAA4B,IAAIC,cAAzC,QAA+D,uBAA/D;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,EAAsBC,QAAtB,QAAsC,oBAAtC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,qBAAT,QAAsC,gBAAtC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,0BAAT,QAA2C,IAA3C;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,gBAAvC;;AAEA,MAAMC,QAAQ,GAAKC,MAAF,IAAc;AAAA;;AAC9B,QAAMC,KAAK,GAAGD,MAAM,CAACE,QAAP,GAAkBF,MAAM,CAACG,IAAzB,GAAgCH,MAAhC,aAAgCA,MAAhC,wCAAgCA,MAAM,CAAEC,KAAxC,kDAAgC,cAAeG,QAA7D,CAD8B,CAG9B;;AACA,QAAMC,YAAY,GAAGC,QAAQ,CAACC,aAAT,CAA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AAP,EAAc;AACb,WAAO,IAAP;AACA;;AAED,SACC,8BACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,IAAI,EAAI,GAAGA,IAAI,CAACV,QAAL,IAAiBU,IAAI,CAACY,IAAM,IAAIZ,IAAI,CAACc,EAAI,EAFrD;AAGC,IAAA,KAAK,EAAG3B,QAAQ,CAAEa,IAAF,CAAR,IAAoBpB,EAAE,CAAE,YAAF,CAH/B;AAIC,IAAA,OAAO,EAAG+B,cAJX;AAKC,IAAA,YAAY,EAAG,MAAMT,mBAAmB,CAAE,IAAF,CALzC;AAMC,IAAA,YAAY,EAAG,MAAMA,mBAAmB,CAAE,KAAF;AANzC,IADD,EAUGD,gBAAgB,IAAIE,cAApB,IACD,cAAC,0BAAD,QACC,cAAC,eAAD;AACC,IAAA,UAAU,EAAGA,cADd;AAEC,IAAA,YAAY,EAAG;AACdc,MAAAA,QAAQ,EAAEjB,IAAI,CAACY,IADD;AAEdM,MAAAA,MAAM,EAAElB,IAAI,CAACc;AAFC;AAFhB,IADD,CAXF,CADD;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalNavigationItem as NavigationItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useCallback, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getPathAndQueryString } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { NavigationPanelPreviewFill } from '..';\nimport TemplatePreview from './template-preview';\nimport { store as editSiteStore } from '../../../store';\n\nconst getTitle = ( entity ) => {\n\tconst title = entity.taxonomy ? entity.name : entity?.title?.rendered;\n\n\t// Make sure encoded characters are displayed as the characters they represent.\n\tconst titleElement = document.createElement( 'div' );\n\ttitleElement.innerHTML = title;\n\n\treturn titleElement.textContent || titleElement.innerText || '';\n};\n\nexport default function ContentNavigationItem( { item } ) {\n\tconst [ isPreviewVisible, setIsPreviewVisible ] = useState( false );\n\tconst previewContent = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPreviewVisible ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst template = select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetTemplateForLink( item.link );\n\t\t\treturn template?.content;\n\t\t},\n\t\t[ isPreviewVisible ]\n\t);\n\tconst { setPage, setIsNavigationPanelOpened } = useDispatch(\n\t\teditSiteStore\n\t);\n\n\tconst onActivateItem = useCallback( () => {\n\t\tconst { type, slug, link, id } = item;\n\t\tsetPage( {\n\t\t\ttype,\n\t\t\tslug,\n\t\t\tpath: getPathAndQueryString( link ),\n\t\t\tcontext: {\n\t\t\t\tpostType: type,\n\t\t\t\tpostId: id,\n\t\t\t},\n\t\t} );\n\t\tsetIsNavigationPanelOpened( false );\n\t}, [ setPage, item ] );\n\n\tif ( ! item ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<NavigationItem\n\t\t\t\tclassName=\"edit-site-navigation-panel__content-item\"\n\t\t\t\titem={ `${ item.taxonomy || item.type }-${ item.id }` }\n\t\t\t\ttitle={ getTitle( item ) || __( '(no title)' ) }\n\t\t\t\tonClick={ onActivateItem }\n\t\t\t\tonMouseEnter={ () => setIsPreviewVisible( true ) }\n\t\t\t\tonMouseLeave={ () => setIsPreviewVisible( false ) }\n\t\t\t/>\n\n\t\t\t{ isPreviewVisible && previewContent && (\n\t\t\t\t<NavigationPanelPreviewFill>\n\t\t\t\t\t<TemplatePreview\n\t\t\t\t\t\trawContent={ previewContent }\n\t\t\t\t\t\tblockContext={ {\n\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</NavigationPanelPreviewFill>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -31,7 +31,7 @@ export default function SaveButton({
|
|
|
31
31
|
isDirty: dirtyEntityRecords.length > 0,
|
|
32
32
|
isSaving: some(dirtyEntityRecords, record => isSavingEntityRecord(record.kind, record.name, record.key))
|
|
33
33
|
};
|
|
34
|
-
});
|
|
34
|
+
}, []);
|
|
35
35
|
const disabled = !isDirty || isSaving;
|
|
36
36
|
return createElement(Fragment, null, createElement(Button, {
|
|
37
37
|
variant: "primary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"names":["some","useSelect","Button","__","store","coreStore","SaveButton","openEntitiesSavedStates","isEntitiesSavedStatesOpen","isDirty","isSaving","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","length","record","kind","name","key","disabled","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA,eAAe,SAASC,UAAT,CAAqB;AACnCC,EAAAA,uBADmC;AAEnCC,EAAAA;AAFmC,CAArB,EAGX;AACH,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAwBT,SAAS,CAAIU,MAAF,IAAc;AACtD,UAAM;AACLC,MAAAA,mCADK;AAELC,MAAAA;AAFK,QAGFF,MAAM,CAAEN,SAAF,CAHV;;AAIA,UAAMS,kBAAkB,GAAGF,mCAAmC,EAA9D;;AACA,WAAO;AACNH,MAAAA,OAAO,EAAEK,kBAAkB,CAACC,MAAnB,GAA4B,CAD/B;AAENL,MAAAA,QAAQ,EAAEV,IAAI,CAAEc,kBAAF,EAAwBE,MAAF,IACnCH,oBAAoB,CAAEG,MAAM,CAACC,IAAT,EAAeD,MAAM,CAACE,IAAtB,EAA4BF,MAAM,CAACG,GAAnC,CADP;AAFR,KAAP;AAMA,GAZsC,CAAvC;AAcA,QAAMC,QAAQ,GAAG,CAAEX,OAAF,IAAaC,QAA9B;AAEA,SACC,8BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,qBAAgBU,QAHjB;AAIC,qBAAgBZ,yBAJjB;AAKC,IAAA,QAAQ,EAAGY,QALZ;AAMC,IAAA,MAAM,EAAGV,QANV;AAOC,IAAA,OAAO,EAAGU,QAAQ,GAAGC,SAAH,GAAed;AAPlC,KASGJ,EAAE,CAAE,MAAF,CATL,CADD,CADD;AAeA","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function SaveButton( {\n\topenEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n} ) {\n\tconst { isDirty, isSaving } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\tisSavingEntityRecord,\n\t\t} = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving: some( dirtyEntityRecords, ( record ) =>\n\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t),\n\t\t};\n\t} );\n\n\tconst disabled = ! isDirty || isSaving;\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tclassName=\"edit-site-save-button__button\"\n\t\t\t\taria-disabled={ disabled }\n\t\t\t\taria-expanded={ isEntitiesSavedStatesOpen }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tisBusy={ isSaving }\n\t\t\t\tonClick={ disabled ? undefined : openEntitiesSavedStates }\n\t\t\t>\n\t\t\t\t{ __( 'Save' ) }\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/save-button/index.js"],"names":["some","useSelect","Button","__","store","coreStore","SaveButton","openEntitiesSavedStates","isEntitiesSavedStatesOpen","isDirty","isSaving","select","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","dirtyEntityRecords","length","record","kind","name","key","disabled","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA,eAAe,SAASC,UAAT,CAAqB;AACnCC,EAAAA,uBADmC;AAEnCC,EAAAA;AAFmC,CAArB,EAGX;AACH,QAAM;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,MAAwBT,SAAS,CAAIU,MAAF,IAAc;AACtD,UAAM;AACLC,MAAAA,mCADK;AAELC,MAAAA;AAFK,QAGFF,MAAM,CAAEN,SAAF,CAHV;;AAIA,UAAMS,kBAAkB,GAAGF,mCAAmC,EAA9D;;AACA,WAAO;AACNH,MAAAA,OAAO,EAAEK,kBAAkB,CAACC,MAAnB,GAA4B,CAD/B;AAENL,MAAAA,QAAQ,EAAEV,IAAI,CAAEc,kBAAF,EAAwBE,MAAF,IACnCH,oBAAoB,CAAEG,MAAM,CAACC,IAAT,EAAeD,MAAM,CAACE,IAAtB,EAA4BF,MAAM,CAACG,GAAnC,CADP;AAFR,KAAP;AAMA,GAZsC,EAYpC,EAZoC,CAAvC;AAcA,QAAMC,QAAQ,GAAG,CAAEX,OAAF,IAAaC,QAA9B;AAEA,SACC,8BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,SAAS,EAAC,+BAFX;AAGC,qBAAgBU,QAHjB;AAIC,qBAAgBZ,yBAJjB;AAKC,IAAA,QAAQ,EAAGY,QALZ;AAMC,IAAA,MAAM,EAAGV,QANV;AAOC,IAAA,OAAO,EAAGU,QAAQ,GAAGC,SAAH,GAAed;AAPlC,KASGJ,EAAE,CAAE,MAAF,CATL,CADD,CADD;AAeA","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\nexport default function SaveButton( {\n\topenEntitiesSavedStates,\n\tisEntitiesSavedStatesOpen,\n} ) {\n\tconst { isDirty, isSaving } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\t__experimentalGetDirtyEntityRecords,\n\t\t\tisSavingEntityRecord,\n\t\t} = select( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\treturn {\n\t\t\tisDirty: dirtyEntityRecords.length > 0,\n\t\t\tisSaving: some( dirtyEntityRecords, ( record ) =>\n\t\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t\t),\n\t\t};\n\t}, [] );\n\n\tconst disabled = ! isDirty || isSaving;\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tclassName=\"edit-site-save-button__button\"\n\t\t\t\taria-disabled={ disabled }\n\t\t\t\taria-expanded={ isEntitiesSavedStatesOpen }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\tisBusy={ isSaving }\n\t\t\t\tonClick={ disabled ? undefined : openEntitiesSavedStates }\n\t\t\t>\n\t\t\t\t{ __( 'Save' ) }\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -38,7 +38,8 @@ export default function InserterSidebar() {
|
|
|
38
38
|
showInserterHelpPanel: true,
|
|
39
39
|
shouldFocusBlock: isMobile,
|
|
40
40
|
rootClientId: insertionPoint.rootClientId,
|
|
41
|
-
__experimentalInsertionIndex: insertionPoint.insertionIndex
|
|
41
|
+
__experimentalInsertionIndex: insertionPoint.insertionIndex,
|
|
42
|
+
__experimentalFilterValue: insertionPoint.filterValue
|
|
42
43
|
})));
|
|
43
44
|
}
|
|
44
45
|
//# sourceMappingURL=inserter-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["useSelect","useDispatch","Button","__experimentalLibrary","Library","close","useViewportMatch","__experimentalUseDialog","useDialog","store","editSiteStore","InserterSidebar","setIsInserterOpened","insertionPoint","select","__experimentalGetInsertionPoint","isMobile","inserterDialogRef","inserterDialogProps","onClose","rootClientId","insertionIndex"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,yBAAjD;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SACCC,gBADD,EAECC,uBAAuB,IAAIC,SAF5B,QAGO,oBAHP;AAKA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BX,WAAW,CAAES,aAAF,CAA3C;AACA,QAAMG,cAAc,GAAGb,SAAS,CAC7Bc,MAAF,IAAcA,MAAM,CAAEJ,aAAF,CAAN,CAAwBK,+BAAxB,EADiB,EAE/B,EAF+B,CAAhC;AAKA,QAAMC,QAAQ,GAAGV,gBAAgB,CAAE,QAAF,EAAY,GAAZ,CAAjC;AACA,QAAM,CAAEW,iBAAF,EAAqBC,mBAArB,IAA6CV,SAAS,CAAE;AAC7DW,IAAAA,OAAO,EAAE,MAAMP,mBAAmB,CAAE,KAAF;AAD2B,GAAF,CAA5D;AAIA,SACC;AACC,IAAA,GAAG,EAAGK;AADP,KAEMC,mBAFN;AAGC,IAAA,SAAS,EAAC;AAHX,MAKC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,IAAI,EAAGb,KADR;AAEC,IAAA,OAAO,EAAG,MAAMO,mBAAmB,CAAE,KAAF;AAFpC,IADD,CALD,EAWC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD;AACC,IAAA,qBAAqB,MADtB;AAEC,IAAA,gBAAgB,EAAGI,QAFpB;AAGC,IAAA,YAAY,EAAGH,cAAc,CAACO,YAH/B;AAIC,IAAA,4BAA4B,EAC3BP,cAAc,CAACQ;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/secondary-sidebar/inserter-sidebar.js"],"names":["useSelect","useDispatch","Button","__experimentalLibrary","Library","close","useViewportMatch","__experimentalUseDialog","useDialog","store","editSiteStore","InserterSidebar","setIsInserterOpened","insertionPoint","select","__experimentalGetInsertionPoint","isMobile","inserterDialogRef","inserterDialogProps","onClose","rootClientId","insertionIndex","filterValue"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,qBAAqB,IAAIC,OAAlC,QAAiD,yBAAjD;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SACCC,gBADD,EAECC,uBAAuB,IAAIC,SAF5B,QAGO,oBAHP;AAKA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,eAAT,GAA2B;AACzC,QAAM;AAAEC,IAAAA;AAAF,MAA0BX,WAAW,CAAES,aAAF,CAA3C;AACA,QAAMG,cAAc,GAAGb,SAAS,CAC7Bc,MAAF,IAAcA,MAAM,CAAEJ,aAAF,CAAN,CAAwBK,+BAAxB,EADiB,EAE/B,EAF+B,CAAhC;AAKA,QAAMC,QAAQ,GAAGV,gBAAgB,CAAE,QAAF,EAAY,GAAZ,CAAjC;AACA,QAAM,CAAEW,iBAAF,EAAqBC,mBAArB,IAA6CV,SAAS,CAAE;AAC7DW,IAAAA,OAAO,EAAE,MAAMP,mBAAmB,CAAE,KAAF;AAD2B,GAAF,CAA5D;AAIA,SACC;AACC,IAAA,GAAG,EAAGK;AADP,KAEMC,mBAFN;AAGC,IAAA,SAAS,EAAC;AAHX,MAKC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,IAAI,EAAGb,KADR;AAEC,IAAA,OAAO,EAAG,MAAMO,mBAAmB,CAAE,KAAF;AAFpC,IADD,CALD,EAWC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,OAAD;AACC,IAAA,qBAAqB,MADtB;AAEC,IAAA,gBAAgB,EAAGI,QAFpB;AAGC,IAAA,YAAY,EAAGH,cAAc,CAACO,YAH/B;AAIC,IAAA,4BAA4B,EAC3BP,cAAc,CAACQ,cALjB;AAOC,IAAA,yBAAyB,EAAGR,cAAc,CAACS;AAP5C,IADD,CAXD,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __experimentalLibrary as Library } from '@wordpress/block-editor';\nimport { close } from '@wordpress/icons';\nimport {\n\tuseViewportMatch,\n\t__experimentalUseDialog as useDialog,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function InserterSidebar() {\n\tconst { setIsInserterOpened } = useDispatch( editSiteStore );\n\tconst insertionPoint = useSelect(\n\t\t( select ) => select( editSiteStore ).__experimentalGetInsertionPoint(),\n\t\t[]\n\t);\n\n\tconst isMobile = useViewportMatch( 'medium', '<' );\n\tconst [ inserterDialogRef, inserterDialogProps ] = useDialog( {\n\t\tonClose: () => setIsInserterOpened( false ),\n\t} );\n\n\treturn (\n\t\t<div\n\t\t\tref={ inserterDialogRef }\n\t\t\t{ ...inserterDialogProps }\n\t\t\tclassName=\"edit-site-editor__inserter-panel\"\n\t\t>\n\t\t\t<div className=\"edit-site-editor__inserter-panel-header\">\n\t\t\t\t<Button\n\t\t\t\t\ticon={ close }\n\t\t\t\t\tonClick={ () => setIsInserterOpened( false ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div className=\"edit-site-editor__inserter-panel-content\">\n\t\t\t\t<Library\n\t\t\t\t\tshowInserterHelpPanel\n\t\t\t\t\tshouldFocusBlock={ isMobile }\n\t\t\t\t\trootClientId={ insertionPoint.rootClientId }\n\t\t\t\t\t__experimentalInsertionIndex={\n\t\t\t\t\t\tinsertionPoint.insertionIndex\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFilterValue={ insertionPoint.filterValue }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n"]}
|
|
@@ -1,181 +1,35 @@
|
|
|
1
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { map, sortBy } from 'lodash';
|
|
7
3
|
/**
|
|
8
4
|
* WordPress dependencies
|
|
9
5
|
*/
|
|
10
|
-
|
|
11
|
-
import { Button, PanelBody, TabPanel } from '@wordpress/components';
|
|
6
|
+
import { Button } from '@wordpress/components';
|
|
12
7
|
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import {
|
|
14
|
-
import { useMemo } from '@wordpress/element';
|
|
8
|
+
import { styles } from '@wordpress/icons';
|
|
15
9
|
/**
|
|
16
10
|
* Internal dependencies
|
|
17
11
|
*/
|
|
18
12
|
|
|
19
|
-
import {
|
|
13
|
+
import { useGlobalStylesReset } from '../editor/global-styles-provider';
|
|
20
14
|
import DefaultSidebar from './default-sidebar';
|
|
21
|
-
import
|
|
22
|
-
|
|
23
|
-
import { default as ColorPanel, useHasColorPanel } from './color-panel';
|
|
24
|
-
import { default as DimensionsPanel, useHasDimensionsPanel } from './dimensions-panel';
|
|
25
|
-
|
|
26
|
-
function GlobalStylesPanel({
|
|
27
|
-
wrapperPanelTitle,
|
|
28
|
-
context,
|
|
29
|
-
getStyle,
|
|
30
|
-
setStyle,
|
|
31
|
-
getSetting,
|
|
32
|
-
setSetting
|
|
33
|
-
}) {
|
|
34
|
-
const hasBorderPanel = useHasBorderPanel(context);
|
|
35
|
-
const hasColorPanel = useHasColorPanel(context);
|
|
36
|
-
const hasTypographyPanel = useHasTypographyPanel(context);
|
|
37
|
-
const hasDimensionsPanel = useHasDimensionsPanel(context);
|
|
38
|
-
|
|
39
|
-
if (!hasColorPanel && !hasTypographyPanel && !hasDimensionsPanel) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const content = createElement(Fragment, null, hasTypographyPanel && createElement(TypographyPanel, {
|
|
44
|
-
context: context,
|
|
45
|
-
getStyle: getStyle,
|
|
46
|
-
setStyle: setStyle
|
|
47
|
-
}), hasColorPanel && createElement(ColorPanel, {
|
|
48
|
-
context: context,
|
|
49
|
-
getStyle: getStyle,
|
|
50
|
-
setStyle: setStyle,
|
|
51
|
-
getSetting: getSetting,
|
|
52
|
-
setSetting: setSetting
|
|
53
|
-
}), hasDimensionsPanel && createElement(DimensionsPanel, {
|
|
54
|
-
context: context,
|
|
55
|
-
getStyle: getStyle,
|
|
56
|
-
setStyle: setStyle
|
|
57
|
-
}), hasBorderPanel && createElement(BorderPanel, {
|
|
58
|
-
context: context,
|
|
59
|
-
getStyle: getStyle,
|
|
60
|
-
setStyle: setStyle
|
|
61
|
-
}));
|
|
62
|
-
|
|
63
|
-
if (!wrapperPanelTitle) {
|
|
64
|
-
return content;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return createElement(PanelBody, {
|
|
68
|
-
title: wrapperPanelTitle,
|
|
69
|
-
initialOpen: false
|
|
70
|
-
}, content);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function getPanelTitle(blockName) {
|
|
74
|
-
const blockType = getBlockType(blockName); // Protect against blocks that aren't registered
|
|
75
|
-
// eg: widget-area
|
|
76
|
-
|
|
77
|
-
if (blockType === undefined) {
|
|
78
|
-
return blockName;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return blockType.title;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function GlobalStylesBlockPanels({
|
|
85
|
-
blocks,
|
|
86
|
-
getStyle,
|
|
87
|
-
setStyle,
|
|
88
|
-
getSetting,
|
|
89
|
-
setSetting
|
|
90
|
-
}) {
|
|
91
|
-
const panels = useMemo(() => sortBy(map(blocks, (block, name) => {
|
|
92
|
-
return {
|
|
93
|
-
block,
|
|
94
|
-
name,
|
|
95
|
-
wrapperPanelTitle: getPanelTitle(name)
|
|
96
|
-
};
|
|
97
|
-
}), ({
|
|
98
|
-
wrapperPanelTitle
|
|
99
|
-
}) => wrapperPanelTitle), [blocks]);
|
|
100
|
-
return map(panels, ({
|
|
101
|
-
block,
|
|
102
|
-
name,
|
|
103
|
-
wrapperPanelTitle
|
|
104
|
-
}) => {
|
|
105
|
-
return createElement(GlobalStylesPanel, {
|
|
106
|
-
key: 'panel-' + name,
|
|
107
|
-
wrapperPanelTitle: wrapperPanelTitle,
|
|
108
|
-
context: block,
|
|
109
|
-
getStyle: getStyle,
|
|
110
|
-
setStyle: setStyle,
|
|
111
|
-
getSetting: getSetting,
|
|
112
|
-
setSetting: setSetting
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export default function GlobalStylesSidebar({
|
|
118
|
-
identifier,
|
|
119
|
-
title,
|
|
120
|
-
icon,
|
|
121
|
-
closeLabel
|
|
122
|
-
}) {
|
|
123
|
-
const {
|
|
124
|
-
root,
|
|
125
|
-
blocks,
|
|
126
|
-
getStyle,
|
|
127
|
-
setStyle,
|
|
128
|
-
getSetting,
|
|
129
|
-
setSetting
|
|
130
|
-
} = useGlobalStylesContext();
|
|
15
|
+
import GlobalStyles from '../global-styles';
|
|
16
|
+
export default function GlobalStylesSidebar() {
|
|
131
17
|
const [canRestart, onReset] = useGlobalStylesReset();
|
|
132
|
-
|
|
133
|
-
if (typeof blocks !== 'object' || !root) {
|
|
134
|
-
// No sidebar is shown.
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
18
|
return createElement(DefaultSidebar, {
|
|
139
19
|
className: "edit-site-global-styles-sidebar",
|
|
140
|
-
identifier:
|
|
141
|
-
title:
|
|
142
|
-
icon:
|
|
143
|
-
closeLabel:
|
|
144
|
-
header: createElement(Fragment, null, createElement("strong", null,
|
|
20
|
+
identifier: "edit-site/global-styles",
|
|
21
|
+
title: __('Styles'),
|
|
22
|
+
icon: styles,
|
|
23
|
+
closeLabel: __('Close global styles sidebar'),
|
|
24
|
+
header: createElement(Fragment, null, createElement("strong", null, __('Styles')), createElement("span", {
|
|
25
|
+
className: "edit-site-global-styles-sidebar__beta"
|
|
26
|
+
}, __('Beta')), createElement(Button, {
|
|
145
27
|
className: "edit-site-global-styles-sidebar__reset-button",
|
|
146
28
|
isSmall: true,
|
|
147
29
|
variant: "tertiary",
|
|
148
30
|
disabled: !canRestart,
|
|
149
31
|
onClick: onReset
|
|
150
32
|
}, __('Reset to defaults')))
|
|
151
|
-
}, createElement(
|
|
152
|
-
tabs: [{
|
|
153
|
-
name: 'root',
|
|
154
|
-
title: __('Root')
|
|
155
|
-
}, {
|
|
156
|
-
name: 'block',
|
|
157
|
-
title: __('By Block Type')
|
|
158
|
-
}]
|
|
159
|
-
}, tab => {
|
|
160
|
-
/* Per Block Context */
|
|
161
|
-
if ('block' === tab.name) {
|
|
162
|
-
return createElement(GlobalStylesBlockPanels, {
|
|
163
|
-
blocks: blocks,
|
|
164
|
-
getStyle: getStyle,
|
|
165
|
-
setStyle: setStyle,
|
|
166
|
-
getSetting: getSetting,
|
|
167
|
-
setSetting: setSetting
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return createElement(GlobalStylesPanel, {
|
|
172
|
-
hasWrapper: false,
|
|
173
|
-
context: root,
|
|
174
|
-
getStyle: getStyle,
|
|
175
|
-
setStyle: setStyle,
|
|
176
|
-
getSetting: getSetting,
|
|
177
|
-
setSetting: setSetting
|
|
178
|
-
});
|
|
179
|
-
}));
|
|
33
|
+
}, createElement(GlobalStyles, null));
|
|
180
34
|
}
|
|
181
35
|
//# sourceMappingURL=global-styles-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["map","sortBy","Button","PanelBody","TabPanel","__","getBlockType","useMemo","useGlobalStylesContext","useGlobalStylesReset","DefaultSidebar","default","TypographyPanel","useHasTypographyPanel","BorderPanel","useHasBorderPanel","ColorPanel","useHasColorPanel","DimensionsPanel","useHasDimensionsPanel","GlobalStylesPanel","wrapperPanelTitle","context","getStyle","setStyle","getSetting","setSetting","hasBorderPanel","hasColorPanel","hasTypographyPanel","hasDimensionsPanel","content","getPanelTitle","blockName","blockType","undefined","title","GlobalStylesBlockPanels","blocks","panels","block","name","GlobalStylesSidebar","identifier","icon","closeLabel","root","canRestart","onReset","tab"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,MAAd,QAA4B,QAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,EAA4BC,QAA5B,QAA4C,uBAA5C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SACCC,sBADD,EAECC,oBAFD,QAGO,kCAHP;AAIA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SACCC,OAAO,IAAIC,eADZ,EAECC,qBAFD,QAGO,oBAHP;AAIA,SAASF,OAAO,IAAIG,WAApB,EAAiCC,iBAAjC,QAA0D,gBAA1D;AACA,SAASJ,OAAO,IAAIK,UAApB,EAAgCC,gBAAhC,Q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AArB,EAA4B;AAC3B,aACC,cAAC,uBAAD;AACC,QAAA,MAAM,EAAGH,MADV;AAEC,QAAA,QAAQ,EAAGf,QAFZ;AAGC,QAAA,QAAQ,EAAGC,QAHZ;AAIC,QAAA,UAAU,EAAGC,UAJd;AAKC,QAAA,UAAU,EAAGC;AALd,QADD;AASA;;AACD,WACC,cAAC,iBAAD;AACC,MAAA,UAAU,EAAG,KADd;AAEC,MAAA,OAAO,EAAGoB,IAFX;AAGC,MAAA,QAAQ,EAAGvB,QAHZ;AAIC,MAAA,QAAQ,EAAGC,QAJZ;AAKC,MAAA,UAAU,EAAGC,UALd;AAMC,MAAA,UAAU,EAAGC;AANd,MADD;AAUA,GA7BF,CArBD,CADD;AAuDA","sourcesContent":["/**\n * External dependencies\n */\nimport { map, sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Button, PanelBody, TabPanel } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseGlobalStylesContext,\n\tuseGlobalStylesReset,\n} from '../editor/global-styles-provider';\nimport DefaultSidebar from './default-sidebar';\nimport {\n\tdefault as TypographyPanel,\n\tuseHasTypographyPanel,\n} from './typography-panel';\nimport { default as BorderPanel, useHasBorderPanel } from './border-panel';\nimport { default as ColorPanel, useHasColorPanel } from './color-panel';\nimport {\n\tdefault as DimensionsPanel,\n\tuseHasDimensionsPanel,\n} from './dimensions-panel';\n\nfunction GlobalStylesPanel( {\n\twrapperPanelTitle,\n\tcontext,\n\tgetStyle,\n\tsetStyle,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst hasBorderPanel = useHasBorderPanel( context );\n\tconst hasColorPanel = useHasColorPanel( context );\n\tconst hasTypographyPanel = useHasTypographyPanel( context );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( context );\n\n\tif ( ! hasColorPanel && ! hasTypographyPanel && ! hasDimensionsPanel ) {\n\t\treturn null;\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ hasTypographyPanel && (\n\t\t\t\t<TypographyPanel\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasColorPanel && (\n\t\t\t\t<ColorPanel\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t\tgetSetting={ getSetting }\n\t\t\t\t\tsetSetting={ setSetting }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasDimensionsPanel && (\n\t\t\t\t<DimensionsPanel\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasBorderPanel && (\n\t\t\t\t<BorderPanel\n\t\t\t\t\tcontext={ context }\n\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n\tif ( ! wrapperPanelTitle ) {\n\t\treturn content;\n\t}\n\treturn (\n\t\t<PanelBody title={ wrapperPanelTitle } initialOpen={ false }>\n\t\t\t{ content }\n\t\t</PanelBody>\n\t);\n}\n\nfunction getPanelTitle( blockName ) {\n\tconst blockType = getBlockType( blockName );\n\n\t// Protect against blocks that aren't registered\n\t// eg: widget-area\n\tif ( blockType === undefined ) {\n\t\treturn blockName;\n\t}\n\n\treturn blockType.title;\n}\n\nfunction GlobalStylesBlockPanels( {\n\tblocks,\n\tgetStyle,\n\tsetStyle,\n\tgetSetting,\n\tsetSetting,\n} ) {\n\tconst panels = useMemo(\n\t\t() =>\n\t\t\tsortBy(\n\t\t\t\tmap( blocks, ( block, name ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tblock,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\twrapperPanelTitle: getPanelTitle( name ),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t\t\t( { wrapperPanelTitle } ) => wrapperPanelTitle\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\treturn map( panels, ( { block, name, wrapperPanelTitle } ) => {\n\t\treturn (\n\t\t\t<GlobalStylesPanel\n\t\t\t\tkey={ 'panel-' + name }\n\t\t\t\twrapperPanelTitle={ wrapperPanelTitle }\n\t\t\t\tcontext={ block }\n\t\t\t\tgetStyle={ getStyle }\n\t\t\t\tsetStyle={ setStyle }\n\t\t\t\tgetSetting={ getSetting }\n\t\t\t\tsetSetting={ setSetting }\n\t\t\t/>\n\t\t);\n\t} );\n}\n\nexport default function GlobalStylesSidebar( {\n\tidentifier,\n\ttitle,\n\ticon,\n\tcloseLabel,\n} ) {\n\tconst {\n\t\troot,\n\t\tblocks,\n\t\tgetStyle,\n\t\tsetStyle,\n\t\tgetSetting,\n\t\tsetSetting,\n\t} = useGlobalStylesContext();\n\tconst [ canRestart, onReset ] = useGlobalStylesReset();\n\n\tif ( typeof blocks !== 'object' || ! root ) {\n\t\t// No sidebar is shown.\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier={ identifier }\n\t\t\ttitle={ title }\n\t\t\ticon={ icon }\n\t\t\tcloseLabel={ closeLabel }\n\t\t\theader={\n\t\t\t\t<>\n\t\t\t\t\t<strong>{ title }</strong>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-global-styles-sidebar__reset-button\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tdisabled={ ! canRestart }\n\t\t\t\t\t\tonClick={ onReset }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset to defaults' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</>\n\t\t\t}\n\t\t>\n\t\t\t<TabPanel\n\t\t\t\ttabs={ [\n\t\t\t\t\t{ name: 'root', title: __( 'Root' ) },\n\t\t\t\t\t{ name: 'block', title: __( 'By Block Type' ) },\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ ( tab ) => {\n\t\t\t\t\t/* Per Block Context */\n\t\t\t\t\tif ( 'block' === tab.name ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<GlobalStylesBlockPanels\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t\t\t\t\tgetSetting={ getSetting }\n\t\t\t\t\t\t\t\tsetSetting={ setSetting }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<GlobalStylesPanel\n\t\t\t\t\t\t\thasWrapper={ false }\n\t\t\t\t\t\t\tcontext={ root }\n\t\t\t\t\t\t\tgetStyle={ getStyle }\n\t\t\t\t\t\t\tsetStyle={ setStyle }\n\t\t\t\t\t\t\tgetSetting={ getSetting }\n\t\t\t\t\t\t\tsetSetting={ setSetting }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</TabPanel>\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/global-styles-sidebar.js"],"names":["Button","__","styles","useGlobalStylesReset","DefaultSidebar","GlobalStyles","GlobalStylesSidebar","canRestart","onReset"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,kCAArC;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,YAAP,MAAyB,kBAAzB;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,UAAF,EAAcC,OAAd,IAA0BL,oBAAoB,EAApD;AAEA,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAGF,EAAE,CAAE,QAAF,CAHX;AAIC,IAAA,IAAI,EAAGC,MAJR;AAKC,IAAA,UAAU,EAAGD,EAAE,CAAE,6BAAF,CALhB;AAMC,IAAA,MAAM,EACL,8BACC,8BAAUA,EAAE,CAAE,QAAF,CAAZ,CADD,EAEC;AAAM,MAAA,SAAS,EAAC;AAAhB,OACGA,EAAE,CAAE,MAAF,CADL,CAFD,EAKC,cAAC,MAAD;AACC,MAAA,SAAS,EAAC,+CADX;AAEC,MAAA,OAAO,MAFR;AAGC,MAAA,OAAO,EAAC,UAHT;AAIC,MAAA,QAAQ,EAAG,CAAEM,UAJd;AAKC,MAAA,OAAO,EAAGC;AALX,OAOGP,EAAE,CAAE,mBAAF,CAPL,CALD;AAPF,KAwBC,cAAC,YAAD,OAxBD,CADD;AA4BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStylesReset } from '../editor/global-styles-provider';\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStyles from '../global-styles';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ canRestart, onReset ] = useGlobalStylesReset();\n\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close global styles sidebar' ) }\n\t\t\theader={\n\t\t\t\t<>\n\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t<span className=\"edit-site-global-styles-sidebar__beta\">\n\t\t\t\t\t\t{ __( 'Beta' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-global-styles-sidebar__reset-button\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tdisabled={ ! canRestart }\n\t\t\t\t\t\tonClick={ onReset }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset to defaults' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStyles />\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
@@ -5,7 +5,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { createSlotFill, PanelBody } from '@wordpress/components';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { cog
|
|
8
|
+
import { cog } from '@wordpress/icons';
|
|
9
9
|
import { useEffect } from '@wordpress/element';
|
|
10
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
11
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
@@ -70,11 +70,6 @@ export function SidebarComplementaryAreaFills() {
|
|
|
70
70
|
headerClassName: "edit-site-sidebar__panel-tabs"
|
|
71
71
|
}, sidebarName === SIDEBAR_TEMPLATE && createElement(PanelBody, null, createElement(TemplateCard, null)), sidebarName === SIDEBAR_BLOCK && createElement(InspectorSlot, {
|
|
72
72
|
bubblesVirtually: true
|
|
73
|
-
})), createElement(GlobalStylesSidebar,
|
|
74
|
-
identifier: "edit-site/global-styles",
|
|
75
|
-
title: __('Global Styles'),
|
|
76
|
-
closeLabel: __('Close global styles sidebar'),
|
|
77
|
-
icon: typography
|
|
78
|
-
}));
|
|
73
|
+
})), createElement(GlobalStylesSidebar, null));
|
|
79
74
|
}
|
|
80
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["createSlotFill","PanelBody","__","cog","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/index.js"],"names":["createSlotFill","PanelBody","__","cog","useEffect","useSelect","useDispatch","store","interfaceStore","blockEditorStore","DefaultSidebar","GlobalStylesSidebar","STORE_NAME","SettingsHeader","TemplateCard","SIDEBAR_BLOCK","SIDEBAR_TEMPLATE","Slot","InspectorSlot","Fill","InspectorFill","SidebarInspectorFill","SidebarComplementaryAreaFills","sidebar","isEditorSidebarOpened","hasBlockSelection","select","_sidebar","getActiveComplementaryArea","_isEditorSidebarOpened","includes","getBlockSelectionStart","enableComplementaryArea","sidebarName"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,cAAT,EAAyBC,SAAzB,QAA0C,uBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,GAAT,QAAoB,kBAApB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,sBAAxC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,uBAA3B;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,YAAP,MAAyB,iBAAzB;AACA,SAASC,aAAT,EAAwBC,gBAAxB,QAAgD,aAAhD;AAEA,MAAM;AAAEC,EAAAA,IAAI,EAAEC,aAAR;AAAuBC,EAAAA,IAAI,EAAEC;AAA7B,IAA+CpB,cAAc,CAClE,0BADkE,CAAnE;AAGA,OAAO,MAAMqB,oBAAoB,GAAGD,aAA7B;AAEP,OAAO,SAASE,6BAAT,GAAyC;AAC/C,QAAM;AAAEC,IA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AC,cAAD;AAAgB,MAAA,WAAW,EAAG+B;AAA9B,MALV;AAMC,IAAA,eAAe,EAAC;AANjB,KAQGA,WAAW,KAAKjB,gBAAhB,IACD,cAAC,SAAD,QACC,cAAC,YAAD,OADD,CATF,EAaGiB,WAAW,KAAKlB,aAAhB,IACD,cAAC,aAAD;AAAe,IAAA,gBAAgB;AAA/B,IAdF,CADD,EAkBC,cAAC,mBAAD,OAlBD,CADD;AAsBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { cog } from '@wordpress/icons';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport GlobalStylesSidebar from './global-styles-sidebar';\nimport { STORE_NAME } from '../../store/constants';\nimport SettingsHeader from './settings-header';\nimport TemplateCard from './template-card';\nimport { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';\n\nconst { Slot: InspectorSlot, Fill: InspectorFill } = createSlotFill(\n\t'EditSiteSidebarInspector'\n);\nexport const SidebarInspectorFill = InspectorFill;\n\nexport function SidebarComplementaryAreaFills() {\n\tconst { sidebar, isEditorSidebarOpened, hasBlockSelection } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _sidebar = select(\n\t\t\t\tinterfaceStore\n\t\t\t).getActiveComplementaryArea( STORE_NAME );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tSIDEBAR_BLOCK,\n\t\t\t\tSIDEBAR_TEMPLATE,\n\t\t\t].includes( _sidebar );\n\t\t\treturn {\n\t\t\t\tsidebar: _sidebar,\n\t\t\t\tisEditorSidebarOpened: _isEditorSidebarOpened,\n\t\t\t\thasBlockSelection: !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\tuseEffect( () => {\n\t\tif ( ! isEditorSidebarOpened ) return;\n\t\tif ( hasBlockSelection ) {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_BLOCK );\n\t\t} else {\n\t\t\tenableComplementaryArea( STORE_NAME, SIDEBAR_TEMPLATE );\n\t\t}\n\t}, [ hasBlockSelection, isEditorSidebarOpened ] );\n\tlet sidebarName = sidebar;\n\tif ( ! isEditorSidebarOpened ) {\n\t\tsidebarName = hasBlockSelection ? SIDEBAR_BLOCK : SIDEBAR_TEMPLATE;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<DefaultSidebar\n\t\t\t\tidentifier={ sidebarName }\n\t\t\t\ttitle={ __( 'Settings' ) }\n\t\t\t\ticon={ cog }\n\t\t\t\tcloseLabel={ __( 'Close settings sidebar' ) }\n\t\t\t\theader={ <SettingsHeader sidebarName={ sidebarName } /> }\n\t\t\t\theaderClassName=\"edit-site-sidebar__panel-tabs\"\n\t\t\t>\n\t\t\t\t{ sidebarName === SIDEBAR_TEMPLATE && (\n\t\t\t\t\t<PanelBody>\n\t\t\t\t\t\t<TemplateCard />\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t\t{ sidebarName === SIDEBAR_BLOCK && (\n\t\t\t\t\t<InspectorSlot bubblesVirtually />\n\t\t\t\t) }\n\t\t\t</DefaultSidebar>\n\t\t\t<GlobalStylesSidebar />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { createElement } from "@wordpress/element";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WordPress dependencies
|
|
6
|
+
*/
|
|
7
|
+
import { ComplementaryArea } from '@wordpress/interface';
|
|
8
|
+
/**
|
|
9
|
+
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
10
|
+
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
11
|
+
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @see PluginSidebarMoreMenuItem
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} props Element props.
|
|
20
|
+
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
|
|
21
|
+
* @param {string} [props.className] An optional class name added to the sidebar body.
|
|
22
|
+
* @param {string} props.title Title displayed at the top of the sidebar.
|
|
23
|
+
* @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
|
|
24
|
+
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```js
|
|
28
|
+
* // Using ES5 syntax
|
|
29
|
+
* var __ = wp.i18n.__;
|
|
30
|
+
* var el = wp.element.createElement;
|
|
31
|
+
* var PanelBody = wp.components.PanelBody;
|
|
32
|
+
* var PluginSidebar = wp.editSite.PluginSidebar;
|
|
33
|
+
* var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
|
|
34
|
+
*
|
|
35
|
+
* function MyPluginSidebar() {
|
|
36
|
+
* return el(
|
|
37
|
+
* PluginSidebar,
|
|
38
|
+
* {
|
|
39
|
+
* name: 'my-sidebar',
|
|
40
|
+
* title: 'My sidebar title',
|
|
41
|
+
* icon: moreIcon,
|
|
42
|
+
* },
|
|
43
|
+
* el(
|
|
44
|
+
* PanelBody,
|
|
45
|
+
* {},
|
|
46
|
+
* __( 'My sidebar content' )
|
|
47
|
+
* )
|
|
48
|
+
* );
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```jsx
|
|
54
|
+
* // Using ESNext syntax
|
|
55
|
+
* import { __ } from '@wordpress/i18n';
|
|
56
|
+
* import { PanelBody } from '@wordpress/components';
|
|
57
|
+
* import { PluginSidebar } from '@wordpress/edit-site';
|
|
58
|
+
* import { more } from '@wordpress/icons';
|
|
59
|
+
*
|
|
60
|
+
* const MyPluginSidebar = () => (
|
|
61
|
+
* <PluginSidebar
|
|
62
|
+
* name="my-sidebar"
|
|
63
|
+
* title="My sidebar title"
|
|
64
|
+
* icon={ more }
|
|
65
|
+
* >
|
|
66
|
+
* <PanelBody>
|
|
67
|
+
* { __( 'My sidebar content' ) }
|
|
68
|
+
* </PanelBody>
|
|
69
|
+
* </PluginSidebar>
|
|
70
|
+
* );
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
export default function PluginSidebarEditSite({
|
|
75
|
+
className,
|
|
76
|
+
...props
|
|
77
|
+
}) {
|
|
78
|
+
return createElement(ComplementaryArea, _extends({
|
|
79
|
+
panelClassName: className,
|
|
80
|
+
className: "edit-site-sidebar",
|
|
81
|
+
scope: "core/edit-site"
|
|
82
|
+
}, props));
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar/plugin-sidebar/index.js"],"names":["ComplementaryArea","PluginSidebarEditSite","className","props"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,sBAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,CAAgC;AAAEC,EAAAA,SAAF;AAAa,KAAGC;AAAhB,CAAhC,EAA0D;AACxE,SACC,cAAC,iBAAD;AACC,IAAA,cAAc,EAAGD,SADlB;AAEC,IAAA,SAAS,EAAC,mBAFX;AAGC,IAAA,KAAK,EAAC;AAHP,KAIMC,KAJN,EADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { ComplementaryArea } from '@wordpress/interface';\n\n/**\n * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.\n * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.\n * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:\n *\n * ```js\n * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' );\n * ```\n *\n * @see PluginSidebarMoreMenuItem\n *\n * @param {Object} props Element props.\n * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.\n * @param {string} [props.className] An optional class name added to the sidebar body.\n * @param {string} props.title Title displayed at the top of the sidebar.\n * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var __ = wp.i18n.__;\n * var el = wp.element.createElement;\n * var PanelBody = wp.components.PanelBody;\n * var PluginSidebar = wp.editSite.PluginSidebar;\n * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.\n *\n * function MyPluginSidebar() {\n * \treturn el(\n * \t\t\tPluginSidebar,\n * \t\t\t{\n * \t\t\t\tname: 'my-sidebar',\n * \t\t\t\ttitle: 'My sidebar title',\n * \t\t\t\ticon: moreIcon,\n * \t\t\t},\n * \t\t\tel(\n * \t\t\t\tPanelBody,\n * \t\t\t\t{},\n * \t\t\t\t__( 'My sidebar content' )\n * \t\t\t)\n * \t);\n * }\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { __ } from '@wordpress/i18n';\n * import { PanelBody } from '@wordpress/components';\n * import { PluginSidebar } from '@wordpress/edit-site';\n * import { more } from '@wordpress/icons';\n *\n * const MyPluginSidebar = () => (\n * \t<PluginSidebar\n * \t\tname=\"my-sidebar\"\n * \t\ttitle=\"My sidebar title\"\n * \t\ticon={ more }\n * \t>\n * \t\t<PanelBody>\n * \t\t\t{ __( 'My sidebar content' ) }\n * \t\t</PanelBody>\n * \t</PluginSidebar>\n * );\n * ```\n */\nexport default function PluginSidebarEditSite( { className, ...props } ) {\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tpanelClassName={ className }\n\t\t\tclassName=\"edit-site-sidebar\"\n\t\t\tscope=\"core/edit-site\"\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n"]}
|