@wordpress/edit-post 7.26.1-next.79a6196f.0 → 7.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 (124) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/build/components/header/index.js +2 -2
  3. package/build/components/header/index.js.map +1 -1
  4. package/build/components/meta-boxes/index.js +3 -2
  5. package/build/components/meta-boxes/index.js.map +1 -1
  6. package/build/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -2
  7. package/build/components/preferences-modal/enable-custom-fields.js.map +1 -0
  8. package/build/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +11 -2
  9. package/build/components/preferences-modal/enable-panel.js.map +1 -0
  10. package/build/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +11 -2
  11. package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  12. package/build/components/preferences-modal/index.js +31 -149
  13. package/build/components/preferences-modal/index.js.map +1 -1
  14. package/build/components/preferences-modal/meta-boxes-section.js +11 -5
  15. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  16. package/build/components/sidebar/plugin-document-setting-panel/index.js +5 -2
  17. package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  18. package/build/editor.js +3 -26
  19. package/build/editor.js.map +1 -1
  20. package/build/editor.native.js +4 -28
  21. package/build/editor.native.js.map +1 -1
  22. package/build/hooks/commands/use-common-commands.js +48 -8
  23. package/build/hooks/commands/use-common-commands.js.map +1 -1
  24. package/build/index.js +2 -2
  25. package/build/index.js.map +1 -1
  26. package/build/index.native.js +1 -1
  27. package/build/index.native.js.map +1 -1
  28. package/build/store/actions.js +11 -10
  29. package/build/store/actions.js.map +1 -1
  30. package/build/store/selectors.js +24 -6
  31. package/build/store/selectors.js.map +1 -1
  32. package/build-module/components/header/index.js +2 -2
  33. package/build-module/components/header/index.js.map +1 -1
  34. package/build-module/components/meta-boxes/index.js +3 -2
  35. package/build-module/components/meta-boxes/index.js.map +1 -1
  36. package/build-module/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -2
  37. package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -0
  38. package/build-module/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +10 -2
  39. package/build-module/components/preferences-modal/enable-panel.js.map +1 -0
  40. package/build-module/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +10 -2
  41. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
  42. package/build-module/components/preferences-modal/index.js +31 -150
  43. package/build-module/components/preferences-modal/index.js.map +1 -1
  44. package/build-module/components/preferences-modal/meta-boxes-section.js +7 -2
  45. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  46. package/build-module/components/sidebar/plugin-document-setting-panel/index.js +5 -2
  47. package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
  48. package/build-module/editor.js +3 -26
  49. package/build-module/editor.js.map +1 -1
  50. package/build-module/editor.native.js +5 -29
  51. package/build-module/editor.native.js.map +1 -1
  52. package/build-module/hooks/commands/use-common-commands.js +49 -9
  53. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  54. package/build-module/index.js +2 -2
  55. package/build-module/index.js.map +1 -1
  56. package/build-module/index.native.js +1 -1
  57. package/build-module/index.native.js.map +1 -1
  58. package/build-module/store/actions.js +11 -10
  59. package/build-module/store/actions.js.map +1 -1
  60. package/build-module/store/selectors.js +24 -6
  61. package/build-module/store/selectors.js.map +1 -1
  62. package/build-style/classic-rtl.css +1 -1
  63. package/build-style/classic.css +1 -1
  64. package/build-style/style-rtl.css +16 -182
  65. package/build-style/style.css +16 -182
  66. package/package.json +32 -32
  67. package/src/components/header/index.js +2 -4
  68. package/src/components/header/style.scss +13 -4
  69. package/src/components/meta-boxes/index.js +4 -2
  70. package/src/components/preferences-modal/{options/enable-custom-fields.js → enable-custom-fields.js} +10 -3
  71. package/src/components/preferences-modal/{options/enable-panel.js → enable-panel.js} +9 -2
  72. package/src/components/preferences-modal/{options/enable-publish-sidebar.js → enable-publish-sidebar.js} +9 -2
  73. package/src/components/preferences-modal/index.js +44 -267
  74. package/src/components/preferences-modal/meta-boxes-section.js +6 -2
  75. package/src/components/preferences-modal/{options/test → test}/__snapshots__/enable-custom-fields.js.snap +4 -4
  76. package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +18 -18
  77. package/src/components/sidebar/plugin-document-setting-panel/index.js +6 -2
  78. package/src/editor.js +55 -85
  79. package/src/editor.native.js +4 -33
  80. package/src/hooks/commands/use-common-commands.js +77 -7
  81. package/src/index.js +2 -2
  82. package/src/index.native.js +1 -1
  83. package/src/store/actions.js +14 -33
  84. package/src/store/selectors.js +52 -26
  85. package/src/store/test/actions.js +9 -9
  86. package/src/style.scss +0 -1
  87. package/build/components/block-manager/category.js +0 -105
  88. package/build/components/block-manager/category.js.map +0 -1
  89. package/build/components/block-manager/checklist.js +0 -35
  90. package/build/components/block-manager/checklist.js.map +0 -1
  91. package/build/components/block-manager/index.js +0 -127
  92. package/build/components/block-manager/index.js.map +0 -1
  93. package/build/components/preferences-modal/options/enable-custom-fields.js.map +0 -1
  94. package/build/components/preferences-modal/options/enable-feature.js +0 -36
  95. package/build/components/preferences-modal/options/enable-feature.js.map +0 -1
  96. package/build/components/preferences-modal/options/enable-panel.js.map +0 -1
  97. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -32
  98. package/build/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +0 -1
  99. package/build/components/preferences-modal/options/enable-publish-sidebar.js.map +0 -1
  100. package/build/components/preferences-modal/options/index.js +0 -42
  101. package/build/components/preferences-modal/options/index.js.map +0 -1
  102. package/build-module/components/block-manager/category.js +0 -96
  103. package/build-module/components/block-manager/category.js.map +0 -1
  104. package/build-module/components/block-manager/checklist.js +0 -27
  105. package/build-module/components/block-manager/checklist.js.map +0 -1
  106. package/build-module/components/block-manager/index.js +0 -118
  107. package/build-module/components/block-manager/index.js.map +0 -1
  108. package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +0 -1
  109. package/build-module/components/preferences-modal/options/enable-feature.js +0 -29
  110. package/build-module/components/preferences-modal/options/enable-feature.js.map +0 -1
  111. package/build-module/components/preferences-modal/options/enable-panel.js.map +0 -1
  112. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -24
  113. package/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js.map +0 -1
  114. package/build-module/components/preferences-modal/options/enable-publish-sidebar.js.map +0 -1
  115. package/build-module/components/preferences-modal/options/index.js +0 -6
  116. package/build-module/components/preferences-modal/options/index.js.map +0 -1
  117. package/src/components/block-manager/category.js +0 -94
  118. package/src/components/block-manager/checklist.js +0 -30
  119. package/src/components/block-manager/index.js +0 -158
  120. package/src/components/block-manager/style.scss +0 -82
  121. package/src/components/preferences-modal/options/enable-feature.js +0 -31
  122. package/src/components/preferences-modal/options/enable-plugin-document-setting-panel.js +0 -23
  123. package/src/components/preferences-modal/options/index.js +0 -5
  124. /package/src/components/preferences-modal/{options/test → test}/enable-custom-fields.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useState","__","Button","withSelect","store","editorStore","privateApis","preferencesPrivateApis","getPathAndQueryString","unlock","PreferenceBaseOption","submitCustomFieldsForm","customFieldsForm","document","getElementById","querySelector","setAttribute","window","location","href","submit","CustomFieldsConfirmation","willEnable","isReloading","setIsReloading","createElement","Fragment","className","variant","isBusy","disabled","onClick","EnableCustomFieldsOption","label","areCustomFieldsEnabled","isChecked","setIsChecked","onChange","select","getEditorSettings","enableCustomFields"],"sources":["@wordpress/edit-post/src/components/preferences-modal/enable-custom-fields.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { getPathAndQueryString } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nfunction submitCustomFieldsForm() {\n\tconst customFieldsForm = document.getElementById(\n\t\t'toggle-custom-fields-form'\n\t);\n\n\t// Ensure the referrer values is up to update with any\n\tcustomFieldsForm\n\t\t.querySelector( '[name=\"_wp_http_referer\"]' )\n\t\t.setAttribute( 'value', getPathAndQueryString( window.location.href ) );\n\n\tcustomFieldsForm.submit();\n}\n\nexport function CustomFieldsConfirmation( { willEnable } ) {\n\tconst [ isReloading, setIsReloading ] = useState( false );\n\treturn (\n\t\t<>\n\t\t\t<p className=\"edit-post-preferences-modal__custom-fields-confirmation-message\">\n\t\t\t\t{ __(\n\t\t\t\t\t'A page reload is required for this change. Make sure your content is saved before reloading.'\n\t\t\t\t) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-preferences-modal__custom-fields-confirmation-button\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tisBusy={ isReloading }\n\t\t\t\tdisabled={ isReloading }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsReloading( true );\n\t\t\t\t\tsubmitCustomFieldsForm();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ willEnable\n\t\t\t\t\t? __( 'Show & Reload Page' )\n\t\t\t\t\t: __( 'Hide & Reload Page' ) }\n\t\t\t</Button>\n\t\t</>\n\t);\n}\n\nexport function EnableCustomFieldsOption( { label, areCustomFieldsEnabled } ) {\n\tconst [ isChecked, setIsChecked ] = useState( areCustomFieldsEnabled );\n\n\treturn (\n\t\t<PreferenceBaseOption\n\t\t\tlabel={ label }\n\t\t\tisChecked={ isChecked }\n\t\t\tonChange={ setIsChecked }\n\t\t>\n\t\t\t{ isChecked !== areCustomFieldsEnabled && (\n\t\t\t\t<CustomFieldsConfirmation willEnable={ isChecked } />\n\t\t\t) }\n\t\t</PreferenceBaseOption>\n\t);\n}\n\nexport default withSelect( ( select ) => ( {\n\tareCustomFieldsEnabled:\n\t\t!! select( editorStore ).getEditorSettings().enableCustomFields,\n} ) )( EnableCustomFieldsOption );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;AAC9E,SAASC,qBAAqB,QAAQ,gBAAgB;;AAEtD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAqB,CAAC,GAAGD,MAAM,CAAEF,sBAAuB,CAAC;AAEjE,SAASI,sBAAsBA,CAAA,EAAG;EACjC,MAAMC,gBAAgB,GAAGC,QAAQ,CAACC,cAAc,CAC/C,2BACD,CAAC;;EAED;EACAF,gBAAgB,CACdG,aAAa,CAAE,2BAA4B,CAAC,CAC5CC,YAAY,CAAE,OAAO,EAAER,qBAAqB,CAAES,MAAM,CAACC,QAAQ,CAACC,IAAK,CAAE,CAAC;EAExEP,gBAAgB,CAACQ,MAAM,CAAC,CAAC;AAC1B;AAEA,OAAO,SAASC,wBAAwBA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC1D,MAAM,CAAEC,WAAW,EAAEC,cAAc,CAAE,GAAGxB,QAAQ,CAAE,KAAM,CAAC;EACzD,OACCyB,aAAA,CAAAC,QAAA,QACCD,aAAA;IAAGE,SAAS,EAAC;EAAiE,GAC3E1B,EAAE,CACH,8FACD,CACE,CAAC,EACJwB,aAAA,CAACvB,MAAM;IACNyB,SAAS,EAAC,gEAAgE;IAC1EC,OAAO,EAAC,WAAW;IACnBC,MAAM,EAAGN,WAAa;IACtBO,QAAQ,EAAGP,WAAa;IACxBQ,OAAO,EAAGA,CAAA,KAAM;MACfP,cAAc,CAAE,IAAK,CAAC;MACtBb,sBAAsB,CAAC,CAAC;IACzB;EAAG,GAEDW,UAAU,GACTrB,EAAE,CAAE,oBAAqB,CAAC,GAC1BA,EAAE,CAAE,oBAAqB,CACrB,CACP,CAAC;AAEL;AAEA,OAAO,SAAS+B,wBAAwBA,CAAE;EAAEC,KAAK;EAAEC;AAAuB,CAAC,EAAG;EAC7E,MAAM,CAAEC,SAAS,EAAEC,YAAY,CAAE,GAAGpC,QAAQ,CAAEkC,sBAAuB,CAAC;EAEtE,OACCT,aAAA,CAACf,oBAAoB;IACpBuB,KAAK,EAAGA,KAAO;IACfE,SAAS,EAAGA,SAAW;IACvBE,QAAQ,EAAGD;EAAc,GAEvBD,SAAS,KAAKD,sBAAsB,IACrCT,aAAA,CAACJ,wBAAwB;IAACC,UAAU,EAAGa;EAAW,CAAE,CAEhC,CAAC;AAEzB;AAEA,eAAehC,UAAU,CAAImC,MAAM,KAAQ;EAC1CJ,sBAAsB,EACrB,CAAC,CAAEI,MAAM,CAAEjC,WAAY,CAAC,CAACkC,iBAAiB,CAAC,CAAC,CAACC;AAC/C,CAAC,CAAG,CAAC,CAAER,wBAAyB,CAAC"}
@@ -3,8 +3,16 @@
3
3
  */
4
4
  import { compose, ifCondition } from '@wordpress/compose';
5
5
  import { withSelect, withDispatch } from '@wordpress/data';
6
- import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
7
6
  import { store as editorStore } from '@wordpress/editor';
7
+ import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { unlock } from '../../lock-unlock';
13
+ const {
14
+ PreferenceBaseOption
15
+ } = unlock(preferencesPrivateApis);
8
16
  export default compose(withSelect((select, {
9
17
  panelName
10
18
  }) => {
@@ -22,5 +30,5 @@ export default compose(withSelect((select, {
22
30
  panelName
23
31
  }) => ({
24
32
  onChange: () => dispatch(editorStore).toggleEditorPanelEnabled(panelName)
25
- })))(BaseOption);
33
+ })))(PreferenceBaseOption);
26
34
  //# sourceMappingURL=enable-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["compose","ifCondition","withSelect","withDispatch","store","editorStore","privateApis","preferencesPrivateApis","unlock","PreferenceBaseOption","select","panelName","isEditorPanelEnabled","isEditorPanelRemoved","isRemoved","isChecked","dispatch","onChange","toggleEditorPanelEnabled"],"sources":["@wordpress/edit-post/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 { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\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":"AAAA;AACA;AACA;AACA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;;AAE9E;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAqB,CAAC,GAAGD,MAAM,CAAED,sBAAuB,CAAC;AAEjE,eAAeP,OAAO,CACrBE,UAAU,CAAE,CAAEQ,MAAM,EAAE;EAAEC;AAAU,CAAC,KAAM;EACxC,MAAM;IAAEC,oBAAoB;IAAEC;EAAqB,CAAC,GACnDH,MAAM,CAAEL,WAAY,CAAC;EACtB,OAAO;IACNS,SAAS,EAAED,oBAAoB,CAAEF,SAAU,CAAC;IAC5CI,SAAS,EAAEH,oBAAoB,CAAED,SAAU;EAC5C,CAAC;AACF,CAAE,CAAC,EACHV,WAAW,CAAE,CAAE;EAAEa;AAAU,CAAC,KAAM,CAAEA,SAAU,CAAC,EAC/CX,YAAY,CAAE,CAAEa,QAAQ,EAAE;EAAEL;AAAU,CAAC,MAAQ;EAC9CM,QAAQ,EAAEA,CAAA,KACTD,QAAQ,CAAEX,WAAY,CAAC,CAACa,wBAAwB,CAAEP,SAAU;AAC9D,CAAC,CAAG,CACL,CAAC,CAAEF,oBAAqB,CAAC"}
