@wordpress/editor 13.26.0 → 13.27.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.
Files changed (137) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/bindings/index.js +20 -0
  3. package/build/bindings/index.js.map +1 -0
  4. package/build/bindings/post-meta.js +52 -0
  5. package/build/bindings/post-meta.js.map +1 -0
  6. package/build/components/block-manager/category.js +106 -0
  7. package/build/components/block-manager/category.js.map +1 -0
  8. package/build/components/block-manager/checklist.js +35 -0
  9. package/build/components/block-manager/checklist.js.map +1 -0
  10. package/build/components/block-manager/index.js +130 -0
  11. package/build/components/block-manager/index.js.map +1 -0
  12. package/build/components/document-tools/index.js +58 -52
  13. package/build/components/document-tools/index.js.map +1 -1
  14. package/build/components/editor-canvas/index.js +4 -4
  15. package/build/components/editor-canvas/index.js.map +1 -1
  16. package/build/components/editor-notices/index.js +11 -11
  17. package/build/components/editor-notices/index.js.map +1 -1
  18. package/build/components/entities-saved-states/entity-type-list.js +38 -7
  19. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  20. package/build/components/entities-saved-states/index.js +1 -1
  21. package/build/components/entities-saved-states/index.js.map +1 -1
  22. package/build/components/offline-status/index.native.js +1 -3
  23. package/build/components/offline-status/index.native.js.map +1 -1
  24. package/build/components/post-locked-modal/index.js +1 -1
  25. package/build/components/post-locked-modal/index.js.map +1 -1
  26. package/build/components/post-saved-state/index.js +10 -24
  27. package/build/components/post-saved-state/index.js.map +1 -1
  28. package/build/components/post-schedule/check.js +5 -16
  29. package/build/components/post-schedule/check.js.map +1 -1
  30. package/build/components/preferences-modal/enable-panel.js +42 -0
  31. package/build/components/preferences-modal/enable-panel.js.map +1 -0
  32. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js +33 -0
  33. package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -0
  34. package/build/components/preferences-modal/index.js +186 -0
  35. package/build/components/preferences-modal/index.js.map +1 -0
  36. package/build/components/provider/disable-non-page-content-blocks.js +1 -4
  37. package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
  38. package/build/components/provider/use-block-editor-settings.js +34 -8
  39. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  40. package/build/hooks/pattern-partial-syncing.js +12 -8
  41. package/build/hooks/pattern-partial-syncing.js.map +1 -1
  42. package/build/index.js +1 -0
  43. package/build/index.js.map +1 -1
  44. package/build/private-apis.js +6 -2
  45. package/build/private-apis.js.map +1 -1
  46. package/build/store/defaults.js +2 -0
  47. package/build/store/defaults.js.map +1 -1
  48. package/build/store/private-actions.js +33 -1
  49. package/build/store/private-actions.js.map +1 -1
  50. package/build/store/private-selectors.js +1 -1
  51. package/build/store/private-selectors.js.map +1 -1
  52. package/build-module/bindings/index.js +15 -0
  53. package/build-module/bindings/index.js.map +1 -0
  54. package/build-module/bindings/post-meta.js +45 -0
  55. package/build-module/bindings/post-meta.js.map +1 -0
  56. package/build-module/components/block-manager/category.js +97 -0
  57. package/build-module/components/block-manager/category.js.map +1 -0
  58. package/build-module/components/block-manager/checklist.js +27 -0
  59. package/build-module/components/block-manager/checklist.js.map +1 -0
  60. package/build-module/components/block-manager/index.js +121 -0
  61. package/build-module/components/block-manager/index.js.map +1 -0
  62. package/build-module/components/document-tools/index.js +58 -52
  63. package/build-module/components/document-tools/index.js.map +1 -1
  64. package/build-module/components/editor-canvas/index.js +4 -4
  65. package/build-module/components/editor-canvas/index.js.map +1 -1
  66. package/build-module/components/editor-notices/index.js +12 -12
  67. package/build-module/components/editor-notices/index.js.map +1 -1
  68. package/build-module/components/entities-saved-states/entity-type-list.js +39 -8
  69. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  70. package/build-module/components/entities-saved-states/index.js +1 -1
  71. package/build-module/components/entities-saved-states/index.js.map +1 -1
  72. package/build-module/components/offline-status/index.native.js +1 -3
  73. package/build-module/components/offline-status/index.native.js.map +1 -1
  74. package/build-module/components/post-locked-modal/index.js +1 -1
  75. package/build-module/components/post-locked-modal/index.js.map +1 -1
  76. package/build-module/components/post-saved-state/index.js +11 -25
  77. package/build-module/components/post-saved-state/index.js.map +1 -1
  78. package/build-module/components/post-schedule/check.js +6 -15
  79. package/build-module/components/post-schedule/check.js.map +1 -1
  80. package/build-module/components/preferences-modal/enable-panel.js +34 -0
  81. package/build-module/components/preferences-modal/enable-panel.js.map +1 -0
  82. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js +24 -0
  83. package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -0
  84. package/build-module/components/preferences-modal/index.js +179 -0
  85. package/build-module/components/preferences-modal/index.js.map +1 -0
  86. package/build-module/components/provider/disable-non-page-content-blocks.js +1 -4
  87. package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
  88. package/build-module/components/provider/use-block-editor-settings.js +35 -9
  89. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  90. package/build-module/hooks/pattern-partial-syncing.js +12 -8
  91. package/build-module/hooks/pattern-partial-syncing.js.map +1 -1
  92. package/build-module/index.js +1 -0
  93. package/build-module/index.js.map +1 -1
  94. package/build-module/private-apis.js +6 -2
  95. package/build-module/private-apis.js.map +1 -1
  96. package/build-module/store/defaults.js +2 -0
  97. package/build-module/store/defaults.js.map +1 -1
  98. package/build-module/store/private-actions.js +29 -0
  99. package/build-module/store/private-actions.js.map +1 -1
  100. package/build-module/store/private-selectors.js +1 -1
  101. package/build-module/store/private-selectors.js.map +1 -1
  102. package/build-style/style-rtl.css +80 -12
  103. package/build-style/style.css +80 -12
  104. package/package.json +33 -33
  105. package/src/bindings/index.js +13 -0
  106. package/src/bindings/post-meta.js +42 -0
  107. package/src/components/block-manager/category.js +96 -0
  108. package/src/components/block-manager/checklist.js +30 -0
  109. package/src/components/block-manager/index.js +160 -0
  110. package/src/components/block-manager/style.scss +82 -0
  111. package/src/components/document-tools/index.js +9 -1
  112. package/src/components/editor-canvas/index.js +3 -2
  113. package/src/components/editor-notices/index.js +11 -12
  114. package/src/components/editor-notices/style.scss +0 -1
  115. package/src/components/entities-saved-states/entity-type-list.js +47 -5
  116. package/src/components/entities-saved-states/index.js +7 -7
  117. package/src/components/entities-saved-states/style.scss +4 -0
  118. package/src/components/offline-status/index.native.js +2 -4
  119. package/src/components/post-locked-modal/index.js +1 -1
  120. package/src/components/post-locked-modal/style.scss +0 -6
  121. package/src/components/post-saved-state/index.js +30 -47
  122. package/src/components/post-schedule/check.js +10 -14
  123. package/src/components/post-schedule/test/check.js +24 -9
  124. package/src/components/preferences-modal/enable-panel.js +30 -0
  125. package/src/components/preferences-modal/enable-plugin-document-setting-panel.js +23 -0
  126. package/src/components/preferences-modal/index.js +269 -0
  127. package/src/components/preferences-modal/test/index.js +28 -0
  128. package/src/components/provider/disable-non-page-content-blocks.js +3 -3
  129. package/src/components/provider/use-block-editor-settings.js +45 -17
  130. package/src/hooks/pattern-partial-syncing.js +26 -29
  131. package/src/index.js +1 -0
  132. package/src/private-apis.js +6 -2
  133. package/src/store/defaults.js +2 -0
  134. package/src/store/private-actions.js +49 -0
  135. package/src/store/private-selectors.js +1 -1
  136. package/src/style.scss +1 -1
  137. package/src/components/editor-canvas/style.scss +0 -5
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_preferences","_store","PostSavedState","forceIsDirty","forceSavedMessage","setForceSavedMessage","useState","isLargeViewport","useViewportMatch","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","showIconLabels","useSelect","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","editorStore","get","preferencesStore","_links","savePost","useDispatch","wasSaving","usePrevious","useEffect","timeoutId","setTimeout","clearTimeout","label","__","shortLabel","isSaved","isSavedState","isDisabled","text","buttonAccessibleLabel","tooltipProps","undefined","shortcut","displayShortcut","primary","_react","createElement","Tooltip","Button","className","classnames","getAnimateClassName","type","onClick","variant","size","icon","cloudUpload","Icon","check","cloud"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n\tTooltip,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPending,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t\tshowIconLabels,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t} = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPending: 'pending' === getEditedPostAttribute( 'status' ),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\tif ( isPublished || isScheduled ) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\tconst buttonAccessibleLabel = text || label;\n\n\t/**\n\t * The tooltip needs to be enabled only if the button is not disabled. When\n\t * relying on the internal Button tooltip functionality, this causes the\n\t * resulting `button` element to be always removed and re-added to the DOM,\n\t * causing focus loss. An alternative approach to circumvent the issue\n\t * is not to use the `label` and `shortcut` props on `Button` (which would\n\t * trigger the tooltip), and instead manually wrap the `Button` in a separate\n\t * `Tooltip` component.\n\t */\n\tconst tooltipProps = isDisabled\n\t\t? undefined\n\t\t: {\n\t\t\t\ttext: buttonAccessibleLabel,\n\t\t\t\tshortcut: displayShortcut.primary( 's' ),\n\t\t };\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Tooltip { ...tooltipProps }>\n\t\t\t<Button\n\t\t\t\tclassName={\n\t\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t\t? classnames( {\n\t\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t\t } )\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\t\t// Make sure the aria-label has always a value, as the default `text` is undefined on small screens.\n\t\t\t\taria-label={ buttonAccessibleLabel }\n\t\t\t\taria-disabled={ isDisabled }\n\t\t\t>\n\t\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yB,EAAEA,YAAY;MACvC,WAAW,EAAEhC,QAAQ;MACrB,eAAe,EAAEN,YAAY;MAC7B,UAAU,EAAEqC,OAAO;MACnB,CAAE,IAAAgB,yCAAmB,EAAE;QACtBC,IAAI,EAAE;MACP,CAAE,CAAC,GAAIhD;IACP,CAAE,CAAC,GACHqC,SACH;IACDY,OAAO,EAAGhB,UAAU,GAAGI,SAAS,GAAG,MAAMjB,QAAQ,CAAC,CAAG;IACrD8B,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAC,SAAS;IACdC,IAAI,EAAG5D,eAAe,GAAG6C,SAAS,GAAGgB;IACrC;IAAA;IACA,cAAalB,qBAAuB;IACpC,iBAAgBF;EAAY,GAE1BD,YAAY,IAAI,IAAAS,MAAA,CAAAC,aAAA,EAAC3D,MAAA,CAAAuE,IAAI;IAACF,IAAI,EAAGrB,OAAO,GAAGwB,YAAK,GAAGC;EAAO,CAAE,CAAC,EACzDtB,IACK,CACA,CAAC;AAEZ"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_compose","_data","_element","_i18n","_icons","_keycodes","_preferences","_store","PostSavedState","forceIsDirty","forceSavedMessage","setForceSavedMessage","useState","isLargeViewport","useViewportMatch","isAutosaving","isDirty","isNew","isPending","isPublished","isSaveable","isSaving","isScheduled","hasPublishAction","showIconLabels","useSelect","select","_getCurrentPost$_link","isEditedPostNew","isCurrentPostPublished","isCurrentPostScheduled","isEditedPostDirty","isSavingPost","isEditedPostSaveable","getCurrentPost","isAutosavingPost","getEditedPostAttribute","editorStore","get","preferencesStore","_links","savePost","useDispatch","wasSaving","usePrevious","useEffect","timeoutId","setTimeout","clearTimeout","label","__","shortLabel","isSaved","isSavedState","isDisabled","text","_react","createElement","Button","className","classnames","getAnimateClassName","type","undefined","onClick","shortcut","displayShortcut","primary","variant","size","icon","cloudUpload","Icon","check","cloud"],"sources":["@wordpress/editor/src/components/post-saved-state/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__unstableGetAnimateClassName as getAnimateClassName,\n\tButton,\n} from '@wordpress/components';\nimport { usePrevious, useViewportMatch } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, check, cloud, cloudUpload } from '@wordpress/icons';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\n/**\n * Component showing whether the post is saved or not and providing save\n * buttons.\n *\n * @param {Object} props Component props.\n * @param {?boolean} props.forceIsDirty Whether to force the post to be marked\n * as dirty.\n * @return {import('react').ComponentType} The component.\n */\nexport default function PostSavedState( { forceIsDirty } ) {\n\tconst [ forceSavedMessage, setForceSavedMessage ] = useState( false );\n\tconst isLargeViewport = useViewportMatch( 'small' );\n\n\tconst {\n\t\tisAutosaving,\n\t\tisDirty,\n\t\tisNew,\n\t\tisPending,\n\t\tisPublished,\n\t\tisSaveable,\n\t\tisSaving,\n\t\tisScheduled,\n\t\thasPublishAction,\n\t\tshowIconLabels,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisEditedPostNew,\n\t\t\t\tisCurrentPostPublished,\n\t\t\t\tisCurrentPostScheduled,\n\t\t\t\tisEditedPostDirty,\n\t\t\t\tisSavingPost,\n\t\t\t\tisEditedPostSaveable,\n\t\t\t\tgetCurrentPost,\n\t\t\t\tisAutosavingPost,\n\t\t\t\tgetEditedPostAttribute,\n\t\t\t} = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\n\t\t\treturn {\n\t\t\t\tisAutosaving: isAutosavingPost(),\n\t\t\t\tisDirty: forceIsDirty || isEditedPostDirty(),\n\t\t\t\tisNew: isEditedPostNew(),\n\t\t\t\tisPending: 'pending' === getEditedPostAttribute( 'status' ),\n\t\t\t\tisPublished: isCurrentPostPublished(),\n\t\t\t\tisSaving: isSavingPost(),\n\t\t\t\tisSaveable: isEditedPostSaveable(),\n\t\t\t\tisScheduled: isCurrentPostScheduled(),\n\t\t\t\thasPublishAction:\n\t\t\t\t\tgetCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\t\tshowIconLabels: get( 'core', 'showIconLabels' ),\n\t\t\t};\n\t\t},\n\t\t[ forceIsDirty ]\n\t);\n\n\tconst { savePost } = useDispatch( editorStore );\n\n\tconst wasSaving = usePrevious( isSaving );\n\n\tuseEffect( () => {\n\t\tlet timeoutId;\n\n\t\tif ( wasSaving && ! isSaving ) {\n\t\t\tsetForceSavedMessage( true );\n\t\t\ttimeoutId = setTimeout( () => {\n\t\t\t\tsetForceSavedMessage( false );\n\t\t\t}, 1000 );\n\t\t}\n\n\t\treturn () => clearTimeout( timeoutId );\n\t}, [ isSaving ] );\n\n\t// Once the post has been submitted for review this button\n\t// is not needed for the contributor role.\n\tif ( ! hasPublishAction && isPending ) {\n\t\treturn null;\n\t}\n\n\tif ( isPublished || isScheduled ) {\n\t\treturn null;\n\t}\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );\n\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tconst shortLabel = __( 'Save' );\n\n\tconst isSaved = forceSavedMessage || ( ! isNew && ! isDirty );\n\tconst isSavedState = isSaving || isSaved;\n\tconst isDisabled = isSaving || isSaved || ! isSaveable;\n\n\tlet text;\n\n\tif ( isSaving ) {\n\t\ttext = isAutosaving ? __( 'Autosaving' ) : __( 'Saving' );\n\t} else if ( isSaved ) {\n\t\ttext = __( 'Saved' );\n\t} else if ( isLargeViewport ) {\n\t\ttext = label;\n\t} else if ( showIconLabels ) {\n\t\ttext = shortLabel;\n\t}\n\n\t// Use common Button instance for all saved states so that focus is not\n\t// lost.\n\treturn (\n\t\t<Button\n\t\t\tclassName={\n\t\t\t\tisSaveable || isSaving\n\t\t\t\t\t? classnames( {\n\t\t\t\t\t\t\t'editor-post-save-draft': ! isSavedState,\n\t\t\t\t\t\t\t'editor-post-saved-state': isSavedState,\n\t\t\t\t\t\t\t'is-saving': isSaving,\n\t\t\t\t\t\t\t'is-autosaving': isAutosaving,\n\t\t\t\t\t\t\t'is-saved': isSaved,\n\t\t\t\t\t\t\t[ getAnimateClassName( {\n\t\t\t\t\t\t\t\ttype: 'loading',\n\t\t\t\t\t\t\t} ) ]: isSaving,\n\t\t\t\t\t } )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\tonClick={ isDisabled ? undefined : () => savePost() }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\tvariant=\"tertiary\"\n\t\t\tsize=\"compact\"\n\t\t\ticon={ isLargeViewport ? undefined : cloudUpload }\n\t\t\tlabel={ text || label }\n\t\t\taria-disabled={ isDisabled }\n\t\t>\n\t\t\t{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }\n\t\t\t{ text }\n\t\t</Button>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASU,cAAcA,CAAE;EAAEC;AAAa,CA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AC,MAAM,IAAKrC,eAAe,EAAG;IAC7B0C,IAAI,GAAGN,KAAK;EACb,CAAC,MAAM,IAAKzB,cAAc,EAAG;IAC5B+B,IAAI,GAAGJ,UAAU;EAClB;;EAEA;EACA;EACA,OACC,IAAAK,MAAA,CAAAC,aAAA,EAAC1D,WAAA,CAAA2D,MAAM;IACNC,SAAS,EACRvC,UAAU,IAAIC,QAAQ,GACnB,IAAAuC,mBAAU,EAAE;MACZ,wBAAwB,EAAE,CAAEP,YAAY;MACxC,yBAAyB,EAAEA,YAAY;MACvC,WAAW,EAAEhC,QAAQ;MACrB,eAAe,EAAEN,YAAY;MAC7B,UAAU,EAAEqC,OAAO;MACnB,CAAE,IAAAS,yCAAmB,EAAE;QACtBC,IAAI,EAAE;MACP,CAAE,CAAC,GAAIzC;IACP,CAAE,CAAC,GACH0C,SACH;IACDC,OAAO,EAAGV,UAAU,GAAGS,SAAS,GAAG,MAAMtB,QAAQ,CAAC;IAClD;AACH;AACA;AACA,OAHG;IAIAwB,QAAQ,EAAGX,UAAU,GAAGS,SAAS,GAAGG,yBAAe,CAACC,OAAO,CAAE,GAAI,CAAG;IACpEC,OAAO,EAAC,UAAU;IAClBC,IAAI,EAAC,SAAS;IACdC,IAAI,EAAGzD,eAAe,GAAGkD,SAAS,GAAGQ,kBAAa;IAClDtB,KAAK,EAAGM,IAAI,IAAIN,KAAO;IACvB,iBAAgBK;EAAY,GAE1BD,YAAY,IAAI,IAAAG,MAAA,CAAAC,aAAA,EAACrD,MAAA,CAAAoE,IAAI;IAACF,IAAI,EAAGlB,OAAO,GAAGqB,YAAK,GAAGC;EAAO,CAAE,CAAC,EACzDnB,IACK,CAAC;AAEX"}
@@ -3,9 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PostScheduleCheck = PostScheduleCheck;
7
- exports.default = void 0;
8
- var _compose = require("@wordpress/compose");
6
+ exports.default = PostScheduleCheck;
9
7
  var _data = require("@wordpress/data");
