@wordpress/editor 14.0.3 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -12
- package/README.md +189 -24
- package/build/components/create-template-part-modal/index.js +2 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/document-bar/index.js +11 -4
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/editor/index.js +18 -24
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-interface/index.js +3 -1
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js +9 -0
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build/components/entities-saved-states/index.js +28 -0
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +1 -1
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/header/index.js +6 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/index.js +15 -0
- package/build/components/index.js.map +1 -1
- package/build/components/post-actions/actions.js +286 -263
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +2 -0
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -0
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +5 -0
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +4 -0
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-slug/check.js +8 -1
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +6 -0
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-status/index.js +2 -1
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/check.js +8 -0
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js +13 -13
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +11 -2
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +5 -1
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js +8 -0
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +14 -2
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +9 -0
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/panel.js +10 -0
- package/build/components/post-taxonomies/panel.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js +2 -0
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-title/index.js +4 -8
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +3 -7
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-trash/check.js +8 -0
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +5 -1
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/provider/index.js +18 -15
- package/build/components/provider/index.js.map +1 -1
- package/build/components/sidebar/index.js +2 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-summary.js +2 -3
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/table-of-contents/index.js +11 -0
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/template-part-content-panel/index.js +70 -0
- package/build/components/template-part-content-panel/index.js.map +1 -0
- package/build/components/template-part-menu-items/convert-to-regular.js +38 -0
- package/build/components/template-part-menu-items/convert-to-regular.js.map +1 -0
- package/build/components/template-part-menu-items/convert-to-template-part.js +77 -0
- package/build/components/template-part-menu-items/convert-to-template-part.js.map +1 -0
- package/build/components/template-part-menu-items/index.js +67 -0
- package/build/components/template-part-menu-items/index.js.map +1 -0
- package/build/components/template-part-menu-items/index.native.js +10 -0
- package/build/components/template-part-menu-items/index.native.js.map +1 -0
- package/build/components/theme-support-check/index.js +9 -0
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/time-to-read/index.js +6 -0
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/word-count/index.js +5 -1
- package/build/components/word-count/index.js.map +1 -1
- package/build/dataviews/api.js +61 -0
- package/build/dataviews/api.js.map +1 -0
- package/build/dataviews/store/private-actions.js +28 -0
- package/build/dataviews/store/private-actions.js.map +1 -0
- package/build/dataviews/store/private-selectors.js +20 -0
- package/build/dataviews/store/private-selectors.js.map +1 -0
- package/build/dataviews/store/reducer.js +36 -0
- package/build/dataviews/store/reducer.js.map +1 -0
- package/build/index.js +12 -0
- package/build/index.js.map +1 -1
- package/build/private-apis.js +0 -6
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/private-actions.js +21 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +5 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +4 -1
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +2 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +11 -4
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/editor/index.js +19 -24
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-interface/index.js +3 -1
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js +10 -0
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +28 -0
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/header/index.js +6 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/index.js +16 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +286 -263
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +2 -0
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +4 -0
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +6 -0
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +4 -0
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-slug/check.js +9 -0
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +6 -0
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-status/index.js +2 -1
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/check.js +9 -0
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js +15 -13
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +10 -1
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +6 -0
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js +9 -0
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +14 -2
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +9 -0
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js +10 -0
- package/build-module/components/post-taxonomies/panel.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +2 -0
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-title/index.js +4 -8
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +3 -7
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-trash/check.js +9 -0
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +6 -0
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/provider/index.js +18 -15
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +2 -3
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +11 -0
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/template-part-content-panel/index.js +63 -0
- package/build-module/components/template-part-content-panel/index.js.map +1 -0
- package/build-module/components/template-part-menu-items/convert-to-regular.js +31 -0
- package/build-module/components/template-part-menu-items/convert-to-regular.js.map +1 -0
- package/build-module/components/template-part-menu-items/convert-to-template-part.js +71 -0
- package/build-module/components/template-part-menu-items/convert-to-template-part.js.map +1 -0
- package/build-module/components/template-part-menu-items/index.js +59 -0
- package/build-module/components/template-part-menu-items/index.js.map +1 -0
- package/build-module/components/template-part-menu-items/index.native.js +4 -0
- package/build-module/components/template-part-menu-items/index.native.js.map +1 -0
- package/build-module/components/theme-support-check/index.js +10 -0
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js +6 -0
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/word-count/index.js +6 -0
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/dataviews/api.js +54 -0
- package/build-module/dataviews/api.js.map +1 -0
- package/build-module/dataviews/store/private-actions.js +21 -0
- package/build-module/dataviews/store/private-actions.js.map +1 -0
- package/build-module/dataviews/store/private-selectors.js +14 -0
- package/build-module/dataviews/store/private-selectors.js.map +1 -0
- package/build-module/dataviews/store/reducer.js +29 -0
- package/build-module/dataviews/store/reducer.js.map +1 -0
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/private-apis.js +0 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/private-actions.js +1 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +4 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +3 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/style-rtl.css +10 -9
- package/build-style/style.css +10 -9
- package/build-types/dataviews/store/private-actions.d.ts +17 -0
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -0
- package/build-types/dataviews/store/private-selectors.d.ts +10 -0
- package/build-types/dataviews/store/private-selectors.d.ts.map +1 -0
- package/build-types/dataviews/store/reducer.d.ts +11 -0
- package/build-types/dataviews/store/reducer.d.ts.map +1 -0
- package/package.json +35 -35
- package/src/components/create-template-part-modal/index.js +2 -0
- package/src/components/create-template-part-modal/style.scss +0 -6
- package/src/components/document-bar/index.js +11 -4
- package/src/components/editor/index.js +23 -28
- package/src/components/editor-interface/index.js +2 -0
- package/src/components/entities-saved-states/hooks/use-is-dirty.js +9 -0
- package/src/components/entities-saved-states/index.js +26 -0
- package/src/components/global-keyboard-shortcuts/index.js +1 -1
- package/src/components/header/index.js +2 -1
- package/src/components/index.js +16 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +0 -3
- package/src/components/post-actions/actions.js +376 -387
- package/src/components/post-actions/index.js +2 -0
- package/src/components/post-card-panel/style.scss +4 -0
- package/src/components/post-panel-row/style.scss +1 -1
- package/src/components/post-publish-button/index.js +3 -0
- package/src/components/post-publish-button/label.js +5 -0
- package/src/components/post-publish-panel/index.js +3 -0
- package/src/components/post-slug/check.js +8 -0
- package/src/components/post-slug/index.js +5 -0
- package/src/components/post-status/index.js +2 -0
- package/src/components/post-status/style.scss +5 -0
- package/src/components/post-sticky/check.js +8 -0
- package/src/components/post-sticky/index.js +14 -12
- package/src/components/post-sticky/style.scss +3 -2
- package/src/components/post-switch-to-draft-button/index.js +10 -1
- package/src/components/post-sync-status/index.js +5 -0
- package/src/components/post-taxonomies/check.js +8 -0
- package/src/components/post-taxonomies/flat-term-selector.js +13 -2
- package/src/components/post-taxonomies/index.js +8 -0
- package/src/components/post-taxonomies/panel.js +9 -0
- package/src/components/post-template/create-new-template-modal.js +2 -0
- package/src/components/post-title/index.js +2 -5
- package/src/components/post-title/post-title-raw.js +2 -5
- package/src/components/post-trash/check.js +8 -0
- package/src/components/post-trash/index.js +5 -0
- package/src/components/provider/index.js +17 -17
- package/src/components/sidebar/index.js +2 -0
- package/src/components/sidebar/post-summary.js +1 -3
- package/src/components/table-of-contents/index.js +10 -0
- package/src/components/template-part-content-panel/index.js +62 -0
- package/src/components/template-part-menu-items/convert-to-regular.js +32 -0
- package/src/components/template-part-menu-items/convert-to-template-part.js +75 -0
- package/src/components/template-part-menu-items/index.js +59 -0
- package/src/components/template-part-menu-items/index.native.js +3 -0
- package/src/components/theme-support-check/index.js +9 -0
- package/src/components/time-to-read/index.js +5 -0
- package/src/components/word-count/index.js +5 -0
- package/src/dataviews/api.js +55 -0
- package/src/dataviews/store/private-actions.ts +30 -0
- package/src/dataviews/store/private-selectors.ts +15 -0
- package/src/dataviews/store/reducer.ts +44 -0
- package/src/index.js +1 -0
- package/src/private-apis.js +0 -6
- package/src/private-apis.native.js +0 -2
- package/src/store/private-actions.js +1 -0
- package/src/store/private-selectors.js +5 -0
- package/src/store/reducer.js +2 -0
- package/tsconfig.json +36 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_icons","_keyboardShortcuts","_components","_interface","_patternOverridesPanel","_interopRequireDefault","_pluginDocumentSettingPanel","_pluginSidebar","_postSummary","_panel","_postTransformPanel","_header","_templateContentPanel","_useAutoSwitchEditorSidebars","_constants","_lockUnlock","_store","_constants2","_jsxRuntime","Tabs","unlock","componentsPrivateApis","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","SidebarContent","tabName","keyboardShortcut","renderingMode","onActionPerformed","extraPanels","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","jsx","default","identifier","header","Provider","value","children","ref","closeLabel","__","className","headerClassName","title","toggleShortcut","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","jsxs","TabPanel","tabId","sidebars","document","focusable","Slot","block","BlockInspector","Sidebar","useAutoSwitchEditorSidebars","showSummary","useSelect","shortcut","keyboardShortcutsStore","getShortcutRepresentation","sidebar","interfaceStore","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","blockEditorStore","getBlockSelectionStart","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","editorStore","getCurrentPostType","getRenderingMode","enableComplementaryArea","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove","_default","exports"],"sources":["@wordpress/editor/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostSummary from './post-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateContentPanel from '../template-content-panel';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\trenderingMode,\n\tonActionPerformed,\n\textraPanels,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<PluginSidebar\n\t\t\tidentifier={ tabName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"editor-sidebar__panel\"\n\t\t\theaderClassName=\"editor-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t<PostSummary onActionPerformed={ onActionPerformed } />\n\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t{ renderingMode !== 'post-only' && (\n\t\t\t\t\t\t<TemplateContentPanel />\n\t\t\t\t\t) }\n\t\t\t\t\t<PostTransformPanel />\n\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t{ extraPanels }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebar>\n\t);\n};\n\nconst Sidebar = ( { extraPanels, onActionPerformed } ) => {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, keyboardShortcut, showSummary, renderingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst shortcut = select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' );\n\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tsidebars.block,\n\t\t\t\tsidebars.document,\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? sidebars.block\n\t\t\t\t\t: sidebars.document;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tkeyboardShortcut: shortcut,\n\t\t\t\tshowSummary: ! [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\t].includes( select( editorStore ).getCurrentPostType() ),\n\t\t\t\trenderingMode: select( editorStore ).getRenderingMode(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\ttabName={ tabName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tshowSummary={ showSummary }\n\t\t\t\trenderingMode={ renderingMode }\n\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\textraPanels={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gB,CAAC;IACvD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEd,gBAAe,CAAC;EAEjE,MAAMe,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BJ,uBAAuB,CAAE,MAAM,EAAEI,gBAAiB,CAAC;IACpD;EACD,CAAC,EACD,CAAEJ,uBAAuB,CAC1B,CAAC;EAED,oBACC,IAAArF,WAAA,CAAAoC,GAAA,EAACnC,IAAI;IACJyF,aAAa,EAAGhF,OAAS;IACzBiF,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG,KAAO;IAAAlD,QAAA,eAEtB,IAAA1C,WAAA,CAAAoC,GAAA,EAAC3B,cAAc;MACdC,OAAO,EAAGA,OAAS;MACnBC,gBAAgB,EAAGA,gBAAkB;MACrCuD,WAAW,EAAGA,WAAa;MAC3BtD,aAAa,EAAGA,aAAe;MAC/BC,iBAAiB,EAAGA,iBAAmB;MACvCC,WAAW,EAAGA;IAAa,CAC3B;EAAC,CACG,CAAC;AAET,CAAC;AAAC,IAAA+E,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAEa2B,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_data","_element","_i18n","_icons","_keyboardShortcuts","_components","_interface","_patternOverridesPanel","_interopRequireDefault","_pluginDocumentSettingPanel","_pluginSidebar","_postSummary","_panel","_postTransformPanel","_header","_templateContentPanel","_templatePartContentPanel","_useAutoSwitchEditorSidebars","_constants","_lockUnlock","_store","_constants2","_jsxRuntime","Tabs","unlock","componentsPrivateApis","SIDEBAR_ACTIVE_BY_DEFAULT","Platform","select","web","native","SidebarContent","tabName","keyboardShortcut","renderingMode","onActionPerformed","extraPanels","tabListRef","useRef","tabsContextValue","useContext","Context","useEffect","tabsElements","Array","from","current","querySelectorAll","selectedTabElement","find","element","getAttribute","activeElement","ownerDocument","tabsHasFocus","some","id","focus","jsx","default","identifier","header","Provider","value","children","ref","closeLabel","__","className","headerClassName","title","toggleShortcut","icon","isRTL","drawerLeft","drawerRight","isActiveByDefault","jsxs","TabPanel","tabId","sidebars","document","focusable","Slot","block","BlockInspector","Sidebar","useAutoSwitchEditorSidebars","showSummary","useSelect","shortcut","keyboardShortcutsStore","getShortcutRepresentation","sidebar","interfaceStore","getActiveComplementaryArea","_isEditorSidebarOpened","includes","_tabName","blockEditorStore","getBlockSelectionStart","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","editorStore","getCurrentPostType","getRenderingMode","enableComplementaryArea","useDispatch","onTabSelect","useCallback","newSelectedTabId","selectedTabId","onSelect","selectOnMove","_default","exports"],"sources":["@wordpress/editor/src/components/sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockInspector,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPlatform,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n} from '@wordpress/element';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { drawerLeft, drawerRight } from '@wordpress/icons';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport PatternOverridesPanel from '../pattern-overrides-panel';\nimport PluginDocumentSettingPanel from '../plugin-document-setting-panel';\nimport PluginSidebar from '../plugin-sidebar';\nimport PostSummary from './post-summary';\nimport PostTaxonomiesPanel from '../post-taxonomies/panel';\nimport PostTransformPanel from '../post-transform-panel';\nimport SidebarHeader from './header';\nimport TemplateContentPanel from '../template-content-panel';\nimport TemplatePartContentPanel from '../template-part-content-panel';\nimport useAutoSwitchEditorSidebars from '../provider/use-auto-switch-editor-sidebars';\nimport { sidebars } from './constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\nimport {\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../store/constants';\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\nconst SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {\n\tweb: true,\n\tnative: false,\n} );\n\nconst SidebarContent = ( {\n\ttabName,\n\tkeyboardShortcut,\n\trenderingMode,\n\tonActionPerformed,\n\textraPanels,\n} ) => {\n\tconst tabListRef = useRef( null );\n\t// Because `PluginSidebar` renders a `ComplementaryArea`, we\n\t// need to forward the `Tabs` context so it can be passed through the\n\t// underlying slot/fill.\n\tconst tabsContextValue = useContext( Tabs.Context );\n\n\t// This effect addresses a race condition caused by tabbing from the last\n\t// block in the editor into the settings sidebar. Without this effect, the\n\t// selected tab and browser focus can become separated in an unexpected way\n\t// (e.g the \"block\" tab is focused, but the \"post\" tab is selected).\n\tuseEffect( () => {\n\t\tconst tabsElements = Array.from(\n\t\t\ttabListRef.current?.querySelectorAll( '[role=\"tab\"]' ) || []\n\t\t);\n\t\tconst selectedTabElement = tabsElements.find(\n\t\t\t// We are purposefully using a custom `data-tab-id` attribute here\n\t\t\t// because we don't want rely on any assumptions about `Tabs`\n\t\t\t// component internals.\n\t\t\t( element ) => element.getAttribute( 'data-tab-id' ) === tabName\n\t\t);\n\t\tconst activeElement = selectedTabElement?.ownerDocument.activeElement;\n\t\tconst tabsHasFocus = tabsElements.some( ( element ) => {\n\t\t\treturn activeElement && activeElement.id === element.id;\n\t\t} );\n\t\tif (\n\t\t\ttabsHasFocus &&\n\t\t\tselectedTabElement &&\n\t\t\tselectedTabElement.id !== activeElement?.id\n\t\t) {\n\t\t\tselectedTabElement?.focus();\n\t\t}\n\t}, [ tabName ] );\n\n\treturn (\n\t\t<PluginSidebar\n\t\t\tidentifier={ tabName }\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<SidebarHeader ref={ tabListRef } />\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t\tcloseLabel={ __( 'Close Settings' ) }\n\t\t\t// This classname is added so we can apply a corrective negative\n\t\t\t// margin to the panel.\n\t\t\t// see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049\n\t\t\tclassName=\"editor-sidebar__panel\"\n\t\t\theaderClassName=\"editor-sidebar__panel-tabs\"\n\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\ttitle={ __( 'Settings' ) }\n\t\t\ttoggleShortcut={ keyboardShortcut }\n\t\t\ticon={ isRTL() ? drawerLeft : drawerRight }\n\t\t\tisActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>\n\t\t\t\t\t<PostSummary onActionPerformed={ onActionPerformed } />\n\t\t\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t\t\t{ renderingMode !== 'post-only' && (\n\t\t\t\t\t\t<TemplateContentPanel />\n\t\t\t\t\t) }\n\t\t\t\t\t<TemplatePartContentPanel />\n\t\t\t\t\t<PostTransformPanel />\n\t\t\t\t\t<PostTaxonomiesPanel />\n\t\t\t\t\t<PatternOverridesPanel />\n\t\t\t\t\t{ extraPanels }\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t<Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>\n\t\t\t\t\t<BlockInspector />\n\t\t\t\t</Tabs.TabPanel>\n\t\t\t</Tabs.Context.Provider>\n\t\t</PluginSidebar>\n\t);\n};\n\nconst Sidebar = ( { extraPanels, onActionPerformed } ) => {\n\tuseAutoSwitchEditorSidebars();\n\tconst { tabName, keyboardShortcut, showSummary, renderingMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst shortcut = select(\n\t\t\t\tkeyboardShortcutsStore\n\t\t\t).getShortcutRepresentation( 'core/editor/toggle-sidebar' );\n\n\t\t\tconst sidebar =\n\t\t\t\tselect( interfaceStore ).getActiveComplementaryArea( 'core' );\n\t\t\tconst _isEditorSidebarOpened = [\n\t\t\t\tsidebars.block,\n\t\t\t\tsidebars.document,\n\t\t\t].includes( sidebar );\n\t\t\tlet _tabName = sidebar;\n\t\t\tif ( ! _isEditorSidebarOpened ) {\n\t\t\t\t_tabName = !! select(\n\t\t\t\t\tblockEditorStore\n\t\t\t\t).getBlockSelectionStart()\n\t\t\t\t\t? sidebars.block\n\t\t\t\t\t: sidebars.document;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttabName: _tabName,\n\t\t\t\tkeyboardShortcut: shortcut,\n\t\t\t\tshowSummary: ! [\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t\tNAVIGATION_POST_TYPE,\n\t\t\t\t].includes( select( editorStore ).getCurrentPostType() ),\n\t\t\t\trenderingMode: select( editorStore ).getRenderingMode(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { enableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst onTabSelect = useCallback(\n\t\t( newSelectedTabId ) => {\n\t\t\tif ( !! newSelectedTabId ) {\n\t\t\t\tenableComplementaryArea( 'core', newSelectedTabId );\n\t\t\t}\n\t\t},\n\t\t[ enableComplementaryArea ]\n\t);\n\n\treturn (\n\t\t<Tabs\n\t\t\tselectedTabId={ tabName }\n\t\t\tonSelect={ onTabSelect }\n\t\t\tselectOnMove={ false }\n\t\t>\n\t\t\t<SidebarContent\n\t\t\t\ttabName={ tabName }\n\t\t\t\tkeyboardShortcut={ keyboardShortcut }\n\t\t\t\tshowSummary={ showSummary }\n\t\t\t\trenderingMode={ renderingMode }\n\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\textraPanels={ extraPanels }\n\t\t\t/>\n\t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AY,CAAC,CAACC,kBAAkB,CAAC,CAAE,CAAC;MACxDvE,aAAa,EAAEN,MAAM,CAAE4E,YAAY,CAAC,CAACE,gBAAgB,CAAC;IACvD,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM;IAAEC;EAAwB,CAAC,GAAG,IAAAC,iBAAW,EAAEd,gBAAe,CAAC;EAEjE,MAAMe,WAAW,GAAG,IAAAC,oBAAW,EAC5BC,gBAAgB,IAAM;IACvB,IAAK,CAAC,CAAEA,gBAAgB,EAAG;MAC1BJ,uBAAuB,CAAE,MAAM,EAAEI,gBAAiB,CAAC;IACpD;EACD,CAAC,EACD,CAAEJ,uBAAuB,CAC1B,CAAC;EAED,oBACC,IAAArF,WAAA,CAAAoC,GAAA,EAACnC,IAAI;IACJyF,aAAa,EAAGhF,OAAS;IACzBiF,QAAQ,EAAGJ,WAAa;IACxBK,YAAY,EAAG,KAAO;IAAAlD,QAAA,eAEtB,IAAA1C,WAAA,CAAAoC,GAAA,EAAC3B,cAAc;MACdC,OAAO,EAAGA,OAAS;MACnBC,gBAAgB,EAAGA,gBAAkB;MACrCuD,WAAW,EAAGA,WAAa;MAC3BtD,aAAa,EAAGA,aAAe;MAC/BC,iBAAiB,EAAGA,iBAAmB;MACvCC,WAAW,EAAGA;IAAa,CAC3B;EAAC,CACG,CAAC;AAET,CAAC;AAAC,IAAA+E,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAEa2B,OAAO","ignoreList":[]}
|
|
@@ -21,7 +21,6 @@ var _postLastEditedPanel = _interopRequireDefault(require("../post-last-edited-p
|
|
|
21
21
|
var _postPanelSection = _interopRequireDefault(require("../post-panel-section"));
|
|
22
22
|
var _panel7 = _interopRequireDefault(require("../post-schedule/panel"));
|
|
23
23
|
var _postStatus = _interopRequireDefault(require("../post-status"));
|
|
24
|
-
var _postSticky = _interopRequireDefault(require("../post-sticky"));
|
|
25
24
|
var _postSyncStatus = _interopRequireDefault(require("../post-sync-status"));
|
|
26
25
|
var _panel8 = _interopRequireDefault(require("../post-template/panel"));
|
|
27
26
|
var _panel9 = _interopRequireDefault(require("../post-url/panel"));
|
|
@@ -76,10 +75,10 @@ function PostSummary({
|
|
|
76
75
|
spacing: 1,
|
|
77
76
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_postContentInformation.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postLastEditedPanel.default, {})]
|
|
78
77
|
}), !isRemovedPostStatusPanel && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
79
|
-
spacing:
|
|
78
|
+
spacing: 4,
|
|
80
79
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
81
80
|
spacing: 1,
|
|
82
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_postStatus.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel7.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel9.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel8.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel3.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postLastRevision.PrivatePostLastRevision, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel2.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postSyncStatus.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blogTitle.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postsPerPage.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_siteDiscussion.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel6.default, {})
|
|
81
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_postStatus.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel7.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel9.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel8.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel3.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postLastRevision.PrivatePostLastRevision, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel2.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postSyncStatus.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blogTitle.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_postsPerPage.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_siteDiscussion.default, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_panel6.default, {})]
|
|
83
82
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_templateAreas.default, {}), fills]
|
|
84
83
|
})]
|
|
85
84
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_data","_pluginPostStatusInfo","_interopRequireDefault","_postActions","_panel","_postCardPanel","_postContentInformation","_panel2","_panel3","_panel4","_panel5","_panel6","_postLastEditedPanel","_postPanelSection","_panel7","_postStatus","
|
|
1
|
+
{"version":3,"names":["_components","require","_data","_pluginPostStatusInfo","_interopRequireDefault","_postActions","_panel","_postCardPanel","_postContentInformation","_panel2","_panel3","_panel4","_panel5","_panel6","_postLastEditedPanel","_postPanelSection","_panel7","_postStatus","_postSyncStatus","_panel8","_panel9","_blogTitle","_postsPerPage","_siteDiscussion","_store","_templateAreas","_postLastRevision","_jsxRuntime","PANEL_NAME","PostSummary","onActionPerformed","isRemovedPostStatusPanel","useSelect","select","isEditorPanelRemoved","getCurrentPostType","editorStore","postType","jsx","default","className","children","Slot","fills","Fragment","jsxs","__experimentalVStack","spacing","actions","withPanelBody","PrivatePostExcerptPanel","PrivatePostLastRevision"],"sources":["@wordpress/editor/src/components/sidebar/post-summary.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport PluginPostStatusInfo from '../plugin-post-status-info';\nimport PostActions from '../post-actions';\nimport PostAuthorPanel from '../post-author/panel';\nimport PostCardPanel from '../post-card-panel';\nimport PostContentInformation from '../post-content-information';\nimport PageAttributesPanel from '../page-attributes/panel';\nimport PostDiscussionPanel from '../post-discussion/panel';\nimport { PrivatePostExcerptPanel as PostExcerptPanel } from '../post-excerpt/panel';\nimport PostFeaturedImagePanel from '../post-featured-image/panel';\nimport PostFormatPanel from '../post-format/panel';\nimport PostLastEditedPanel from '../post-last-edited-panel';\nimport PostPanelSection from '../post-panel-section';\nimport PostSchedulePanel from '../post-schedule/panel';\nimport PostStatusPanel from '../post-status';\nimport PostSyncStatus from '../post-sync-status';\nimport PostTemplatePanel from '../post-template/panel';\nimport PostURLPanel from '../post-url/panel';\nimport BlogTitle from '../blog-title';\nimport PostsPerPage from '../posts-per-page';\nimport SiteDiscussion from '../site-discussion';\nimport { store as editorStore } from '../../store';\nimport TemplateAreas from '../template-areas';\nimport { PrivatePostLastRevision } from '../post-last-revision';\n\n/**\n * Module Constants\n */\nconst PANEL_NAME = 'post-status';\n\nexport default function PostSummary( { onActionPerformed } ) {\n\tconst { isRemovedPostStatusPanel } = useSelect( ( select ) => {\n\t\t// We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do\n\t\t// not use isEditorPanelEnabled since this panel should not be disabled through the UI.\n\t\tconst { isEditorPanelRemoved, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisRemovedPostStatusPanel: isEditorPanelRemoved( PANEL_NAME ),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<PostPanelSection className=\"editor-post-summary\">\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t<PostCardPanel\n\t\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\t\t<PostActions\n\t\t\t\t\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostFeaturedImagePanel withPanelBody={ false } />\n\t\t\t\t\t\t\t<PostExcerptPanel />\n\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<PostContentInformation />\n\t\t\t\t\t\t\t\t<PostLastEditedPanel />\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t{ ! isRemovedPostStatusPanel && (\n\t\t\t\t\t\t\t\t<VStack spacing={ 4 }>\n\t\t\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t\t\t<PostStatusPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSchedulePanel />\n\t\t\t\t\t\t\t\t\t\t<PostURLPanel />\n\t\t\t\t\t\t\t\t\t\t<PostAuthorPanel />\n\t\t\t\t\t\t\t\t\t\t<PostTemplatePanel />\n\t\t\t\t\t\t\t\t\t\t<PostDiscussionPanel />\n\t\t\t\t\t\t\t\t\t\t<PrivatePostLastRevision />\n\t\t\t\t\t\t\t\t\t\t<PageAttributesPanel />\n\t\t\t\t\t\t\t\t\t\t<PostSyncStatus />\n\t\t\t\t\t\t\t\t\t\t<BlogTitle />\n\t\t\t\t\t\t\t\t\t\t<PostsPerPage />\n\t\t\t\t\t\t\t\t\t\t<SiteDiscussion />\n\t\t\t\t\t\t\t\t\t\t<PostFormatPanel />\n\t\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t\t\t<TemplateAreas />\n\t\t\t\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</VStack>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CAAAW,GAAA,EAAChB,aAAA,CAAAiB,OAAY,IAAE,CAAC,eAChB,IAAAZ,WAAA,CAAAW,GAAA,EAACf,eAAA,CAAAgB,OAAc,IAAE,CAAC,eAClB,IAAAZ,WAAA,CAAAW,GAAA,EAACzB,OAAA,CAAA0B,OAAe,IAAE,CAAC;YAAA,CACZ,CAAC,eACT,IAAAZ,WAAA,CAAAW,GAAA,EAACb,cAAA,CAAAc,OAAa,IAAE,CAAC,EACfI,KAAK;UAAA,CACA,CACR;QAAA,CACM;MAAC,CACR;IACF,CACyB;EAAC,CACX,CAAC;AAErB","ignoreList":[]}
|
|
@@ -56,5 +56,16 @@ function TableOfContents({
|
|
|
56
56
|
})
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Renders a table of contents component.
|
|
62
|
+
*
|
|
63
|
+
* @param {Object} props The component props.
|
|
64
|
+
* @param {boolean} props.hasOutlineItemsDisabled Whether outline items are disabled.
|
|
65
|
+
* @param {boolean} props.repositionDropdown Whether to reposition the dropdown.
|
|
66
|
+
* @param {Element.ref} ref The component's ref.
|
|
67
|
+
*
|
|
68
|
+
* @return {JSX.Element} The rendered table of contents component.
|
|
69
|
+
*/
|
|
59
70
|
var _default = exports.default = (0, _element.forwardRef)(TableOfContents);
|
|
60
71
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_icons","_element","_blockEditor","_panel","_interopRequireDefault","_jsxRuntime","TableOfContents","hasOutlineItemsDisabled","repositionDropdown","props","ref","hasBlocks","useSelect","select","blockEditorStore","getBlockCount","jsx","Dropdown","popoverProps","placement","className","contentClassName","renderToggle","isOpen","onToggle","Button","onClick","undefined","icon","info","label","__","tooltipPosition","renderContent","onClose","default","onRequestClose","_default","exports","forwardRef"],"sources":["@wordpress/editor/src/components/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { info } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsPanel from './panel';\n\nfunction TableOfContents(\n\t{ hasOutlineItemsDisabled, repositionDropdown, ...props },\n\tref\n) {\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: repositionDropdown ? 'right' : 'bottom',\n\t\t\t} }\n\t\t\tclassName=\"table-of-contents\"\n\t\t\tcontentClassName=\"table-of-contents__popover\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tonClick={ hasBlocks ? onToggle : undefined }\n\t\t\t\t\ticon={ info }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\taria-disabled={ ! hasBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<TableOfContentsPanel\n\t\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( TableOfContents );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,Q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names":["_i18n","require","_components","_data","_icons","_element","_blockEditor","_panel","_interopRequireDefault","_jsxRuntime","TableOfContents","hasOutlineItemsDisabled","repositionDropdown","props","ref","hasBlocks","useSelect","select","blockEditorStore","getBlockCount","jsx","Dropdown","popoverProps","placement","className","contentClassName","renderToggle","isOpen","onToggle","Button","onClick","undefined","icon","info","label","__","tooltipPosition","renderContent","onClose","default","onRequestClose","_default","exports","forwardRef"],"sources":["@wordpress/editor/src/components/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { info } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsPanel from './panel';\n\nfunction TableOfContents(\n\t{ hasOutlineItemsDisabled, repositionDropdown, ...props },\n\tref\n) {\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: repositionDropdown ? 'right' : 'bottom',\n\t\t\t} }\n\t\t\tclassName=\"table-of-contents\"\n\t\t\tcontentClassName=\"table-of-contents__popover\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tonClick={ hasBlocks ? onToggle : undefined }\n\t\t\t\t\ticon={ info }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\taria-disabled={ ! hasBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<TableOfContentsPanel\n\t\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\n/**\n * Renders a table of contents component.\n *\n * @param {Object} props The component props.\n * @param {boolean} props.hasOutlineItemsDisabled Whether outline items are disabled.\n * @param {boolean} props.repositionDropdown Whether to reposition the dropdown.\n * @param {Element.ref} ref The component's ref.\n *\n * @return {JSX.Element} The rendered table of contents component.\n */\nexport default forwardRef( TableOfContents );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAC,sBAAA,CAAAP,OAAA;AAA2C,IAAAQ,WAAA,GAAAR,OAAA;AAb3C;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASS,eAAeA,CACvB;EAAEC,uBAAuB;EAAEC,kBAAkB;EAAE,GAAGC;AAAM,CAAC,EACzDC,GAAG,EACF;EACD,MAAMC,SAAS,GAAG,IAAAC,eAAS,EACxBC,MAAM,IAAM,CAAC,CAAEA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,aAAa,CAAC,CAAC,EAC3D,EACD,CAAC;EACD,oBACC,IAAAV,WAAA,CAAAW,GAAA,EAAClB,WAAA,CAAAmB,QAAQ;IACRC,YAAY,EAAG;MACdC,SAAS,EAAEX,kBAAkB,GAAG,OAAO,GAAG;IAC3C,CAAG;IACHY,SAAS,EAAC,mBAAmB;IAC7BC,gBAAgB,EAAC,4BAA4B;IAC7CC,YAAY,EAAGA,CAAE;MAAEC,MAAM;MAAEC;IAAS,CAAC,kBACpC,IAAAnB,WAAA,CAAAW,GAAA,EAAClB,WAAA,CAAA2B,MAAM;MAAA,GACDhB,KAAK;MACVC,GAAG,EAAGA,GAAK;MACXgB,OAAO,EAAGf,SAAS,GAAGa,QAAQ,GAAGG,SAAW;MAC5CC,IAAI,EAAGC,WAAM;MACb,iBAAgBN,MAAQ;MACxB,iBAAc;MACd;MACAO,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;MACzBC,eAAe,EAAC,QAAQ;MACxB,iBAAgB,CAAErB;IAAW,CAC7B,CACC;IACHsB,aAAa,EAAGA,CAAE;MAAEC;IAAQ,CAAC,kBAC5B,IAAA7B,WAAA,CAAAW,GAAA,EAACb,MAAA,CAAAgC,OAAoB;MACpBC,cAAc,EAAGF,OAAS;MAC1B3B,uBAAuB,EAAGA;IAAyB,CACnD;EACC,CACH,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA,IAAA8B,QAAA,GAAAC,OAAA,CAAAH,OAAA,GAUe,IAAAI,mBAAU,EAAEjC,eAAgB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = TemplatePartContentPanel;
|
|
7
|
+
var _data = require("@wordpress/data");
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
var _blocks = require("@wordpress/blocks");
|
|
10
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
+
var _components = require("@wordpress/components");
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
14
|
+
var _constants = require("../../store/constants");
|
|
15
|
+
var _store = require("../../store");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* WordPress dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
BlockQuickNavigation
|
|
27
|
+
} = (0, _lockUnlock.unlock)(_blockEditor.privateApis);
|
|
28
|
+
function TemplatePartContentPanelInner() {
|
|
29
|
+
const blockTypes = (0, _data.useSelect)(select => {
|
|
30
|
+
const {
|
|
31
|
+
getBlockTypes
|
|
32
|
+
} = select(_blocks.store);
|
|
33
|
+
return getBlockTypes();
|
|
34
|
+
}, []);
|
|
35
|
+
const themeBlockNames = (0, _element.useMemo)(() => {
|
|
36
|
+
return blockTypes.filter(blockType => {
|
|
37
|
+
return blockType.category === 'theme';
|
|
38
|
+
}).map(({
|
|
39
|
+
name
|
|
40
|
+
}) => name);
|
|
41
|
+
}, [blockTypes]);
|
|
42
|
+
const themeBlocks = (0, _data.useSelect)(select => {
|
|
43
|
+
const {
|
|
44
|
+
getBlocksByName
|
|
45
|
+
} = select(_blockEditor.store);
|
|
46
|
+
return getBlocksByName(themeBlockNames);
|
|
47
|
+
}, [themeBlockNames]);
|
|
48
|
+
if (themeBlocks.length === 0) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.PanelBody, {
|
|
52
|
+
title: (0, _i18n.__)('Content'),
|
|
53
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockQuickNavigation, {
|
|
54
|
+
clientIds: themeBlocks
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function TemplatePartContentPanel() {
|
|
59
|
+
const postType = (0, _data.useSelect)(select => {
|
|
60
|
+
const {
|
|
61
|
+
getCurrentPostType
|
|
62
|
+
} = select(_store.store);
|
|
63
|
+
return getCurrentPostType();
|
|
64
|
+
}, []);
|
|
65
|
+
if (postType !== _constants.TEMPLATE_PART_POST_TYPE) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TemplatePartContentPanelInner, {});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_blocks","_blockEditor","_components","_i18n","_lockUnlock","_constants","_store","_jsxRuntime","BlockQuickNavigation","unlock","blockEditorPrivateApis","TemplatePartContentPanelInner","blockTypes","useSelect","select","getBlockTypes","blocksStore","themeBlockNames","useMemo","filter","blockType","category","map","name","themeBlocks","getBlocksByName","blockEditorStore","length","jsx","PanelBody","title","__","children","clientIds","TemplatePartContentPanel","postType","getCurrentPostType","editorStore","TEMPLATE_PART_POST_TYPE"],"sources":["@wordpress/editor/src/components/template-part-content-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as blocksStore } from '@wordpress/blocks';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { PanelBody } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_PART_POST_TYPE } from '../../store/constants';\nimport { store as editorStore } from '../../store';\n\nconst { BlockQuickNavigation } = unlock( blockEditorPrivateApis );\n\nfunction TemplatePartContentPanelInner() {\n\tconst blockTypes = useSelect( ( select ) => {\n\t\tconst { getBlockTypes } = select( blocksStore );\n\t\treturn getBlockTypes();\n\t}, [] );\n\tconst themeBlockNames = useMemo( () => {\n\t\treturn blockTypes\n\t\t\t.filter( ( blockType ) => {\n\t\t\t\treturn blockType.category === 'theme';\n\t\t\t} )\n\t\t\t.map( ( { name } ) => name );\n\t}, [ blockTypes ] );\n\tconst themeBlocks = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocksByName } = select( blockEditorStore );\n\t\t\treturn getBlocksByName( themeBlockNames );\n\t\t},\n\t\t[ themeBlockNames ]\n\t);\n\tif ( themeBlocks.length === 0 ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t<BlockQuickNavigation clientIds={ themeBlocks } />\n\t\t</PanelBody>\n\t);\n}\n\nexport default function TemplatePartContentPanel() {\n\tconst postType = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType } = select( editorStore );\n\t\treturn getCurrentPostType();\n\t}, [] );\n\tif ( postType !== TEMPLATE_PART_POST_TYPE ) {\n\t\treturn null;\n\t}\n\n\treturn <TemplatePartContentPanelInner />;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAKA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AAlBnD;AACA;AACA;;AAWA;AACA;AACA;;AAKA,MAAM;EAAEU;AAAqB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAEjE,SAASC,6BAA6BA,CAAA,EAAG;EACxC,MAAMC,UAAU,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC3C,MAAM;MAAEC;IAAc,CAAC,GAAGD,MAAM,CAAEE,aAAY,CAAC;IAC/C,OAAOD,aAAa,CAAC,CAAC;EACvB,CAAC,EAAE,EAAG,CAAC;EACP,MAAME,eAAe,GAAG,IAAAC,gBAAO,EAAE,MAAM;IACtC,OAAON,UAAU,CACfO,MAAM,CAAIC,SAAS,IAAM;MACzB,OAAOA,SAAS,CAACC,QAAQ,KAAK,OAAO;IACtC,CAAE,CAAC,CACFC,GAAG,CAAE,CAAE;MAAEC;IAAK,CAAC,KAAMA,IAAK,CAAC;EAC9B,CAAC,EAAE,CAAEX,UAAU,CAAG,CAAC;EACnB,MAAMY,WAAW,GAAG,IAAAX,eAAS,EAC1BC,MAAM,IAAM;IACb,MAAM;MAAEW;IAAgB,CAAC,GAAGX,MAAM,CAAEY,kBAAiB,CAAC;IACtD,OAAOD,eAAe,CAAER,eAAgB,CAAC;EAC1C,CAAC,EACD,CAAEA,eAAe,CAClB,CAAC;EACD,IAAKO,WAAW,CAACG,MAAM,KAAK,CAAC,EAAG;IAC/B,OAAO,IAAI;EACZ;EACA,oBACC,IAAApB,WAAA,CAAAqB,GAAA,EAAC1B,WAAA,CAAA2B,SAAS;IAACC,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;IAAAC,QAAA,eACnC,IAAAzB,WAAA,CAAAqB,GAAA,EAACpB,oBAAoB;MAACyB,SAAS,EAAGT;IAAa,CAAE;EAAC,CACxC,CAAC;AAEd;AAEe,SAASU,wBAAwBA,CAAA,EAAG;EAClD,MAAMC,QAAQ,GAAG,IAAAtB,eAAS,EAAIC,MAAM,IAAM;IACzC,MAAM;MAAEsB;IAAmB,CAAC,GAAGtB,MAAM,CAAEuB,YAAY,CAAC;IACpD,OAAOD,kBAAkB,CAAC,CAAC;EAC5B,CAAC,EAAE,EAAG,CAAC;EACP,IAAKD,QAAQ,KAAKG,kCAAuB,EAAG;IAC3C,OAAO,IAAI;EACZ;EAEA,oBAAO,IAAA/B,WAAA,CAAAqB,GAAA,EAACjB,6BAA6B,IAAE,CAAC;AACzC","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ConvertToRegularBlocks;
|
|
7
|
+
var _data = require("@wordpress/data");
|
|
8
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
9
|
+
var _components = require("@wordpress/components");
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
function ConvertToRegularBlocks({
|
|
17
|
+
clientId,
|
|
18
|
+
onClose
|
|
19
|
+
}) {
|
|
20
|
+
const {
|
|
21
|
+
getBlocks
|
|
22
|
+
} = (0, _data.useSelect)(_blockEditor.store);
|
|
23
|
+
const {
|
|
24
|
+
replaceBlocks
|
|
25
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
26
|
+
const canRemove = (0, _data.useSelect)(select => select(_blockEditor.store).canRemoveBlock(clientId), [clientId]);
|
|
27
|
+
if (!canRemove) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
|
|
31
|
+
onClick: () => {
|
|
32
|
+
replaceBlocks(clientId, getBlocks(clientId));
|
|
33
|
+
onClose();
|
|
34
|
+
},
|
|
35
|
+
children: (0, _i18n.__)('Detach')
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=convert-to-regular.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_components","_i18n","_jsxRuntime","ConvertToRegularBlocks","clientId","onClose","getBlocks","useSelect","blockEditorStore","replaceBlocks","useDispatch","canRemove","select","canRemoveBlock","jsx","MenuItem","onClick","children","__"],"sources":["@wordpress/editor/src/components/template-part-menu-items/convert-to-regular.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function ConvertToRegularBlocks( { clientId, onClose } ) {\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst canRemove = useSelect(\n\t\t( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tif ( ! canRemove ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\treplaceBlocks( clientId, getBlocks( clientId ) );\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Detach' ) }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,IAAAI,WAAA,GAAAJ,OAAA;AANrC;AACA;AACA;;AAMe,SAASK,sBAAsBA,CAAE;EAAEC,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EACvE,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,eAAS,EAAEC,kBAAiB,CAAC;EACnD,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,iBAAW,EAAEF,kBAAiB,CAAC;EAEzD,MAAMG,SAAS,GAAG,IAAAJ,eAAS,EACxBK,MAAM,IAAMA,MAAM,CAAEJ,kBAAiB,CAAC,CAACK,cAAc,CAAET,QAAS,CAAC,EACnE,CAAEA,QAAQ,CACX,CAAC;EAED,IAAK,CAAEO,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,oBACC,IAAAT,WAAA,CAAAY,GAAA,EAACd,WAAA,CAAAe,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACfP,aAAa,CAAEL,QAAQ,EAAEE,SAAS,CAAEF,QAAS,CAAE,CAAC;MAChDC,OAAO,CAAC,CAAC;IACV,CAAG;IAAAY,QAAA,EAED,IAAAC,QAAE,EAAE,QAAS;EAAC,CACP,CAAC;AAEb","ignoreList":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = ConvertToTemplatePart;
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
+
var _components = require("@wordpress/components");
|
|
11
|
+
var _blocks = require("@wordpress/blocks");
|
|
12
|
+
var _i18n = require("@wordpress/i18n");
|
|
13
|
+
var _element = require("@wordpress/element");
|
|
14
|
+
var _notices = require("@wordpress/notices");
|
|
15
|
+
var _icons = require("@wordpress/icons");
|
|
16
|
+
var _createTemplatePartModal = _interopRequireDefault(require("../create-template-part-modal"));
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
/**
|
|
19
|
+
* WordPress dependencies
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Internal dependencies
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
function ConvertToTemplatePart({
|
|
27
|
+
clientIds,
|
|
28
|
+
blocks
|
|
29
|
+
}) {
|
|
30
|
+
const [isModalOpen, setIsModalOpen] = (0, _element.useState)(false);
|
|
31
|
+
const {
|
|
32
|
+
replaceBlocks
|
|
33
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
34
|
+
const {
|
|
35
|
+
createSuccessNotice
|
|
36
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
37
|
+
const {
|
|
38
|
+
canCreate
|
|
39
|
+
} = (0, _data.useSelect)(select => {
|
|
40
|
+
return {
|
|
41
|
+
canCreate: select(_blockEditor.store).canInsertBlockType('core/template-part')
|
|
42
|
+
};
|
|
43
|
+
}, []);
|
|
44
|
+
if (!canCreate) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const onConvert = async templatePart => {
|
|
48
|
+
replaceBlocks(clientIds, (0, _blocks.createBlock)('core/template-part', {
|
|
49
|
+
slug: templatePart.slug,
|
|
50
|
+
theme: templatePart.theme
|
|
51
|
+
}));
|
|
52
|
+
createSuccessNotice((0, _i18n.__)('Template part created.'), {
|
|
53
|
+
type: 'snackbar'
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// The modal and this component will be unmounted because of `replaceBlocks` above,
|
|
57
|
+
// so no need to call `closeModal` or `onClose`.
|
|
58
|
+
};
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
60
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.MenuItem, {
|
|
61
|
+
icon: _icons.symbolFilled,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
setIsModalOpen(true);
|
|
64
|
+
},
|
|
65
|
+
"aria-expanded": isModalOpen,
|
|
66
|
+
"aria-haspopup": "dialog",
|
|
67
|
+
children: (0, _i18n.__)('Create template part')
|
|
68
|
+
}), isModalOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_createTemplatePartModal.default, {
|
|
69
|
+
closeModal: () => {
|
|
70
|
+
setIsModalOpen(false);
|
|
71
|
+
},
|
|
72
|
+
blocks: blocks,
|
|
73
|
+
onCreate: onConvert
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=convert-to-template-part.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_components","_blocks","_i18n","_element","_notices","_icons","_createTemplatePartModal","_interopRequireDefault","_jsxRuntime","ConvertToTemplatePart","clientIds","blocks","isModalOpen","setIsModalOpen","useState","replaceBlocks","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","canCreate","useSelect","select","canInsertBlockType","onConvert","templatePart","createBlock","slug","theme","__","type","jsxs","Fragment","children","jsx","MenuItem","icon","symbolFilled","onClick","default","closeModal","onCreate"],"sources":["@wordpress/editor/src/components/template-part-menu-items/convert-to-template-part.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { createBlock } from '@wordpress/blocks';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { symbolFilled } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function ConvertToTemplatePart( { clientIds, blocks } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst { canCreate } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tcanCreate:\n\t\t\t\tselect( blockEditorStore ).canInsertBlockType(\n\t\t\t\t\t'core/template-part'\n\t\t\t\t),\n\t\t};\n\t}, [] );\n\n\tif ( ! canCreate ) {\n\t\treturn null;\n\t}\n\n\tconst onConvert = async ( templatePart ) => {\n\t\treplaceBlocks(\n\t\t\tclientIds,\n\t\t\tcreateBlock( 'core/template-part', {\n\t\t\t\tslug: templatePart.slug,\n\t\t\t\ttheme: templatePart.theme,\n\t\t\t} )\n\t\t);\n\t\tcreateSuccessNotice( __( 'Template part created.' ), {\n\t\t\ttype: 'snackbar',\n\t\t} );\n\n\t\t// The modal and this component will be unmounted because of `replaceBlocks` above,\n\t\t// so no need to call `closeModal` or `onClose`.\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\ticon={ symbolFilled }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t\taria-expanded={ isModalOpen }\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t>\n\t\t\t\t{ __( 'Create template part' ) }\n\t\t\t</MenuItem>\n\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IAAAgB,mBAAW,EAAE,oBAAoB,EAAE;MAClCC,IAAI,EAAEF,YAAY,CAACE,IAAI;MACvBC,KAAK,EAAEH,YAAY,CAACG;IACrB,CAAE,CACH,CAAC;IACDV,mBAAmB,CAAE,IAAAW,QAAE,EAAE,wBAAyB,CAAC,EAAE;MACpDC,IAAI,EAAE;IACP,CAAE,CAAC;;IAEH;IACA;EACD,CAAC;EAED,oBACC,IAAAtB,WAAA,CAAAuB,IAAA,EAAAvB,WAAA,CAAAwB,QAAA;IAAAC,QAAA,gBACC,IAAAzB,WAAA,CAAA0B,GAAA,EAAClC,WAAA,CAAAmC,QAAQ;MACRC,IAAI,EAAGC,mBAAc;MACrBC,OAAO,EAAGA,CAAA,KAAM;QACfzB,cAAc,CAAE,IAAK,CAAC;MACvB,CAAG;MACH,iBAAgBD,WAAa;MAC7B,iBAAc,QAAQ;MAAAqB,QAAA,EAEpB,IAAAJ,QAAE,EAAE,sBAAuB;IAAC,CACrB,CAAC,EACTjB,WAAW,iBACZ,IAAAJ,WAAA,CAAA0B,GAAA,EAAC5B,wBAAA,CAAAiC,OAAuB;MACvBC,UAAU,EAAGA,CAAA,KAAM;QAClB3B,cAAc,CAAE,KAAM,CAAC;MACxB,CAAG;MACHF,MAAM,EAAGA,MAAQ;MACjB8B,QAAQ,EAAGjB;IAAW,CACtB,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = TemplatePartMenuItems;
|
|
8
|
+
var _data = require("@wordpress/data");
|
|
9
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
10
|
+
var _convertToRegular = _interopRequireDefault(require("./convert-to-regular"));
|
|
11
|
+
var _convertToTemplatePart = _interopRequireDefault(require("./convert-to-template-part"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
function TemplatePartMenuItems() {
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockSettingsMenuControls, {
|
|
23
|
+
children: ({
|
|
24
|
+
selectedClientIds,
|
|
25
|
+
onClose
|
|
26
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(TemplatePartConverterMenuItem, {
|
|
27
|
+
clientIds: selectedClientIds,
|
|
28
|
+
onClose: onClose
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function TemplatePartConverterMenuItem({
|
|
33
|
+
clientIds,
|
|
34
|
+
onClose
|
|
35
|
+
}) {
|
|
36
|
+
const {
|
|
37
|
+
isContentOnly,
|
|
38
|
+
blocks
|
|
39
|
+
} = (0, _data.useSelect)(select => {
|
|
40
|
+
const {
|
|
41
|
+
getBlocksByClientId,
|
|
42
|
+
getBlockEditingMode
|
|
43
|
+
} = select(_blockEditor.store);
|
|
44
|
+
return {
|
|
45
|
+
blocks: getBlocksByClientId(clientIds),
|
|
46
|
+
isContentOnly: clientIds.length === 1 && getBlockEditingMode(clientIds[0]) === 'contentOnly'
|
|
47
|
+
};
|
|
48
|
+
}, [clientIds]);
|
|
49
|
+
|
|
50
|
+
// Do not show the convert button if the block is in content-only mode.
|
|
51
|
+
if (isContentOnly) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Allow converting a single template part to standard blocks.
|
|
56
|
+
if (blocks.length === 1 && blocks[0]?.name === 'core/template-part') {
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_convertToRegular.default, {
|
|
58
|
+
clientId: clientIds[0],
|
|
59
|
+
onClose: onClose
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_convertToTemplatePart.default, {
|
|
63
|
+
clientIds: clientIds,
|
|
64
|
+
blocks: blocks
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_convertToRegular","_interopRequireDefault","_convertToTemplatePart","_jsxRuntime","TemplatePartMenuItems","jsx","BlockSettingsMenuControls","children","selectedClientIds","onClose","TemplatePartConverterMenuItem","clientIds","isContentOnly","blocks","useSelect","select","getBlocksByClientId","getBlockEditingMode","blockEditorStore","length","name","default","clientId"],"sources":["@wordpress/editor/src/components/template-part-menu-items/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ConvertToRegularBlocks from './convert-to-regular';\nimport ConvertToTemplatePart from './convert-to-template-part';\n\nexport default function TemplatePartMenuItems() {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds, onClose } ) => (\n\t\t\t\t<TemplatePartConverterMenuItem\n\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\tonClose={ onClose }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n\nfunction TemplatePartConverterMenuItem( { clientIds, onClose } ) {\n\tconst { isContentOnly, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocksByClientId, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tblocks: getBlocksByClientId( clientIds ),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tclientIds.length === 1 &&\n\t\t\t\t\tgetBlockEditingMode( clientIds[ 0 ] ) === 'contentOnly',\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\t// Do not show the convert button if the block is in content-only mode.\n\tif ( isContentOnly ) {\n\t\treturn null;\n\t}\n\n\t// Allow converting a single template part to standard blocks.\n\tif ( blocks.length === 1 && blocks[ 0 ]?.name === 'core/template-part' ) {\n\t\treturn (\n\t\t\t<ConvertToRegularBlocks\n\t\t\t\tclientId={ clientIds[ 0 ] }\n\t\t\t\tonClose={ onClose }\n\t\t\t/>\n\t\t);\n\t}\n\treturn <ConvertToTemplatePart clientIds={ clientIds } blocks={ blocks } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,iBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAD,sBAAA,CAAAH,OAAA;AAA+D,IAAAK,WAAA,GAAAL,OAAA;AAb/D;AACA;AACA;;AAOA;AACA;AACA;;AAIe,SAASM,qBAAqBA,CAAA,EAAG;EAC/C,oBACC,IAAAD,WAAA,CAAAE,GAAA,EAACN,YAAA,CAAAO,yBAAyB;IAAAC,QAAA,EACvBA,CAAE;MAAEC,iBAAiB;MAAEC;IAAQ,CAAC,kBACjC,IAAAN,WAAA,CAAAE,GAAA,EAACK,6BAA6B;MAC7BC,SAAS,EAAGH,iBAAmB;MAC/BC,OAAO,EAAGA;IAAS,CACnB;EACD,CACyB,CAAC;AAE9B;AAEA,SAASC,6BAA6BA,CAAE;EAAEC,SAAS;EAAEF;AAAQ,CAAC,EAAG;EAChE,MAAM;IAAEG,aAAa;IAAEC;EAAO,CAAC,GAAG,IAAAC,eAAS,EACxCC,MAAM,IAAM;IACb,MAAM;MAAEC,mBAAmB;MAAEC;IAAoB,CAAC,GACjDF,MAAM,CAAEG,kBAAiB,CAAC;IAC3B,OAAO;MACNL,MAAM,EAAEG,mBAAmB,CAAEL,SAAU,CAAC;MACxCC,aAAa,EACZD,SAAS,CAACQ,MAAM,KAAK,CAAC,IACtBF,mBAAmB,CAAEN,SAAS,CAAE,CAAC,CAAG,CAAC,KAAK;IAC5C,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;;EAED;EACA,IAAKC,aAAa,EAAG;IACpB,OAAO,IAAI;EACZ;;EAEA;EACA,IAAKC,MAAM,CAACM,MAAM,KAAK,CAAC,IAAIN,MAAM,CAAE,CAAC,CAAE,EAAEO,IAAI,KAAK,oBAAoB,EAAG;IACxE,oBACC,IAAAjB,WAAA,CAAAE,GAAA,EAACL,iBAAA,CAAAqB,OAAsB;MACtBC,QAAQ,EAAGX,SAAS,CAAE,CAAC,CAAI;MAC3BF,OAAO,EAAGA;IAAS,CACnB,CAAC;EAEJ;EACA,oBAAO,IAAAN,WAAA,CAAAE,GAAA,EAACH,sBAAA,CAAAmB,OAAqB;IAACV,SAAS,EAAGA,SAAW;IAACE,MAAM,EAAGA;EAAQ,CAAE,CAAC;AAC3E","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TemplatePartMenuItems"],"sources":["@wordpress/editor/src/components/template-part-menu-items/index.native.js"],"sourcesContent":["export default function TemplatePartMenuItems() {\n\treturn null;\n}\n"],"mappings":";;;;;;AAAe,SAASA,qBAAqBA,CAAA,EAAG;EAC/C,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -15,6 +15,15 @@ var _store = require("../../store");
|
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Checks if the current theme supports specific features and renders the children if supported.
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} props The component props.
|
|
22
|
+
* @param {Element} props.children The children to render if the theme supports the specified features.
|
|
23
|
+
* @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.
|
|
24
|
+
*
|
|
25
|
+
* @return {JSX.Element|null} The rendered children if the theme supports the specified features, otherwise null.
|
|
26
|
+
*/
|
|
18
27
|
function ThemeSupportCheck({
|
|
19
28
|
children,
|
|
20
29
|
supportKeys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_coreData","_store","ThemeSupportCheck","children","supportKeys","postType","themeSupports","useSelect","select","editorStore","getEditedPostAttribute","coreStore","getThemeSupports","isSupported","Array","isArray","some","key","_themeSupports$key","supported","includes"],"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function ThemeSupportCheck( { children, supportKeys } ) {\n\tconst { postType, themeSupports } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t\t\tthemeSupports: select( coreStore ).getThemeSupports(),\n\t\t};\n\t}, [] );\n\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_data","require","_coreData","_store","ThemeSupportCheck","children","supportKeys","postType","themeSupports","useSelect","select","editorStore","getEditedPostAttribute","coreStore","getThemeSupports","isSupported","Array","isArray","some","key","_themeSupports$key","supported","includes"],"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Checks if the current theme supports specific features and renders the children if supported.\n *\n * @param {Object} props The component props.\n * @param {Element} props.children The children to render if the theme supports the specified features.\n * @param {string|string[]} props.supportKeys The key(s) of the theme support(s) to check.\n *\n * @return {JSX.Element|null} The rendered children if the theme supports the specified features, otherwise null.\n */\nexport default function ThemeSupportCheck( { children, supportKeys } ) {\n\tconst { postType, themeSupports } = useSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getEditedPostAttribute( 'type' ),\n\t\t\tthemeSupports: select( coreStore ).getThemeSupports(),\n\t\t};\n\t}, [] );\n\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASG,iBAAiBA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EACtE,MAAM;IAAEC,QAAQ;IAAEC;EAAc,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC5D,OAAO;MACNH,QAAQ,EAAEG,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,MAAO,CAAC;MAChEJ,aAAa,EAAEE,MAAM,CAAEG,eAAU,CAAC,CAACC,gBAAgB,CAAC;IACrD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAO,CAAEX,WAAY,CAAC,GAAGA,WAAW,GAAG,CAAEA,WAAW,CAAE,EAC3DY,IAAI,CAAIC,GAAG,IAAM;IAAA,IAAAC,kBAAA;IAClB,MAAMC,SAAS,IAAAD,kBAAA,GAAGZ,aAAa,GAAIW,GAAG,CAAE,cAAAC,kBAAA,cAAAA,kBAAA,GAAI,KAAK;IACjD;IACA;IACA;IACA;IACA,IAAK,iBAAiB,KAAKD,GAAG,IAAIH,KAAK,CAACC,OAAO,CAAEI,SAAU,CAAC,EAAG;MAC9D,OAAOA,SAAS,CAACC,QAAQ,CAAEf,QAAS,CAAC;IACtC;IACA,OAAOc,SAAS;EACjB,CAAE,CAAC;EAEH,IAAK,CAAEN,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,OAAOV,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -25,6 +25,12 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
25
25
|
*
|
|
26
26
|
* @type {number} A rough estimate of the average reading rate across multiple languages.
|
|
27
27
|
*/const AVERAGE_READING_RATE = 189;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Component for showing Time To Read in Content.
|
|
31
|
+
*
|
|
32
|
+
* @return {JSX.Element} The rendered TimeToRead component.
|
|
33
|
+
*/
|
|
28
34
|
function TimeToRead() {
|
|
29
35
|
const content = (0, _data.useSelect)(select => select(_store.store).getEditedPostAttribute('content'), []);
|
|
30
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_wordcount","_element","_store","_jsxRuntime","AVERAGE_READING_RATE","TimeToRead","content","useSelect","select","editorStore","getEditedPostAttribute","wordCountType","_x","minutesToRead","Math","round","wordCount","minutesToReadString","createInterpolateElement","__","span","jsx","sprintf","_n","className","children"],"sources":["@wordpress/editor/src/components/time-to-read/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x, _n, __, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Average reading rate - based on average taken from\n * https://irisreading.com/average-reading-speed-in-various-languages/\n * (Characters/minute used for Chinese rather than words).\n *\n * @type {number} A rough estimate of the average reading rate across multiple languages.\n */\nconst AVERAGE_READING_RATE = 189;\n\nexport default function TimeToRead() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst minutesToRead = Math.round(\n\t\twordCount( content, wordCountType ) / AVERAGE_READING_RATE\n\t);\n\tconst minutesToReadString =\n\t\tminutesToRead === 0\n\t\t\t? createInterpolateElement( __( '<span>< 1</span> minute' ), {\n\t\t\t\t\tspan: <span />,\n\t\t\t } )\n\t\t\t: createInterpolateElement(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s is the number of minutes the post will take to read. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'<span>%d</span> minute',\n\t\t\t\t\t\t\t'<span>%d</span> minutes',\n\t\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t\t),\n\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t}\n\t\t\t );\n\n\treturn <span className=\"time-to-read\">{ minutesToReadString }</span>;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAAmD,IAAAK,WAAA,GAAAL,OAAA;AAXnD;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMM,oBAAoB,GAAG,GAAG;
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_wordcount","_element","_store","_jsxRuntime","AVERAGE_READING_RATE","TimeToRead","content","useSelect","select","editorStore","getEditedPostAttribute","wordCountType","_x","minutesToRead","Math","round","wordCount","minutesToReadString","createInterpolateElement","__","span","jsx","sprintf","_n","className","children"],"sources":["@wordpress/editor/src/components/time-to-read/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x, _n, __, sprintf } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Average reading rate - based on average taken from\n * https://irisreading.com/average-reading-speed-in-various-languages/\n * (Characters/minute used for Chinese rather than words).\n *\n * @type {number} A rough estimate of the average reading rate across multiple languages.\n */\nconst AVERAGE_READING_RATE = 189;\n\n/**\n * Component for showing Time To Read in Content.\n *\n * @return {JSX.Element} The rendered TimeToRead component.\n */\nexport default function TimeToRead() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst minutesToRead = Math.round(\n\t\twordCount( content, wordCountType ) / AVERAGE_READING_RATE\n\t);\n\tconst minutesToReadString =\n\t\tminutesToRead === 0\n\t\t\t? createInterpolateElement( __( '<span>< 1</span> minute' ), {\n\t\t\t\t\tspan: <span />,\n\t\t\t } )\n\t\t\t: createInterpolateElement(\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t/* translators: %s is the number of minutes the post will take to read. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'<span>%d</span> minute',\n\t\t\t\t\t\t\t'<span>%d</span> minutes',\n\t\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t\t),\n\t\t\t\t\t\tminutesToRead\n\t\t\t\t\t),\n\t\t\t\t\t{\n\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t}\n\t\t\t );\n\n\treturn <span className=\"time-to-read\">{ minutesToReadString }</span>;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAAmD,IAAAK,WAAA,GAAAL,OAAA;AAXnD;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,GACA,MAAMM,oBAAoB,GAAG,GAAG;;AAEhC;AACA;AACA;AACA;AACA;AACe,SAASC,UAAUA,CAAA,EAAG;EACpC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,SAAU,CAAC,EACvE,EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,aAAa,GAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,oCAAqC,CAAC;EACzE,MAAMC,aAAa,GAAGC,IAAI,CAACC,KAAK,CAC/B,IAAAC,gBAAS,EAAEV,OAAO,EAAEK,aAAc,CAAC,GAAGP,oBACvC,CAAC;EACD,MAAMa,mBAAmB,GACxBJ,aAAa,KAAK,CAAC,GAChB,IAAAK,iCAAwB,EAAE,IAAAC,QAAE,EAAE,yBAA0B,CAAC,EAAE;IAC3DC,IAAI,eAAE,IAAAjB,WAAA,CAAAkB,GAAA,YAAO;EACb,CAAE,CAAC,GACH,IAAAH,iCAAwB,EACxB,IAAAI,aAAO,GACN;EACA,IAAAC,QAAE,EACD,wBAAwB,EACxB,yBAAyB,EACzBV,aACD,CAAC,EACDA,aACD,CAAC,EACD;IACCO,IAAI,eAAE,IAAAjB,WAAA,CAAAkB,GAAA,YAAO;EACd,CACA,CAAC;EAEL,oBAAO,IAAAlB,WAAA,CAAAkB,GAAA;IAAMG,SAAS,EAAC,cAAc;IAAAC,QAAA,EAAGR;EAAmB,CAAQ,CAAC;AACrE","ignoreList":[]}
|
|
@@ -17,7 +17,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Renders the word count of the post content.
|
|
22
|
+
*
|
|
23
|
+
* @return {JSX.Element|null} The rendered WordCount component.
|
|
24
|
+
*/function WordCount() {
|
|
21
25
|
const content = (0, _data.useSelect)(select => select(_store.store).getEditedPostAttribute('content'), []);
|
|
22
26
|
|
|
23
27
|
/*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_wordcount","_store","_jsxRuntime","WordCount","content","useSelect","select","editorStore","getEditedPostAttribute","wordCountType","_x","jsx","className","children","wordCount"],"sources":["@wordpress/editor/src/components/word-count/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function WordCount() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\treturn (\n\t\t<span className=\"word-count\">\n\t\t\t{ wordCount( content, wordCountType ) }\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAAmD,IAAAI,WAAA,GAAAJ,OAAA;AAVnD;AACA;AACA;;AAKA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_wordcount","_store","_jsxRuntime","WordCount","content","useSelect","select","editorStore","getEditedPostAttribute","wordCountType","_x","jsx","className","children","wordCount"],"sources":["@wordpress/editor/src/components/word-count/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { _x } from '@wordpress/i18n';\nimport { count as wordCount } from '@wordpress/wordcount';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Renders the word count of the post content.\n *\n * @return {JSX.Element|null} The rendered WordCount component.\n */\nexport default function WordCount() {\n\tconst content = useSelect(\n\t\t( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),\n\t\t[]\n\t);\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\n\treturn (\n\t\t<span className=\"word-count\">\n\t\t\t{ wordCount( content, wordCountType ) }\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AAAmD,IAAAI,WAAA,GAAAJ,OAAA;AAVnD;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,GACe,SAASK,SAASA,CAAA,EAAG;EACnC,MAAMC,OAAO,GAAG,IAAAC,eAAS,EACtBC,MAAM,IAAMA,MAAM,CAAEC,YAAY,CAAC,CAACC,sBAAsB,CAAE,SAAU,CAAC,EACvE,EACD,CAAC;;EAED;AACD;AACA;AACA;AACA;EACC,MAAMC,aAAa,GAAG,IAAAC,QAAE,EAAE,OAAO,EAAE,oCAAqC,CAAC;EAEzE,oBACC,IAAAR,WAAA,CAAAS,GAAA;IAAMC,SAAS,EAAC,YAAY;IAAAC,QAAA,EACzB,IAAAC,gBAAS,EAAEV,OAAO,EAAEK,aAAc;EAAC,CAChC,CAAC;AAET","ignoreList":[]}
|