@@ -5,7 +5,15 @@ import { compose } from '@wordpress/compose';
5
5
  import { withSelect, withDispatch } from '@wordpress/data';
6
6
  import { ifViewportMatches } from '@wordpress/viewport';
7
7
  import { store as editorStore } from '@wordpress/editor';
8
- import { ___unstablePreferencesModalBaseOption as BaseOption } from '@wordpress/interface';
8
+ import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { unlock } from '../../lock-unlock';
14
+ const {
15
+ PreferenceBaseOption
16
+ } = unlock(preferencesPrivateApis);
9
17
  export default compose(withSelect(select => ({
10
18
  isChecked: select(editorStore).isPublishSidebarEnabled()
11
19
  })), withDispatch(dispatch => {
@@ -19,5 +27,5 @@ export default compose(withSelect(select => ({
19
27
  }),
20
28
  // In < medium viewports we override this option and always show the publish sidebar.
21
29
  // See the edit-post's header component for the specific logic.
22
- ifViewportMatches('medium'))(BaseOption);
30
+ ifViewportMatches('medium'))(PreferenceBaseOption);
23
31
  //# sourceMappingURL=enable-publish-sidebar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["compose","withSelect","withDispatch","ifViewportMatches","store","editorStore","privateApis","preferencesPrivateApis","unlock","PreferenceBaseOption","select","isChecked","isPublishSidebarEnabled","dispatch","enablePublishSidebar","disablePublishSidebar","onChange","isEnabled"],"sources":["@wordpress/edit-post/src/components/preferences-modal/enable-publish-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect, withDispatch } from '@wordpress/data';\nimport { ifViewportMatches } from '@wordpress/viewport';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferenceBaseOption } = unlock( preferencesPrivateApis );\n\nexport default compose(\n\twithSelect( ( select ) => ( {\n\t\tisChecked: select( editorStore ).isPublishSidebarEnabled(),\n\t} ) ),\n\twithDispatch( ( dispatch ) => {\n\t\tconst { enablePublishSidebar, disablePublishSidebar } =\n\t\t\tdispatch( editorStore );\n\t\treturn {\n\t\t\tonChange: ( isEnabled ) =>\n\t\t\t\tisEnabled ? enablePublishSidebar() : disablePublishSidebar(),\n\t\t};\n\t} ),\n\t// In < medium viewports we override this option and always show the publish sidebar.\n\t// See the edit-post's header component for the specific logic.\n\tifViewportMatches( 'medium' )\n)( PreferenceBaseOption );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;;AAE9E;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAqB,CAAC,GAAGD,MAAM,CAAED,sBAAuB,CAAC;AAEjE,eAAeP,OAAO,CACrBC,UAAU,CAAIS,MAAM,KAAQ;EAC3BC,SAAS,EAAED,MAAM,CAAEL,WAAY,CAAC,CAACO,uBAAuB,CAAC;AAC1D,CAAC,CAAG,CAAC,EACLV,YAAY,CAAIW,QAAQ,IAAM;EAC7B,MAAM;IAAEC,oBAAoB;IAAEC;EAAsB,CAAC,GACpDF,QAAQ,CAAER,WAAY,CAAC;EACxB,OAAO;IACNW,QAAQ,EAAIC,SAAS,IACpBA,SAAS,GAAGH,oBAAoB,CAAC,CAAC,GAAGC,qBAAqB,CAAC;EAC7D,CAAC;AACF,CAAE,CAAC;AACH;AACA;AACAZ,iBAAiB,CAAE,QAAS,CAC7B,CAAC,CAAEM,oBAAqB,CAAC"}
@@ -6,179 +6,60 @@ import { createElement, Fragment } from "react";
6
6
  import { __ } from '@wordpress/i18n';
7
7
  import { useViewportMatch } from '@wordpress/compose';
8
8
  import { useSelect, useDispatch } from '@wordpress/data';
9
- import { useMemo } from '@wordpress/element';
10
- import { PostTaxonomies, PostExcerptCheck, PageAttributesCheck, PostFeaturedImageCheck, PostTypeSupportCheck, store as editorStore } from '@wordpress/editor';
11
- import { PreferencesModal, PreferencesModalTabs, PreferencesModalSection, store as interfaceStore } from '@wordpress/interface';
12
- import { store as preferencesStore } from '@wordpress/preferences';
9
+ import { store as interfaceStore } from '@wordpress/interface';
10
+ import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
11
+ import { privateApis as editorPrivateApis } from '@wordpress/editor';
13
12
 
14
13
  /**
15
14
  * Internal dependencies
16
15
  */
17
-
18
- import { EnablePluginDocumentSettingPanelOption, EnablePublishSidebarOption, EnablePanelOption, EnableFeature } from './options';
16
+ import { unlock } from '../../lock-unlock';
19
17
  import MetaBoxesSection from './meta-boxes-section';
20
- import { store as editPostStore } from '../../store';
21
- import BlockManager from '../block-manager';
18
+ import EnablePublishSidebarOption from './enable-publish-sidebar';
19
+ const {
20
+ PreferencesModalSection,
21
+ PreferenceToggleControl
22
+ } = unlock(preferencesPrivateApis);
23
+ const {
24
+ PreferencesModal
25
+ } = unlock(editorPrivateApis);
22
26
  export const PREFERENCES_MODAL_NAME = 'edit-post/preferences';
23
27
  export default function EditPostPreferencesModal() {
24
28
  const isLargeViewport = useViewportMatch('medium');
25
29
  const {
26
30
  closeModal
27
31
  } = useDispatch(interfaceStore);
28
- const [isModalActive, showBlockBreadcrumbsOption] = useSelect(select => {
29
- const {
30
- getEditorSettings
31
- } = select(editorStore);
32
- const {
33
- getEditorMode
34
- } = select(editPostStore);
35
- const {
36
- get
37
- } = select(preferencesStore);
38
- const modalActive = select(interfaceStore).isModalActive(PREFERENCES_MODAL_NAME);
39
- const mode = getEditorMode();
40
- const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
41
- const isDistractionFreeEnabled = get('core', 'distractionFree');
42
- return [modalActive, !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled && mode === 'visual', isDistractionFreeEnabled];
43
- }, [isLargeViewport]);
44
- const {
45
- closeGeneralSidebar
46
- } = useDispatch(editPostStore);
47
- const {
48
- setIsListViewOpened,
49
- setIsInserterOpened
50
- } = useDispatch(editorStore);
51
32
  const {
52
- set: setPreference
53
- } = useDispatch(preferencesStore);
54
- const toggleDistractionFree = () => {
55
- setPreference('core', 'fixedToolbar', true);
56
- setIsInserterOpened(false);
57
- setIsListViewOpened(false);
58
- closeGeneralSidebar();
59
- };
60
- const turnOffDistractionFree = () => {
61
- setPreference('core', 'distractionFree', false);
62
- };
63
- const sections = useMemo(() => [{
64
- name: 'general',
65
- tabLabel: __('General'),
66
- content: createElement(Fragment, null, isLargeViewport && createElement(PreferencesModalSection, {
33
+ isModalActive
34
+ } = useSelect(select => {
35
+ const modalActive = select(interfaceStore).isModalActive(PREFERENCES_MODAL_NAME);
36
+ return {
37
+ isModalActive: modalActive
38
+ };
39
+ }, []);
40
+ const extraSections = {
41
+ general: createElement(Fragment, null, isLargeViewport && createElement(PreferencesModalSection, {
67
42
  title: __('Publishing')
68
43
  }, createElement(EnablePublishSidebarOption, {
69
44
  help: __('Review settings, such as visibility and tags.'),
70
45
  label: __('Enable pre-publish checks')
71
- })), createElement(PreferencesModalSection, {
72
- title: __('Interface')
73
- }, createElement(EnableFeature, {
74
- scope: "core",
75
- featureName: "showListViewByDefault",
76
- help: __('Opens the block list view sidebar by default.'),
77
- label: __('Always open list view')
78
- }), showBlockBreadcrumbsOption && createElement(EnableFeature, {
79
- scope: "core",
80
- featureName: "showBlockBreadcrumbs",
81
- help: __('Display the block hierarchy trail at the bottom of the editor.'),
82
- label: __('Show block breadcrumbs')
83
- }), createElement(EnableFeature, {
84
- scope: "core",
85
- featureName: "allowRightClickOverrides",
86
- help: __('Allows contextual list view menus via right-click, overriding browser defaults.'),
87
- label: __('Allow right-click contextual menus')
88
- })), createElement(PreferencesModalSection, {
89
- title: __('Document settings'),
90
- description: __('Select what settings are shown in the document panel.')
91
- }, createElement(EnablePluginDocumentSettingPanelOption.Slot, null), createElement(PostTaxonomies, {
92
- taxonomyWrapper: (content, taxonomy) => createElement(EnablePanelOption, {
93
- label: taxonomy.labels.menu_name,
94
- panelName: `taxonomy-panel-${taxonomy.slug}`
95
- })
96
- }), createElement(PostFeaturedImageCheck, null, createElement(EnablePanelOption, {
97
- label: __('Featured image'),
98
- panelName: "featured-image"
99
- })), createElement(PostExcerptCheck, null, createElement(EnablePanelOption, {
100
- label: __('Excerpt'),
101
- panelName: "post-excerpt"
102
- })), createElement(PostTypeSupportCheck, {
103
- supportKeys: ['comments', 'trackbacks']
104
- }, createElement(EnablePanelOption, {
105
- label: __('Discussion'),
106
- panelName: "discussion-panel"
107
- })), createElement(PageAttributesCheck, null, createElement(EnablePanelOption, {
108
- label: __('Page attributes'),
109
- panelName: "page-attributes"
110
- }))), createElement(MetaBoxesSection, {
46
+ })), createElement(MetaBoxesSection, {
111
47
  title: __('Advanced')
112
- }))
113
- }, {
114
- name: 'appearance',
115
- tabLabel: __('Appearance'),
116
- content: createElement(PreferencesModalSection, {
117
- title: __('Appearance'),
118
- description: __('Customize the editor interface to suit your needs.')
119
- }, createElement(EnableFeature, {
120
- scope: "core",
121
- featureName: "fixedToolbar",
122
- onToggle: turnOffDistractionFree,
123
- help: __('Access all block and document tools in a single place.'),
124
- label: __('Top toolbar')
125
- }), createElement(EnableFeature, {
126
- scope: "core",
127
- featureName: "distractionFree",
128
- onToggle: toggleDistractionFree,
129
- help: __('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'),
130
- label: __('Distraction free')
131
- }), createElement(EnableFeature, {
132
- scope: "core",
133
- featureName: "focusMode",
134
- help: __('Highlights the current block and fades other content.'),
135
- label: __('Spotlight mode')
136
- }), createElement(EnableFeature, {
48
+ })),
49
+ appearance: createElement(PreferenceToggleControl, {
50
+ scope: "core/edit-post",
137
51
  featureName: "themeStyles",
138
52
  help: __('Make the editor look like your theme.'),
139
53
  label: __('Use theme styles')
140
- }))
141
- }, {
142
- name: 'accessibility',
143
- tabLabel: __('Accessibility'),
144
- content: createElement(Fragment, null, createElement(PreferencesModalSection, {
145
- title: __('Navigation'),
146
- description: __('Optimize the editing experience for enhanced control.')
147
- }, createElement(EnableFeature, {
148
- scope: "core",
149
- featureName: "keepCaretInsideBlock",
150
- help: __('Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'),
151
- label: __('Contain text cursor inside block')
152
- })), createElement(PreferencesModalSection, {
153
- title: __('Interface')
154
- }, createElement(EnableFeature, {
155
- scope: "core",
156
- featureName: "showIconLabels",
157
- label: __('Show button text labels'),
158
- help: __('Show text instead of icons on buttons across the interface.')
159
- })))
160
- }, {
161
- name: 'blocks',
162
- tabLabel: __('Blocks'),
163
- content: createElement(Fragment, null, createElement(PreferencesModalSection, {
164
- title: __('Inserter')
165
- }, createElement(EnableFeature, {
166
- scope: "core",
167
- featureName: "mostUsedBlocks",
168
- help: __('Adds a category with the most frequently used blocks in the inserter.'),
169
- label: __('Show most used blocks')
170
- })), createElement(PreferencesModalSection, {
171
- title: __('Manage block visibility'),
172
- description: __("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.")
173
- }, createElement(BlockManager, null)))
174
- }], [isLargeViewport, showBlockBreadcrumbsOption]);
54
+ })
55
+ };
175
56
  if (!isModalActive) {
176
57
  return null;
177
58
  }
178
59
  return createElement(PreferencesModal, {
179
- closeModal: closeModal
180
- }, createElement(PreferencesModalTabs, {
181
- sections: sections
182
- }));
60
+ extraSections: extraSections,
61
+ isActive: isModalActive,
62
+ onClose: closeModal
63
+ });
183
64
  }