10
8
  var _store = require("../../store");
11
9
  /**
@@ -17,24 +15,15 @@ var _store = require("../../store");
17
15
  */
18
16
 
19
17
  function PostScheduleCheck({
20
- hasPublishAction,
21
18
  children
22
19
  }) {
20
+ const hasPublishAction = (0, _data.useSelect)(select => {
21
+ var _select$getCurrentPos;
22
+ return (_select$getCurrentPos = select(_store.store).getCurrentPost()._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false;
23
+ }, []);
23
24
  if (!hasPublishAction) {
24
25
  return null;
25
26
  }
26
27
  return children;
27
28
  }
28
- var _default = (0, _compose.compose)([(0, _data.withSelect)(select => {
29
- var _getCurrentPost$_link;
30
- const {
31
- getCurrentPost,
32
- getCurrentPostType
33
- } = select(_store.store);
34
- return {
35
- hasPublishAction: (_getCurrentPost$_link = getCurrentPost()._links?.['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
36
- postType: getCurrentPostType()
37
- };
38
- })])(PostScheduleCheck);
39
- exports.default = _default;
40
29
  //# sourceMappingURL=check.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_compose","require","_data","_store","PostScheduleCheck","hasPublishAction","children","_default","compose","withSelect","select","_getCurrentPost$_link","getCurrentPost","getCurrentPostType","editorStore","_links","postType","exports","default"],"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostScheduleCheck( { hasPublishAction, children } ) {\n\tif ( ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostScheduleCheck );\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGO,SAASG,iBAAiBA,CAAE;EAAEC,gBAAgB;EAAEC;AAAS,CAAC,EAAG;EACnE,IAAK,CAAED,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OAAOC,QAAQ;AAChB;AAAC,IAAAC,QAAA,GAEc,IAAAC,gBAAO,EAAE,CACvB,IAAAC,gBAAU,EAAIC,MAAM,IAAM;EAAA,IAAAC,qBAAA;EACzB,MAAM;IAAEC,cAAc;IAAEC;EAAmB,CAAC,GAAGH,MAAM,CAAEI,YAAY,CAAC;EACpE,OAAO;IACNT,gBAAgB,GAAAM,qBAAA,GACfC,cAAc,CAAC,CAAC,CAACG,MAAM,GAAI,mBAAmB,CAAE,cAAAJ,qBAAA,cAAAA,qBAAA,GAAI,KAAK;IAC1DK,QAAQ,EAAEH,kBAAkB,CAAC;EAC9B,CAAC;AACF,CAAE,CAAC,CACF,CAAC,CAAET,iBAAkB,CAAC;AAAAa,OAAA,CAAAC,OAAA,GAAAX,QAAA"}
1
+ {"version":3,"names":["_data","require","_store","PostScheduleCheck","children","hasPublishAction","useSelect","select","_select$getCurrentPos","editorStore","getCurrentPost","_links"],"sources":["@wordpress/editor/src/components/post-schedule/check.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport default function PostScheduleCheck( { children } ) {\n\tconst hasPublishAction = useSelect( ( select ) => {\n\t\treturn (\n\t\t\tselect( editorStore ).getCurrentPost()._links?.[\n\t\t\t\t'wp:action-publish'\n\t\t\t] ?? false\n\t\t);\n\t}, [] );\n\n\tif ( ! hasPublishAction ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGe,SAASE,iBAAiBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACzD,MAAMC,gBAAgB,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IACjD,QAAAA,qBAAA,GACCD,MAAM,CAAEE,YAAY,CAAC,CAACC,cAAc,CAAC,CAAC,CAACC,MAAM,GAC5C,mBAAmB,CACnB,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,KAAK;EAEZ,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEH,gBAAgB,EAAG;IACzB,OAAO,IAAI;EACZ;EAEA,OAAOD,QAAQ;AAChB"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _compose = require("@wordpress/compose");
8
+ var _data = require("@wordpress/data");
9
+ var _preferences = require("@wordpress/preferences");
10
+ var _lockUnlock = require("../../lock-unlock");
11
+ var _store = require("../../store");
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ const {
21
+ PreferenceBaseOption
22
+ } = (0, _lockUnlock.unlock)(_preferences.privateApis);
23
+ var _default = (0, _compose.compose)((0, _data.withSelect)((select, {
24
+ panelName
25
+ }) => {
26
+ const {
27
+ isEditorPanelEnabled,
28
+ isEditorPanelRemoved
29
+ } = select(_store.store);
30
+ return {
31
+ isRemoved: isEditorPanelRemoved(panelName),
32
+ isChecked: isEditorPanelEnabled(panelName)
33
+ };
34
+ }), (0, _compose.ifCondition)(({
35
+ isRemoved
36
+ }) => !isRemoved), (0, _data.withDispatch)((dispatch, {
37
+ panelName
38
+ }) => ({
39
+ onChange: () => dispatch(_store.store).toggleEditorPanelEnabled(panelName)
40
+ })))(PreferenceBaseOption);
41
+ exports.default = _default;
42
+ //# sourceMappingURL=enable-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_compose","require","_data","_preferences","_lockUnlock","_store","PreferenceBaseOption","unlock","preferencesPrivateApis","_default","compose","withSelect","select","panelName","isEditorPanelEnabled","isEditorPanelRemoved","editorStore","isRemoved","isChecked","ifCondition","withDispatch","dispatch","onChange","toggleEditorPanelEnabled","exports","default"],"sources":["@wordpress/editor/src/components/preferences-modal/enable-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose, ifCondition } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editorStore } from '../../store';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nexport default compose(\n\twithSelect( ( select, { panelName } ) => {\n\t\tconst { isEditorPanelEnabled, isEditorPanelRemoved } =\n\t\t\tselect( editorStore );\n\t\treturn {\n\t\t\tisRemoved: isEditorPanelRemoved( panelName ),\n\t\t\tisChecked: isEditorPanelEnabled( panelName ),\n\t\t};\n\t} ),\n\tifCondition( ( { isRemoved } ) => ! isRemoved ),\n\twithDispatch( ( dispatch, { panelName } ) => ( {\n\t\tonChange: () =>\n\t\t\tdispatch( editorStore ).toggleEditorPanelEnabled( panelName ),\n\t} ) )\n)( PreferenceBaseOption );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAKA;AACA;AACA;;AAIA,MAAM;EAAEK;AAAqB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAAC,IAAAC,QAAA,GAEnD,IAAAC,gBAAO,EACrB,IAAAC,gBAAU,EAAE,CAAEC,MAAM,EAAE;EAAEC;AAAU,CAAC,KAAM;EACxC,MAAM;IAAEC,oBAAoB;IAAEC;EAAqB,CAAC,GACnDH,MAAM,CAAEI,YAAY,CAAC;EACtB,OAAO;IACNC,SAAS,EAAEF,oBAAoB,CAAEF,SAAU,CAAC;IAC5CK,SAAS,EAAEJ,oBAAoB,CAAED,SAAU;EAC5C,CAAC;AACF,CAAE,CAAC,EACH,IAAAM,oBAAW,EAAE,CAAE;EAAEF;AAAU,CAAC,KAAM,CAAEA,SAAU,CAAC,EAC/C,IAAAG,kBAAY,EAAE,CAAEC,QAAQ,EAAE;EAAER;AAAU,CAAC,MAAQ;EAC9CS,QAAQ,EAAEA,CAAA,KACTD,QAAQ,CAAEL,YAAY,CAAC,CAACO,wBAAwB,CAAEV,SAAU;AAC9D,CAAC,CAAG,CACL,CAAC,CAAEP,oBAAqB,CAAC;AAAAkB,OAAA,CAAAC,OAAA,GAAAhB,QAAA"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = require("react");
9
+ var _components = require("@wordpress/components");
10
+ var _enablePanel = _interopRequireDefault(require("./enable-panel"));
11
+ /**
12
+ * WordPress dependencies
13
+ */
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+
19
+ const {
20
+ Fill,
21
+ Slot
22
+ } = (0, _components.createSlotFill)('EnablePluginDocumentSettingPanelOption');
23
+ const EnablePluginDocumentSettingPanelOption = ({
24
+ label,
25
+ panelName
26
+ }) => (0, _react.createElement)(Fill, null, (0, _react.createElement)(_enablePanel.default, {
27
+ label: label,
28
+ panelName: panelName
29
+ }));
30
+ EnablePluginDocumentSettingPanelOption.Slot = Slot;
31
+ var _default = EnablePluginDocumentSettingPanelOption;
32
+ exports.default = _default;
33
+ //# sourceMappingURL=enable-plugin-document-setting-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_enablePanel","_interopRequireDefault","Fill","Slot","createSlotFill","EnablePluginDocumentSettingPanelOption","label","panelName","_react","createElement","default","_default","exports"],"sources":["@wordpress/editor/src/components/preferences-modal/enable-plugin-document-setting-panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport EnablePanelOption from './enable-panel';\n\nconst { Fill, Slot } = createSlotFill(\n\t'EnablePluginDocumentSettingPanelOption'\n);\n\nconst EnablePluginDocumentSettingPanelOption = ( { label, panelName } ) => (\n\t<Fill>\n\t\t<EnablePanelOption label={ label } panelName={ panelName } />\n\t</Fill>\n);\n\nEnablePluginDocumentSettingPanelOption.Slot = Slot;\n\nexport default EnablePluginDocumentSettingPanelOption;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAM;EAAEG,IAAI;EAAEC;AAAK,CAAC,GAAG,IAAAC,0BAAc,EACpC,wCACD,CAAC;AAED,MAAMC,sCAAsC,GAAGA,CAAE;EAAEC,KAAK;EAAEC;AAAU,CAAC,KACpE,IAAAC,MAAA,CAAAC,aAAA,EAACP,IAAI,QACJ,IAAAM,MAAA,CAAAC,aAAA,EAACT,YAAA,CAAAU,OAAiB;EAACJ,KAAK,EAAGA,KAAO;EAACC,SAAS,EAAGA;AAAW,CAAE,CACvD,CACN;AAEDF,sCAAsC,CAACF,IAAI,GAAGA,IAAI;AAAC,IAAAQ,QAAA,GAEpCN,sCAAsC;AAAAO,OAAA,CAAAF,OAAA,GAAAC,QAAA"}
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = EditorPreferencesModal;
8
+ var _react = require("react");
9
+ var _i18n = require("@wordpress/i18n");
10
+ var _compose = require("@wordpress/compose");
11
+ var _data = require("@wordpress/data");
12
+ var _element = require("@wordpress/element");
13
+ var _preferences = require("@wordpress/preferences");
14
+ var _enablePanel = _interopRequireDefault(require("./enable-panel"));
15
+ var _enablePluginDocumentSettingPanel = _interopRequireDefault(require("./enable-plugin-document-setting-panel"));
16
+ var _blockManager = _interopRequireDefault(require("../block-manager"));
17
+ var _postTaxonomies = _interopRequireDefault(require("../post-taxonomies"));
18
+ var _check = _interopRequireDefault(require("../post-featured-image/check"));
19
+ var _check2 = _interopRequireDefault(require("../post-excerpt/check"));
20
+ var _check3 = _interopRequireDefault(require("../page-attributes/check"));
21
+ var _postTypeSupportCheck = _interopRequireDefault(require("../post-type-support-check"));
22
+ var _store = require("../../store");
23
+ var _lockUnlock = require("../../lock-unlock");
24
+ /**
25
+ * WordPress dependencies
26
+ */
27
+
28
+ /**
29
+ * Internal dependencies
30
+ */
31
+
32
+ const {
33
+ PreferencesModal,
34
+ PreferencesModalTabs,
35
+ PreferencesModalSection,
36
+ PreferenceToggleControl
37
+ } = (0, _lockUnlock.unlock)(_preferences.privateApis);
38
+ function EditorPreferencesModal({
39
+ extraSections = {},
40
+ isActive,
41
+ onClose
42
+ }) {
43
+ const isLargeViewport = (0, _compose.useViewportMatch)('medium');
44
+ const {
45
+ showBlockBreadcrumbsOption
46
+ } = (0, _data.useSelect)(select => {
47
+ const {
48
+ getEditorSettings
49
+ } = select(_store.store);
50
+ const {
51
+ get
52
+ } = select(_preferences.store);
53
+ const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
54
+ const isDistractionFreeEnabled = get('core', 'distractionFree');
55
+ return {
56
+ showBlockBreadcrumbsOption: !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled
57
+ };
58
+ }, [isLargeViewport]);
59
+ const {
60
+ setIsListViewOpened,
61
+ setIsInserterOpened
62
+ } = (0, _data.useDispatch)(_store.store);
63
+ const {
64
+ set: setPreference
65
+ } = (0, _data.useDispatch)(_preferences.store);
66
+ const toggleDistractionFree = () => {
67
+ setPreference('core', 'fixedToolbar', true);
68
+ setIsInserterOpened(false);
69
+ setIsListViewOpened(false);
70
+ // Todo: Check sidebar when closing/opening distraction free.
71
+ };
72
+
73
+ const turnOffDistractionFree = () => {
74
+ setPreference('core', 'distractionFree', false);
75
+ };
76
+ const sections = (0, _element.useMemo)(() => [{
77
+ name: 'general',
78
+ tabLabel: (0, _i18n.__)('General'),
79
+ content: (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(PreferencesModalSection, {
80
+ title: (0, _i18n.__)('Interface')
81
+ }, (0, _react.createElement)(PreferenceToggleControl, {
82
+ scope: "core",
83
+ featureName: "showListViewByDefault",
84
+ help: (0, _i18n.__)('Opens the block list view sidebar by default.'),
85
+ label: (0, _i18n.__)('Always open list view')
86
+ }), showBlockBreadcrumbsOption && (0, _react.createElement)(PreferenceToggleControl, {
87
+ scope: "core",
88
+ featureName: "showBlockBreadcrumbs",
89
+ help: (0, _i18n.__)('Display the block hierarchy trail at the bottom of the editor.'),
90
+ label: (0, _i18n.__)('Show block breadcrumbs')
91
+ }), (0, _react.createElement)(PreferenceToggleControl, {
92
+ scope: "core",
93
+ featureName: "allowRightClickOverrides",
94
+ help: (0, _i18n.__)('Allows contextual list view menus via right-click, overriding browser defaults.'),
95
+ label: (0, _i18n.__)('Allow right-click contextual menus')
96
+ })), (0, _react.createElement)(PreferencesModalSection, {
97
+ title: (0, _i18n.__)('Document settings'),
98
+ description: (0, _i18n.__)('Select what settings are shown in the document panel.')
99
+ }, (0, _react.createElement)(_enablePluginDocumentSettingPanel.default.Slot, null), (0, _react.createElement)(_postTaxonomies.default, {
100
+ taxonomyWrapper: (content, taxonomy) => (0, _react.createElement)(_enablePanel.default, {
101
+ label: taxonomy.labels.menu_name,
102
+ panelName: `taxonomy-panel-${taxonomy.slug}`
103
+ })
104
+ }), (0, _react.createElement)(_check.default, null, (0, _react.createElement)(_enablePanel.default, {
105
+ label: (0, _i18n.__)('Featured image'),
106
+ panelName: "featured-image"
107
+ })), (0, _react.createElement)(_check2.default, null, (0, _react.createElement)(_enablePanel.default, {
108
+ label: (0, _i18n.__)('Excerpt'),
109
+ panelName: "post-excerpt"
110
+ })), (0, _react.createElement)(_postTypeSupportCheck.default, {
111
+ supportKeys: ['comments', 'trackbacks']
112
+ }, (0, _react.createElement)(_enablePanel.default, {
113
+ label: (0, _i18n.__)('Discussion'),
114
+ panelName: "discussion-panel"
115
+ })), (0, _react.createElement)(_check3.default, null, (0, _react.createElement)(_enablePanel.default, {
116
+ label: (0, _i18n.__)('Page attributes'),
117
+ panelName: "page-attributes"
118
+ }))), extraSections?.general)
119
+ }, {
120
+ name: 'appearance',
121
+ tabLabel: (0, _i18n.__)('Appearance'),
122
+ content: (0, _react.createElement)(PreferencesModalSection, {
123
+ title: (0, _i18n.__)('Appearance'),
124
+ description: (0, _i18n.__)('Customize the editor interface to suit your needs.')
125
+ }, (0, _react.createElement)(PreferenceToggleControl, {
126
+ scope: "core",
127
+ featureName: "fixedToolbar",
128
+ onToggle: turnOffDistractionFree,
129
+ help: (0, _i18n.__)('Access all block and document tools in a single place.'),
130
+ label: (0, _i18n.__)('Top toolbar')
131
+ }), (0, _react.createElement)(PreferenceToggleControl, {
132
+ scope: "core",
133
+ featureName: "distractionFree",
134
+ onToggle: toggleDistractionFree,
135
+ help: (0, _i18n.__)('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'),
136
+ label: (0, _i18n.__)('Distraction free')
137
+ }), (0, _react.createElement)(PreferenceToggleControl, {
138
+ scope: "core",
139
+ featureName: "focusMode",
140
+ help: (0, _i18n.__)('Highlights the current block and fades other content.'),
141
+ label: (0, _i18n.__)('Spotlight mode')
142
+ }), extraSections?.appearance)
143
+ }, {
144
+ name: 'accessibility',
145
+ tabLabel: (0, _i18n.__)('Accessibility'),
146
+ content: (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(PreferencesModalSection, {
147
+ title: (0, _i18n.__)('Navigation'),
148
+ description: (0, _i18n.__)('Optimize the editing experience for enhanced control.')
149
+ }, (0, _react.createElement)(PreferenceToggleControl, {
150
+ scope: "core",
151
+ featureName: "keepCaretInsideBlock",
152
+ help: (0, _i18n.__)('Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'),
153
+ label: (0, _i18n.__)('Contain text cursor inside block')
154
+ })), (0, _react.createElement)(PreferencesModalSection, {
155
+ title: (0, _i18n.__)('Interface')
156
+ }, (0, _react.createElement)(PreferenceToggleControl, {
157
+ scope: "core",
158
+ featureName: "showIconLabels",
159
+ label: (0, _i18n.__)('Show button text labels'),
160
+ help: (0, _i18n.__)('Show text instead of icons on buttons across the interface.')
161
+ })))
162
+ }, {
163
+ name: 'blocks',
164
+ tabLabel: (0, _i18n.__)('Blocks'),
165
+ content: (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(PreferencesModalSection, {
166
+ title: (0, _i18n.__)('Inserter')
167
+ }, (0, _react.createElement)(PreferenceToggleControl, {
168
+ scope: "core",
169
+ featureName: "mostUsedBlocks",
170
+ help: (0, _i18n.__)('Adds a category with the most frequently used blocks in the inserter.'),
171
+ label: (0, _i18n.__)('Show most used blocks')
172
+ })), (0, _react.createElement)(PreferencesModalSection, {
173
+ title: (0, _i18n.__)('Manage block visibility'),
174
+ description: (0, _i18n.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.")
175
+ }, (0, _react.createElement)(_blockManager.default, null)))
176
+ }], [isLargeViewport, showBlockBreadcrumbsOption, extraSections]);
177
+ if (!isActive) {
178
+ return null;
179
+ }
180
+ return (0, _react.createElement)(PreferencesModal, {
181
+ closeModal: onClose
182
+ }, (0, _react.createElement)(PreferencesModalTabs, {
183
+ sections: sections
184
+ }));
185
+ }
186
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_compose","_data","_element","_preferences","_enablePanel","_interopRequireDefault","_enablePluginDocumentSettingPanel","_blockManager","_postTaxonomies","_check","_check2","_check3","_postTypeSupportCheck","_store","_lockUnlock","PreferencesModal","PreferencesModalTabs","PreferencesModalSection","PreferenceToggleControl","unlock","preferencesPrivateApis","EditorPreferencesModal","extraSections","isActive","onClose","isLargeViewport","useViewportMatch","showBlockBreadcrumbsOption","useSelect","select","getEditorSettings","editorStore","get","preferencesStore","isRichEditingEnabled","richEditingEnabled","isDistractionFreeEnabled","setIsListViewOpened","setIsInserterOpened","useDispatch","set","setPreference","toggleDistractionFree","turnOffDistractionFree","sections","useMemo","name","tabLabel","__","content","_react","createElement","Fragment","title","scope","featureName","help","label","description","default","Slot","taxonomyWrapper","taxonomy","labels","menu_name","panelName","slug","supportKeys","general","onToggle","appearance","closeModal"],"sources":["@wordpress/editor/src/components/preferences-modal/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { __ } from '@wordpress/i18n';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport {\n\tstore as preferencesStore,\n\tprivateApis as preferencesPrivateApis,\n} from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnablePanelOption from './enable-panel';\nimport EnablePluginDocumentSettingPanelOption from './enable-plugin-document-setting-panel';\nimport BlockManager from '../block-manager';\nimport PostTaxonomies from '../post-taxonomies';\nimport PostFeaturedImageCheck from '../post-featured-image/check';\nimport PostExcerptCheck from '../post-excerpt/check';\nimport PageAttributesCheck from '../page-attributes/check';\nimport PostTypeSupportCheck from '../post-type-support-check';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst {\n\tPreferencesModal,\n\tPreferencesModalTabs,\n\tPreferencesModalSection,\n\tPreferenceToggleControl,\n} = unlock( preferencesPrivateApis );\n\nexport default function EditorPreferencesModal( {\n\textraSections = {},\n\tisActive,\n\tonClose,\n} ) {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { showBlockBreadcrumbsOption } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst isRichEditingEnabled = getEditorSettings().richEditingEnabled;\n\t\t\tconst isDistractionFreeEnabled = get( 'core', 'distractionFree' );\n\t\t\treturn {\n\t\t\t\tshowBlockBreadcrumbsOption:\n\t\t\t\t\t! isDistractionFreeEnabled &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisRichEditingEnabled,\n\t\t\t};\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\n\tconst { setIsListViewOpened, setIsInserterOpened } =\n\t\tuseDispatch( editorStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst toggleDistractionFree = () => {\n\t\tsetPreference( 'core', 'fixedToolbar', true );\n\t\tsetIsInserterOpened( false );\n\t\tsetIsListViewOpened( false );\n\t\t// Todo: Check sidebar when closing/opening distraction free.\n\t};\n\n\tconst turnOffDistractionFree = () => {\n\t\tsetPreference( 'core', 'distractionFree', false );\n\t};\n\n\tconst sections = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tname: 'general',\n\t\t\t\ttabLabel: __( 'General' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"showListViewByDefault\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Opens the block list view sidebar by default.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Always open list view' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ showBlockBreadcrumbsOption && (\n\t\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\t\tfeatureName=\"showBlockBreadcrumbs\"\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Display the block hierarchy trail at the bottom of the editor.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Show block breadcrumbs' ) }\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<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"allowRightClickOverrides\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Allows contextual list view menus via right-click, overriding browser defaults.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Allow right-click contextual menus'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Document settings' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Select what settings are shown in the document panel.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EnablePluginDocumentSettingPanelOption.Slot />\n\t\t\t\t\t\t\t<PostTaxonomies\n\t\t\t\t\t\t\t\ttaxonomyWrapper={ ( content, taxonomy ) => (\n\t\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\t\tlabel={ taxonomy.labels.menu_name }\n\t\t\t\t\t\t\t\t\t\tpanelName={ `taxonomy-panel-${ taxonomy.slug }` }\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<PostFeaturedImageCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Featured image' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"featured-image\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostFeaturedImageCheck>\n\t\t\t\t\t\t\t<PostExcerptCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Excerpt' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"post-excerpt\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostExcerptCheck>\n\t\t\t\t\t\t\t<PostTypeSupportCheck\n\t\t\t\t\t\t\t\tsupportKeys={ [ 'comments', 'trackbacks' ] }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Discussion' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"discussion-panel\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PostTypeSupportCheck>\n\t\t\t\t\t\t\t<PageAttributesCheck>\n\t\t\t\t\t\t\t\t<EnablePanelOption\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Page attributes' ) }\n\t\t\t\t\t\t\t\t\tpanelName=\"page-attributes\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PageAttributesCheck>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t{ extraSections?.general }\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'appearance',\n\t\t\t\ttabLabel: __( 'Appearance' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\ttitle={ __( 'Appearance' ) }\n\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t'Customize the editor interface to suit your needs.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"fixedToolbar\"\n\t\t\t\t\t\t\tonToggle={ turnOffDistractionFree }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Access all block and document tools in a single place.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"distractionFree\"\n\t\t\t\t\t\t\tonToggle={ toggleDistractionFree }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Distraction free' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\tfeatureName=\"focusMode\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Highlights the current block and fades other content.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ extraSections?.appearance }\n\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'accessibility',\n\t\t\t\ttabLabel: __( 'Accessibility' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t'Optimize the editing experience for enhanced control.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"keepCaretInsideBlock\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t'Contain text cursor inside block'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"showIconLabels\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Show button text labels' ) }\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Show text instead of icons on buttons across the interface.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'blocks',\n\t\t\t\ttabLabel: __( 'Blocks' ),\n\t\t\t\tcontent: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Inserter' ) }>\n\t\t\t\t\t\t\t<PreferenceToggleControl\n\t\t\t\t\t\t\t\tscope=\"core\"\n\t\t\t\t\t\t\t\tfeatureName=\"mostUsedBlocks\"\n\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t'Adds a category with the most frequently used blocks in the inserter.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tlabel={ __( 'Show most used blocks' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\ttitle={ __( 'Manage block visibility' ) }\n\t\t\t\t\t\t\tdescription={ __(\n\t\t\t\t\t\t\t\t\"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.\"\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockManager />\n\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t],\n\t\t[ isLargeViewport, showBlockBreadcrumbsOption, extraSections ]\n\t);\n\n\tif ( ! isActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModal closeModal={ onClose }>\n\t\t\t<PreferencesModalTabs sections={ sections } />\n\t\t</PreferencesModal>\n\t);\n}\n"],"mappings":";;;;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAQA,IAAAK,YAAA,GAAAC,sBAAA,CAAAN,OAAA;AACA,IAAAO,iCAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,aAAA,GAAAF,sBAAA,CAAAN,OAAA;AACA,IAAAS,eAAA,GAAAH,sBAAA,CAAAN,OAAA;AACA,IAAAU,MAAA,GAAAJ,sBAAA,CAAAN,OAAA;AACA,IAAAW,OAAA,GAAAL,sBAAA,CAAAN,OAAA;AACA,IAAAY,OAAA,GAAAN,sBAAA,CAAAN,OAAA;AACA,IAAAa,qBAAA,GAAAP,sBAAA,CAAAN,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AAzBA;AACA;AACA;;AAWA;AACA;AACA;;AAYA,MAAM;EACLgB,gBAAgB;EAChBC,oBAAoB;EACpBC,uBAAuB;EACvBC;AACD,CAAC,GAAG,IAAAC,kBAAM,E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ElC,eAAe,EAAEE,0BAA0B,EAAEL,aAAa,CAC7D,CAAC;EAED,IAAK,CAAEC,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EAEA,OACC,IAAA2B,MAAA,CAAAC,aAAA,EAACpC,gBAAgB;IAACwD,UAAU,EAAG/C;EAAS,GACvC,IAAA0B,MAAA,CAAAC,aAAA,EAACnC,oBAAoB;IAAC4B,QAAQ,EAAGA;EAAU,CAAE,CAC5B,CAAC;AAErB"}
@@ -48,10 +48,7 @@ function DisableBlock({
48
48
  function DisableNonPageContentBlocks() {
49
49
  (0, _blockEditor.useBlockEditingMode)('disabled');
50
50
  const clientIds = (0, _data.useSelect)(select => {
51
- const {
52
- __experimentalGetGlobalBlocksByName
53
- } = select(_blockEditor.store);
54
- return __experimentalGetGlobalBlocksByName(_constants.PAGE_CONTENT_BLOCK_TYPES);
51
+ return select(_blockEditor.store).getBlocksByName(_constants.PAGE_CONTENT_BLOCK_TYPES);
55
52
  }, []);
56
53
  return clientIds.map(clientId => {
57
54
  return (0, _react.createElement)(DisableBlock, {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blockEditor","_element","_constants","DisableBlock","clientId","isDescendentOfQueryLoop","useSelect","select","getBlockParentsByBlockName","blockEditorStore","length","mode","undefined","setBlockEditingMode","unsetBlockEditingMode","useDispatch","useEffect","DisableNonPageContentBlocks","useBlockEditingMode","clientIds","__experimentalGetGlobalBlocksByName","PAGE_CONTENT_BLOCK_TYPES","map","_react","createElement","key"],"sources":["@wordpress/editor/src/components/provider/disable-non-page-content-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseBlockEditingMode,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { PAGE_CONTENT_BLOCK_TYPES } from './constants';\n\nfunction DisableBlock( { clientId } ) {\n\tconst isDescendentOfQueryLoop = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName } = select( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/query' ).length !==\n\t\t\t\t0\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst mode = isDescendentOfQueryLoop ? undefined : 'contentOnly';\n\tconst { setBlockEditingMode, unsetBlockEditingMode } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\tif ( mode ) {\n\t\t\tsetBlockEditingMode( clientId, mode );\n\t\t\treturn () => {\n\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t};\n\t\t}\n\t}, [ clientId, mode, setBlockEditingMode, unsetBlockEditingMode ] );\n}\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\tuseBlockEditingMode( 'disabled' );\n\tconst clientIds = useSelect( ( select ) => {\n\t\tconst { __experimentalGetGlobalBlocksByName } =\n\t\t\tselect( blockEditorStore );\n\t\treturn __experimentalGetGlobalBlocksByName( PAGE_CONTENT_BLOCK_TYPES );\n\t}, [] );\n\n\treturn clientIds.map( ( clientId ) => {\n\t\treturn <DisableBlock key={ clientId } clientId={ clientId } />;\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASI,YAAYA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACrC,MAAMC,uBAAuB,GAAG,IAAAC,eAAS,EACtCC,MAAM,IAAM;IACb,MAAM;MAAEC;IAA2B,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IACjE,OACCD,0BAA0B,CAAEJ,QAAQ,EAAE,YAAa,CAAC,CAACM,MAAM,KAC3D,CAAC;EAEH,CAAC,EACD,CAAEN,QAAQ,CACX,CAAC;EACD,MAAMO,IAAI,GAAGN,uBAAuB,GAAGO,SAAS,GAAG,aAAa;EAChE,MAAM;IAAEC,mBAAmB;IAAEC;EAAsB,CAAC,GACnD,IAAAC,iBAAW,EAAEN,kBAAiB,CAAC;EAChC,IAAAO,kBAAS,EAAE,MAAM;IAChB,IAAKL,IAAI,EAAG;MACXE,mBAAmB,CAAET,QAAQ,EAAEO,IAAK,CAAC;MACrC,OAAO,MAAM;QACZG,qBAAqB,CAAEV,QAAS,CAAC;MAClC,CAAC;IACF;EACD,CAAC,EAAE,CAAEA,QAAQ,EAAEO,IAAI,EAAEE,mBAAmB,EAAEC,qBAAqB,CAAG,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACe,SAASG,2BAA2BA,CAAA,EAAG;EACrD,IAAAC,gCAAmB,EAAE,UAAW,CAAC;EACjC,MAAMC,SAAS,GAAG,IAAAb,eAAS,EAAIC,MAAM,IAAM;IAC1C,MAAM;MAAEa;IAAoC,CAAC,GAC5Cb,MAAM,CAAEE,kBAAiB,CAAC;IAC3B,OAAOW,mCAAmC,CAAEC,mCAAyB,CAAC;EACvE,CAAC,EAAE,EAAG,CAAC;EAEP,OAAOF,SAAS,CAACG,GAAG,CAAIlB,QAAQ,IAAM;IACrC,OAAO,IAAAmB,MAAA,CAAAC,aAAA,EAACrB,YAAY;MAACsB,GAAG,EAAGrB,QAAU;MAACA,QAAQ,EAAGA;IAAU,CAAE,CAAC;EAC/D,CAAE,CAAC;AACJ"}
1
+ {"version":3,"names":["_data","require","_blockEditor","_element","_constants","DisableBlock","clientId","isDescendentOfQueryLoop","useSelect","select","getBlockParentsByBlockName","blockEditorStore","length","mode","undefined","setBlockEditingMode","unsetBlockEditingMode","useDispatch","useEffect","DisableNonPageContentBlocks","useBlockEditingMode","clientIds","getBlocksByName","PAGE_CONTENT_BLOCK_TYPES","map","_react","createElement","key"],"sources":["@wordpress/editor/src/components/provider/disable-non-page-content-blocks.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseBlockEditingMode,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { PAGE_CONTENT_BLOCK_TYPES } from './constants';\n\nfunction DisableBlock( { clientId } ) {\n\tconst isDescendentOfQueryLoop = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName } = select( blockEditorStore );\n\t\t\treturn (\n\t\t\t\tgetBlockParentsByBlockName( clientId, 'core/query' ).length !==\n\t\t\t\t0\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst mode = isDescendentOfQueryLoop ? undefined : 'contentOnly';\n\tconst { setBlockEditingMode, unsetBlockEditingMode } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\tif ( mode ) {\n\t\t\tsetBlockEditingMode( clientId, mode );\n\t\t\treturn () => {\n\t\t\t\tunsetBlockEditingMode( clientId );\n\t\t\t};\n\t\t}\n\t}, [ clientId, mode, setBlockEditingMode, unsetBlockEditingMode ] );\n}\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\tuseBlockEditingMode( 'disabled' );\n\tconst clientIds = useSelect( ( select ) => {\n\t\treturn select( blockEditorStore ).getBlocksByName(\n\t\t\tPAGE_CONTENT_BLOCK_TYPES\n\t\t);\n\t}, [] );\n\n\treturn clientIds.map( ( clientId ) => {\n\t\treturn <DisableBlock key={ clientId } clientId={ clientId } />;\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AAbA;AACA;AACA;;AAQA;AACA;AACA;;AAGA,SAASI,YAAYA,CAAE;EAAEC;AAAS,CAAC,EAAG;EACrC,MAAMC,uBAAuB,GAAG,IAAAC,eAAS,EACtCC,MAAM,IAAM;IACb,MAAM;MAAEC;IAA2B,CAAC,GAAGD,MAAM,CAAEE,kBAAiB,CAAC;IACjE,OACCD,0BAA0B,CAAEJ,QAAQ,EAAE,YAAa,CAAC,CAACM,MAAM,KAC3D,CAAC;EAEH,CAAC,EACD,CAAEN,QAAQ,CACX,CAAC;EACD,MAAMO,IAAI,GAAGN,uBAAuB,GAAGO,SAAS,GAAG,aAAa;EAChE,MAAM;IAAEC,mBAAmB;IAAEC;EAAsB,CAAC,GACnD,IAAAC,iBAAW,EAAEN,kBAAiB,CAAC;EAChC,IAAAO,kBAAS,EAAE,MAAM;IAChB,IAAKL,IAAI,EAAG;MACXE,mBAAmB,CAAET,QAAQ,EAAEO,IAAK,CAAC;MACrC,OAAO,MAAM;QACZG,qBAAqB,CAAEV,QAAS,CAAC;MAClC,CAAC;IACF;EACD,CAAC,EAAE,CAAEA,QAAQ,EAAEO,IAAI,EAAEE,mBAAmB,EAAEC,qBAAqB,CAAG,CAAC;AACpE;;AAEA;AACA;AACA;AACA;AACe,SAASG,2BAA2BA,CAAA,EAAG;EACrD,IAAAC,gCAAmB,EAAE,UAAW,CAAC;EACjC,MAAMC,SAAS,GAAG,IAAAb,eAAS,EAAIC,MAAM,IAAM;IAC1C,OAAOA,MAAM,CAAEE,kBAAiB,CAAC,CAACW,eAAe,CAChDC,mCACD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,OAAOF,SAAS,CAACG,GAAG,CAAIlB,QAAQ,IAAM;IACrC,OAAO,IAAAmB,MAAA,CAAAC,aAAA,EAACrB,YAAY;MAACsB,GAAG,EAAGrB,QAAU;MAACA,QAAQ,EAAGA;IAAU,CAAE,CAAC;EAC/D,CAAE,CAAC;AACJ"}
@@ -11,6 +11,7 @@ var _coreData = require("@wordpress/core-data");
11
11
  var _i18n = require("@wordpress/i18n");
12
12
  var _preferences = require("@wordpress/preferences");
13
13
  var _compose = require("@wordpress/compose");
14
+ var _blocks = require("@wordpress/blocks");
14
15
  var _mediaCategories = _interopRequireDefault(require("../media-categories"));
15
16
  var _utils = require("../../utils");
16
17
  var _store = require("../../store");
@@ -23,7 +24,7 @@ var _store = require("../../store");
23
24
  */
24
25
 
25
26
  const EMPTY_BLOCKS_LIST = [];
26
- const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'getPostLinkProps', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
27
+ const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__unstableGalleryWithImageBlocks', 'alignWide', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'fontSizes', 'gradients', 'generateAnchors', 'getPostLinkProps', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme', '__experimentalArchiveTitleTypeLabel', '__experimentalArchiveTitleNameLabel'];
27
28
 
28
29
  /**
29
30
  * React hook used to compute the block editor settings to use for the post editor.
@@ -39,18 +40,19 @@ function useBlockEditorSettings(settings, postType, postId) {
39
40
  const isLargeViewport = (0, _compose.useViewportMatch)('medium');
40
41
  const {
41
42
  allowRightClickOverrides,
43
+ blockTypes,
42
44
  focusMode,
43
45
  hasFixedToolbar,
44
46
  isDistractionFree,
45
47
  keepCaretInsideBlock,
46
48
  reusableBlocks,
47
49
  hasUploadPermissions,
50
+ hiddenBlockTypes,
48
51
  canUseUnfilteredHTML,
49
52
  userCanCreatePages,
50
53
  pageOnFront,
51
54
  pageForPosts,
52
55
  userPatternCategories,
53
- restBlockPatterns,
54
56
  restBlockPatternCategories
55
57
  } = (0, _data.useSelect)(select => {
56
58
  var _canUser;
@@ -61,18 +63,22 @@ function useBlockEditorSettings(settings, postType, postId) {
61
63
  getEntityRecord,
62
64
  getUserPatternCategories,
63
65
  getEntityRecords,
64
- getBlockPatterns,
65
66
  getBlockPatternCategories
66
67
  } = select(_coreData.store);
67
68
  const {
68
69
  get
69
70
  } = select(_preferences.store);
71
+ const {
72
+ getBlockTypes
73
+ } = select(_blocks.store);
70
74
  const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined;
71
75
  return {
72
76
  allowRightClickOverrides: get('core', 'allowRightClickOverrides'),
77
+ blockTypes: getBlockTypes(),
73
78
  canUseUnfilteredHTML: getRawEntityRecord('postType', postType, postId)?._links?.hasOwnProperty('wp:action-unfiltered-html'),
74
79
  focusMode: get('core', 'focusMode'),
75
80
  hasFixedToolbar: get('core', 'fixedToolbar') || !isLargeViewport,
81
+ hiddenBlockTypes: get('core', 'hiddenBlockTypes'),
76
82
  isDistractionFree: get('core', 'distractionFree'),
77
83
  keepCaretInsideBlock: get('core', 'keepCaretInsideBlock'),
78
84
  reusableBlocks: isWeb ? getEntityRecords('postType', 'wp_block', {
@@ -84,7 +90,6 @@ function useBlockEditorSettings(settings, postType, postId) {
84
90
  pageOnFront: siteSettings?.page_on_front,
85
91
  pageForPosts: siteSettings?.page_for_posts,
86
92
  userPatternCategories: getUserPatternCategories(),
87
- restBlockPatterns: getBlockPatterns(),
88
93
  restBlockPatternCategories: getBlockPatternCategories()
89
94
  };
90
95
  }, [postType, postId, isLargeViewport]);
@@ -95,11 +100,11 @@ function useBlockEditorSettings(settings, postType, postId) {
95
100
  // WP 6.0
96
101
  settings.__experimentalBlockPatternCategories; // WP 5.9
97
102
 
98
- const blockPatterns = (0, _element.useMemo)(() => [...(settingsBlockPatterns || []), ...(restBlockPatterns || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)).filter(({
103
+ const blockPatterns = (0, _element.useMemo)(() => [...(settingsBlockPatterns || [])].filter(({
99
104
  postTypes
100
105
  }) => {
101
106
  return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType);
102
- }), [settingsBlockPatterns, restBlockPatterns, postType]);
107
+ }), [settingsBlockPatterns, postType]);
103
108
  const blockPatternCategories = (0, _element.useMemo)(() => [...(settingsBlockPatternCategories || []), ...(restBlockPatternCategories || [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name)), [settingsBlockPatternCategories, restBlockPatternCategories]);
104
109
  const {
105
110
  undo,
@@ -124,17 +129,38 @@ function useBlockEditorSettings(settings, postType, postId) {
124
129
  }
125
130
  return saveEntityRecord('postType', 'page', options);
126
131
  }, [saveEntityRecord, userCanCreatePages]);
132
+ const allowedBlockTypes = (0, _element.useMemo)(() => {
133
+ // Omit hidden block types if exists and non-empty.
134
+ if (hiddenBlockTypes && hiddenBlockTypes.length > 0) {
135
+ // Defer to passed setting for `allowedBlockTypes` if provided as
136
+ // anything other than `true` (where `true` is equivalent to allow
137
+ // all block types).
138
+ const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({
139
+ name
140
+ }) => name) : settings.allowedBlockTypes || [];
141
+ return defaultAllowedBlockTypes.filter(type => !hiddenBlockTypes.includes(type));
142
+ }
143
+ return settings.allowedBlockTypes;
144
+ }, [settings.allowedBlockTypes, hiddenBlockTypes, blockTypes]);
127
145
  const forceDisableFocusMode = settings.focusMode === false;
128
146
  return (0, _element.useMemo)(() => ({
129
147
  ...Object.fromEntries(Object.entries(settings).filter(([key]) => BLOCK_EDITOR_SETTINGS.includes(key))),
148
+ allowedBlockTypes,
130
149
  allowRightClickOverrides,
131
150
  focusMode: focusMode && !forceDisableFocusMode,
132
151
  hasFixedToolbar,
133
152
  isDistractionFree,
134
153
  keepCaretInsideBlock,
135
154
  mediaUpload: hasUploadPermissions ? _utils.mediaUpload : undefined,
136
- __experimentalReusableBlocks: reusableBlocks,
137
155
  __experimentalBlockPatterns: blockPatterns,
156
+ __experimentalFetchBlockPatterns: async () => {
157
+ return (await (0, _coreData.fetchBlockPatterns)()).filter(({
158
+ postTypes
159
+ }) => {
160
+ return !postTypes || Array.isArray(postTypes) && postTypes.includes(postType);
161
+ });
162
+ },
163
+ __experimentalReusableBlocks: reusableBlocks,
138
164
  __experimentalBlockPatternCategories: blockPatternCategories,
139
165
  __experimentalUserPatternCategories: userPatternCategories,
140
166
  __experimentalFetchLinkSuggestions: (search, searchOptions) => (0, _coreData.__experimentalFetchLinkSuggestions)(search, searchOptions, settings),
@@ -157,7 +183,7 @@ function useBlockEditorSettings(settings, postType, postId) {
157
183
  templateLock: postType === 'wp_navigation' ? 'insert' : settings.templateLock,
158
184
  template: postType === 'wp_navigation' ? [['core/navigation', {}, []]] : settings.template,
159
185
  __experimentalSetIsInserterOpened: setIsInserterOpened
160
- }), [allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened]);
186
+ }), [allowedBlockTypes, allowRightClickOverrides, focusMode, forceDisableFocusMode, hasFixedToolbar, isDistractionFree, keepCaretInsideBlock, settings, hasUploadPermissions, reusableBlocks, userPatternCategories, blockPatterns, blockPatternCategories, canUseUnfilteredHTML, undo, createPageEntity, userCanCreatePages, pageOnFront, pageForPosts, postType, setIsInserterOpened]);
161
187
  }
162
188
  var _default = useBlockEditorSettings;
163
189
  exports.default = _default;