@wordpress/editor 14.8.5 → 14.9.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 +2 -0
- package/build/bindings/api.js +2 -5
- package/build/bindings/api.js.map +1 -1
- package/build/bindings/pattern-overrides.js +7 -6
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +16 -16
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +15 -18
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/document-tools/index.js +1 -6
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/header/index.js +22 -17
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +8 -9
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +17 -18
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/use-post-content-blocks.js +34 -0
- package/build/components/provider/use-post-content-blocks.js.map +1 -0
- package/build/components/resizable-editor/resize-handle.js +4 -0
- package/build/components/resizable-editor/resize-handle.js.map +1 -1
- package/build/components/zoom-out-toggle/index.js +1 -1
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build/dataviews/store/private-actions.js +2 -7
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/hooks/pattern-overrides.js +1 -4
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/store/actions.js +20 -5
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build-module/bindings/api.js +1 -4
- package/build-module/bindings/api.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +7 -6
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +16 -16
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +14 -18
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -6
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/header/index.js +22 -17
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +8 -9
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +17 -18
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/use-post-content-blocks.js +27 -0
- package/build-module/components/provider/use-post-content-blocks.js.map +1 -0
- package/build-module/components/resizable-editor/resize-handle.js +4 -0
- package/build-module/components/resizable-editor/resize-handle.js.map +1 -1
- package/build-module/components/zoom-out-toggle/index.js +1 -1
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/dataviews/store/private-actions.js +4 -8
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +1 -4
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/store/actions.js +18 -5
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-style/style-rtl.css +10 -1
- package/build-style/style.css +10 -1
- package/build-types/bindings/api.d.ts.map +1 -1
- package/build-types/bindings/pattern-overrides.d.ts +5 -4
- package/build-types/bindings/pattern-overrides.d.ts.map +1 -1
- package/build-types/bindings/post-meta.d.ts +8 -8
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/document-tools/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -1
- package/build-types/components/provider/use-post-content-blocks.d.ts +2 -0
- package/build-types/components/provider/use-post-content-blocks.d.ts.map +1 -0
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +1 -13
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-selectors.d.ts +2 -2
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/bindings/api.js +1 -2
- package/src/bindings/pattern-overrides.js +27 -30
- package/src/bindings/post-meta.js +28 -30
- package/src/components/block-settings-menu/content-only-settings-menu.js +19 -19
- package/src/components/document-tools/index.js +1 -4
- package/src/components/header/index.js +30 -14
- package/src/components/inserter-sidebar/index.js +8 -11
- package/src/components/provider/disable-non-page-content-blocks.js +20 -34
- package/src/components/provider/use-post-content-blocks.js +42 -0
- package/src/components/resizable-editor/resize-handle.js +5 -0
- package/src/components/zoom-out-toggle/index.js +1 -1
- package/src/dataviews/store/private-actions.ts +7 -7
- package/src/hooks/pattern-overrides.js +1 -2
- package/src/store/actions.js +23 -6
- package/src/store/private-selectors.js +2 -2
- package/src/store/test/actions.js +76 -0
- package/src/store/test/reducer.js +0 -22
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataviews/actions/delete-post.js +0 -98
- package/build/dataviews/actions/delete-post.js.map +0 -1
- package/build/dataviews/actions/rename-post.js +0 -125
- package/build/dataviews/actions/rename-post.js.map +0 -1
- package/build/dataviews/actions/reset-post.js +0 -113
- package/build/dataviews/actions/reset-post.js.map +0 -1
- package/build/dataviews/actions/restore-post.js +0 -112
- package/build/dataviews/actions/restore-post.js.map +0 -1
- package/build/dataviews/actions/trash-post.js +0 -144
- package/build/dataviews/actions/trash-post.js.map +0 -1
- package/build/dataviews/fields/index.js +0 -32
- package/build/dataviews/fields/index.js.map +0 -1
- package/build-module/dataviews/actions/delete-post.js +0 -89
- package/build-module/dataviews/actions/delete-post.js.map +0 -1
- package/build-module/dataviews/actions/rename-post.js +0 -118
- package/build-module/dataviews/actions/rename-post.js.map +0 -1
- package/build-module/dataviews/actions/reset-post.js +0 -106
- package/build-module/dataviews/actions/reset-post.js.map +0 -1
- package/build-module/dataviews/actions/restore-post.js +0 -104
- package/build-module/dataviews/actions/restore-post.js.map +0 -1
- package/build-module/dataviews/actions/trash-post.js +0 -137
- package/build-module/dataviews/actions/trash-post.js.map +0 -1
- package/build-module/dataviews/fields/index.js +0 -26
- package/build-module/dataviews/fields/index.js.map +0 -1
- package/build-types/dataviews/actions/delete-post.d.ts +0 -5
- package/build-types/dataviews/actions/delete-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/rename-post.d.ts +0 -5
- package/build-types/dataviews/actions/rename-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/reset-post.d.ts +0 -5
- package/build-types/dataviews/actions/reset-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/restore-post.d.ts +0 -5
- package/build-types/dataviews/actions/restore-post.d.ts.map +0 -1
- package/build-types/dataviews/actions/trash-post.d.ts +0 -5
- package/build-types/dataviews/actions/trash-post.d.ts.map +0 -1
- package/build-types/dataviews/fields/index.d.ts +0 -8
- package/build-types/dataviews/fields/index.d.ts.map +0 -1
- package/src/dataviews/actions/delete-post.tsx +0 -109
- package/src/dataviews/actions/rename-post.tsx +0 -146
- package/src/dataviews/actions/reset-post.tsx +0 -147
- package/src/dataviews/actions/restore-post.tsx +0 -134
- package/src/dataviews/actions/trash-post.tsx +0 -198
- package/src/dataviews/fields/index.ts +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_compose","_components","_preferences","_element","_interface","_blockEditor","_backButton","_interopRequireWildcard","_collapsibleBlockToolbar","_interopRequireDefault","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_zoomOutToggle","_store","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","isEditorIframed","isWideViewport","useViewportMatch","isLargeViewport","isTooNarrowForDocumentBar","useMediaQuery","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","isNestedEntity","useSelect","select","getPreference","preferencesStore","getEditorMode","getEditorSettings","_isPublishSidebarOpened","editorStore","__unstableGetEditorMode","blockEditorStore","onNavigateToPreviousEntityRecord","isZoomedOutView","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasCenter","hasBackButton","useHasBackButton","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","Slot","disableBlockTools","isCollapsed","onToggle","forceIsAutosaveable","disabled","PinnedItems","scope","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport ZoomOutToggle from '../zoom-out-toggle';\nimport { store as editorStore } from '../../store';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n\tisEditorIframed,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\tisNestedEntity,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\n\t\treturn {\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t\tisZoomedOutView: __unstableGetEditorMode() === 'zoom-out',\n\t\t};\n\t}, [] );\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter = isBlockToolsCollapsed && ! isTooNarrowForDocumentBar;\n\tconst hasBackButton = useHasBackButton();\n\n\t// The edit-post-header classname is only kept for backward compatibilty\n\t// as some plugins might be relying on its presence.\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t// This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t// We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t// we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t// We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t// when the publish sidebar has been closed.\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\n\t\t\t\t{ isEditorIframed && isWideViewport && <ZoomOutToggle /> }\n\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ customSaveButton }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAC,uBAAA,CAAAR,OAAA;AACA,IAAAS,wBAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,YAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,cAAA,GAAAF,sBAAA,CAAAV,OAAA;AACA,IAAAa,SAAA,GAAAH,sBAAA,CAAAV,OAAA;AACA,IAAAc,kBAAA,GAAAJ,sBAAA,CAAAV,OAAA;AACA,IAAAe,0BAAA,GAAAL,sBAAA,CAAAV,OAAA;AACA,IAAAgB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AAQ,EAAGjC;MAAgB,CAC3B,CAAC,eACF,IAAA9C,WAAA,CAAAoE,GAAA,EAAC3E,kBAAA,CAAAc,OAAiB;QACjB2D,SAAS,EAAC,oCAAoC;QAC9CY,mBAAmB,EAAG9C;MAAc,CACpC,CAAC,eACF,IAAAhC,WAAA,CAAAoE,GAAA,EAACxE,aAAA,CAAAW,OAAY,IAAE,CAAC,EAEd6B,eAAe,IAAIC,cAAc,iBAAI,IAAArC,WAAA,CAAAoE,GAAA,EAACtE,cAAA,CAAAS,OAAa,IAAE,CAAC,EAEtD,CAAE8B,cAAc,IAAI,CAAEO,cAAc,kBACrC,IAAA5C,WAAA,CAAAoE,GAAA,EAACpF,UAAA,CAAAgG,WAAW,CAACN,IAAI;QAACO,KAAK,EAAC;MAAM,CAAE,CAChC,EAEC,CAAElD,gBAAgB,iBACnB,IAAA/B,WAAA,CAAAoE,GAAA,EAAC1E,0BAAA,CAAAa,OAAyB;QACzByB,YAAY,EAAGA,YAAc;QAC7BE,8BAA8B,EAC7BA;MACA,CACD,CACD,EAECH,gBAAgB,eAClB,IAAA/B,WAAA,CAAAoE,GAAA,EAAC5E,SAAA,CAAAe,OAAQ,IAAE,CAAC;IAAA,CACD,CAAC;EAAA,CACT,CAAC;AAER;AAAC,IAAA2E,QAAA,GAAAC,OAAA,CAAA5E,OAAA,GAEcuB,MAAM","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_data","_compose","_components","_preferences","_element","_interface","_backButton","_interopRequireWildcard","_collapsibleBlockToolbar","_interopRequireDefault","_documentBar","_documentTools","_moreMenu","_postPreviewButton","_postPublishButtonOrToggle","_postSavedState","_postViewLink","_previewDropdown","_zoomOutToggle","_store","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","toolbarVariations","distractionFreeDisabled","y","distractionFreeHover","distractionFreeHidden","visible","hidden","backButtonVariations","x","Header","customSaveButton","forceIsDirty","forceDisableBlockTools","setEntitiesSavedStatesCallback","title","isEditorIframed","isWideViewport","useViewportMatch","isLargeViewport","isTooNarrowForDocumentBar","useMediaQuery","postType","isTextEditor","isPublishSidebarOpened","showIconLabels","hasFixedToolbar","hasBlockSelection","isNestedEntity","useSelect","select","getPreference","preferencesStore","getEditorMode","getEditorSettings","getCurrentPostType","_isPublishSidebarOpened","editorStore","blockEditorStore","getBlockSelectionStart","onNavigateToPreviousEntityRecord","canBeZoomedOut","includes","isBlockToolsCollapsed","setIsBlockToolsCollapsed","useState","hasCenter","hasBackButton","useHasBackButton","jsxs","className","children","jsx","__unstableMotion","div","variants","transition","type","Slot","disableBlockTools","isCollapsed","onToggle","forceIsAutosaveable","disabled","PinnedItems","scope","_default","exports"],"sources":["@wordpress/editor/src/components/header/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMediaQuery, useViewportMatch } from '@wordpress/compose';\nimport { __unstableMotion as motion } from '@wordpress/components';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { useState } from '@wordpress/element';\nimport { PinnedItems } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport BackButton, { useHasBackButton } from './back-button';\nimport CollapsibleBlockToolbar from '../collapsible-block-toolbar';\nimport DocumentBar from '../document-bar';\nimport DocumentTools from '../document-tools';\nimport MoreMenu from '../more-menu';\nimport PostPreviewButton from '../post-preview-button';\nimport PostPublishButtonOrToggle from '../post-publish-button/post-publish-button-or-toggle';\nimport PostSavedState from '../post-saved-state';\nimport PostViewLink from '../post-view-link';\nimport PreviewDropdown from '../preview-dropdown';\nimport ZoomOutToggle from '../zoom-out-toggle';\nimport { store as editorStore } from '../../store';\n\nconst toolbarVariations = {\n\tdistractionFreeDisabled: { y: '-50px' },\n\tdistractionFreeHover: { y: 0 },\n\tdistractionFreeHidden: { y: '-50px' },\n\tvisible: { y: 0 },\n\thidden: { y: 0 },\n};\n\nconst backButtonVariations = {\n\tdistractionFreeDisabled: { x: '-100%' },\n\tdistractionFreeHover: { x: 0 },\n\tdistractionFreeHidden: { x: '-100%' },\n\tvisible: { x: 0 },\n\thidden: { x: 0 },\n};\n\nfunction Header( {\n\tcustomSaveButton,\n\tforceIsDirty,\n\tforceDisableBlockTools,\n\tsetEntitiesSavedStatesCallback,\n\ttitle,\n\tisEditorIframed,\n} ) {\n\tconst isWideViewport = useViewportMatch( 'large' );\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );\n\tconst {\n\t\tpostType,\n\t\tisTextEditor,\n\t\tisPublishSidebarOpened,\n\t\tshowIconLabels,\n\t\thasFixedToolbar,\n\t\thasBlockSelection,\n\t\tisNestedEntity,\n\t} = useSelect( ( select ) => {\n\t\tconst { get: getPreference } = select( preferencesStore );\n\t\tconst {\n\t\t\tgetEditorMode,\n\t\t\tgetEditorSettings,\n\t\t\tgetCurrentPostType,\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened,\n\t\t} = select( editorStore );\n\n\t\treturn {\n\t\t\tpostType: getCurrentPostType(),\n\t\t\tisTextEditor: getEditorMode() === 'text',\n\t\t\tisPublishSidebarOpened: _isPublishSidebarOpened(),\n\t\t\tshowIconLabels: getPreference( 'core', 'showIconLabels' ),\n\t\t\thasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),\n\t\t\thasBlockSelection:\n\t\t\t\t!! select( blockEditorStore ).getBlockSelectionStart(),\n\t\t\tisNestedEntity:\n\t\t\t\t!! getEditorSettings().onNavigateToPreviousEntityRecord,\n\t\t};\n\t}, [] );\n\n\tconst canBeZoomedOut = [ 'post', 'page', 'wp_template' ].includes(\n\t\tpostType\n\t);\n\n\tconst [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =\n\t\tuseState( true );\n\n\tconst hasCenter =\n\t\t( ! hasBlockSelection || isBlockToolsCollapsed ) &&\n\t\t! isTooNarrowForDocumentBar;\n\tconst hasBackButton = useHasBackButton();\n\t/*\n\t * The edit-post-header classname is only kept for backward compatability\n\t * as some plugins might be relying on its presence.\n\t */\n\treturn (\n\t\t<div className=\"editor-header edit-post-header\">\n\t\t\t{ hasBackButton && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__back-button\"\n\t\t\t\t\tvariants={ backButtonVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<BackButton.Slot />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\tclassName=\"editor-header__toolbar\"\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t>\n\t\t\t\t<DocumentTools\n\t\t\t\t\tdisableBlockTools={ forceDisableBlockTools || isTextEditor }\n\t\t\t\t/>\n\t\t\t\t{ hasFixedToolbar && isLargeViewport && (\n\t\t\t\t\t<CollapsibleBlockToolbar\n\t\t\t\t\t\tisCollapsed={ isBlockToolsCollapsed }\n\t\t\t\t\t\tonToggle={ setIsBlockToolsCollapsed }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</motion.div>\n\t\t\t{ hasCenter && (\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"editor-header__center\"\n\t\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\t>\n\t\t\t\t\t<DocumentBar title={ title } />\n\t\t\t\t</motion.div>\n\t\t\t) }\n\t\t\t<motion.div\n\t\t\t\tvariants={ toolbarVariations }\n\t\t\t\ttransition={ { type: 'tween' } }\n\t\t\t\tclassName=\"editor-header__settings\"\n\t\t\t>\n\t\t\t\t{ ! customSaveButton && ! isPublishSidebarOpened && (\n\t\t\t\t\t/*\n\t\t\t\t\t * This button isn't completely hidden by the publish sidebar.\n\t\t\t\t\t * We can't hide the whole toolbar when the publish sidebar is open because\n\t\t\t\t\t * we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.\n\t\t\t\t\t * We track that DOM node to return focus to the PostPublishButtonOrToggle\n\t\t\t\t\t * when the publish sidebar has been closed.\n\t\t\t\t\t */\n\t\t\t\t\t<PostSavedState forceIsDirty={ forceIsDirty } />\n\t\t\t\t) }\n\n\t\t\t\t{ canBeZoomedOut && isEditorIframed && isWideViewport && (\n\t\t\t\t\t<ZoomOutToggle />\n\t\t\t\t) }\n\n\t\t\t\t<PreviewDropdown\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t\tdisabled={ isNestedEntity }\n\t\t\t\t/>\n\t\t\t\t<PostPreviewButton\n\t\t\t\t\tclassName=\"editor-header__post-preview-button\"\n\t\t\t\t\tforceIsAutosaveable={ forceIsDirty }\n\t\t\t\t/>\n\t\t\t\t<PostViewLink />\n\n\t\t\t\t{ ( isWideViewport || ! showIconLabels ) && (\n\t\t\t\t\t<PinnedItems.Slot scope=\"core\" />\n\t\t\t\t) }\n\n\t\t\t\t{ ! customSaveButton && (\n\t\t\t\t\t<PostPublishButtonOrToggle\n\t\t\t\t\t\tforceIsDirty={ forceIsDirty }\n\t\t\t\t\t\tsetEntitiesSavedStatesCallback={\n\t\t\t\t\t\t\tsetEntitiesSavedStatesCallback\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ customSaveButton }\n\t\t\t\t<MoreMenu />\n\t\t\t</motion.div>\n\t\t</div>\n\t);\n}\n\nexport default Header;\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAKA,IAAAO,WAAA,GAAAC,uBAAA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ChF,SAAA,CAAAe,OAAQ,IAAE,CAAC;IAAA,CACD,CAAC;EAAA,CACT,CAAC;AAER;AAAC,IAAA+E,QAAA,GAAAC,OAAA,CAAAhF,OAAA,GAEcuB,MAAM","ignoreList":[]}
|
|
@@ -29,13 +29,13 @@ function InserterSidebar() {
|
|
|
29
29
|
const {
|
|
30
30
|
blockSectionRootClientId,
|
|
31
31
|
inserterSidebarToggleRef,
|
|
32
|
-
|
|
32
|
+
inserter,
|
|
33
33
|
showMostUsedBlocks,
|
|
34
34
|
sidebarIsOpened
|
|
35
35
|
} = (0, _data.useSelect)(select => {
|
|
36
36
|
const {
|
|
37
37
|
getInserterSidebarToggleRef,
|
|
38
|
-
|
|
38
|
+
getInserter,
|
|
39
39
|
isPublishSidebarOpened
|
|
40
40
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
41
41
|
const {
|
|
@@ -60,7 +60,7 @@ function InserterSidebar() {
|
|
|
60
60
|
};
|
|
61
61
|
return {
|
|
62
62
|
inserterSidebarToggleRef: getInserterSidebarToggleRef(),
|
|
63
|
-
|
|
63
|
+
inserter: getInserter(),
|
|
64
64
|
showMostUsedBlocks: get('core', 'mostUsedBlocks'),
|
|
65
65
|
blockSectionRootClientId: getBlockSectionRootClientId(),
|
|
66
66
|
sidebarIsOpened: !!(getActiveComplementaryArea('core') || isPublishSidebarOpened())
|
|
@@ -92,12 +92,11 @@ function InserterSidebar() {
|
|
|
92
92
|
showMostUsedBlocks: showMostUsedBlocks,
|
|
93
93
|
showInserterHelpPanel: true,
|
|
94
94
|
shouldFocusBlock: isMobileViewport,
|
|
95
|
-
rootClientId: blockSectionRootClientId
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
__experimentalFilterValue: insertionPoint.filterValue,
|
|
95
|
+
rootClientId: blockSectionRootClientId,
|
|
96
|
+
onSelect: inserter.onSelect,
|
|
97
|
+
__experimentalInitialTab: inserter.tab,
|
|
98
|
+
__experimentalInitialCategory: inserter.category,
|
|
99
|
+
__experimentalFilterValue: inserter.filterValue,
|
|
101
100
|
onPatternCategorySelection: sidebarIsOpened ? () => disableComplementaryArea('core') : undefined,
|
|
102
101
|
ref: libraryRef,
|
|
103
102
|
onClose: closeInserterSidebar
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_compose","_element","_preferences","_keycodes","_interface","_lockUnlock","_store","_jsxRuntime","PrivateInserterLibrary","unlock","blockEditorPrivateApis","InserterSidebar","blockSectionRootClientId","inserterSidebarToggleRef","
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_compose","_element","_preferences","_keycodes","_interface","_lockUnlock","_store","_jsxRuntime","PrivateInserterLibrary","unlock","blockEditorPrivateApis","InserterSidebar","blockSectionRootClientId","inserterSidebarToggleRef","inserter","showMostUsedBlocks","sidebarIsOpened","useSelect","select","getInserterSidebarToggleRef","getInserter","isPublishSidebarOpened","editorStore","getBlockRootClientId","__unstableGetEditorMode","getSectionRootClientId","blockEditorStore","get","preferencesStore","getActiveComplementaryArea","interfaceStore","getBlockSectionRootClientId","sectionRootClientId","setIsInserterOpened","useDispatch","disableComplementaryArea","isMobileViewport","useViewportMatch","libraryRef","useRef","closeInserterSidebar","useCallback","current","focus","closeOnEscape","event","keyCode","ESCAPE","defaultPrevented","preventDefault","inserterContents","jsx","className","children","showInserterHelpPanel","shouldFocusBlock","rootClientId","onSelect","__experimentalInitialTab","tab","__experimentalInitialCategory","category","__experimentalFilterValue","filterValue","onPatternCategorySelection","undefined","ref","onClose","onKeyDown"],"sources":["@wordpress/editor/src/components/inserter-sidebar/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useCallback, useRef } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { store as interfaceStore } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PrivateInserterLibrary } = unlock( blockEditorPrivateApis );\n\nexport default function InserterSidebar() {\n\tconst {\n\t\tblockSectionRootClientId,\n\t\tinserterSidebarToggleRef,\n\t\tinserter,\n\t\tshowMostUsedBlocks,\n\t\tsidebarIsOpened,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetInserterSidebarToggleRef,\n\t\t\tgetInserter,\n\t\t\tisPublishSidebarOpened,\n\t\t} = unlock( select( editorStore ) );\n\t\tconst {\n\t\t\tgetBlockRootClientId,\n\t\t\t__unstableGetEditorMode,\n\t\t\tgetSectionRootClientId,\n\t\t} = unlock( select( blockEditorStore ) );\n\t\tconst { get } = select( preferencesStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\t\tconst getBlockSectionRootClientId = () => {\n\t\t\tif ( __unstableGetEditorMode() === 'zoom-out' ) {\n\t\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\n\t\t\t\tif ( sectionRootClientId ) {\n\t\t\t\t\treturn sectionRootClientId;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn getBlockRootClientId();\n\t\t};\n\t\treturn {\n\t\t\tinserterSidebarToggleRef: getInserterSidebarToggleRef(),\n\t\t\tinserter: getInserter(),\n\t\t\tshowMostUsedBlocks: get( 'core', 'mostUsedBlocks' ),\n\t\t\tblockSectionRootClientId: getBlockSectionRootClientId(),\n\t\t\tsidebarIsOpened: !! (\n\t\t\t\tgetActiveComplementaryArea( 'core' ) || isPublishSidebarOpened()\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setIsInserterOpened } = useDispatch( editorStore );\n\tconst { disableComplementaryArea } = useDispatch( interfaceStore );\n\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst libraryRef = useRef();\n\n\t// When closing the inserter, focus should return to the toggle button.\n\tconst closeInserterSidebar = useCallback( () => {\n\t\tsetIsInserterOpened( false );\n\t\tinserterSidebarToggleRef.current?.focus();\n\t}, [ inserterSidebarToggleRef, setIsInserterOpened ] );\n\n\tconst closeOnEscape = useCallback(\n\t\t( event ) => {\n\t\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tcloseInserterSidebar();\n\t\t\t}\n\t\t},\n\t\t[ closeInserterSidebar ]\n\t);\n\n\tconst inserterContents = (\n\t\t<div className=\"editor-inserter-sidebar__content\">\n\t\t\t<PrivateInserterLibrary\n\t\t\t\tshowMostUsedBlocks={ showMostUsedBlocks }\n\t\t\t\tshowInserterHelpPanel\n\t\t\t\tshouldFocusBlock={ isMobileViewport }\n\t\t\t\trootClientId={ blockSectionRootClientId }\n\t\t\t\tonSelect={ inserter.onSelect }\n\t\t\t\t__experimentalInitialTab={ inserter.tab }\n\t\t\t\t__experimentalInitialCategory={ inserter.category }\n\t\t\t\t__experimentalFilterValue={ inserter.filterValue }\n\t\t\t\tonPatternCategorySelection={\n\t\t\t\t\tsidebarIsOpened\n\t\t\t\t\t\t? () => disableComplementaryArea( 'core' )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tref={ libraryRef }\n\t\t\t\tonClose={ closeInserterSidebar }\n\t\t\t/>\n\t\t</div>\n\t);\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div onKeyDown={ closeOnEscape } className=\"editor-inserter-sidebar\">\n\t\t\t{ inserterContents }\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAA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BAA6B,EAAG9C,QAAQ,CAAC+C,QAAU;MACnDC,yBAAyB,EAAGhD,QAAQ,CAACiD,WAAa;MAClDC,0BAA0B,EACzBhD,eAAe,GACZ,MAAMmB,wBAAwB,CAAE,MAAO,CAAC,GACxC8B,SACH;MACDC,GAAG,EAAG5B,UAAY;MAClB6B,OAAO,EAAG3B;IAAsB,CAChC;EAAC,CACE,CACL;EAED;IAAA;IACC;IACA,IAAAjC,WAAA,CAAA4C,GAAA;MAAKiB,SAAS,EAAGxB,aAAe;MAACQ,SAAS,EAAC,yBAAyB;MAAAC,QAAA,EACjEH;IAAgB,CACd;EAAC;AAER","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -7,9 +8,7 @@ exports.default = DisableNonPageContentBlocks;
|
|
|
7
8
|
var _data = require("@wordpress/data");
|
|
8
9
|
var _blockEditor = require("@wordpress/block-editor");
|
|
9
10
|
var _element = require("@wordpress/element");
|
|
10
|
-
var
|
|
11
|
-
var _store = require("../../store");
|
|
12
|
-
var _lockUnlock = require("../../lock-unlock");
|
|
11
|
+
var _usePostContentBlocks = _interopRequireDefault(require("./use-post-content-blocks"));
|
|
13
12
|
/**
|
|
14
13
|
* WordPress dependencies
|
|
15
14
|
*/
|
|
@@ -18,30 +17,24 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
18
17
|
* Internal dependencies
|
|
19
18
|
*/
|
|
20
19
|
|
|
21
|
-
const POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content'];
|
|
22
|
-
|
|
23
20
|
/**
|
|
24
21
|
* Component that when rendered, makes it so that the site editor allows only
|
|
25
22
|
* page content to be edited.
|
|
26
23
|
*/
|
|
27
24
|
function DisableNonPageContentBlocks() {
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
// Note that there are two separate subscriptions because the result for each
|
|
31
|
-
// returns a new array.
|
|
32
|
-
const contentOnlyIds = (0, _data.useSelect)(select => {
|
|
25
|
+
const contentOnlyIds = (0, _usePostContentBlocks.default)();
|
|
26
|
+
const templateParts = (0, _data.useSelect)(select => {
|
|
33
27
|
const {
|
|
34
|
-
|
|
35
|
-
} =
|
|
36
|
-
return
|
|
37
|
-
}, [
|
|
28
|
+
getBlocksByName
|
|
29
|
+
} = select(_blockEditor.store);
|
|
30
|
+
return getBlocksByName('core/template-part');
|
|
31
|
+
}, []);
|
|
38
32
|
const disabledIds = (0, _data.useSelect)(select => {
|
|
39
33
|
const {
|
|
40
|
-
getBlocksByName,
|
|
41
34
|
getBlockOrder
|
|
42
35
|
} = select(_blockEditor.store);
|
|
43
|
-
return
|
|
44
|
-
}, []);
|
|
36
|
+
return templateParts.flatMap(clientId => getBlockOrder(clientId));
|
|
37
|
+
}, [templateParts]);
|
|
45
38
|
const registry = (0, _data.useRegistry)();
|
|
46
39
|
(0, _element.useEffect)(() => {
|
|
47
40
|
const {
|
|
@@ -53,6 +46,9 @@ function DisableNonPageContentBlocks() {
|
|
|
53
46
|
for (const clientId of contentOnlyIds) {
|
|
54
47
|
setBlockEditingMode(clientId, 'contentOnly');
|
|
55
48
|
}
|
|
49
|
+
for (const clientId of templateParts) {
|
|
50
|
+
setBlockEditingMode(clientId, 'contentOnly');
|
|
51
|
+
}
|
|
56
52
|
for (const clientId of disabledIds) {
|
|
57
53
|
setBlockEditingMode(clientId, 'disabled');
|
|
58
54
|
}
|
|
@@ -63,12 +59,15 @@ function DisableNonPageContentBlocks() {
|
|
|
63
59
|
for (const clientId of contentOnlyIds) {
|
|
64
60
|
unsetBlockEditingMode(clientId);
|
|
65
61
|
}
|
|
62
|
+
for (const clientId of templateParts) {
|
|
63
|
+
unsetBlockEditingMode(clientId);
|
|
64
|
+
}
|
|
66
65
|
for (const clientId of disabledIds) {
|
|
67
66
|
unsetBlockEditingMode(clientId);
|
|
68
67
|
}
|
|
69
68
|
});
|
|
70
69
|
};
|
|
71
|
-
}, [contentOnlyIds, disabledIds, registry]);
|
|
70
|
+
}, [templateParts, contentOnlyIds, disabledIds, registry]);
|
|
72
71
|
return null;
|
|
73
72
|
}
|
|
74
73
|
//# sourceMappingURL=disable-non-page-content-blocks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_element","
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_element","_usePostContentBlocks","_interopRequireDefault","DisableNonPageContentBlocks","contentOnlyIds","usePostContentBlocks","templateParts","useSelect","select","getBlocksByName","blockEditorStore","disabledIds","getBlockOrder","flatMap","clientId","registry","useRegistry","useEffect","setBlockEditingMode","unsetBlockEditingMode","dispatch","batch"],"sources":["@wordpress/editor/src/components/provider/disable-non-page-content-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport usePostContentBlocks from './use-post-content-blocks';\n\n/**\n * Component that when rendered, makes it so that the site editor allows only\n * page content to be edited.\n */\nexport default function DisableNonPageContentBlocks() {\n\tconst contentOnlyIds = usePostContentBlocks();\n\tconst templateParts = useSelect( ( select ) => {\n\t\tconst { getBlocksByName } = select( blockEditorStore );\n\t\treturn getBlocksByName( 'core/template-part' );\n\t}, [] );\n\tconst disabledIds = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockOrder } = select( blockEditorStore );\n\t\t\treturn templateParts.flatMap( ( clientId ) =>\n\t\t\t\tgetBlockOrder( clientId )\n\t\t\t);\n\t\t},\n\t\t[ templateParts ]\n\t);\n\n\tconst registry = useRegistry();\n\n\tuseEffect( () => {\n\t\tconst { setBlockEditingMode, unsetBlockEditingMode } =\n\t\t\tregistry.dispatch( blockEditorStore );\n\n\t\tregistry.batch( () => {\n\t\t\tsetBlockEditingMode( '', 'disabled' );\n\t\t\tfor ( const clientId of contentOnlyIds ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'contentOnly' );\n\t\t\t}\n\t\t\tfor ( const clientId of templateParts ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'contentOnly' );\n\t\t\t}\n\t\t\tfor ( const clientId of disabledIds ) {\n\t\t\t\tsetBlockEditingMode( clientId, 'disabled' );\n\t\t\t}\n\t\t} );\n\n\t\treturn () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tunsetBlockEditingMode( '' );\n\t\t\t\tfor ( const clientId of contentOnlyIds ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t\tfor ( const clientId of templateParts ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t\tfor ( const clientId of disabledIds ) {\n\t\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t\t}\n\t\t\t} );\n\t\t};\n\t}, [ templateParts, contentOnlyIds, disabledIds, registry ] );\n\n\treturn null;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,qBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACe,SAASK,2BAA2BA,CAAA,EAAG;EACrD,MAAMC,cAAc,GAAG,IAAAC,6BAAoB,EAAC,CAAC;EAC7C,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAC9C,MAAM;MAAEC;IAAgB,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IACtD,OAAOD,eAAe,CAAE,oBAAqB,CAAC;EAC/C,CAAC,EAAE,EAAG,CAAC;EACP,MAAME,WAAW,GAAG,IAAAJ,eA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,WAAW,EAAEI,QAAQ,CAAG,CAAC;EAE7D,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = usePostContentBlocks;
|
|
7
|
+
var _data = require("@wordpress/data");
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
var _hooks = require("@wordpress/hooks");
|
|
10
|
+
var _store = require("../../store");
|
|
11
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const POST_CONTENT_BLOCK_TYPES = ['core/post-title', 'core/post-featured-image', 'core/post-content'];
|
|
21
|
+
function usePostContentBlocks() {
|
|
22
|
+
const contentOnlyBlockTypes = (0, _element.useMemo)(() => [...(0, _hooks.applyFilters)('editor.postContentBlockTypes', POST_CONTENT_BLOCK_TYPES)], []);
|
|
23
|
+
|
|
24
|
+
// Note that there are two separate subscriptions because the result for each
|
|
25
|
+
// returns a new array.
|
|
26
|
+
const contentOnlyIds = (0, _data.useSelect)(select => {
|
|
27
|
+
const {
|
|
28
|
+
getPostBlocksByName
|
|
29
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
30
|
+
return getPostBlocksByName(contentOnlyBlockTypes);
|
|
31
|
+
}, [contentOnlyBlockTypes]);
|
|
32
|
+
return contentOnlyIds;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=use-post-content-blocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_data","require","_element","_hooks","_store","_lockUnlock","POST_CONTENT_BLOCK_TYPES","usePostContentBlocks","contentOnlyBlockTypes","useMemo","applyFilters","contentOnlyIds","useSelect","select","getPostBlocksByName","unlock","editorStore"],"sources":["@wordpress/editor/src/components/provider/use-post-content-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POST_CONTENT_BLOCK_TYPES = [\n\t'core/post-title',\n\t'core/post-featured-image',\n\t'core/post-content',\n];\n\nexport default function usePostContentBlocks() {\n\tconst contentOnlyBlockTypes = useMemo(\n\t\t() => [\n\t\t\t...applyFilters(\n\t\t\t\t'editor.postContentBlockTypes',\n\t\t\t\tPOST_CONTENT_BLOCK_TYPES\n\t\t\t),\n\t\t],\n\t\t[]\n\t);\n\n\t// Note that there are two separate subscriptions because the result for each\n\t// returns a new array.\n\tconst contentOnlyIds = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostBlocksByName } = unlock( select( editorStore ) );\n\t\t\treturn getPostBlocksByName( contentOnlyBlockTypes );\n\t\t},\n\t\t[ contentOnlyBlockTypes ]\n\t);\n\n\treturn contentOnlyIds;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA,MAAMK,wBAAwB,GAAG,CAChC,iBAAiB,EACjB,0BAA0B,EAC1B,mBAAmB,CACnB;AAEc,SAASC,oBAAoBA,CAAA,EAAG;EAC9C,MAAMC,qBAAqB,GAAG,IAAAC,gBAAO,EACpC,MAAM,CACL,GAAG,IAAAC,mBAAY,EACd,8BAA8B,EAC9BJ,wBACD,CAAC,CACD,EACD,EACD,CAAC;;EAED;EACA;EACA,MAAMK,cAAc,GAAG,IAAAC,eAAS,EAC7BC,MAAM,IAAM;IACb,MAAM;MAAEC;IAAoB,CAAC,GAAG,IAAAC,kBAAM,EAAEF,MAAM,CAAEG,YAAY,CAAE,CAAC;IAC/D,OAAOF,mBAAmB,CAAEN,qBAAsB,CAAC;EACpD,CAAC,EACD,CAAEA,qBAAqB,CACxB,CAAC;EAED,OAAOG,cAAc;AACtB","ignoreList":[]}
|
|
@@ -22,6 +22,10 @@ function ResizeHandle({
|
|
|
22
22
|
const {
|
|
23
23
|
keyCode
|
|
24
24
|
} = event;
|
|
25
|
+
if (keyCode !== _keycodes.LEFT && keyCode !== _keycodes.RIGHT) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
event.preventDefault();
|
|
25
29
|
if (direction === 'left' && keyCode === _keycodes.LEFT || direction === 'right' && keyCode === _keycodes.RIGHT) {
|
|
26
30
|
resizeWidthBy(DELTA_DISTANCE);
|
|
27
31
|
} else if (direction === 'left' && keyCode === _keycodes.RIGHT || direction === 'right' && keyCode === _keycodes.LEFT) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_keycodes","_components","_jsxRuntime","DELTA_DISTANCE","ResizeHandle","direction","resizeWidthBy","handleKeyDown","event","keyCode","LEFT","RIGHT","resizeHandleVariants","active","opacity","scaleY","resizableHandleHelpId","jsxs","Fragment","children","jsx","Tooltip","text","__","__unstableMotion","button","className","onKeyDown","variants","whileFocus","whileHover","whileTap","role","VisuallyHidden","id"],"sources":["@wordpress/editor/src/components/resizable-editor/resize-handle.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\nimport {\n\tVisuallyHidden,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\n\nconst DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.\n\nexport default function ResizeHandle( { direction, resizeWidthBy } ) {\n\tfunction handleKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\n\t\tif (\n\t\t\t( direction === 'left' && keyCode === LEFT ) ||\n\t\t\t( direction === 'right' && keyCode === RIGHT )\n\t\t) {\n\t\t\tresizeWidthBy( DELTA_DISTANCE );\n\t\t} else if (\n\t\t\t( direction === 'left' && keyCode === RIGHT ) ||\n\t\t\t( direction === 'right' && keyCode === LEFT )\n\t\t) {\n\t\t\tresizeWidthBy( -DELTA_DISTANCE );\n\t\t}\n\t}\n\n\tconst resizeHandleVariants = {\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\n\tconst resizableHandleHelpId = `resizable-editor__resize-help-${ direction }`;\n\n\treturn (\n\t\t<>\n\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t<motion.button\n\t\t\t\t\tclassName={ `editor-resizable-editor__resize-handle is-${ direction }` }\n\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\twhileTap=\"active\"\n\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\trole=\"separator\"\n\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\t\t\t<VisuallyHidden id={ resizableHandleHelpId }>\n\t\t\t\t{ __( 'Use left and right arrow keys to resize the canvas.' ) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAI+B,IAAAG,WAAA,GAAAH,OAAA;AAT/B;AACA;AACA;;AASA,MAAMI,cAAc,GAAG,EAAE,CAAC,CAAC;;AAEZ,SAASC,YAAYA,CAAE;EAAEC,SAAS;EAAEC;AAAc,CAAC,EAAG;EACpE,SAASC,aAAaA,CAAEC,KAAK,EAAG;IAC/B,MAAM;MAAEC;IAAQ,CAAC,GAAGD,KAAK;IAEzB,
|
|
1
|
+
{"version":3,"names":["_i18n","require","_keycodes","_components","_jsxRuntime","DELTA_DISTANCE","ResizeHandle","direction","resizeWidthBy","handleKeyDown","event","keyCode","LEFT","RIGHT","preventDefault","resizeHandleVariants","active","opacity","scaleY","resizableHandleHelpId","jsxs","Fragment","children","jsx","Tooltip","text","__","__unstableMotion","button","className","onKeyDown","variants","whileFocus","whileHover","whileTap","role","VisuallyHidden","id"],"sources":["@wordpress/editor/src/components/resizable-editor/resize-handle.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { LEFT, RIGHT } from '@wordpress/keycodes';\nimport {\n\tVisuallyHidden,\n\tTooltip,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\n\nconst DELTA_DISTANCE = 20; // The distance to resize per keydown in pixels.\n\nexport default function ResizeHandle( { direction, resizeWidthBy } ) {\n\tfunction handleKeyDown( event ) {\n\t\tconst { keyCode } = event;\n\n\t\tif ( keyCode !== LEFT && keyCode !== RIGHT ) {\n\t\t\treturn;\n\t\t}\n\t\tevent.preventDefault();\n\n\t\tif (\n\t\t\t( direction === 'left' && keyCode === LEFT ) ||\n\t\t\t( direction === 'right' && keyCode === RIGHT )\n\t\t) {\n\t\t\tresizeWidthBy( DELTA_DISTANCE );\n\t\t} else if (\n\t\t\t( direction === 'left' && keyCode === RIGHT ) ||\n\t\t\t( direction === 'right' && keyCode === LEFT )\n\t\t) {\n\t\t\tresizeWidthBy( -DELTA_DISTANCE );\n\t\t}\n\t}\n\n\tconst resizeHandleVariants = {\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\n\tconst resizableHandleHelpId = `resizable-editor__resize-help-${ direction }`;\n\n\treturn (\n\t\t<>\n\t\t\t<Tooltip text={ __( 'Drag to resize' ) }>\n\t\t\t\t<motion.button\n\t\t\t\t\tclassName={ `editor-resizable-editor__resize-handle is-${ direction }` }\n\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\taria-describedby={ resizableHandleHelpId }\n\t\t\t\t\tonKeyDown={ handleKeyDown }\n\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\twhileHover=\"active\"\n\t\t\t\t\twhileTap=\"active\"\n\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\trole=\"separator\"\n\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t/>\n\t\t\t</Tooltip>\n\t\t\t<VisuallyHidden id={ resizableHandleHelpId }>\n\t\t\t\t{ __( 'Use left and right arrow keys to resize the canvas.' ) }\n\t\t\t</VisuallyHidden>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAI+B,IAAAG,WAAA,GAAAH,OAAA;AAT/B;AACA;AACA;;AASA,MAAMI,cAAc,GAAG,EAAE,CAAC,CAAC;;AAEZ,SAASC,YAAYA,CAAE;EAAEC,SAAS;EAAEC;AAAc,CAAC,EAAG;EACpE,SAASC,aAAaA,CAAEC,KAAK,EAAG;IAC/B,MAAM;MAAEC;IAAQ,CAAC,GAAGD,KAAK;IAEzB,IAAKC,OAAO,KAAKC,cAAI,IAAID,OAAO,KAAKE,eAAK,EAAG;MAC5C;IACD;IACAH,KAAK,CAACI,cAAc,CAAC,CAAC;IAEtB,IACGP,SAAS,KAAK,MAAM,IAAII,OAAO,KAAKC,cAAI,IACxCL,SAAS,KAAK,OAAO,IAAII,OAAO,KAAKE,eAAO,EAC7C;MACDL,aAAa,CAAEH,cAAe,CAAC;IAChC,CAAC,MAAM,IACJE,SAAS,KAAK,MAAM,IAAII,OAAO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: _icons.square,
|
|
47
|
-
label: (0, _i18n.__)('
|
|
47
|
+
label: (0, _i18n.__)('Zoom Out'),
|
|
48
48
|
isPressed: isZoomOut,
|
|
49
49
|
size: "compact",
|
|
50
50
|
showTooltip: !showIconLabels
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_data","_blockEditor","_icons","_preferences","_lockUnlock","_jsxRuntime","ZoomOutToggle","isZoomOut","showIconLabels","useSelect","select","unlock","blockEditorStore","preferencesStore","get","resetZoomLevel","setZoomLevel","__unstableSetEditorMode","useDispatch","handleZoomOut","jsx","Button","onClick","icon","zoomOutIcon","label","__","isPressed","size","showTooltip","_default","exports","default"],"sources":["@wordpress/editor/src/components/zoom-out-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { square as zoomOutIcon } from '@wordpress/icons';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst ZoomOutToggle = () => {\n\tconst { isZoomOut, showIconLabels } = useSelect( ( select ) => ( {\n\t\tisZoomOut: unlock( select( blockEditorStore ) ).isZoomOut(),\n\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'showIconLabels'\n\t\t),\n\t} ) );\n\n\tconst { resetZoomLevel, setZoomLevel, __unstableSetEditorMode } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst handleZoomOut = () => {\n\t\tif ( isZoomOut ) {\n\t\t\tresetZoomLevel();\n\t\t} else {\n\t\t\tsetZoomLevel( 50 );\n\t\t}\n\t\t__unstableSetEditorMode( isZoomOut ? 'edit' : 'zoom-out' );\n\t};\n\n\treturn (\n\t\t<Button\n\t\t\tonClick={ handleZoomOut }\n\t\t\ticon={ zoomOutIcon }\n\t\t\tlabel={ __( '
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_data","_blockEditor","_icons","_preferences","_lockUnlock","_jsxRuntime","ZoomOutToggle","isZoomOut","showIconLabels","useSelect","select","unlock","blockEditorStore","preferencesStore","get","resetZoomLevel","setZoomLevel","__unstableSetEditorMode","useDispatch","handleZoomOut","jsx","Button","onClick","icon","zoomOutIcon","label","__","isPressed","size","showTooltip","_default","exports","default"],"sources":["@wordpress/editor/src/components/zoom-out-toggle/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { square as zoomOutIcon } from '@wordpress/icons';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst ZoomOutToggle = () => {\n\tconst { isZoomOut, showIconLabels } = useSelect( ( select ) => ( {\n\t\tisZoomOut: unlock( select( blockEditorStore ) ).isZoomOut(),\n\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t'core',\n\t\t\t'showIconLabels'\n\t\t),\n\t} ) );\n\n\tconst { resetZoomLevel, setZoomLevel, __unstableSetEditorMode } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst handleZoomOut = () => {\n\t\tif ( isZoomOut ) {\n\t\t\tresetZoomLevel();\n\t\t} else {\n\t\t\tsetZoomLevel( 50 );\n\t\t}\n\t\t__unstableSetEditorMode( isZoomOut ? 'edit' : 'zoom-out' );\n\t};\n\n\treturn (\n\t\t<Button\n\t\t\tonClick={ handleZoomOut }\n\t\t\ticon={ zoomOutIcon }\n\t\t\tlabel={ __( 'Zoom Out' ) }\n\t\t\tisPressed={ isZoomOut }\n\t\t\tsize=\"compact\"\n\t\t\tshowTooltip={ ! showIconLabels }\n\t\t/>\n\t);\n};\n\nexport default ZoomOutToggle;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;EAAgB,CAChC,CAAC;AAEJ,CAAC;AAAC,IAAAsB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa1B,aAAa","ignoreList":[]}
|
|
@@ -10,15 +10,10 @@ exports.setIsReady = setIsReady;
|
|
|
10
10
|
exports.unregisterEntityAction = unregisterEntityAction;
|
|
11
11
|
var _coreData = require("@wordpress/core-data");
|
|
12
12
|
var _hooks = require("@wordpress/hooks");
|
|
13
|
-
var _duplicateTemplatePart = _interopRequireDefault(require("../actions/duplicate-template-part"));
|
|
14
|
-
var _resetPost = _interopRequireDefault(require("../actions/reset-post"));
|
|
15
|
-
var _trashPost = _interopRequireDefault(require("../actions/trash-post"));
|
|
16
|
-
var _renamePost = _interopRequireDefault(require("../actions/rename-post"));
|
|
17
|
-
var _restorePost = _interopRequireDefault(require("../actions/restore-post"));
|
|
18
13
|
var _store = require("../../store");
|
|
19
14
|
var _lockUnlock = require("../../lock-unlock");
|
|
20
15
|
var _fields = require("@wordpress/fields");
|
|
21
|
-
var
|
|
16
|
+
var _duplicateTemplatePart = _interopRequireDefault(require("../actions/duplicate-template-part"));
|
|
22
17
|
/**
|
|
23
18
|
* WordPress dependencies
|
|
24
19
|
*/
|
|
@@ -66,7 +61,7 @@ const registerPostTypeActions = postType => async ({
|
|
|
66
61
|
const currentTheme = await registry.resolveSelect(_coreData.store).getCurrentTheme();
|
|
67
62
|
const actions = [postTypeConfig.viewable ? _fields.viewPost : undefined, !!postTypeConfig?.supports?.revisions ? _fields.viewPostRevisions : undefined,
|
|
68
63
|
// @ts-ignore
|
|
69
|
-
globalThis.IS_GUTENBERG_PLUGIN ? !['wp_template', 'wp_block', 'wp_template_part'].includes(postTypeConfig.slug) && canCreate && _fields.duplicatePost : undefined, postTypeConfig.slug === 'wp_template_part' && canCreate && currentTheme?.is_block_theme ? _duplicateTemplatePart.default : undefined, canCreate && postTypeConfig.slug === 'wp_block' ? _fields.duplicatePattern : undefined, postTypeConfig.supports?.title ?
|
|
64
|
+
globalThis.IS_GUTENBERG_PLUGIN ? !['wp_template', 'wp_block', 'wp_template_part'].includes(postTypeConfig.slug) && canCreate && _fields.duplicatePost : undefined, postTypeConfig.slug === 'wp_template_part' && canCreate && currentTheme?.is_block_theme ? _duplicateTemplatePart.default : undefined, canCreate && postTypeConfig.slug === 'wp_block' ? _fields.duplicatePattern : undefined, postTypeConfig.supports?.title ? _fields.renamePost : undefined, postTypeConfig?.supports?.['page-attributes'] ? _fields.reorderPage : undefined, postTypeConfig.slug === 'wp_block' ? _fields.exportPattern : undefined, _fields.restorePost, _fields.resetPost, _fields.deletePost, _fields.trashPost, _fields.permanentlyDeletePost];
|
|
70
65
|
registry.batch(() => {
|
|
71
66
|
actions.forEach(action => {
|
|
72
67
|
if (!action) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_hooks","
|
|
1
|
+
{"version":3,"names":["_coreData","require","_hooks","_store","_lockUnlock","_fields","_duplicateTemplatePart","_interopRequireDefault","registerEntityAction","kind","name","config","type","unregisterEntityAction","actionId","setIsReady","registerPostTypeActions","postType","registry","isReady","unlock","select","editorStore","isEntityReady","dispatch","postTypeConfig","resolveSelect","coreStore","getPostType","canCreate","canUser","currentTheme","getCurrentTheme","actions","viewable","viewPost","undefined","supports","revisions","viewPostRevisions","globalThis","IS_GUTENBERG_PLUGIN","includes","slug","duplicatePost","is_block_theme","duplicateTemplatePart","duplicatePattern","title","renamePost","reorderPage","exportPattern","restorePost","resetPost","deletePost","trashPost","permanentlyDeletePost","batch","forEach","action","doAction","exports"],"sources":["@wordpress/editor/src/dataviews/store/private-actions.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { Action } from '@wordpress/dataviews';\nimport { doAction } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport type { PostType } from '../types';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tviewPost,\n\tviewPostRevisions,\n\tduplicatePost,\n\tduplicatePattern,\n\treorderPage,\n\texportPattern,\n\tpermanentlyDeletePost,\n\trestorePost,\n\ttrashPost,\n\trenamePost,\n\tresetPost,\n\tdeletePost,\n} from '@wordpress/fields';\nimport duplicateTemplatePart from '../actions/duplicate-template-part';\n\nexport function registerEntityAction< Item >(\n\tkind: string,\n\tname: string,\n\tconfig: Action< Item >\n) {\n\treturn {\n\t\ttype: 'REGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tconfig,\n\t};\n}\n\nexport function unregisterEntityAction(\n\tkind: string,\n\tname: string,\n\tactionId: string\n) {\n\treturn {\n\t\ttype: 'UNREGISTER_ENTITY_ACTION' as const,\n\t\tkind,\n\t\tname,\n\t\tactionId,\n\t};\n}\n\nexport function setIsReady( kind: string, name: string ) {\n\treturn {\n\t\ttype: 'SET_IS_READY' as const,\n\t\tkind,\n\t\tname,\n\t};\n}\n\nexport const registerPostTypeActions =\n\t( postType: string ) =>\n\tasync ( { registry }: { registry: any } ) => {\n\t\tconst isReady = unlock( registry.select( editorStore ) ).isEntityReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\t\tif ( isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\tunlock( registry.dispatch( editorStore ) ).setIsReady(\n\t\t\t'postType',\n\t\t\tpostType\n\t\t);\n\n\t\tconst postTypeConfig = ( await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getPostType( postType ) ) as PostType;\n\n\t\tconst canCreate = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\tconst currentTheme = await registry\n\t\t\t.resolveSelect( coreStore )\n\t\t\t.getCurrentTheme();\n\n\t\tconst actions = [\n\t\t\tpostTypeConfig.viewable ? viewPost : undefined,\n\t\t\t!! postTypeConfig?.supports?.revisions\n\t\t\t\t? viewPostRevisions\n\t\t\t\t: undefined,\n\t\t\t// @ts-ignore\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! [ 'wp_template', 'wp_block', 'wp_template_part' ].includes(\n\t\t\t\t\t\tpostTypeConfig.slug\n\t\t\t\t ) &&\n\t\t\t\t canCreate &&\n\t\t\t\t duplicatePost\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_template_part' &&\n\t\t\tcanCreate &&\n\t\t\tcurrentTheme?.is_block_theme\n\t\t\t\t? duplicateTemplatePart\n\t\t\t\t: undefined,\n\t\t\tcanCreate && postTypeConfig.slug === 'wp_block'\n\t\t\t\t? duplicatePattern\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.supports?.title ? renamePost : undefined,\n\t\t\tpostTypeConfig?.supports?.[ 'page-attributes' ]\n\t\t\t\t? reorderPage\n\t\t\t\t: undefined,\n\t\t\tpostTypeConfig.slug === 'wp_block' ? exportPattern : undefined,\n\t\t\trestorePost,\n\t\t\tresetPost,\n\t\t\tdeletePost,\n\t\t\ttrashPost,\n\t\t\tpermanentlyDeletePost,\n\t\t];\n\n\t\tregistry.batch( () => {\n\t\t\tactions.forEach( ( action ) => {\n\t\t\t\tif ( ! action ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tunlock( registry.dispatch( editorStore ) ).registerEntityAction(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\taction\n\t\t\t\t);\n\t\t\t} );\n\t\t} );\n\n\t\tdoAction( 'core.registerPostTypeActions', postType );\n\t};\n"],"mappings":";;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAMA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAcA,IAAAK,sBAAA,GAAAC,sBAAA,CAAAN,OAAA;AA3BA;AACA;AACA;;AAKA;AACA;AACA;;AAoBO,SAASO,oBA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|
55
55
|
isEditingSyncedPattern
|
|
56
56
|
} = (0, _data.useSelect)(select => {
|
|
57
|
-
const {
|
|
58
|
-
getBlockBindingsSource
|
|
59
|
-
} = (0, _lockUnlock.unlock)(select(_blocks.store));
|
|
60
57
|
const {
|
|
61
58
|
getCurrentPostType,
|
|
62
59
|
getEditedPostAttribute
|
|
63
60
|
} = select(_store.store);
|
|
64
61
|
return {
|
|
65
62
|
// For editing link to the site editor if the theme and user permissions support it.
|
|
66
|
-
hasPatternOverridesSource: !!getBlockBindingsSource('core/pattern-overrides'),
|
|
63
|
+
hasPatternOverridesSource: !!(0, _blocks.getBlockBindingsSource)('core/pattern-overrides'),
|
|
67
64
|
isEditingSyncedPattern: getCurrentPostType() === PATTERN_TYPES.user && getEditedPostAttribute('meta')?.wp_pattern_sync_status !== PATTERN_SYNC_TYPES.unsynced && getEditedPostAttribute('wp_pattern_sync_status') !== PATTERN_SYNC_TYPES.unsynced
|
|
68
65
|
};
|
|
69
66
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_hooks","require","_patterns","_compose","_blockEditor","_data","_blocks","_store","_lockUnlock","_jsxRuntime","PatternOverridesControls","ResetOverridesControl","PatternOverridesBlockControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","PATTERN_SYNC_TYPES","unlock","patternsPrivateApis","withPatternOverrideControls","createHigherOrderComponent","BlockEdit","props","isSupportedBlock","name","jsxs","Fragment","children","jsx","isSelected","ControlsWithStoreSubscription","blockEditingMode","useBlockEditingMode","hasPatternOverridesSource","isEditingSyncedPattern","useSelect","select","
|
|
1
|
+
{"version":3,"names":["_hooks","require","_patterns","_compose","_blockEditor","_data","_blocks","_store","_lockUnlock","_jsxRuntime","PatternOverridesControls","ResetOverridesControl","PatternOverridesBlockControls","PATTERN_TYPES","PARTIAL_SYNCING_SUPPORTED_BLOCKS","PATTERN_SYNC_TYPES","unlock","patternsPrivateApis","withPatternOverrideControls","createHigherOrderComponent","BlockEdit","props","isSupportedBlock","name","jsxs","Fragment","children","jsx","isSelected","ControlsWithStoreSubscription","blockEditingMode","useBlockEditingMode","hasPatternOverridesSource","isEditingSyncedPattern","useSelect","select","getCurrentPostType","getEditedPostAttribute","editorStore","getBlockBindingsSource","user","wp_pattern_sync_status","unsynced","bindings","attributes","metadata","hasPatternBindings","Object","values","some","binding","source","shouldShowPatternOverridesControls","shouldShowResetOverridesControl","addFilter"],"sources":["@wordpress/editor/src/hooks/pattern-overrides.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useBlockEditingMode } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\nimport { unlock } from '../lock-unlock';\n\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\nconst {\n\tPatternOverridesControls,\n\tResetOverridesControl,\n\tPatternOverridesBlockControls,\n\tPATTERN_TYPES,\n\tPARTIAL_SYNCING_SUPPORTED_BLOCKS,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternsPrivateApis );\n\n/**\n * Override the default edit UI to include a new block inspector control for\n * assigning a partial syncing controls to supported blocks in the pattern editor.\n * Currently, only the `core/paragraph` block is supported.\n *\n * @param {Component} BlockEdit Original component.\n *\n * @return {Component} Wrapped component.\n */\nconst withPatternOverrideControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst isSupportedBlock =\n\t\t\t!! PARTIAL_SYNCING_SUPPORTED_BLOCKS[ props.name ];\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t\t{ props.isSelected && isSupportedBlock && (\n\t\t\t\t\t<ControlsWithStoreSubscription { ...props } />\n\t\t\t\t) }\n\t\t\t\t{ isSupportedBlock && <PatternOverridesBlockControls /> }\n\t\t\t</>\n\t\t);\n\t},\n\t'withPatternOverrideControls'\n);\n\n// Split into a separate component to avoid a store subscription\n// on every block.\nfunction ControlsWithStoreSubscription( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst { hasPatternOverridesSource, isEditingSyncedPattern } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPostType, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t\tisEditingSyncedPattern:\n\t\t\t\t\tgetCurrentPostType() === PATTERN_TYPES.user &&\n\t\t\t\t\tgetEditedPostAttribute( 'meta' )?.wp_pattern_sync_status !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced &&\n\t\t\t\t\tgetEditedPostAttribute( 'wp_pattern_sync_status' ) !==\n\t\t\t\t\t\tPATTERN_SYNC_TYPES.unsynced,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst bindings = props.attributes.metadata?.bindings;\n\tconst hasPatternBindings =\n\t\t!! bindings &&\n\t\tObject.values( bindings ).some(\n\t\t\t( binding ) => binding.source === 'core/pattern-overrides'\n\t\t);\n\n\tconst shouldShowPatternOverridesControls =\n\t\tisEditingSyncedPattern && blockEditingMode === 'default';\n\tconst shouldShowResetOverridesControl =\n\t\t! isEditingSyncedPattern &&\n\t\t!! props.attributes.metadata?.name &&\n\t\tblockEditingMode !== 'disabled' &&\n\t\thasPatternBindings;\n\n\tif ( ! hasPatternOverridesSource ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ shouldShowPatternOverridesControls && (\n\t\t\t\t<PatternOverridesControls { ...props } />\n\t\t\t) }\n\t\t\t{ shouldShowResetOverridesControl && (\n\t\t\t\t<ResetOverridesControl { ...props } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/editor/with-pattern-override-controls',\n\twithPatternOverrideControls\n);\n"],"mappings":";;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAAwC,IAAAQ,WAAA,GAAAR,OAAA;AAdxC;AACA;AACA;;AAQA;AACA;AACA;;AAIA,6EAEA,MAAM;EACLS,wBAAwB;EACxBC,qBAAqB;EACrBC,6BAA6B;EAC7BC,aAAa;EACbC,gCAAgC;EAChCC;AACD,CAAC,GAAG,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;;AAEjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,2BAA2B,GAAG,IAAAC,mCAA0B,EAC3DC,SAAS,IAAQC,KAAK,IAAM;EAC7B,MAAMC,gBAAgB,GACrB,CAAC,CAAER,gCAAgC,CAAEO,KAAK,CAACE,IAAI,CAAE;EAElD,oBACC,IAAAd,WAAA,CAAAe,IAAA,EAAAf,WAAA,CAAAgB,QAAA;IAAAC,QAAA,gBACC,IAAAjB,WAAA,CAAAkB,GAAA,EAACP,SAAS;MAAA,GAAiBC;IAAK,GAAjB,MAAqB,CAAC,EACnCA,KAAK,CAACO,UAAU,IAAIN,gBAAgB,iBACrC,IAAAb,WAAA,CAAAkB,GAAA,EAACE,6BAA6B;MAAA,GAAMR;IAAK,CAAI,CAC7C,EACCC,gBAAgB,iBAAI,IAAAb,WAAA,CAAAkB,GAAA,EAACf,6BAA6B,IAAE,CAAC;EAAA,CACtD,CAAC;AAEL,CAAC,EACD,6BACD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AAkC,iBACnC,IAAA3C,WAAA,CAAAkB,GAAA,EAACjB,wBAAwB;MAAA,GAAMW;IAAK,CAAI,CACxC,EACCgC,+BAA+B,iBAChC,IAAA5C,WAAA,CAAAkB,GAAA,EAAChB,qBAAqB;MAAA,GAAMU;IAAK,CAAI,CACrC;EAAA,CACA,CAAC;AAEL;AAEA,IAAAiC,gBAAS,EACR,kBAAkB,EAClB,4CAA4C,EAC5CpC,2BACD,CAAC","ignoreList":[]}
|
package/build/store/actions.js
CHANGED
|
@@ -22,7 +22,7 @@ exports.resetPost = resetPost;
|
|
|
22
22
|
exports.selectBlock = exports.savePost = void 0;
|
|
23
23
|
exports.setDeviceType = setDeviceType;
|
|
24
24
|
exports.setEditedPost = setEditedPost;
|
|
25
|
-
exports.setIsInserterOpened =
|
|
25
|
+
exports.setIsInserterOpened = void 0;
|
|
26
26
|
exports.setIsListViewOpened = setIsListViewOpened;
|
|
27
27
|
exports.setupEditor = exports.setTemplateValidity = exports.setRenderingMode = void 0;
|
|
28
28
|
exports.setupEditorState = setupEditorState;
|
|
@@ -48,6 +48,7 @@ var _i18n = require("@wordpress/i18n");
|
|
|
48
48
|
var _constants = require("./constants");
|
|
49
49
|
var _localAutosave = require("./local-autosave");
|
|
50
50
|
var _noticeBuilder = require("./utils/notice-builder");
|
|
51
|
+
var _lockUnlock = require("../lock-unlock");
|
|
51
52
|
/**
|
|
52
53
|
* WordPress dependencies
|
|
53
54
|
*/
|
|
@@ -751,15 +752,28 @@ function removeEditorPanel(panelName) {
|
|
|
751
752
|
* use an object.
|
|
752
753
|
* @param {string} value.rootClientId The root client ID to insert at.
|
|
753
754
|
* @param {number} value.insertionIndex The index to insert at.
|
|
755
|
+
* @param {string} value.filterValue A query to filter the inserter results.
|
|
756
|
+
* @param {Function} value.onSelect A callback when an item is selected.
|
|
757
|
+
* @param {string} value.tab The tab to open in the inserter.
|
|
758
|
+
* @param {string} value.category The category to initialize in the inserter.
|
|
754
759
|
*
|
|
755
760
|
* @return {Object} Action object.
|
|
756
761
|
*/
|
|
757
|
-
|
|
758
|
-
|
|
762
|
+
const setIsInserterOpened = value => ({
|
|
763
|
+
dispatch,
|
|
764
|
+
registry
|
|
765
|
+
}) => {
|
|
766
|
+
if (typeof value === 'object' && value.hasOwnProperty('rootClientId') && value.hasOwnProperty('insertionIndex')) {
|
|
767
|
+
(0, _lockUnlock.unlock)(registry.dispatch(_blockEditor.store)).setInsertionPoint({
|
|
768
|
+
rootClientId: value.rootClientId,
|
|
769
|
+
index: value.insertionIndex
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
dispatch({
|
|
759
773
|
type: 'SET_IS_INSERTER_OPENED',
|
|
760
774
|
value
|
|
761
|
-
};
|
|
762
|
-
}
|
|
775
|
+
});
|
|
776
|
+
};
|
|
763
777
|
|
|
764
778
|
/**
|
|
765
779
|
* Returns an action object used to open/close the list view.
|
|
@@ -767,6 +781,7 @@ function setIsInserterOpened(value) {
|
|
|
767
781
|
* @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
|
|
768
782
|
* @return {Object} Action object.
|
|
769
783
|
*/
|
|
784
|
+
exports.setIsInserterOpened = setIsInserterOpened;
|
|
770
785
|
function setIsListViewOpened(isOpen) {
|
|
771
786
|
return {
|
|
772
787
|
type: 'SET_IS_LIST_VIEW_OPENED',
|