184
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["__","useViewportMatch","useSelect","useDispatch","useMemo","PostTaxonomies","PostExcerptCheck","PageAttributesCheck","PostFeaturedImageCheck","PostTypeSupportCheck","store","editorStore","PreferencesModal","PreferencesModalTabs","PreferencesModalSection","interfaceStore","preferencesStore","EnablePluginDocumentSettingPanelOption","EnablePublishSidebarOption","EnablePanelOption","EnableFeature","MetaBoxesSection","editPostStore","BlockManager","PREFERENCES_MODAL_NAME","EditPostPreferencesModal","isLargeViewport","closeModal","isModalActive","showBlockBreadcrumbsOption","select","getEditorSettings","getEditorMode","get","modalActive","mode","isRichEditingEnabled","richEditingEnabled","isDistractionFreeEnabled","closeGeneralSidebar","setIsListViewOpened","setIsInserterOpened","set","setPreference","toggleDistractionFree","turnOffDistractionFree","sections","name","tabLabel","content","createElement","Fragment","title","help","label","scope","featureName","description","Slot","taxonomyWrapper","taxonomy","labels","menu_name","panelName","slug","supportKeys","onToggle"],"sources":["@wordpress/edit-post/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\tPostTaxonomies,\n\tPostExcerptCheck,\n\tPageAttributesCheck,\n\tPostFeaturedImageCheck,\n\tPostTypeSupportCheck,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport {\n\tPreferencesModal,\n\tPreferencesModalTabs,\n\tPreferencesModalSection,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\n\nimport {\n\tEnablePluginDocumentSettingPanelOption,\n\tEnablePublishSidebarOption,\n\tEnablePanelOption,\n\tEnableFeature,\n} from './options';\nimport MetaBoxesSection from './meta-boxes-section';\nimport { store as editPostStore } from '../../store';\nimport BlockManager from '../block-manager';\n\nexport const PREFERENCES_MODAL_NAME = 'edit-post/preferences';\n\nexport default function EditPostPreferencesModal() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { closeModal } = useDispatch( interfaceStore );\n\tconst [ isModalActive, showBlockBreadcrumbsOption ] = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getEditorMode } = select( editPostStore );\n\t\t\tconst { get } = select( preferencesStore );\n\t\t\tconst modalActive = select( interfaceStore ).isModalActive(\n\t\t\t\tPREFERENCES_MODAL_NAME\n\t\t\t);\n\t\t\tconst mode = getEditorMode();\n\t\t\tconst isRichEditingEnabled = getEditorSettings().richEditingEnabled;\n\t\t\tconst isDistractionFreeEnabled = get( 'core', 'distractionFree' );\n\t\t\treturn [\n\t\t\t\tmodalActive,\n\t\t\t\t! isDistractionFreeEnabled &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisRichEditingEnabled &&\n\t\t\t\t\tmode === 'visual',\n\t\t\t\tisDistractionFreeEnabled,\n\t\t\t];\n\t\t},\n\t\t[ isLargeViewport ]\n\t);\n\n\tconst { closeGeneralSidebar } = useDispatch( editPostStore );\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\tcloseGeneralSidebar();\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{ isLargeViewport && (\n\t\t\t\t\t\t\t<PreferencesModalSection\n\t\t\t\t\t\t\t\ttitle={ __( 'Publishing' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<EnablePublishSidebarOption\n\t\t\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t\t\t'Review settings, such as visibility and tags.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Enable pre-publish checks' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<PreferencesModalSection title={ __( 'Interface' ) }>\n\t\t\t\t\t\t\t<EnableFeature\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<EnableFeature\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<EnableFeature\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<MetaBoxesSection title={ __( 'Advanced' ) } />\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<EnableFeature\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<EnableFeature\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<EnableFeature\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<EnableFeature\n\t\t\t\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Make the editor look like your theme.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t\t\t\t/>\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<EnableFeature\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<EnableFeature\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<EnableFeature\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 ]\n\t);\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModal closeModal={ closeModal }>\n\t\t\t<PreferencesModalTabs sections={ sections } />\n\t\t</PreferencesModal>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SACCC,cAAc,EACdC,gBAAgB,EAChBC,mBAAmB,EACnBC,sBAAsB,EACtBC,oBAAoB,EACpBC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SACCC,gBAAgB,EAChBC,oBAAoB,EACpBC,uBAAuB,EACvBJ,KAAK,IAAIK,cAAc,QACjB,sBAAsB;AAC7B,SAASL,KAAK,IAAIM,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;;AAEA,SACCC,sCAAsC,EACtCC,0BAA0B,EAC1BC,iBAAiB,EACjBC,aAAa,QACP,WAAW;AAClB,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASX,KAAK,IAAIY,aAAa,QAAQ,aAAa;AACpD,OAAOC,YAAY,MAAM,kBAAkB;AAE3C,OAAO,MAAMC,sBAAsB,GAAG,uBAAuB;AAE7D,eAAe,SAASC,wBAAwBA,CAAA,EAAG;EAClD,MAAMC,eAAe,GAAGzB,gBAAgB,CAAE,QAAS,CAAC;EACpD,MAAM;IAAE0B;EAAW,CA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AE,CACT,kCACD;IAAG,CACH,CACuB,CAAC,EAC1BkD,aAAA,CAACpC,uBAAuB;MAACsC,KAAK,EAAGpD,EAAE,CAAE,WAAY;IAAG,GACnDkD,aAAA,CAAC9B,aAAa;MACbmC,KAAK,EAAC,MAAM;MACZC,WAAW,EAAC,gBAAgB;MAC5BF,KAAK,EAAGtD,EAAE,CAAE,yBAA0B,CAAG;MACzCqD,IAAI,EAAGrD,EAAE,CACR,6DACD;IAAG,CACH,CACuB,CACxB;EAEJ,CAAC,EACD;IACC+C,IAAI,EAAE,QAAQ;IACdC,QAAQ,EAAEhD,EAAE,CAAE,QAAS,CAAC;IACxBiD,OAAO,EACNC,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACpC,uBAAuB;MAACsC,KAAK,EAAGpD,EAAE,CAAE,UAAW;IAAG,GAClDkD,aAAA,CAAC9B,aAAa;MACbmC,KAAK,EAAC,MAAM;MACZC,WAAW,EAAC,gBAAgB;MAC5BH,IAAI,EAAGrD,EAAE,CACR,uEACD,CAAG;MACHsD,KAAK,EAAGtD,EAAE,CAAE,uBAAwB;IAAG,CACvC,CACuB,CAAC,EAC1BkD,aAAA,CAACpC,uBAAuB;MACvBsC,KAAK,EAAGpD,EAAE,CAAE,yBAA0B,CAAG;MACzCyD,WAAW,EAAGzD,EAAE,CACf,yGACD;IAAG,GAEHkD,aAAA,CAAC3B,YAAY,MAAE,CACS,CACxB;EAEJ,CAAC,CACD,EACD,CAAEG,eAAe,EAAEG,0BAA0B,CAC9C,CAAC;EAED,IAAK,CAAED,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OACCsB,aAAA,CAACtC,gBAAgB;IAACe,UAAU,EAAGA;EAAY,GAC1CuB,aAAA,CAACrC,oBAAoB;IAACiC,QAAQ,EAAGA;EAAU,CAAE,CAC5B,CAAC;AAErB"}
1
+ {"version":3,"names":["__","useViewportMatch","useSelect","useDispatch","store","interfaceStore","privateApis","preferencesPrivateApis","editorPrivateApis","unlock","MetaBoxesSection","EnablePublishSidebarOption","PreferencesModalSection","PreferenceToggleControl","PreferencesModal","PREFERENCES_MODAL_NAME","EditPostPreferencesModal","isLargeViewport","closeModal","isModalActive","select","modalActive","extraSections","general","createElement","Fragment","title","help","label","appearance","scope","featureName","isActive","onClose"],"sources":["@wordpress/edit-post/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 { store as interfaceStore } from '@wordpress/interface';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport MetaBoxesSection from './meta-boxes-section';\nimport EnablePublishSidebarOption from './enable-publish-sidebar';\n\nconst { PreferencesModalSection, PreferenceToggleControl } = unlock(\n\tpreferencesPrivateApis\n);\nconst { PreferencesModal } = unlock( editorPrivateApis );\n\nexport const PREFERENCES_MODAL_NAME = 'edit-post/preferences';\n\nexport default function EditPostPreferencesModal() {\n\tconst isLargeViewport = useViewportMatch( 'medium' );\n\tconst { closeModal } = useDispatch( interfaceStore );\n\tconst { isModalActive } = useSelect( ( select ) => {\n\t\tconst modalActive = select( interfaceStore ).isModalActive(\n\t\t\tPREFERENCES_MODAL_NAME\n\t\t);\n\t\treturn {\n\t\t\tisModalActive: modalActive,\n\t\t};\n\t}, [] );\n\n\tconst extraSections = {\n\t\tgeneral: (\n\t\t\t<>\n\t\t\t\t{ isLargeViewport && (\n\t\t\t\t\t<PreferencesModalSection title={ __( 'Publishing' ) }>\n\t\t\t\t\t\t<EnablePublishSidebarOption\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Review settings, such as visibility and tags.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tlabel={ __( 'Enable pre-publish checks' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PreferencesModalSection>\n\t\t\t\t) }\n\t\t\t\t<MetaBoxesSection title={ __( 'Advanced' ) } />\n\t\t\t</>\n\t\t),\n\t\tappearance: (\n\t\t\t<PreferenceToggleControl\n\t\t\t\tscope=\"core/edit-post\"\n\t\t\t\tfeatureName=\"themeStyles\"\n\t\t\t\thelp={ __( 'Make the editor look like your theme.' ) }\n\t\t\t\tlabel={ __( 'Use theme styles' ) }\n\t\t\t/>\n\t\t),\n\t};\n\n\tif ( ! isModalActive ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModal\n\t\t\textraSections={ extraSections }\n\t\t\tisActive={ isModalActive }\n\t\t\tonClose={ closeModal }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;;AAEA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,cAAc,QAAQ,sBAAsB;AAC9D,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;AAC9E,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,OAAOC,0BAA0B,MAAM,0BAA0B;AAEjE,MAAM;EAAEC,uBAAuB;EAAEC;AAAwB,CAAC,GAAGJ,MAAM,CAClEF,sBACD,CAAC;AACD,MAAM;EAAEO;AAAiB,CAAC,GAAGL,MAAM,CAAED,iBAAkB,CAAC;AAExD,OAAO,MAAMO,sBAAsB,GAAG,uBAAuB;AAE7D,eAAe,SAASC,wBAAwBA,CAAA,EAAG;EAClD,MAAMC,eAAe,GAAGhB,gBAAgB,CAAE,QAAS,CAAC;EACpD,MAAM;IAAEiB;EAAW,CAAC,GAAGf,WAAW,CAAEE,cAAe,CAAC;EACpD,MAAM;IAAEc;EAAc,CAAC,GAAGjB,SAAS,CAAIkB,MAAM,IAAM;IAClD,MAAMC,WAAW,GAAGD,MAAM,CAAEf,cAAe,CAAC,CAACc,aAAa,CACzDJ,sBACD,CAAC;IACD,OAAO;MACNI,aAAa,EAAEE;IAChB,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,aAAa,GAAG;IACrBC,OAAO,EACNC,aAAA,CAAAC,QAAA,QACGR,eAAe,IAChBO,aAAA,CAACZ,uBAAuB;MAACc,KAAK,EAAG1B,EAAE,CAAE,YAAa;IAAG,GACpDwB,aAAA,CAACb,0BAA0B;MAC1BgB,IAAI,EAAG3B,EAAE,CACR,+CACD,CAAG;MACH4B,KAAK,EAAG5B,EAAE,CAAE,2BAA4B;IAAG,CAC3C,CACuB,CACzB,EACDwB,aAAA,CAACd,gBAAgB;MAACgB,KAAK,EAAG1B,EAAE,CAAE,UAAW;IAAG,CAAE,CAC7C,CACF;IACD6B,UAAU,EACTL,aAAA,CAACX,uBAAuB;MACvBiB,KAAK,EAAC,gBAAgB;MACtBC,WAAW,EAAC,aAAa;MACzBJ,IAAI,EAAG3B,EAAE,CAAE,uCAAwC,CAAG;MACtD4B,KAAK,EAAG5B,EAAE,CAAE,kBAAmB;IAAG,CAClC;EAEH,CAAC;EAED,IAAK,CAAEmB,aAAa,EAAG;IACtB,OAAO,IAAI;EACZ;EAEA,OACCK,aAAA,CAACV,gBAAgB;IAChBQ,aAAa,EAAGA,aAAe;IAC/BU,QAAQ,EAAGb,aAAe;IAC1Bc,OAAO,EAAGf;EAAY,CACtB,CAAC;AAEJ"}
@@ -5,13 +5,18 @@ import { createElement } from "react";
5
5
  import { __ } from '@wordpress/i18n';
6
6
  import { withSelect } from '@wordpress/data';
7
7
  import { store as editorStore } from '@wordpress/editor';
8
- import { PreferencesModalSection } from '@wordpress/interface';
8
+ import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
9
9
 
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
- import { EnableCustomFieldsOption, EnablePanelOption } from './options';
13
+ import EnableCustomFieldsOption from './enable-custom-fields';
14
+ import EnablePanelOption from './enable-panel';
14
15
  import { store as editPostStore } from '../../store';
16
+ import { unlock } from '../../lock-unlock';
17
+ const {
18
+ PreferencesModalSection
19
+ } = unlock(preferencesPrivateApis);
15
20
  export function MetaBoxesSection({
16
21
  areCustomFieldsRegistered,
17
22
  metaBoxes,
@@ -1 +1 @@
1
- {"version":3,"names":["__","withSelect","store","editorStore","PreferencesModalSection","EnableCustomFieldsOption","EnablePanelOption","editPostStore","MetaBoxesSection","areCustomFieldsRegistered","metaBoxes","sectionProps","thirdPartyMetaBoxes","filter","id","length","createElement","label","map","title","key","panelName","select","getEditorSettings","getAllMetaBoxes","enableCustomFields","undefined"],"sources":["@wordpress/edit-post/src/components/preferences-modal/meta-boxes-section.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { PreferencesModalSection } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { EnableCustomFieldsOption, EnablePanelOption } from './options';\nimport { store as editPostStore } from '../../store';\n\nexport function MetaBoxesSection( {\n\tareCustomFieldsRegistered,\n\tmetaBoxes,\n\t...sectionProps\n} ) {\n\t// The 'Custom Fields' meta box is a special case that we handle separately.\n\tconst thirdPartyMetaBoxes = metaBoxes.filter(\n\t\t( { id } ) => id !== 'postcustom'\n\t);\n\n\tif ( ! areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModalSection { ...sectionProps }>\n\t\t\t{ areCustomFieldsRegistered && (\n\t\t\t\t<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />\n\t\t\t) }\n\t\t\t{ thirdPartyMetaBoxes.map( ( { id, title } ) => (\n\t\t\t\t<EnablePanelOption\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tpanelName={ `meta-box-${ id }` }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</PreferencesModalSection>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditorSettings } = select( editorStore );\n\tconst { getAllMetaBoxes } = select( editPostStore );\n\n\treturn {\n\t\t// This setting should not live in the block editor's store.\n\t\tareCustomFieldsRegistered:\n\t\t\tgetEditorSettings().enableCustomFields !== undefined,\n\t\tmetaBoxes: getAllMetaBoxes(),\n\t};\n} )( MetaBoxesSection );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,uBAAuB,QAAQ,sBAAsB;;AAE9D;AACA;AACA;AACA,SAASC,wBAAwB,EAAEC,iBAAiB,QAAQ,WAAW;AACvE,SAASJ,KAAK,IAAIK,aAAa,QAAQ,aAAa;AAEpD,OAAO,SAASC,gBAAgBA,CAAE;EACjCC,yBAAyB;EACzBC,SAAS;EACT,GAAGC;AACJ,CAAC,EAAG;EACH;EACA,MAAMC,mBAAmB,GAAGF,SAAS,CAACG,MAAM,CAC3C,CAAE;IAAEC;EAAG,CAAC,KAAMA,EAAE,KAAK,YACtB,CAAC;EAED,IAAK,CAAEL,yBAAyB,IAAIG,mBAAmB,CAACG,MAAM,KAAK,CAAC,EAAG;IACtE,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA,CAACZ,uBAAuB;IAAA,GAAMO;EAAY,GACvCF,yBAAyB,IAC1BO,aAAA,CAACX,wBAAwB;IAACY,KAAK,EAAGjB,EAAE,CAAE,eAAgB;EAAG,CAAE,CAC3D,EACCY,mBAAmB,CAACM,GAAG,CAAE,CAAE;IAAEJ,EAAE;IAAEK;EAAM,CAAC,KACzCH,aAAA,CAACV,iBAAiB;IACjBc,GAAG,EAAGN,EAAI;IACVG,KAAK,EAAGE,KAAO;IACfE,SAAS,EAAI,YAAYP,EAAI;EAAG,CAChC,CACA,CACsB,CAAC;AAE5B;AAEA,eAAeb,UAAU,CAAIqB,MAAM,IAAM;EACxC,MAAM;IAAEC;EAAkB,CAAC,GAAGD,MAAM,CAAEnB,WAAY,CAAC;EACnD,MAAM;IAAEqB;EAAgB,CAAC,GAAGF,MAAM,CAAEf,aAAc,CAAC;EAEnD,OAAO;IACN;IACAE,yBAAyB,EACxBc,iBAAiB,CAAC,CAAC,CAACE,kBAAkB,KAAKC,SAAS;IACrDhB,SAAS,EAAEc,eAAe,CAAC;EAC5B,CAAC;AACF,CAAE,CAAC,CAAEhB,gBAAiB,CAAC"}
1
+ {"version":3,"names":["__","withSelect","store","editorStore","privateApis","preferencesPrivateApis","EnableCustomFieldsOption","EnablePanelOption","editPostStore","unlock","PreferencesModalSection","MetaBoxesSection","areCustomFieldsRegistered","metaBoxes","sectionProps","thirdPartyMetaBoxes","filter","id","length","createElement","label","map","title","key","panelName","select","getEditorSettings","getAllMetaBoxes","enableCustomFields","undefined"],"sources":["@wordpress/edit-post/src/components/preferences-modal/meta-boxes-section.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { withSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as preferencesPrivateApis } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport EnableCustomFieldsOption from './enable-custom-fields';\nimport EnablePanelOption from './enable-panel';\nimport { store as editPostStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { PreferencesModalSection } = unlock( preferencesPrivateApis );\n\nexport function MetaBoxesSection( {\n\tareCustomFieldsRegistered,\n\tmetaBoxes,\n\t...sectionProps\n} ) {\n\t// The 'Custom Fields' meta box is a special case that we handle separately.\n\tconst thirdPartyMetaBoxes = metaBoxes.filter(\n\t\t( { id } ) => id !== 'postcustom'\n\t);\n\n\tif ( ! areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<PreferencesModalSection { ...sectionProps }>\n\t\t\t{ areCustomFieldsRegistered && (\n\t\t\t\t<EnableCustomFieldsOption label={ __( 'Custom fields' ) } />\n\t\t\t) }\n\t\t\t{ thirdPartyMetaBoxes.map( ( { id, title } ) => (\n\t\t\t\t<EnablePanelOption\n\t\t\t\t\tkey={ id }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tpanelName={ `meta-box-${ id }` }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</PreferencesModalSection>\n\t);\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getEditorSettings } = select( editorStore );\n\tconst { getAllMetaBoxes } = select( editPostStore );\n\n\treturn {\n\t\t// This setting should not live in the block editor's store.\n\t\tareCustomFieldsRegistered:\n\t\t\tgetEditorSettings().enableCustomFields !== undefined,\n\t\tmetaBoxes: getAllMetaBoxes(),\n\t};\n} )( MetaBoxesSection );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,wBAAwB;;AAE9E;AACA;AACA;AACA,OAAOC,wBAAwB,MAAM,wBAAwB;AAC7D,OAAOC,iBAAiB,MAAM,gBAAgB;AAC9C,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAwB,CAAC,GAAGD,MAAM,CAAEJ,sBAAuB,CAAC;AAEpE,OAAO,SAASM,gBAAgBA,CAAE;EACjCC,yBAAyB;EACzBC,SAAS;EACT,GAAGC;AACJ,CAAC,EAAG;EACH;EACA,MAAMC,mBAAmB,GAAGF,SAAS,CAACG,MAAM,CAC3C,CAAE;IAAEC;EAAG,CAAC,KAAMA,EAAE,KAAK,YACtB,CAAC;EAED,IAAK,CAAEL,yBAAyB,IAAIG,mBAAmB,CAACG,MAAM,KAAK,CAAC,EAAG;IACtE,OAAO,IAAI;EACZ;EAEA,OACCC,aAAA,CAACT,uBAAuB;IAAA,GAAMI;EAAY,GACvCF,yBAAyB,IAC1BO,aAAA,CAACb,wBAAwB;IAACc,KAAK,EAAGpB,EAAE,CAAE,eAAgB;EAAG,CAAE,CAC3D,EACCe,mBAAmB,CAACM,GAAG,CAAE,CAAE;IAAEJ,EAAE;IAAEK;EAAM,CAAC,KACzCH,aAAA,CAACZ,iBAAiB;IACjBgB,GAAG,EAAGN,EAAI;IACVG,KAAK,EAAGE,KAAO;IACfE,SAAS,EAAI,YAAYP,EAAI;EAAG,CAChC,CACA,CACsB,CAAC;AAE5B;AAEA,eAAehB,UAAU,CAAIwB,MAAM,IAAM;EACxC,MAAM;IAAEC;EAAkB,CAAC,GAAGD,MAAM,CAAEtB,WAAY,CAAC;EACnD,MAAM;IAAEwB;EAAgB,CAAC,GAAGF,MAAM,CAAEjB,aAAc,CAAC;EAEnD,OAAO;IACN;IACAI,yBAAyB,EACxBc,iBAAiB,CAAC,CAAC,CAACE,kBAAkB,KAAKC,SAAS;IACrDhB,SAAS,EAAEc,eAAe,CAAC;EAC5B,CAAC;AACF,CAAE,CAAC,CAAEhB,gBAAiB,CAAC"}
@@ -6,16 +6,19 @@ import { createSlotFill, PanelBody } from '@wordpress/components';
6
6
  import { usePluginContext } from '@wordpress/plugins';
7
7
  import { useDispatch, useSelect } from '@wordpress/data';
8
8
  import warning from '@wordpress/warning';
9
- import { store as editorStore } from '@wordpress/editor';
9
+ import { store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
10
10
 
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
- import { EnablePluginDocumentSettingPanelOption } from '../../preferences-modal/options';
14
+ import { unlock } from '../../../lock-unlock';
15
15
  const {
16
16
  Fill,
17
17
  Slot
18
18
  } = createSlotFill('PluginDocumentSettingPanel');
19
+ const {
20
+ EnablePluginDocumentSettingPanelOption
21
+ } = unlock(editorPrivateApis);
19
22
 
20
23
  /**
21
24
  * Renders items below the Status & Availability panel in the Document Sidebar.
@@ -1 +1 @@
1
- {"version":3,"names":["createSlotFill","PanelBody","usePluginContext","useDispatch","useSelect","warning","store","editorStore","EnablePluginDocumentSettingPanelOption","Fill","Slot","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","panelName","opened","isEnabled","select","isEditorPanelOpened","isEditorPanelEnabled","toggleEditorPanelOpened","undefined","SCRIPT_DEBUG","createElement","Fragment","label","onToggle"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { EnablePluginDocumentSettingPanelOption } from '../../preferences-modal/options';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,SAAS,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,OAAOC,OAAO,MAAM,oBAAoB;AACxC,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASC,sCAAsC,QAAQ,iCAAiC;AAExF,MAAM;EAAEC,IAAI;EAAEC;AAAK,CAAC,GAAGV,cAAc,CAAE,4BAA6B,CAAC;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMW,0BAA0B,GAAGA,CAAE;EACpCC,IAAI;EACJC,SAAS;EACTC,KAAK;EACLC,IAAI;EACJC;AACD,CAAC,KAAM;EACN,MAAM;IAAEJ,IAAI,EAAEK;EAAW,CAAC,GAAGf,gBAAgB,CAAC,CAAC;EAC/C,MAAMgB,SAAS,GAAI,GAAGD,UAAY,IAAIL,IAAM,EAAC;EAC7C,MAAM;IAAEO,MAAM;IAAEC;EAAU,CAAC,GAAGhB,SAAS,CACpCiB,MAAM,IAAM;IACb,MAAM;MAAEC,mBAAmB;MAAEC;IAAqB,CAAC,GAClDF,MAAM,CAAEd,WAAY,CAAC;IAEtB,OAAO;MACNY,MAAM,EAAEG,mBAAmB,CAAEJ,SAAU,CAAC;MACxCE,SAAS,EAAEG,oBAAoB,CAAEL,SAAU;IAC5C,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;EACD,MAAM;IAAEM;EAAwB,CAAC,GAAGrB,WAAW,CAAEI,WAAY,CAAC;EAE9D,IAAKkB,SAAS,KAAKb,IAAI,EAAG;IACzB,OAAAc,YAAA,oBAAAA,YAAA,YAAArB,OAAO,CAAE,sDAAuD,CAAC;EAClE;EAEA,OACCsB,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACnB,sCAAsC;IACtCqB,KAAK,EAAGf,KAAO;IACfI,SAAS,EAAGA;EAAW,CACvB,CAAC,EACFS,aAAA,CAAClB,IAAI,QACFW,SAAS,IACVO,aAAA,CAAC1B,SAAS;IACTY,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGA,KAAO;IACfC,IAAI,EAAGA,IAAM;IACbI,MAAM,EAAGA,MAAQ;IACjBW,QAAQ,EAAGA,CAAA,KAAMN,uBAAuB,CAAEN,SAAU;EAAG,GAErDF,QACQ,CAEP,CACL,CAAC;AAEL,CAAC;AAEDL,0BAA0B,CAACD,IAAI,GAAGA,IAAI;AAEtC,eAAeC,0BAA0B"}
1
+ {"version":3,"names":["createSlotFill","PanelBody","usePluginContext","useDispatch","useSelect","warning","store","editorStore","privateApis","editorPrivateApis","unlock","Fill","Slot","EnablePluginDocumentSettingPanelOption","PluginDocumentSettingPanel","name","className","title","icon","children","pluginName","panelName","opened","isEnabled","select","isEditorPanelOpened","isEditorPanelEnabled","toggleEditorPanelOpened","undefined","SCRIPT_DEBUG","createElement","Fragment","label","onToggle"],"sources":["@wordpress/edit-post/src/components/sidebar/plugin-document-setting-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSlotFill, PanelBody } from '@wordpress/components';\nimport { usePluginContext } from '@wordpress/plugins';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport warning from '@wordpress/warning';\nimport {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst { Fill, Slot } = createSlotFill( 'PluginDocumentSettingPanel' );\nconst { EnablePluginDocumentSettingPanelOption } = unlock( editorPrivateApis );\n\n/**\n * Renders items below the Status & Availability panel in the Document Sidebar.\n *\n * @param {Object} props Component properties.\n * @param {string} props.name Required. A machine-friendly name for the panel.\n * @param {string} [props.className] An optional class name added to the row.\n * @param {string} [props.title] The title of the panel\n * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.\n * @param {Element} props.children Children to be rendered\n *\n * @example\n * ```js\n * // Using ES5 syntax\n * var el = React.createElement;\n * var __ = wp.i18n.__;\n * var registerPlugin = wp.plugins.registerPlugin;\n * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;\n *\n * function MyDocumentSettingPlugin() {\n * \treturn el(\n * \t\tPluginDocumentSettingPanel,\n * \t\t{\n * \t\t\tclassName: 'my-document-setting-plugin',\n * \t\t\ttitle: 'My Panel',\n * \t\t\tname: 'my-panel',\n * \t\t},\n * \t\t__( 'My Document Setting Panel' )\n * \t);\n * }\n *\n * registerPlugin( 'my-document-setting-plugin', {\n * \t\trender: MyDocumentSettingPlugin\n * } );\n * ```\n *\n * @example\n * ```jsx\n * // Using ESNext syntax\n * import { registerPlugin } from '@wordpress/plugins';\n * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';\n *\n * const MyDocumentSettingTest = () => (\n * \t\t<PluginDocumentSettingPanel className=\"my-document-setting-plugin\" title=\"My Panel\" name=\"my-panel\">\n *\t\t\t<p>My Document Setting Panel</p>\n *\t\t</PluginDocumentSettingPanel>\n *\t);\n *\n * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );\n * ```\n *\n * @return {Component} The component to be rendered.\n */\nconst PluginDocumentSettingPanel = ( {\n\tname,\n\tclassName,\n\ttitle,\n\ticon,\n\tchildren,\n} ) => {\n\tconst { name: pluginName } = usePluginContext();\n\tconst panelName = `${ pluginName }/${ name }`;\n\tconst { opened, isEnabled } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isEditorPanelOpened, isEditorPanelEnabled } =\n\t\t\t\tselect( editorStore );\n\n\t\t\treturn {\n\t\t\t\topened: isEditorPanelOpened( panelName ),\n\t\t\t\tisEnabled: isEditorPanelEnabled( panelName ),\n\t\t\t};\n\t\t},\n\t\t[ panelName ]\n\t);\n\tconst { toggleEditorPanelOpened } = useDispatch( editorStore );\n\n\tif ( undefined === name ) {\n\t\twarning( 'PluginDocumentSettingPanel requires a name property.' );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<EnablePluginDocumentSettingPanelOption\n\t\t\t\tlabel={ title }\n\t\t\t\tpanelName={ panelName }\n\t\t\t/>\n\t\t\t<Fill>\n\t\t\t\t{ isEnabled && (\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\topened={ opened }\n\t\t\t\t\t\tonToggle={ () => toggleEditorPanelOpened( panelName ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</Fill>\n\t\t</>\n\t);\n};\n\nPluginDocumentSettingPanel.Slot = Slot;\n\nexport default PluginDocumentSettingPanel;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,cAAc,EAAEC,SAAS,QAAQ,uBAAuB;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,OAAOC,OAAO,MAAM,oBAAoB;AACxC,SACCC,KAAK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AuD,CAAC;EAClE;EAEA,OACCyB,aAAA,CAAAC,QAAA,QACCD,aAAA,CAACjB,sCAAsC;IACtCmB,KAAK,EAAGf,KAAO;IACfI,SAAS,EAAGA;EAAW,CACvB,CAAC,EACFS,aAAA,CAACnB,IAAI,QACFY,SAAS,IACVO,aAAA,CAAC7B,SAAS;IACTe,SAAS,EAAGA,SAAW;IACvBC,KAAK,EAAGA,KAAO;IACfC,IAAI,EAAGA,IAAM;IACbI,MAAM,EAAGA,MAAQ;IACjBW,QAAQ,EAAGA,CAAA,KAAMN,uBAAuB,CAAEN,SAAU;EAAG,GAErDF,QACQ,CAEP,CACL,CAAC;AAEL,CAAC;AAEDL,0BAA0B,CAACF,IAAI,GAAGA,IAAI;AAEtC,eAAeE,0BAA0B"}
@@ -2,7 +2,6 @@ import { createElement } from "react";
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
5
- import { store as blocksStore } from '@wordpress/blocks';
6
5
  import { useSelect, useDispatch } from '@wordpress/data';
7
6
  import { ErrorBoundary, PostLockedModal, store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
8
7
  import { useMemo } from '@wordpress/element';
@@ -38,15 +37,12 @@ function Editor({
38
37
  hasInlineToolbar,
39
38
  post,
40
39
  preferredStyleVariations,
41
- hiddenBlockTypes,
42
- blockTypes,
43
40
  template
44
41
  } = useSelect(select => {
45
42
  var _getPostType$viewable;
46
43
  const {
47
44
  isFeatureActive,
48
- getEditedPostTemplate,
49
- getHiddenBlockTypes
45
+ getEditedPostTemplate
50
46
  } = select(editPostStore);
51
47
  const {
52
48
  getEntityRecord,
@@ -57,9 +53,6 @@ function Editor({
57
53
  const {
58
54
  getEditorSettings
59
55
  } = select(editorStore);
60
- const {
61
- getBlockTypes
62
- } = select(blocksStore);
63
56
  const isTemplate = ['wp_template', 'wp_template_part'].includes(currentPost.postType);
64
57
  // Ideally the initializeEditor function should be called using the ID of the REST endpoint.
65
58
  // to avoid the special case.
@@ -78,8 +71,6 @@ function Editor({
78
71
  return {
79
72
  hasInlineToolbar: isFeatureActive('inlineToolbar'),
80
73
  preferredStyleVariations: select(preferencesStore).get('core/edit-post', 'preferredStyleVariations'),
81
- hiddenBlockTypes: getHiddenBlockTypes(),
82
- blockTypes: getBlockTypes(),
83
74
  template: supportsTemplateMode && isViewable && canEditTemplate ? getEditedPostTemplate() : null,
84
75
  post: postObject
85
76
  };
@@ -96,24 +87,10 @@ function Editor({
96
87
  value: preferredStyleVariations,
97
88
  onChange: updatePreferredStyleVariations
98
89
  },
99
- hasInlineToolbar,
100
- // Keep a reference of the `allowedBlockTypes` from the server to handle use cases
101
- // where we need to differentiate if a block is disabled by the user or some plugin.
102
- defaultAllowedBlockTypes: settings.allowedBlockTypes
90
+ hasInlineToolbar
103
91
  };
104
-
105
- // Omit hidden block types if exists and non-empty.
106
- if (hiddenBlockTypes.length > 0) {
107
- // Defer to passed setting for `allowedBlockTypes` if provided as
108
- // anything other than `true` (where `true` is equivalent to allow
109
- // all block types).
110
- const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({
111
- name
112
- }) => name) : settings.allowedBlockTypes || [];
113
- result.allowedBlockTypes = defaultAllowedBlockTypes.filter(type => !hiddenBlockTypes.includes(type));
114
- }
115
92
  return result;
116
- }, [settings, hasInlineToolbar, hiddenBlockTypes, blockTypes, preferredStyleVariations, updatePreferredStyleVariations, getPostLinkProps, goBack]);
93
+ }, [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, getPostLinkProps, goBack]);
117
94
  if (!post) {
118
95
  return null;
119
96
  }
@@ -1 +1 @@
1
- {"version":3,"names":["store","blocksStore","useSelect","useDispatch","ErrorBoundary","PostLockedModal","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","preferencesStore","CommandMenu","Layout","EditorInitialization","editPostStore","unlock","usePostHistory","ExperimentalEditorProvider","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","currentPost","getPostLinkProps","goBack","hasInlineToolbar","post","preferredStyleVariations","hiddenBlockTypes","blockTypes","template","select","_getPostType$viewable","isFeatureActive","getEditedPostTemplate","getHiddenBlockTypes","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","getBlockTypes","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","defaultAllowedBlockTypes","allowedBlockTypes","length","map","name","filter","type","createElement","useSubRegistry","__unstableTemplate"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport usePostHistory from './hooks/use-post-history';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst { currentPost, getPostLinkProps, goBack } = usePostHistory(\n\t\tinitialPostId,\n\t\tinitialPostType\n\t);\n\n\tconst {\n\t\thasInlineToolbar,\n\t\tpost,\n\t\tpreferredStyleVariations,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\ttemplate,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisFeatureActive,\n\t\t\t\tgetEditedPostTemplate,\n\t\t\t\tgetHiddenBlockTypes,\n\t\t\t} = select( editPostStore );\n\t\t\tconst { getEntityRecord, getPostType, getEntityRecords, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\tconst { getBlockTypes } = select( blocksStore );\n\t\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\t\tcurrentPost.postType\n\t\t\t);\n\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t// to avoid the special case.\n\t\t\tlet postObject;\n\t\t\tif ( isTemplate ) {\n\t\t\t\tconst posts = getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\t{\n\t\t\t\t\t\twp_id: currentPost.postId,\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t} else {\n\t\t\t\tpostObject = getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\tcurrentPost.postId\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst supportsTemplateMode =\n\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\tconst isViewable =\n\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\treturn {\n\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t),\n\t\t\t\thiddenBlockTypes: getHiddenBlockTypes(),\n\t\t\t\tblockTypes: getBlockTypes(),\n\t\t\t\ttemplate:\n\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t: null,\n\t\t\t\tpost: postObject,\n\t\t\t};\n\t\t},\n\t\t[ currentPost.postType, currentPost.postId ]\n\t);\n\n\tconst { updatePreferredStyleVariations } = useDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\tgetPostLinkProps,\n\t\t\tgoBack,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasInlineToolbar,\n\n\t\t\t// Keep a reference of the `allowedBlockTypes` from the server to handle use cases\n\t\t\t// where we need to differentiate if a block is disabled by the user or some plugin.\n\t\t\tdefaultAllowedBlockTypes: settings.allowedBlockTypes,\n\t\t};\n\n\t\t// Omit hidden block types if exists and non-empty.\n\t\tif ( hiddenBlockTypes.length > 0 ) {\n\t\t\t// Defer to passed setting for `allowedBlockTypes` if provided as\n\t\t\t// anything other than `true` (where `true` is equivalent to allow\n\t\t\t// all block types).\n\t\t\tconst defaultAllowedBlockTypes =\n\t\t\t\ttrue === settings.allowedBlockTypes\n\t\t\t\t\t? blockTypes.map( ( { name } ) => name )\n\t\t\t\t\t: settings.allowedBlockTypes || [];\n\n\t\t\tresult.allowedBlockTypes = defaultAllowedBlockTypes.filter(\n\t\t\t\t( type ) => ! hiddenBlockTypes.includes( type )\n\t\t\t);\n\t\t}\n\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasInlineToolbar,\n\t\thiddenBlockTypes,\n\t\tblockTypes,\n\t\tpreferredStyleVariations,\n\t\tupdatePreferredStyleVariations,\n\t\tgetPostLinkProps,\n\t\tgoBack,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,aAAa,EACbC,eAAe,EACfL,KAAK,IAAIM,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASV,KAAK,IAAIW,SAAS,QAAQ,sBAAsB;AACzD,SAASX,KAAK,IAAIY,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,WAAW,QAAQ,qBAAqB;;AAEjD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,oBAAoB,MAAM,oCAAoC;AACrE,SAASf,KAAK,IAAIgB,aAAa,QAAQ,SAAS;AAChD,SAASC,MAAM,QAAQ,eAAe;AACtC,OAAOC,cAAc,MAAM,0BAA0B;AAErD,MAAM;EAAEC;AAA2B,CAAC,GAAGF,MAAM,CAAET,iBAAkB,CAAC;AAElE,SAASY,MAAMA,CAAE;EAChBC,MAAM,EAAEC,aAAa;EACrBC,QAAQ,EAAEC,eAAe;EACzBC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM;IAAEC,WAAW;IAAEC,gBAAgB;IAAEC;EAAO,CAAC,GAAGZ,cAAc,CAC/DI,aAAa,EACbE,eACD,CAAC;EAED,MAAM;IACLO,gBAAgB;IAChBC,IAAI;IACJC,wBAAwB;IACxBC,gBAAgB;IAChBC,UAAU;IACVC;EACD,CAAC,GAAGlC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AEH,IAAK,CAAEE,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;EAEA,OACCuC,aAAA,CAAC7D,gBAAgB,QAChB6D,aAAA,CAACpD,0BAA0B;IAC1BM,QAAQ,EAAGkC,cAAgB;IAC3B3B,IAAI,EAAGA,IAAM;IACbN,YAAY,EAAGA,YAAc;IAC7B8C,cAAc,EAAG,KAAO;IACxBC,kBAAkB,EAAGrC,QAAU;IAAA,GAC1BT;EAAK,GAEV4C,aAAA,CAACnE,aAAa,QACbmE,aAAA,CAAC1D,WAAW,MAAE,CAAC,EACf0D,aAAA,CAACxD,oBAAoB;IAACM,MAAM,EAAGO,WAAW,CAACP;EAAQ,CAAE,CAAC,EACtDkD,aAAA,CAACzD,MAAM,MAAE,CACK,CAAC,EAChByD,aAAA,CAAClE,eAAe,MAAE,CACS,CACX,CAAC;AAErB;AAEA,eAAee,MAAM"}
1
+ {"version":3,"names":["useSelect","useDispatch","ErrorBoundary","PostLockedModal","store","editorStore","privateApis","editorPrivateApis","useMemo","SlotFillProvider","coreStore","preferencesStore","CommandMenu","Layout","EditorInitialization","editPostStore","unlock","usePostHistory","ExperimentalEditorProvider","Editor","postId","initialPostId","postType","initialPostType","settings","initialEdits","props","currentPost","getPostLinkProps","goBack","hasInlineToolbar","post","preferredStyleVariations","template","select","_getPostType$viewable","isFeatureActive","getEditedPostTemplate","getEntityRecord","getPostType","getEntityRecords","canUser","getEditorSettings","isTemplate","includes","postObject","posts","wp_id","supportsTemplateMode","isViewable","viewable","canEditTemplate","get","updatePreferredStyleVariations","editorSettings","result","__experimentalPreferredStyleVariations","value","onChange","createElement","useSubRegistry","__unstableTemplate"],"sources":["@wordpress/edit-post/src/editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tErrorBoundary,\n\tPostLockedModal,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { useMemo } from '@wordpress/element';\nimport { SlotFillProvider } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { CommandMenu } from '@wordpress/commands';\n\n/**\n * Internal dependencies\n */\nimport Layout from './components/layout';\nimport EditorInitialization from './components/editor-initialization';\nimport { store as editPostStore } from './store';\nimport { unlock } from './lock-unlock';\nimport usePostHistory from './hooks/use-post-history';\n\nconst { ExperimentalEditorProvider } = unlock( editorPrivateApis );\n\nfunction Editor( {\n\tpostId: initialPostId,\n\tpostType: initialPostType,\n\tsettings,\n\tinitialEdits,\n\t...props\n} ) {\n\tconst { currentPost, getPostLinkProps, goBack } = usePostHistory(\n\t\tinitialPostId,\n\t\tinitialPostType\n\t);\n\n\tconst { hasInlineToolbar, post, preferredStyleVariations, template } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { isFeatureActive, getEditedPostTemplate } =\n\t\t\t\t\tselect( editPostStore );\n\t\t\t\tconst {\n\t\t\t\t\tgetEntityRecord,\n\t\t\t\t\tgetPostType,\n\t\t\t\t\tgetEntityRecords,\n\t\t\t\t\tcanUser,\n\t\t\t\t} = select( coreStore );\n\t\t\t\tconst { getEditorSettings } = select( editorStore );\n\t\t\t\tconst isTemplate = [\n\t\t\t\t\t'wp_template',\n\t\t\t\t\t'wp_template_part',\n\t\t\t\t].includes( currentPost.postType );\n\t\t\t\t// Ideally the initializeEditor function should be called using the ID of the REST endpoint.\n\t\t\t\t// to avoid the special case.\n\t\t\t\tlet postObject;\n\t\t\t\tif ( isTemplate ) {\n\t\t\t\t\tconst posts = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twp_id: currentPost.postId,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tpostObject = posts?.[ 0 ];\n\t\t\t\t} else {\n\t\t\t\t\tpostObject = getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tcurrentPost.postType,\n\t\t\t\t\t\tcurrentPost.postId\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst supportsTemplateMode =\n\t\t\t\t\tgetEditorSettings().supportsTemplateMode;\n\t\t\t\tconst isViewable =\n\t\t\t\t\tgetPostType( currentPost.postType )?.viewable ?? false;\n\t\t\t\tconst canEditTemplate = canUser( 'create', 'templates' );\n\t\t\t\treturn {\n\t\t\t\t\thasInlineToolbar: isFeatureActive( 'inlineToolbar' ),\n\t\t\t\t\tpreferredStyleVariations: select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-post',\n\t\t\t\t\t\t'preferredStyleVariations'\n\t\t\t\t\t),\n\t\t\t\t\ttemplate:\n\t\t\t\t\t\tsupportsTemplateMode && isViewable && canEditTemplate\n\t\t\t\t\t\t\t? getEditedPostTemplate()\n\t\t\t\t\t\t\t: null,\n\t\t\t\t\tpost: postObject,\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ currentPost.postType, currentPost.postId ]\n\t\t);\n\n\tconst { updatePreferredStyleVariations } = useDispatch( editPostStore );\n\n\tconst editorSettings = useMemo( () => {\n\t\tconst result = {\n\t\t\t...settings,\n\t\t\tgetPostLinkProps,\n\t\t\tgoBack,\n\t\t\t__experimentalPreferredStyleVariations: {\n\t\t\t\tvalue: preferredStyleVariations,\n\t\t\t\tonChange: updatePreferredStyleVariations,\n\t\t\t},\n\t\t\thasInlineToolbar,\n\t\t};\n\t\treturn result;\n\t}, [\n\t\tsettings,\n\t\thasInlineToolbar,\n\t\tpreferredStyleVariations,\n\t\tupdatePreferredStyleVariations,\n\t\tgetPostLinkProps,\n\t\tgoBack,\n\t] );\n\n\tif ( ! post ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<ExperimentalEditorProvider\n\t\t\t\tsettings={ editorSettings }\n\t\t\t\tpost={ post }\n\t\t\t\tinitialEdits={ initialEdits }\n\t\t\t\tuseSubRegistry={ false }\n\t\t\t\t__unstableTemplate={ template }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t<ErrorBoundary>\n\t\t\t\t\t<CommandMenu />\n\t\t\t\t\t<EditorInitialization postId={ currentPost.postId } />\n\t\t\t\t\t<Layout />\n\t\t\t\t</ErrorBoundary>\n\t\t\t\t<PostLockedModal />\n\t\t\t</ExperimentalEditorProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n\nexport default Editor;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SACCC,aAAa,EACbC,eAAe,EACfC,KAAK,IAAIC,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASL,KAAK,IAAIM,SAAS,QAAQ,sBAAsB;AACzD,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,wBAAwB;AAClE,SAASC,WAAW,QAAQ,qBAAqB;;AAEjD;AACA;AACA;AACA,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,oBAAoB,MAAM,oCAAoC;AACrE,SAASV,KAAK,IAAIW,aAAa,QAAQ,SAAS;AAChD,SAASC,MAAM,QAAQ,eAAe;AACtC,OAAOC,cAAc,MAAM,0BAA0B;AAErD,MAAM;EAAEC;AAA2B,CAAC,GAAGF,MAAM,CAAET,iBAAkB,CAAC;AAElE,SAASY,MAAMA,CAAE;EAChBC,MAAM,EAAEC,aAAa;EACrBC,QAAQ,EAAEC,eAAe;EACzBC,QAAQ;EACRC,YAAY;EACZ,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM;IAAEC,WAAW;IAAEC,gBAAgB;IAAEC;EAAO,CAAC,GAAGZ,cAAc,CAC/DI,aAAa,EACbE,eACD,CAAC;EAED,MAAM;IAAEO,gBAAgB;IAAEC,IAAI;IAAEC,wBAAwB;IAAEC;EAAS,CAAC,GACn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