@wordpress/editor 13.1.0 → 13.3.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 (138) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +1 -1
  3. package/build/components/error-boundary/index.js +24 -30
  4. package/build/components/error-boundary/index.js.map +1 -1
  5. package/build/components/media-categories/index.js +237 -0
  6. package/build/components/media-categories/index.js.map +1 -0
  7. package/build/components/page-attributes/parent.js +1 -1
  8. package/build/components/page-attributes/parent.js.map +1 -1
  9. package/build/components/post-author/select.js +1 -0
  10. package/build/components/post-author/select.js.map +1 -1
  11. package/build/components/post-format/index.js +1 -0
  12. package/build/components/post-format/index.js.map +1 -1
  13. package/build/components/post-publish-panel/postpublish.js +1 -0
  14. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  15. package/build/components/post-slug/index.js +1 -0
  16. package/build/components/post-slug/index.js.map +1 -1
  17. package/build/components/post-taxonomies/hierarchical-term-selector.js +7 -3
  18. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  19. package/build/components/post-template/index.js +8 -4
  20. package/build/components/post-template/index.js.map +1 -1
  21. package/build/components/post-url/index.js +1 -0
  22. package/build/components/post-url/index.js.map +1 -1
  23. package/build/components/provider/index.js +26 -8
  24. package/build/components/provider/index.js.map +1 -1
  25. package/build/components/provider/index.native.js +21 -14
  26. package/build/components/provider/index.native.js.map +1 -1
  27. package/build/components/provider/use-block-editor-settings.js +7 -4
  28. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  29. package/build/components/provider/use-block-editor-settings.native.js +1 -2
  30. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  31. package/build/components/table-of-contents/index.js +3 -1
  32. package/build/components/table-of-contents/index.js.map +1 -1
  33. package/build/components/unsaved-changes-warning/index.js +1 -1
  34. package/build/components/unsaved-changes-warning/index.js.map +1 -1
  35. package/build/experiments.js +20 -0
  36. package/build/experiments.js.map +1 -0
  37. package/build/hooks/custom-sources-backwards-compatibility.js +16 -8
  38. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  39. package/build/hooks/default-autocompleters.js +2 -7
  40. package/build/hooks/default-autocompleters.js.map +1 -1
  41. package/build/index.js +14 -0
  42. package/build/index.js.map +1 -1
  43. package/build/index.native.js +14 -0
  44. package/build/index.native.js.map +1 -1
  45. package/build/lockUnlock.js +19 -0
  46. package/build/lockUnlock.js.map +1 -0
  47. package/build/store/defaults.js +1 -2
  48. package/build/store/defaults.js.map +1 -1
  49. package/build/store/selectors.js +1 -1
  50. package/build/store/selectors.js.map +1 -1
  51. package/build/utils/terms.js +9 -5
  52. package/build/utils/terms.js.map +1 -1
  53. package/build-module/components/error-boundary/index.js +24 -30
  54. package/build-module/components/error-boundary/index.js.map +1 -1
  55. package/build-module/components/media-categories/index.js +225 -0
  56. package/build-module/components/media-categories/index.js.map +1 -0
  57. package/build-module/components/page-attributes/parent.js +2 -2
  58. package/build-module/components/page-attributes/parent.js.map +1 -1
  59. package/build-module/components/post-author/select.js +1 -0
  60. package/build-module/components/post-author/select.js.map +1 -1
  61. package/build-module/components/post-format/index.js +1 -0
  62. package/build-module/components/post-format/index.js.map +1 -1
  63. package/build-module/components/post-publish-panel/postpublish.js +1 -0
  64. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  65. package/build-module/components/post-slug/index.js +1 -0
  66. package/build-module/components/post-slug/index.js.map +1 -1
  67. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +8 -5
  68. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  69. package/build-module/components/post-template/index.js +9 -5
  70. package/build-module/components/post-template/index.js.map +1 -1
  71. package/build-module/components/post-url/index.js +1 -0
  72. package/build-module/components/post-url/index.js.map +1 -1
  73. package/build-module/components/provider/index.js +21 -9
  74. package/build-module/components/provider/index.js.map +1 -1
  75. package/build-module/components/provider/index.native.js +20 -12
  76. package/build-module/components/provider/index.native.js.map +1 -1
  77. package/build-module/components/provider/use-block-editor-settings.js +5 -5
  78. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  79. package/build-module/components/provider/use-block-editor-settings.native.js +1 -2
  80. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  81. package/build-module/components/table-of-contents/index.js +3 -1
  82. package/build-module/components/table-of-contents/index.js.map +1 -1
  83. package/build-module/components/unsaved-changes-warning/index.js +1 -1
  84. package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
  85. package/build-module/experiments.js +10 -0
  86. package/build-module/experiments.js.map +1 -0
  87. package/build-module/hooks/custom-sources-backwards-compatibility.js +17 -9
  88. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  89. package/build-module/hooks/default-autocompleters.js +2 -6
  90. package/build-module/hooks/default-autocompleters.js.map +1 -1
  91. package/build-module/index.js +1 -0
  92. package/build-module/index.js.map +1 -1
  93. package/build-module/index.native.js +1 -0
  94. package/build-module/index.native.js.map +1 -1
  95. package/build-module/lockUnlock.js +9 -0
  96. package/build-module/lockUnlock.js.map +1 -0
  97. package/build-module/store/defaults.js +1 -2
  98. package/build-module/store/defaults.js.map +1 -1
  99. package/build-module/store/selectors.js +1 -1
  100. package/build-module/store/selectors.js.map +1 -1
  101. package/build-module/utils/terms.js +9 -6
  102. package/build-module/utils/terms.js.map +1 -1
  103. package/build-style/style-rtl.css +0 -3
  104. package/build-style/style.css +0 -3
  105. package/package.json +30 -29
  106. package/src/components/autosave-monitor/test/index.js +8 -2
  107. package/src/components/editor-help/test/index.native.js +5 -5
  108. package/src/components/error-boundary/index.js +24 -37
  109. package/src/components/media-categories/index.js +247 -0
  110. package/src/components/page-attributes/parent.js +2 -2
  111. package/src/components/page-attributes/test/order.js +4 -14
  112. package/src/components/post-author/select.js +1 -0
  113. package/src/components/post-format/index.js +1 -0
  114. package/src/components/post-preview-button/test/index.js +5 -17
  115. package/src/components/post-publish-button/test/index.js +5 -17
  116. package/src/components/post-publish-panel/postpublish.js +1 -0
  117. package/src/components/post-publish-panel/style.scss +1 -5
  118. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -18
  119. package/src/components/post-saved-state/test/index.js +1 -5
  120. package/src/components/post-slug/index.js +1 -0
  121. package/src/components/post-taxonomies/hierarchical-term-selector.js +23 -17
  122. package/src/components/post-template/index.js +4 -4
  123. package/src/components/post-url/index.js +1 -0
  124. package/src/components/provider/index.js +120 -91
  125. package/src/components/provider/index.native.js +26 -17
  126. package/src/components/provider/use-block-editor-settings.js +60 -49
  127. package/src/components/provider/use-block-editor-settings.native.js +1 -2
  128. package/src/components/table-of-contents/index.js +3 -1
  129. package/src/components/unsaved-changes-warning/index.js +1 -1
  130. package/src/experiments.js +10 -0
  131. package/src/hooks/custom-sources-backwards-compatibility.js +16 -13
  132. package/src/hooks/default-autocompleters.js +1 -6
  133. package/src/index.js +1 -0
  134. package/src/index.native.js +1 -0
  135. package/src/lockUnlock.js +9 -0
  136. package/src/store/defaults.js +0 -1
  137. package/src/store/selectors.js +1 -1
  138. package/src/utils/terms.js +8 -5
@@ -3,15 +3,17 @@
3
3
  */
4
4
  import { Platform, useMemo } from '@wordpress/element';
5
5
  import { useDispatch, useSelect } from '@wordpress/data';
6
- import { store as coreStore, __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData, __experimentalFetchMedia as fetchMedia } from '@wordpress/core-data';
6
+ import { store as coreStore, __experimentalFetchLinkSuggestions as fetchLinkSuggestions, __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
7
7
  import { __ } from '@wordpress/i18n';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
11
 
12
+ import inserterMediaCategories from '../media-categories';
12
13
  import { mediaUpload } from '../../utils';
13
14
  import { store as editorStore } from '../../store';
14
15
  const EMPTY_BLOCKS_LIST = [];
16
+ const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__experimentalBlockInspectorAnimation', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'blockInspectorTabs', 'allowedMimeTypes', 'bodyPlaceholder', 'canLockBlocks', 'capabilities', 'clearBlockSelection', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'enableOpenverseMediaCategory', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'hasInlineToolbar', 'isDistractionFree', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'locale', 'maxWidth', 'onUpdateDefaultBlockStyles', 'postsPerPage', 'readOnly', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets'];
15
17
  /**
16
18
  * React hook used to compute the block editor settings to use for the post editor.
17
19
  *
@@ -102,16 +104,14 @@ function useBlockEditorSettings(settings, hasTemplate) {
102
104
 
103
105
  return useMemo(() => ({ ...Object.fromEntries(Object.entries(settings).filter(_ref2 => {
104
106
  let [key] = _ref2;
105
- return ['__experimentalBlockDirectory', '__experimentalBlockInspectorTabs', '__experimentalDiscussionSettings', '__experimentalFeatures', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', '__unstableGalleryWithImageBlocks', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'canLockBlocks', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomSpacingSizes', 'disableCustomGradients', 'disableLayoutStyles', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'generateAnchors', 'hasFixedToolbar', 'isDistractionFree', 'hasInlineToolbar', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableResolvedAssets'].includes(key);
107
+ return BLOCK_EDITOR_SETTINGS.includes(key);
106
108
  })),
107
109
  mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
108
110
  __experimentalReusableBlocks: reusableBlocks,
109
111
  __experimentalBlockPatterns: blockPatterns,
110
112
  __experimentalBlockPatternCategories: blockPatternCategories,
111
113
  __experimentalFetchLinkSuggestions: (search, searchOptions) => fetchLinkSuggestions(search, searchOptions, settings),
112
- // TODO: We should find a proper way to consolidate similar cases
113
- // like reusable blocks, fetch entities, etc.
114
- __unstableFetchMedia: fetchMedia,
114
+ inserterMediaCategories,
115
115
  __experimentalFetchRichUrlData: fetchUrlData,
116
116
  __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
117
117
  __experimentalUndo: undo,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__experimentalFetchMedia","fetchMedia","__","mediaUpload","editorStore","EMPTY_BLOCKS_LIST","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","isWeb","OS","canUser","getEntityRecord","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","Object","fromEntries","entries","key","__experimentalReusableBlocks","search","searchOptions","__unstableFetchMedia","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,EAICC,wBAAwB,IAAIC,UAJ7B,QAKO,sBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAAST,KAAK,IAAIU,WAAlB,QAAqC,aAArC;AAEA,MAAMC,iBAAiB,GAAG,EAA1B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,sBAAT,CAAiCC,QAAjC,EAA2CC,WAA3C,EAAyD;AAAA;;AACxD,QAAM;AACLC,IAAAA,cADK;AAELC,IAAAA,oBAFK;AAGLC,IAAAA,oBAHK;AAILC,IAAAA,kBAJK;AAKLC,IAAAA,WALK;AAMLC,IAAAA;AANK,MAOFrB,SAAS,CAAIsB,MAAF,IAAc;AAAA;;AAC5B,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEX,WAAF,CADP;AAEA,UAAMc,KAAK,GAAG5B,QAAQ,CAAC6B,EAAT,KAAgB,KAA9B;AACA,UAAM;AAAEC,MAAAA,OAAF;AAAWC,MAAAA;AAAX,QAA+BN,MAAM,CAAEpB,SAAF,CAA3C;AAEA,UAAM2B,YAAY,GAAGF,OAAO,CAAE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IAAAA,oBAAoB,EAAE/D,UA1Df;AA2DPgE,IAAAA,8BAA8B,EAAElE,YA3DzB;AA4DPmE,IAAAA,sCAAsC,EAAEvD,oBA5DjC;AA6DPwD,IAAAA,kBAAkB,EAAEjB,IA7Db;AA8DPkB,IAAAA,WAAW,EAAE5D,WA9DN;AA+DP6D,IAAAA,8BAA8B,EAAEjB,gBA/DzB;AAgEPkB,IAAAA,gCAAgC,EAAE1D,kBAhE3B;AAiEPC,IAAAA,WAjEO;AAkEP0D,IAAAA,kCAAkC,EAAE/D;AAlE7B,GAAR,CADa,EAqEb,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC4B,aAJD,EAKCY,sBALD,EAMCtC,oBAND,EAOCuC,IAPD,EAQC1C,WARD,EASCI,kBATD,EAUCC,WAVD,CArEa,CAAd;AAkFA;;AAED,eAAeP,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n\t__experimentalFetchMedia as fetchMedia,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\t[\n\t\t\t\t\t\t'__experimentalBlockDirectory',\n\t\t\t\t\t\t'__experimentalBlockInspectorTabs',\n\t\t\t\t\t\t'__experimentalDiscussionSettings',\n\t\t\t\t\t\t'__experimentalFeatures',\n\t\t\t\t\t\t'__experimentalPreferredStyleVariations',\n\t\t\t\t\t\t'__experimentalSetIsInserterOpened',\n\t\t\t\t\t\t'__unstableGalleryWithImageBlocks',\n\t\t\t\t\t\t'alignWide',\n\t\t\t\t\t\t'allowedBlockTypes',\n\t\t\t\t\t\t'bodyPlaceholder',\n\t\t\t\t\t\t'canLockBlocks',\n\t\t\t\t\t\t'codeEditingEnabled',\n\t\t\t\t\t\t'colors',\n\t\t\t\t\t\t'disableCustomColors',\n\t\t\t\t\t\t'disableCustomFontSizes',\n\t\t\t\t\t\t'disableCustomSpacingSizes',\n\t\t\t\t\t\t'disableCustomGradients',\n\t\t\t\t\t\t'disableLayoutStyles',\n\t\t\t\t\t\t'enableCustomLineHeight',\n\t\t\t\t\t\t'enableCustomSpacing',\n\t\t\t\t\t\t'enableCustomUnits',\n\t\t\t\t\t\t'focusMode',\n\t\t\t\t\t\t'fontSizes',\n\t\t\t\t\t\t'gradients',\n\t\t\t\t\t\t'generateAnchors',\n\t\t\t\t\t\t'hasFixedToolbar',\n\t\t\t\t\t\t'isDistractionFree',\n\t\t\t\t\t\t'hasInlineToolbar',\n\t\t\t\t\t\t'imageDefaultSize',\n\t\t\t\t\t\t'imageDimensions',\n\t\t\t\t\t\t'imageEditing',\n\t\t\t\t\t\t'imageSizes',\n\t\t\t\t\t\t'isRTL',\n\t\t\t\t\t\t'keepCaretInsideBlock',\n\t\t\t\t\t\t'maxWidth',\n\t\t\t\t\t\t'onUpdateDefaultBlockStyles',\n\t\t\t\t\t\t'styles',\n\t\t\t\t\t\t'template',\n\t\t\t\t\t\t'templateLock',\n\t\t\t\t\t\t'titlePlaceholder',\n\t\t\t\t\t\t'supportsLayout',\n\t\t\t\t\t\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t\t\t\t\t\t'__unstableResolvedAssets',\n\t\t\t\t\t].includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\t// TODO: We should find a proper way to consolidate similar cases\n\t\t\t// like reusable blocks, fetch entities, etc.\n\t\t\t__unstableFetchMedia: fetchMedia,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.js"],"names":["Platform","useMemo","useDispatch","useSelect","store","coreStore","__experimentalFetchLinkSuggestions","fetchLinkSuggestions","__experimentalFetchUrlData","fetchUrlData","__","inserterMediaCategories","mediaUpload","editorStore","EMPTY_BLOCKS_LIST","BLOCK_EDITOR_SETTINGS","useBlockEditorSettings","settings","hasTemplate","reusableBlocks","hasUploadPermissions","canUseUnfilteredHTML","userCanCreatePages","pageOnFront","postType","select","canUserUseUnfilteredHTML","getCurrentPostType","isWeb","OS","canUser","getEntityRecord","siteSettings","undefined","getEntityRecords","per_page","page_on_front","settingsBlockPatterns","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","settingsBlockPatternCategories","__experimentalAdditionalBlockPatternCategories","__experimentalBlockPatternCategories","restBlockPatterns","restBlockPatternCategories","getBlockPatterns","getBlockPatternCategories","blockPatterns","filter","x","index","arr","findIndex","y","name","postTypes","Array","isArray","includes","blockPatternCategories","undo","saveEntityRecord","createPageEntity","options","Promise","reject","message","Object","fromEntries","entries","key","__experimentalReusableBlocks","search","searchOptions","__experimentalFetchRichUrlData","__experimentalCanUserUseUnfilteredHTML","__experimentalUndo","outlineMode","__experimentalCreatePageEntity","__experimentalUserCanCreatePages","__experimentalPreferPatternsOnRoot"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,OAAnB,QAAkC,oBAAlC;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,KAAK,IAAIC,SADV,EAECC,kCAAkC,IAAIC,oBAFvC,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,sBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,qBAApC;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,aAArC;AAEA,MAAMC,iBAAiB,GAAG,EAA1B;AAEA,MAAMC,qBAAqB,GAAG,CAC7B,8BAD6B,EAE7B,uCAF6B,EAG7B,kCAH6B,EAI7B,wBAJ6B,EAK7B,sCAL6B,EAM7B,wCAN6B,EAO7B,mCAP6B,EAQ7B,kCAR6B,EAS7B,WAT6B,EAU7B,mBAV6B,EAW7B,oBAX6B,EAY7B,kBAZ6B,EAa7B,iBAb6B,EAc7B,eAd6B,EAe7B,cAf6B,EAgB7B,qBAhB6B,EAiB7B,oBAjB6B,EAkB7B,QAlB6B,EAmB7B,qBAnB6B,EAoB7B,wBApB6B,EAqB7B,2BArB6B,EAsB7B,wBAtB6B,EAuB7B,qBAvB6B,EAwB7B,wBAxB6B,EAyB7B,qBAzB6B,EA0B7B,mBA1B6B,EA2B7B,8BA3B6B,EA4B7B,WA5B6B,EA6B7B,WA7B6B,EA8B7B,WA9B6B,EA+B7B,iBA/B6B,EAgC7B,iBAhC6B,EAiC7B,kBAjC6B,EA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,WAAW,EAAEQ,oBAAoB,GAAGR,WAAH,GAAiBqB,SAN3C;AAOPsC,IAAAA,4BAA4B,EAAEpD,cAPvB;AAQPoB,IAAAA,2BAA2B,EAAEQ,aARtB;AASPL,IAAAA,oCAAoC,EAAEiB,sBAT/B;AAUPrD,IAAAA,kCAAkC,EAAE,CAAEkE,MAAF,EAAUC,aAAV,KACnClE,oBAAoB,CAAEiE,MAAF,EAAUC,aAAV,EAAyBxD,QAAzB,CAXd;AAYPN,IAAAA,uBAZO;AAaP+D,IAAAA,8BAA8B,EAAEjE,YAbzB;AAcPkE,IAAAA,sCAAsC,EAAEtD,oBAdjC;AAePuD,IAAAA,kBAAkB,EAAEhB,IAfb;AAgBPiB,IAAAA,WAAW,EAAE3D,WAhBN;AAiBP4D,IAAAA,8BAA8B,EAAEhB,gBAjBzB;AAkBPiB,IAAAA,gCAAgC,EAAEzD,kBAlB3B;AAmBPC,IAAAA,WAnBO;AAoBPyD,IAAAA,kCAAkC,EAAE9D;AApB7B,GAAR,CADa,EAuBb,CACCD,QADD,EAECG,oBAFD,EAGCD,cAHD,EAIC4B,aAJD,EAKCY,sBALD,EAMCtC,oBAND,EAOCuC,IAPD,EAQC1C,WARD,EASCI,kBATD,EAUCC,WAVD,CAvBa,CAAd;AAoCA;;AAED,eAAeP,sBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform, useMemo } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tstore as coreStore,\n\t__experimentalFetchLinkSuggestions as fetchLinkSuggestions,\n\t__experimentalFetchUrlData as fetchUrlData,\n} from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport inserterMediaCategories from '../media-categories';\nimport { mediaUpload } from '../../utils';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nconst BLOCK_EDITOR_SETTINGS = [\n\t'__experimentalBlockDirectory',\n\t'__experimentalBlockInspectorAnimation',\n\t'__experimentalDiscussionSettings',\n\t'__experimentalFeatures',\n\t'__experimentalGlobalStylesBaseStyles',\n\t'__experimentalPreferredStyleVariations',\n\t'__experimentalSetIsInserterOpened',\n\t'__unstableGalleryWithImageBlocks',\n\t'alignWide',\n\t'allowedBlockTypes',\n\t'blockInspectorTabs',\n\t'allowedMimeTypes',\n\t'bodyPlaceholder',\n\t'canLockBlocks',\n\t'capabilities',\n\t'clearBlockSelection',\n\t'codeEditingEnabled',\n\t'colors',\n\t'disableCustomColors',\n\t'disableCustomFontSizes',\n\t'disableCustomSpacingSizes',\n\t'disableCustomGradients',\n\t'disableLayoutStyles',\n\t'enableCustomLineHeight',\n\t'enableCustomSpacing',\n\t'enableCustomUnits',\n\t'enableOpenverseMediaCategory',\n\t'focusMode',\n\t'fontSizes',\n\t'gradients',\n\t'generateAnchors',\n\t'hasFixedToolbar',\n\t'hasInlineToolbar',\n\t'isDistractionFree',\n\t'imageDefaultSize',\n\t'imageDimensions',\n\t'imageEditing',\n\t'imageSizes',\n\t'isRTL',\n\t'keepCaretInsideBlock',\n\t'locale',\n\t'maxWidth',\n\t'onUpdateDefaultBlockStyles',\n\t'postsPerPage',\n\t'readOnly',\n\t'styles',\n\t'template',\n\t'templateLock',\n\t'titlePlaceholder',\n\t'supportsLayout',\n\t'widgetTypesToHideFromLegacyWidgetBlock',\n\t'__unstableHasCustomAppender',\n\t'__unstableIsPreviewMode',\n\t'__unstableResolvedAssets',\n];\n\n/**\n * React hook used to compute the block editor settings to use for the post editor.\n *\n * @param {Object} settings EditorProvider settings prop.\n * @param {boolean} hasTemplate Whether template mode is enabled.\n *\n * @return {Object} Block Editor Settings.\n */\nfunction useBlockEditorSettings( settings, hasTemplate ) {\n\tconst {\n\t\treusableBlocks,\n\t\thasUploadPermissions,\n\t\tcanUseUnfilteredHTML,\n\t\tuserCanCreatePages,\n\t\tpageOnFront,\n\t\tpostType,\n\t} = useSelect( ( select ) => {\n\t\tconst { canUserUseUnfilteredHTML, getCurrentPostType } =\n\t\t\tselect( editorStore );\n\t\tconst isWeb = Platform.OS === 'web';\n\t\tconst { canUser, getEntityRecord } = select( coreStore );\n\n\t\tconst siteSettings = canUser( 'read', 'settings' )\n\t\t\t? getEntityRecord( 'root', 'site' )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanUseUnfilteredHTML: canUserUseUnfilteredHTML(),\n\t\t\treusableBlocks: isWeb\n\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t{ per_page: -1 }\n\t\t\t\t )\n\t\t\t\t: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.\n\t\t\thasUploadPermissions: canUser( 'create', 'media' ) ?? true,\n\t\t\tuserCanCreatePages: canUser( 'create', 'pages' ),\n\t\t\tpageOnFront: siteSettings?.page_on_front,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t}, [] );\n\n\tconst settingsBlockPatterns =\n\t\tsettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatterns; // WP 5.9\n\tconst settingsBlockPatternCategories =\n\t\tsettings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0\n\t\tsettings.__experimentalBlockPatternCategories; // WP 5.9\n\n\tconst { restBlockPatterns, restBlockPatternCategories } = useSelect(\n\t\t( select ) => ( {\n\t\t\trestBlockPatterns: select( coreStore ).getBlockPatterns(),\n\t\t\trestBlockPatternCategories:\n\t\t\t\tselect( coreStore ).getBlockPatternCategories(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tconst blockPatterns = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatterns || [] ),\n\t\t\t\t...( restBlockPatterns || [] ),\n\t\t\t]\n\t\t\t\t.filter(\n\t\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t\t)\n\t\t\t\t.filter( ( { postTypes } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t);\n\t\t\t\t} ),\n\t\t[ settingsBlockPatterns, restBlockPatterns, postType ]\n\t);\n\n\tconst blockPatternCategories = useMemo(\n\t\t() =>\n\t\t\t[\n\t\t\t\t...( settingsBlockPatternCategories || [] ),\n\t\t\t\t...( restBlockPatternCategories || [] ),\n\t\t\t].filter(\n\t\t\t\t( x, index, arr ) =>\n\t\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t\t),\n\t\t[ settingsBlockPatternCategories, restBlockPatternCategories ]\n\t);\n\n\tconst { undo } = useDispatch( editorStore );\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\t/**\n\t * Creates a Post entity.\n\t * This is utilised by the Link UI to allow for on-the-fly creation of Posts/Pages.\n\t *\n\t * @param {Object} options parameters for the post being created. These mirror those used on 3rd param of saveEntityRecord.\n\t * @return {Object} the post type object that was created.\n\t */\n\tconst createPageEntity = ( options ) => {\n\t\tif ( ! userCanCreatePages ) {\n\t\t\treturn Promise.reject( {\n\t\t\t\tmessage: __( 'You do not have permission to create Pages.' ),\n\t\t\t} );\n\t\t}\n\t\treturn saveEntityRecord( 'postType', 'page', options );\n\t};\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...Object.fromEntries(\n\t\t\t\tObject.entries( settings ).filter( ( [ key ] ) =>\n\t\t\t\t\tBLOCK_EDITOR_SETTINGS.includes( key )\n\t\t\t\t)\n\t\t\t),\n\t\t\tmediaUpload: hasUploadPermissions ? mediaUpload : undefined,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalBlockPatterns: blockPatterns,\n\t\t\t__experimentalBlockPatternCategories: blockPatternCategories,\n\t\t\t__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>\n\t\t\t\tfetchLinkSuggestions( search, searchOptions, settings ),\n\t\t\tinserterMediaCategories,\n\t\t\t__experimentalFetchRichUrlData: fetchUrlData,\n\t\t\t__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,\n\t\t\t__experimentalUndo: undo,\n\t\t\toutlineMode: hasTemplate,\n\t\t\t__experimentalCreatePageEntity: createPageEntity,\n\t\t\t__experimentalUserCanCreatePages: userCanCreatePages,\n\t\t\tpageOnFront,\n\t\t\t__experimentalPreferPatternsOnRoot: hasTemplate,\n\t\t} ),\n\t\t[\n\t\t\tsettings,\n\t\t\thasUploadPermissions,\n\t\t\treusableBlocks,\n\t\t\tblockPatterns,\n\t\t\tblockPatternCategories,\n\t\t\tcanUseUnfilteredHTML,\n\t\t\tundo,\n\t\t\thasTemplate,\n\t\t\tuserCanCreatePages,\n\t\t\tpageOnFront,\n\t\t]\n\t);\n}\n\nexport default useBlockEditorSettings;\n"]}
@@ -15,9 +15,8 @@ const EMPTY_BLOCKS_LIST = [];
15
15
  function useNativeBlockEditorSettings(settings, hasTemplate) {
16
16
  var _settings$capabilitie;
17
17
 
18
- const capabilities = (_settings$capabilitie = settings.capabilities) !== null && _settings$capabilitie !== void 0 ? _settings$capabilitie : {};
19
18
  const editorSettings = useBlockEditorSettings(settings, hasTemplate);
20
- const supportReusableBlock = capabilities.reusableBlock === true;
19
+ const supportReusableBlock = ((_settings$capabilitie = settings.capabilities) === null || _settings$capabilitie === void 0 ? void 0 : _settings$capabilitie.reusableBlock) === true;
21
20
  const {
22
21
  reusableBlocks,
23
22
  isTitleSelected
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.native.js"],"names":["useMemo","useSelect","store","coreStore","useBlockEditorSettings","editorStore","EMPTY_BLOCKS_LIST","useNativeBlockEditorSettings","settings","hasTemplate","capabilities","editorSettings","supportReusableBlock","reusableBlock","reusableBlocks","isTitleSelected","select","getEntityRecords","per_page","isPostTitleSelected","__experimentalReusableBlocks","__experimentalShouldInsertAtTheTop"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,gCAAnC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;AAEA,MAAMC,iBAAiB,GAAG,EAA1B;;AAEA,SAASC,4BAAT,CAAuCC,QAAvC,EAAiDC,WAAjD,EAA+D;AAAA;;AAC9D,QAAMC,YAAY,4BAAGF,QAAQ,CAACE,YAAZ,yEAA4B,EAA9C;AACA,QAAMC,cAAc,GAAGP,sBAAsB,CAAEI,QAAF,EAAYC,WAAZ,CAA7C;AAEA,QAAMG,oBAAoB,GAAGF,YAAY,CAACG,aAAb,KAA+B,IAA5D;AACA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAsCd,SAAS,CAClDe,MAAF,IAAc;AACb,WAAO;AACNF,MAAAA,cAAc,EAAEF,oBAAoB,GACjCI,MAAM,CAAEb,SAAF,CAAN,CAAoBc,gBAApB,CACA,UADA,EAEA,UAFA,EAGA;AACA;AACA;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,OALA,CADiC,GAQjCZ,iBATG;AAUNS,MAAAA,eAAe,EAAEC,MAAM,CAAEX,WAAF,CAAN,CAAsBc,mBAAtB;AAVX,KAAP;AAYA,GAdmD,EAepD,CAAEP,oBAAF,CAfoD,CAArD;AAkBA,SAAOZ,OAAO,CACb,OAAQ,EACP,GAAGW,cADI;AAEPS,IAAAA,4BAA4B,EAAEN,cAFvB;AAGPO,IAAAA,kCAAkC,EAAEN;AAH7B,GAAR,CADa,EAMb,CAAEJ,cAAF,EAAkBG,cAAlB,EAAkCC,eAAlC,CANa,CAAd;AAQA;;AAED,eAAeR,4BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useBlockEditorSettings from './use-block-editor-settings.js';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nfunction useNativeBlockEditorSettings( settings, hasTemplate ) {\n\tconst capabilities = settings.capabilities ?? {};\n\tconst editorSettings = useBlockEditorSettings( settings, hasTemplate );\n\n\tconst supportReusableBlock = capabilities.reusableBlock === true;\n\tconst { reusableBlocks, isTitleSelected } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\treusableBlocks: supportReusableBlock\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t\t// Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle.\n\t\t\t\t\t\t\t// Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661\n\t\t\t\t\t\t\t{ per_page: 100 }\n\t\t\t\t\t )\n\t\t\t\t\t: EMPTY_BLOCKS_LIST,\n\t\t\t\tisTitleSelected: select( editorStore ).isPostTitleSelected(),\n\t\t\t};\n\t\t},\n\t\t[ supportReusableBlock ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...editorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalShouldInsertAtTheTop: isTitleSelected,\n\t\t} ),\n\t\t[ editorSettings, reusableBlocks, isTitleSelected ]\n\t);\n}\n\nexport default useNativeBlockEditorSettings;\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/provider/use-block-editor-settings.native.js"],"names":["useMemo","useSelect","store","coreStore","useBlockEditorSettings","editorStore","EMPTY_BLOCKS_LIST","useNativeBlockEditorSettings","settings","hasTemplate","editorSettings","supportReusableBlock","capabilities","reusableBlock","reusableBlocks","isTitleSelected","select","getEntityRecords","per_page","isPostTitleSelected","__experimentalReusableBlocks","__experimentalShouldInsertAtTheTop"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,gCAAnC;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,aAArC;AAEA,MAAMC,iBAAiB,GAAG,EAA1B;;AAEA,SAASC,4BAAT,CAAuCC,QAAvC,EAAiDC,WAAjD,EAA+D;AAAA;;AAC9D,QAAMC,cAAc,GAAGN,sBAAsB,CAAEI,QAAF,EAAYC,WAAZ,CAA7C;AACA,QAAME,oBAAoB,GAAG,0BAAAH,QAAQ,CAACI,YAAT,gFAAuBC,aAAvB,MAAyC,IAAtE;AAEA,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAsCd,SAAS,CAClDe,MAAF,IAAc;AACb,WAAO;AACNF,MAAAA,cAAc,EAAEH,oBAAoB,GACjCK,MAAM,CAAEb,SAAF,CAAN,CAAoBc,gBAApB,CACA,UADA,EAEA,UAFA,EAGA;AACA;AACA;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,OALA,CADiC,GAQjCZ,iBATG;AAUNS,MAAAA,eAAe,EAAEC,MAAM,CAAEX,WAAF,CAAN,CAAsBc,mBAAtB;AAVX,KAAP;AAYA,GAdmD,EAepD,CAAER,oBAAF,CAfoD,CAArD;AAkBA,SAAOX,OAAO,CACb,OAAQ,EACP,GAAGU,cADI;AAEPU,IAAAA,4BAA4B,EAAEN,cAFvB;AAGPO,IAAAA,kCAAkC,EAAEN;AAH7B,GAAR,CADa,EAMb,CAAEL,cAAF,EAAkBI,cAAlB,EAAkCC,eAAlC,CANa,CAAd;AAQA;;AAED,eAAeR,4BAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport useBlockEditorSettings from './use-block-editor-settings.js';\nimport { store as editorStore } from '../../store';\n\nconst EMPTY_BLOCKS_LIST = [];\n\nfunction useNativeBlockEditorSettings( settings, hasTemplate ) {\n\tconst editorSettings = useBlockEditorSettings( settings, hasTemplate );\n\tconst supportReusableBlock = settings.capabilities?.reusableBlock === true;\n\n\tconst { reusableBlocks, isTitleSelected } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\treusableBlocks: supportReusableBlock\n\t\t\t\t\t? select( coreStore ).getEntityRecords(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t'wp_block',\n\t\t\t\t\t\t\t// Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle.\n\t\t\t\t\t\t\t// Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661\n\t\t\t\t\t\t\t{ per_page: 100 }\n\t\t\t\t\t )\n\t\t\t\t\t: EMPTY_BLOCKS_LIST,\n\t\t\t\tisTitleSelected: select( editorStore ).isPostTitleSelected(),\n\t\t\t};\n\t\t},\n\t\t[ supportReusableBlock ]\n\t);\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...editorSettings,\n\t\t\t__experimentalReusableBlocks: reusableBlocks,\n\t\t\t__experimentalShouldInsertAtTheTop: isTitleSelected,\n\t\t} ),\n\t\t[ editorSettings, reusableBlocks, isTitleSelected ]\n\t);\n}\n\nexport default useNativeBlockEditorSettings;\n"]}
@@ -24,7 +24,9 @@ function TableOfContents(_ref, ref) {
24
24
  } = _ref;
25
25
  const hasBlocks = useSelect(select => !!select(blockEditorStore).getBlockCount(), []);
26
26
  return createElement(Dropdown, {
27
- position: repositionDropdown ? 'middle right right' : 'bottom',
27
+ popoverProps: {
28
+ placement: repositionDropdown ? 'right' : 'bottom'
29
+ },
28
30
  className: "table-of-contents",
29
31
  contentClassName: "table-of-contents__popover",
30
32
  renderToggle: _ref2 => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/table-of-contents/index.js"],"names":["__","Dropdown","Button","useSelect","info","forwardRef","store","blockEditorStore","TableOfContentsPanel","TableOfContents","ref","hasOutlineItemsDisabled","repositionDropdown","props","hasBlocks","select","getBlockCount","isOpen","onToggle","undefined","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,uBAAjC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,SAAjC;;AAEA,SAASC,eAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,uBAAF;AAA2BC,IAAAA,kBAA3B;AAA+C,OAAGC;AAAlD,GAEC;AACD,QAAMC,SAAS,GAAGX,SAAS,CACxBY,MAAF,IAAc,CAAC,CAAEA,MAAM,CAAER,gBAAF,CAAN,CAA2BS,aAA3B,EADS,EAE1B,EAF0B,CAA3B;AAIA,SACC,cAAC,QAAD;AACC,IAAA,QAAQ,EAAGJ,kBAAkB,GAAG,oBAAH,GAA0B,QADxD;AAEC,IAAA,SAAS,EAAC,mBAFX;AAGC,IAAA,gBAAgB,EAAC,4BAHlB;AAIC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEK,QAAAA,MAAF;AAAUC,QAAAA;AAAV,OAAF;AAAA,aACd,cAAC,MAAD,eACML,KADN;AAEC,QAAA,GAAG,EAAGH,GAFP;AAGC,QAAA,OAAO,EAAGI,SAAS,GAAGI,QAAH,GAAcC,SAHlC;AAIC,QAAA,IAAI,EAAGf,IAJR;AAKC,yBAAgBa,MALjB;AAMC,yBAAc;AACd;AAPD;AAQC,QAAA,KAAK,EAAGjB,EAAE,CAAE,SAAF,CARX;AASC,QAAA,eAAe,EAAC,QATjB;AAUC,yBAAgB,CAAEc;AAVnB,SADc;AAAA,KAJhB;AAkBC,IAAA,aAAa,EAAG;AAAA,UAAE;AAAEM,QAAAA;AAAF,OAAF;AAAA,aACf,cAAC,oBAAD;AACC,QAAA,cAAc,EAAGA,OADlB;AAEC,QAAA,uBAAuB,EAAGT;AAF3B,QADe;AAAA;AAlBjB,IADD;AA2BA;;AAED,eAAeN,UAAU,CAAEI,eAAF,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { info } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsPanel from './panel';\n\nfunction TableOfContents(\n\t{ hasOutlineItemsDisabled, repositionDropdown, ...props },\n\tref\n) {\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Dropdown\n\t\t\tposition={ repositionDropdown ? 'middle right right' : 'bottom' }\n\t\t\tclassName=\"table-of-contents\"\n\t\t\tcontentClassName=\"table-of-contents__popover\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tonClick={ hasBlocks ? onToggle : undefined }\n\t\t\t\t\ticon={ info }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\taria-disabled={ ! hasBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<TableOfContentsPanel\n\t\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( TableOfContents );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/table-of-contents/index.js"],"names":["__","Dropdown","Button","useSelect","info","forwardRef","store","blockEditorStore","TableOfContentsPanel","TableOfContents","ref","hasOutlineItemsDisabled","repositionDropdown","props","hasBlocks","select","getBlockCount","placement","isOpen","onToggle","undefined","onClose"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,uBAAjC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,IAAT,QAAqB,kBAArB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,SAAjC;;AAEA,SAASC,eAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,uBAAF;AAA2BC,IAAAA,kBAA3B;AAA+C,OAAGC;AAAlD,GAEC;AACD,QAAMC,SAAS,GAAGX,SAAS,CACxBY,MAAF,IAAc,CAAC,CAAEA,MAAM,CAAER,gBAAF,CAAN,CAA2BS,aAA3B,EADS,EAE1B,EAF0B,CAA3B;AAIA,SACC,cAAC,QAAD;AACC,IAAA,YAAY,EAAG;AACdC,MAAAA,SAAS,EAAEL,kBAAkB,GAAG,OAAH,GAAa;AAD5B,KADhB;AAIC,IAAA,SAAS,EAAC,mBAJX;AAKC,IAAA,gBAAgB,EAAC,4BALlB;AAMC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEM,QAAAA,MAAF;AAAUC,QAAAA;AAAV,OAAF;AAAA,aACd,cAAC,MAAD,eACMN,KADN;AAEC,QAAA,GAAG,EAAGH,GAFP;AAGC,QAAA,OAAO,EAAGI,SAAS,GAAGK,QAAH,GAAcC,SAHlC;AAIC,QAAA,IAAI,EAAGhB,IAJR;AAKC,yBAAgBc,MALjB;AAMC,yBAAc;AACd;AAPD;AAQC,QAAA,KAAK,EAAGlB,EAAE,CAAE,SAAF,CARX;AASC,QAAA,eAAe,EAAC,QATjB;AAUC,yBAAgB,CAAEc;AAVnB,SADc;AAAA,KANhB;AAoBC,IAAA,aAAa,EAAG;AAAA,UAAE;AAAEO,QAAAA;AAAF,OAAF;AAAA,aACf,cAAC,oBAAD;AACC,QAAA,cAAc,EAAGA,OADlB;AAEC,QAAA,uBAAuB,EAAGV;AAF3B,QADe;AAAA;AApBjB,IADD;AA6BA;;AAED,eAAeN,UAAU,CAAEI,eAAF,CAAzB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { info } from '@wordpress/icons';\nimport { forwardRef } from '@wordpress/element';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsPanel from './panel';\n\nfunction TableOfContents(\n\t{ hasOutlineItemsDisabled, repositionDropdown, ...props },\n\tref\n) {\n\tconst hasBlocks = useSelect(\n\t\t( select ) => !! select( blockEditorStore ).getBlockCount(),\n\t\t[]\n\t);\n\treturn (\n\t\t<Dropdown\n\t\t\tpopoverProps={ {\n\t\t\t\tplacement: repositionDropdown ? 'right' : 'bottom',\n\t\t\t} }\n\t\t\tclassName=\"table-of-contents\"\n\t\t\tcontentClassName=\"table-of-contents__popover\"\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tonClick={ hasBlocks ? onToggle : undefined }\n\t\t\t\t\ticon={ info }\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t/* translators: button label text should, if possible, be under 16 characters. */\n\t\t\t\t\tlabel={ __( 'Details' ) }\n\t\t\t\t\ttooltipPosition=\"bottom\"\n\t\t\t\t\taria-disabled={ ! hasBlocks }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t<TableOfContentsPanel\n\t\t\t\t\tonRequestClose={ onClose }\n\t\t\t\t\thasOutlineItemsDisabled={ hasOutlineItemsDisabled }\n\t\t\t\t/>\n\t\t\t) }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( TableOfContents );\n"]}
@@ -29,7 +29,7 @@ export default function UnsavedChangesWarning() {
29
29
  *
30
30
  * @param {Event} event `beforeunload` event.
31
31
  *
32
- * @return {?string} Warning prompt message, if unsaved changes exist.
32
+ * @return {string | undefined} Warning prompt message, if unsaved changes exist.
33
33
  */
34
34
 
35
35
  const warnIfUnsavedChanges = event => {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/unsaved-changes-warning/index.js"],"names":["__","useEffect","useSelect","store","coreStore","UnsavedChangesWarning","isDirty","select","__experimentalGetDirtyEntityRecords","dirtyEntityRecords","length","warnIfUnsavedChanges","event","returnValue","window","addEventListener","removeEventListener"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,QAAMC,OAAO,GAAGJ,SAAS,CAAIK,MAAF,IAAc;AACxC,WAAO,MAAM;AACZ,YAAM;AAAEC,QAAAA;AAAF,UAA0CD,MAAM,CAAEH,SAAF,CAAtD;;AACA,YAAMK,kBAAkB,GAAGD,mCAAmC,EAA9D;;AACA,aAAOC,kBAAkB,CAACC,MAAnB,GAA4B,CAAnC;AACA,KAJD;AAKA,GANwB,EAMtB,EANsB,CAAzB;AAQA;AACD;AACA;AACA;AACA;AACA;AACA;;AACC,QAAMC,oBAAoB,GAAKC,KAAF,IAAa;AACzC;AACA;AACA;AACA;AACA,QAAKN,OAAO,EAAZ,EAAiB;AAChBM,MAAAA,KAAK,CAACC,WAAN,GAAoBb,EAAE,CACrB,8DADqB,CAAtB;AAGA,aAAOY,KAAK,CAACC,WAAb;AACA;AACD,GAXD;;AAaAZ,EAAAA,SAAS,CAAE,MAAM;AAChBa,IAAAA,MAAM,CAACC,gBAAP,CAAyB,cAAzB,EAAyCJ,oBAAzC;AAEA,WAAO,MAAM;AACZG,MAAAA,MAAM,CAACE,mBAAP,CAA4B,cAA5B,EAA4CL,oBAA5C;AACA,KAFD;AAGA,GANQ,EAMN,EANM,CAAT;AAQA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n * Compatible with Post Editor and Site Editor.\n *\n * @return {WPComponent} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst isDirty = useSelect( ( select ) => {\n\t\treturn () => {\n\t\t\tconst { __experimentalGetDirtyEntityRecords } = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\treturn dirtyEntityRecords.length > 0;\n\t\t};\n\t}, [] );\n\n\t/**\n\t * Warns the user if there are unsaved changes before leaving the editor.\n\t *\n\t * @param {Event} event `beforeunload` event.\n\t *\n\t * @return {?string} Warning prompt message, if unsaved changes exist.\n\t */\n\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t// We need to call the selector directly in the listener to avoid race\n\t\t// conditions with `BrowserURL` where `componentDidUpdate` gets the\n\t\t// new value of `isEditedPostDirty` before this component does,\n\t\t// causing this component to incorrectly think a trashed post is still dirty.\n\t\tif ( isDirty() ) {\n\t\t\tevent.returnValue = __(\n\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t);\n\t\t\treturn event.returnValue;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [] );\n\n\treturn null;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/unsaved-changes-warning/index.js"],"names":["__","useEffect","useSelect","store","coreStore","UnsavedChangesWarning","isDirty","select","__experimentalGetDirtyEntityRecords","dirtyEntityRecords","length","warnIfUnsavedChanges","event","returnValue","window","addEventListener","removeEventListener"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,qBAAT,GAAiC;AAC/C,QAAMC,OAAO,GAAGJ,SAAS,CAAIK,MAAF,IAAc;AACxC,WAAO,MAAM;AACZ,YAAM;AAAEC,QAAAA;AAAF,UAA0CD,MAAM,CAAEH,SAAF,CAAtD;;AACA,YAAMK,kBAAkB,GAAGD,mCAAmC,EAA9D;;AACA,aAAOC,kBAAkB,CAACC,MAAnB,GAA4B,CAAnC;AACA,KAJD;AAKA,GANwB,EAMtB,EANsB,CAAzB;AAQA;AACD;AACA;AACA;AACA;AACA;AACA;;AACC,QAAMC,oBAAoB,GAAKC,KAAF,IAAa;AACzC;AACA;AACA;AACA;AACA,QAAKN,OAAO,EAAZ,EAAiB;AAChBM,MAAAA,KAAK,CAACC,WAAN,GAAoBb,EAAE,CACrB,8DADqB,CAAtB;AAGA,aAAOY,KAAK,CAACC,WAAb;AACA;AACD,GAXD;;AAaAZ,EAAAA,SAAS,CAAE,MAAM;AAChBa,IAAAA,MAAM,CAACC,gBAAP,CAAyB,cAAzB,EAAyCJ,oBAAzC;AAEA,WAAO,MAAM;AACZG,MAAAA,MAAM,CAACE,mBAAP,CAA4B,cAA5B,EAA4CL,oBAA5C;AACA,KAFD;AAGA,GANQ,EAMN,EANM,CAAT;AAQA,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Warns the user if there are unsaved changes before leaving the editor.\n * Compatible with Post Editor and Site Editor.\n *\n * @return {WPComponent} The component.\n */\nexport default function UnsavedChangesWarning() {\n\tconst isDirty = useSelect( ( select ) => {\n\t\treturn () => {\n\t\t\tconst { __experimentalGetDirtyEntityRecords } = select( coreStore );\n\t\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\t\treturn dirtyEntityRecords.length > 0;\n\t\t};\n\t}, [] );\n\n\t/**\n\t * Warns the user if there are unsaved changes before leaving the editor.\n\t *\n\t * @param {Event} event `beforeunload` event.\n\t *\n\t * @return {string | undefined} Warning prompt message, if unsaved changes exist.\n\t */\n\tconst warnIfUnsavedChanges = ( event ) => {\n\t\t// We need to call the selector directly in the listener to avoid race\n\t\t// conditions with `BrowserURL` where `componentDidUpdate` gets the\n\t\t// new value of `isEditedPostDirty` before this component does,\n\t\t// causing this component to incorrectly think a trashed post is still dirty.\n\t\tif ( isDirty() ) {\n\t\t\tevent.returnValue = __(\n\t\t\t\t'You have unsaved changes. If you proceed, they will be lost.'\n\t\t\t);\n\t\t\treturn event.returnValue;\n\t\t}\n\t};\n\n\tuseEffect( () => {\n\t\twindow.addEventListener( 'beforeunload', warnIfUnsavedChanges );\n\n\t\treturn () => {\n\t\t\twindow.removeEventListener( 'beforeunload', warnIfUnsavedChanges );\n\t\t};\n\t}, [] );\n\n\treturn null;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { ExperimentalEditorProvider } from './components/provider';
5
+ import { lock } from './lockUnlock';
6
+ export const experiments = {};
7
+ lock(experiments, {
8
+ ExperimentalEditorProvider
9
+ });
10
+ //# sourceMappingURL=experiments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/editor/src/experiments.js"],"names":["ExperimentalEditorProvider","lock","experiments"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,0BAAT,QAA2C,uBAA3C;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,OAAO,MAAMC,WAAW,GAAG,EAApB;AACPD,IAAI,CAAEC,WAAF,EAAe;AAClBF,EAAAA;AADkB,CAAf,CAAJ","sourcesContent":["/**\n * Internal dependencies\n */\nimport { ExperimentalEditorProvider } from './components/provider';\nimport { lock } from './lockUnlock';\n\nexport const experiments = {};\nlock( experiments, {\n\tExperimentalEditorProvider,\n} );\n"]}
@@ -4,7 +4,7 @@ import { createElement } from "@wordpress/element";
4
4
  /**
5
5
  * External dependencies
6
6
  */
7
- import { pickBy, mapValues, isEmpty } from 'lodash';
7
+ import { mapValues, isEmpty } from 'lodash';
8
8
  /**
9
9
  * WordPress dependencies
10
10
  */
@@ -58,10 +58,13 @@ const createWithMetaAttributeSource = metaAttributes => createHigherOrderCompone
58
58
  return createElement(BlockEdit, _extends({
59
59
  attributes: mergedAttributes,
60
60
  setAttributes: nextAttributes => {
61
- const nextMeta = Object.fromEntries(Object.entries( // Filter to intersection of keys between the updated
61
+ const nextMeta = Object.fromEntries(Object.entries(nextAttributes !== null && nextAttributes !== void 0 ? nextAttributes : {}).filter( // Filter to intersection of keys between the updated
62
62
  // attributes and those with an associated meta key.
63
- pickBy(nextAttributes, (value, key) => metaAttributes[key])).map(_ref2 => {
64
- let [attributeKey, value] = _ref2;
63
+ _ref2 => {
64
+ let [key] = _ref2;
65
+ return key in metaAttributes;
66
+ }).map(_ref3 => {
67
+ let [attributeKey, value] = _ref3;
65
68
  return [// Rename the keys to the expected meta key name.
66
69
  metaAttributes[attributeKey], value];
67
70
  }));
@@ -85,10 +88,15 @@ const createWithMetaAttributeSource = metaAttributes => createHigherOrderCompone
85
88
 
86
89
 
87
90
  function shimAttributeSource(settings) {
91
+ var _settings$attributes;
92
+
88
93
  /** @type {WPMetaAttributeMapping} */
89
- const metaAttributes = mapValues(pickBy(settings.attributes, {
90
- source: 'meta'
91
- }), 'meta');
94
+ const metaAttributes = mapValues(Object.fromEntries(Object.entries((_settings$attributes = settings.attributes) !== null && _settings$attributes !== void 0 ? _settings$attributes : {}).filter(_ref4 => {
95
+ let [, {
96
+ source
97
+ }] = _ref4;
98
+ return source === 'meta';
99
+ })), 'meta');
92
100
 
93
101
  if (!isEmpty(metaAttributes)) {
94
102
  settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
@@ -116,10 +124,10 @@ addFilter('blocks.registerBlockType', 'core/editor/custom-sources-backwards-comp
116
124
  // In the future, we could support updating block settings, at which point this
117
125
  // implementation could use that mechanism instead.
118
126
 
119
- globalSelect(blocksStore).getBlockTypes().map(_ref3 => {
127
+ globalSelect(blocksStore).getBlockTypes().map(_ref5 => {
120
128
  let {
121
129
  name
122
- } = _ref3;
130
+ } = _ref5;
123
131
  return globalSelect(blocksStore).getBlockType(name);
124
132
  }).forEach(shimAttributeSource);
125
133
  //# sourceMappingURL=custom-sources-backwards-compatibility.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["pickBy","mapValues","isEmpty","store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","Object","fromEntries","entries","value","key","map","attributeKey","shimAttributeSource","settings","source","edit","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,SAAjB,EAA4BC,OAA5B,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASC,MAAM,IAAIC,YAAnB,EAAiCC,SAAjC,QAAkD,iBAAlD;AACA,SAASC,aAAT,QAA8B,sBAA9B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASR,KAAK,IAAIS,WAAlB,QAAqC,UAArC;AAEA;;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,6BAA6B,GAAKC,cAAF,IACrCJ,0BAA0B,CACvBK,SAAF,IACC,QAA+C;AAAA,MAA7C;AAAEC,IAAAA,UAAF;AAAcC,IAAAA,aAAd;AAA6B,OAAGC;AAAhC,GAA6C;AAC9C,QAAMC,QAAQ,GAAGZ,SAAS,CACvBF,MAAF,IAAcA,MAAM,CAAEO,WAAF,CAAN,CAAsBQ,kBAAtB,EADW,EAEzB,EAFyB,CAA1B;AAIA,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoBd,aAAa,CACtC,UADsC,EAEtCW,QAFsC,EAGtC,MAHsC,CAAvC;AAMA,QAAMI,gBAAgB,GAAGd,OAAO,CAC/B,OAAQ,EACP,GAAGO,UADI;AAEP,OAAGf,SAAS,CACXa,cADW,EAETU,OAAF,IAAeH,IAAI,CAAEG,OAAF,CAFR;AAFL,GAAR,CAD+B,EAQ/B,CAAER,UAAF,EAAcK,IAAd,CAR+B,CAAhC;AAWA,SACC,cAAC,SAAD;AACC,IAAA,UAAU,EAAGE,gBADd;AAEC,IAAA,aAAa,EAAK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N,GAFF,CAEO;AAAA,MAAE;AAAEO,IAAAA;AAAF,GAAF;AAAA,SAAgBjC,YAAY,CAAEF,WAAF,CAAZ,CAA4BoC,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWP,mBAHX","sourcesContent":["/**\n * External dependencies\n */\nimport { pickBy, mapValues, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...mapValues(\n\t\t\t\t\t\t\tmetaAttributes,\n\t\t\t\t\t\t\t( metaKey ) => meta[ metaKey ]\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries(\n\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\tpickBy(\n\t\t\t\t\t\t\t\t\t\tnextAttributes,\n\t\t\t\t\t\t\t\t\t\t( value, key ) => metaAttributes[ key ]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t).map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = mapValues(\n\t\tpickBy( settings.attributes, { source: 'meta' } ),\n\t\t'meta'\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/hooks/custom-sources-backwards-compatibility.js"],"names":["mapValues","isEmpty","store","blocksStore","select","globalSelect","useSelect","useEntityProp","useMemo","createHigherOrderComponent","addFilter","editorStore","createWithMetaAttributeSource","metaAttributes","BlockEdit","attributes","setAttributes","props","postType","getCurrentPostType","meta","setMeta","mergedAttributes","metaKey","nextAttributes","nextMeta","Object","fromEntries","entries","filter","key","map","attributeKey","value","shimAttributeSource","settings","source","edit","getBlockTypes","name","getBlockType","forEach"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,OAApB,QAAmC,QA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ACA;;AACA7B,YAAY,CAAEF,WAAF,CAAZ,CACEmC,aADF,GAEEP,GAFF,CAEO;AAAA,MAAE;AAAEQ,IAAAA;AAAF,GAAF;AAAA,SAAgBlC,YAAY,CAAEF,WAAF,CAAZ,CAA4BqC,YAA5B,CAA0CD,IAA1C,CAAhB;AAAA,CAFP,EAGEE,OAHF,CAGWP,mBAHX","sourcesContent":["/**\n * External dependencies\n */\nimport { mapValues, isEmpty } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { select as globalSelect, useSelect } from '@wordpress/data';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\n/** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */\n/** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */\n\n/**\n * Object whose keys are the names of block attributes, where each value\n * represents the meta key to which the block attribute is intended to save.\n *\n * @see https://developer.wordpress.org/reference/functions/register_meta/\n *\n * @typedef {Object<string,string>} WPMetaAttributeMapping\n */\n\n/**\n * Given a mapping of attribute names (meta source attributes) to their\n * associated meta key, returns a higher order component that overrides its\n * `attributes` and `setAttributes` props to sync any changes with the edited\n * post's meta keys.\n *\n * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.\n *\n * @return {WPHigherOrderComponent} Higher-order component.\n */\nconst createWithMetaAttributeSource = ( metaAttributes ) =>\n\tcreateHigherOrderComponent(\n\t\t( BlockEdit ) =>\n\t\t\t( { attributes, setAttributes, ...props } ) => {\n\t\t\t\tconst postType = useSelect(\n\t\t\t\t\t( select ) => select( editorStore ).getCurrentPostType(),\n\t\t\t\t\t[]\n\t\t\t\t);\n\t\t\t\tconst [ meta, setMeta ] = useEntityProp(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\t'meta'\n\t\t\t\t);\n\n\t\t\t\tconst mergedAttributes = useMemo(\n\t\t\t\t\t() => ( {\n\t\t\t\t\t\t...attributes,\n\t\t\t\t\t\t...mapValues(\n\t\t\t\t\t\t\tmetaAttributes,\n\t\t\t\t\t\t\t( metaKey ) => meta[ metaKey ]\n\t\t\t\t\t\t),\n\t\t\t\t\t} ),\n\t\t\t\t\t[ attributes, meta ]\n\t\t\t\t);\n\n\t\t\t\treturn (\n\t\t\t\t\t<BlockEdit\n\t\t\t\t\t\tattributes={ mergedAttributes }\n\t\t\t\t\t\tsetAttributes={ ( nextAttributes ) => {\n\t\t\t\t\t\t\tconst nextMeta = Object.fromEntries(\n\t\t\t\t\t\t\t\tObject.entries( nextAttributes ?? {} )\n\t\t\t\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t\t\t\t// Filter to intersection of keys between the updated\n\t\t\t\t\t\t\t\t\t\t// attributes and those with an associated meta key.\n\t\t\t\t\t\t\t\t\t\t( [ key ] ) => key in metaAttributes\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.map( ( [ attributeKey, value ] ) => [\n\t\t\t\t\t\t\t\t\t\t// Rename the keys to the expected meta key name.\n\t\t\t\t\t\t\t\t\t\tmetaAttributes[ attributeKey ],\n\t\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( ! isEmpty( nextMeta ) ) {\n\t\t\t\t\t\t\t\tsetMeta( nextMeta );\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsetAttributes( nextAttributes );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t},\n\t\t'withMetaAttributeSource'\n\t);\n\n/**\n * Filters a registered block's settings to enhance a block's `edit` component\n * to upgrade meta-sourced attributes to use the post's meta entity property.\n *\n * @param {WPBlockSettings} settings Registered block settings.\n *\n * @return {WPBlockSettings} Filtered block settings.\n */\nfunction shimAttributeSource( settings ) {\n\t/** @type {WPMetaAttributeMapping} */\n\tconst metaAttributes = mapValues(\n\t\tObject.fromEntries(\n\t\t\tObject.entries( settings.attributes ?? {} ).filter(\n\t\t\t\t( [ , { source } ] ) => source === 'meta'\n\t\t\t)\n\t\t),\n\t\t'meta'\n\t);\n\tif ( ! isEmpty( metaAttributes ) ) {\n\t\tsettings.edit = createWithMetaAttributeSource( metaAttributes )(\n\t\t\tsettings.edit\n\t\t);\n\t}\n\n\treturn settings;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/custom-sources-backwards-compatibility/shim-attribute-source',\n\tshimAttributeSource\n);\n\n// The above filter will only capture blocks registered after the filter was\n// added. There may already be blocks registered by this point, and those must\n// be updated to apply the shim.\n//\n// The following implementation achieves this, albeit with a couple caveats:\n// - Only blocks registered on the global store will be modified.\n// - The block settings are directly mutated, since there is currently no\n// mechanism to update an existing block registration. This is the reason for\n// `getBlockType` separate from `getBlockTypes`, since the latter returns a\n// _copy_ of the block registration (i.e. the mutation would not affect the\n// actual registered block settings).\n//\n// `getBlockTypes` or `getBlockType` implementation could change in the future\n// in regards to creating settings clones, but the corresponding end-to-end\n// tests for meta blocks should cover against any potential regressions.\n//\n// In the future, we could support updating block settings, at which point this\n// implementation could use that mechanism instead.\nglobalSelect( blocksStore )\n\t.getBlockTypes()\n\t.map( ( { name } ) => globalSelect( blocksStore ).getBlockType( name ) )\n\t.forEach( shimAttributeSource );\n"]}
@@ -1,11 +1,6 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { clone } from 'lodash';
5
1
  /**
6
2
  * WordPress dependencies
7
3
  */
8
-
9
4
  import { addFilter } from '@wordpress/hooks';
10
5
  /**
11
6
  * Internal dependencies
@@ -16,7 +11,8 @@ import { userAutocompleter } from '../components';
16
11
  function setDefaultCompleters() {
17
12
  let completers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
18
13
  // Provide copies so filters may directly modify them.
19
- completers.push(clone(userAutocompleter));
14
+ completers.push({ ...userAutocompleter
15
+ });
20
16
  return completers;
21
17
  }
22
18
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"names":["clone","addFilter","userAutocompleter","setDefaultCompleters","completers","push"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAT,QAAsB,QAAtB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,eAAlC;;AAEA,SAASC,oBAAT,GAAiD;AAAA,MAAlBC,UAAkB,uEAAL,EAAK;AAChD;AACAA,EAAAA,UAAU,CAACC,IAAX,CAAiBL,KAAK,CAAEE,iBAAF,CAAtB;AAEA,SAAOE,UAAP;AACA;;AAEDH,SAAS,CACR,gCADQ,EAER,8CAFQ,EAGRE,oBAHQ,CAAT","sourcesContent":["/**\n * External dependencies\n */\nimport { clone } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { userAutocompleter } from '../components';\n\nfunction setDefaultCompleters( completers = [] ) {\n\t// Provide copies so filters may directly modify them.\n\tcompleters.push( clone( userAutocompleter ) );\n\n\treturn completers;\n}\n\naddFilter(\n\t'editor.Autocomplete.completers',\n\t'editor/autocompleters/set-default-completers',\n\tsetDefaultCompleters\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/hooks/default-autocompleters.js"],"names":["addFilter","userAutocompleter","setDefaultCompleters","completers","push"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,kBAA1B;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,eAAlC;;AAEA,SAASC,oBAAT,GAAiD;AAAA,MAAlBC,UAAkB,uEAAL,EAAK;AAChD;AACAA,EAAAA,UAAU,CAACC,IAAX,CAAiB,EAAE,GAAGH;AAAL,GAAjB;AAEA,SAAOE,UAAP;AACA;;AAEDH,SAAS,CACR,gCADQ,EAER,8CAFQ,EAGRE,oBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { userAutocompleter } from '../components';\n\nfunction setDefaultCompleters( completers = [] ) {\n\t// Provide copies so filters may directly modify them.\n\tcompleters.push( { ...userAutocompleter } );\n\n\treturn completers;\n}\n\naddFilter(\n\t'editor.Autocomplete.completers',\n\t'editor/autocompleters/set-default-completers',\n\tsetDefaultCompleters\n);\n"]}
@@ -5,6 +5,7 @@ import './hooks';
5
5
  export { storeConfig, store } from './store';
6
6
  export * from './components';
7
7
  export * from './utils';
8
+ export * from './experiments';
8
9
  /*
9
10
  * Backward compatibility
10
11
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/index.js"],"names":["storeConfig","store","transformStyles"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,SAAP;AAEA,SAASA,WAAT,EAAsBC,KAAtB,QAAmC,SAAnC;AACA,cAAc,cAAd;AACA,cAAc,SAAd;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,yBAAhC","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\n\nexport { storeConfig, store } from './store';\nexport * from './components';\nexport * from './utils';\n\n/*\n * Backward compatibility\n */\nexport { transformStyles } from '@wordpress/block-editor';\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/index.js"],"names":["storeConfig","store","transformStyles"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,SAAP;AAEA,SAASA,WAAT,EAAsBC,KAAtB,QAAmC,SAAnC;AACA,cAAc,cAAd;AACA,cAAc,SAAd;AACA,cAAc,eAAd;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,yBAAhC","sourcesContent":["/**\n * Internal dependencies\n */\nimport './hooks';\n\nexport { storeConfig, store } from './store';\nexport * from './components';\nexport * from './utils';\nexport * from './experiments';\n\n/*\n * Backward compatibility\n */\nexport { transformStyles } from '@wordpress/block-editor';\n"]}
@@ -12,4 +12,5 @@ import './hooks';
12
12
  export { store } from './store';
13
13
  export * from './components';
14
14
  export * from './utils';
15
+ export * from './experiments';
15
16
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/index.native.js"],"names":["store"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,yBAAP;AACA,OAAO,sBAAP;AACA,OAAO,sBAAP;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AAEA,SAASA,KAAT,QAAsB,SAAtB;AACA,cAAc,cAAd;AACA,cAAc,SAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/block-editor';\nimport '@wordpress/core-data';\nimport '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\n\nexport { store } from './store';\nexport * from './components';\nexport * from './utils';\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/index.native.js"],"names":["store"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,yBAAP;AACA,OAAO,sBAAP;AACA,OAAO,sBAAP;AAEA;AACA;AACA;;AACA,OAAO,SAAP;AAEA,SAASA,KAAT,QAAsB,SAAtB;AACA,cAAc,cAAd;AACA,cAAc,SAAd;AACA,cAAc,eAAd","sourcesContent":["/**\n * WordPress dependencies\n */\nimport '@wordpress/block-editor';\nimport '@wordpress/core-data';\nimport '@wordpress/rich-text';\n\n/**\n * Internal dependencies\n */\nimport './hooks';\n\nexport { store } from './store';\nexport * from './components';\nexport * from './utils';\nexport * from './experiments';\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';
5
+ export const {
6
+ lock,
7
+ unlock
8
+ } = __dangerousOptInToUnstableAPIsOnlyForCoreModules('I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/editor');
9
+ //# sourceMappingURL=lockUnlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/editor/src/lockUnlock.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,wBAAjE;AACA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,mBAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/editor'\n\t);\n"]}
@@ -24,7 +24,6 @@ import { SETTINGS_DEFAULTS } from '@wordpress/block-editor';
24
24
  export const EDITOR_SETTINGS_DEFAULTS = { ...SETTINGS_DEFAULTS,
25
25
  richEditingEnabled: true,
26
26
  codeEditingEnabled: true,
27
- enableCustomFields: undefined,
28
- supportsLayout: true
27
+ enableCustomFields: undefined
29
28
  };
30
29
  //# sourceMappingURL=defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/defaults.js"],"names":["SETTINGS_DEFAULTS","EDITOR_SETTINGS_DEFAULTS","richEditingEnabled","codeEditingEnabled","enableCustomFields","undefined","supportsLayout"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,yBAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,wBAAwB,GAAG,EACvC,GAAGD,iBADoC;AAGvCE,EAAAA,kBAAkB,EAAE,IAHmB;AAIvCC,EAAAA,kBAAkB,EAAE,IAJmB;AAKvCC,EAAAA,kBAAkB,EAAEC,SALmB;AAMvCC,EAAAA,cAAc,EAAE;AANuB,CAAjC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SETTINGS_DEFAULTS } from '@wordpress/block-editor';\n\n/**\n * The default post editor settings.\n *\n * @property {boolean|Array} allowedBlockTypes Allowed block types\n * @property {boolean} richEditingEnabled Whether rich editing is enabled or not\n * @property {boolean} codeEditingEnabled Whether code editing is enabled or not\n * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.\n * true = the user has opted to show the Custom Fields panel at the bottom of the editor.\n * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.\n * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.\n * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.\n * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.\n * @property {Array?} availableTemplates The available post templates\n * @property {boolean} disablePostFormats Whether or not the post formats are disabled\n * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions\n * @property {number} maxUploadFileSize Maximum upload file size\n * @property {boolean} supportsLayout Whether the editor supports layouts.\n */\nexport const EDITOR_SETTINGS_DEFAULTS = {\n\t...SETTINGS_DEFAULTS,\n\n\trichEditingEnabled: true,\n\tcodeEditingEnabled: true,\n\tenableCustomFields: undefined,\n\tsupportsLayout: true,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/store/defaults.js"],"names":["SETTINGS_DEFAULTS","EDITOR_SETTINGS_DEFAULTS","richEditingEnabled","codeEditingEnabled","enableCustomFields","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,yBAAlC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,wBAAwB,GAAG,EACvC,GAAGD,iBADoC;AAGvCE,EAAAA,kBAAkB,EAAE,IAHmB;AAIvCC,EAAAA,kBAAkB,EAAE,IAJmB;AAKvCC,EAAAA,kBAAkB,EAAEC;AALmB,CAAjC","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SETTINGS_DEFAULTS } from '@wordpress/block-editor';\n\n/**\n * The default post editor settings.\n *\n * @property {boolean|Array} allowedBlockTypes Allowed block types\n * @property {boolean} richEditingEnabled Whether rich editing is enabled or not\n * @property {boolean} codeEditingEnabled Whether code editing is enabled or not\n * @property {boolean} enableCustomFields Whether the WordPress custom fields are enabled or not.\n * true = the user has opted to show the Custom Fields panel at the bottom of the editor.\n * false = the user has opted to hide the Custom Fields panel at the bottom of the editor.\n * undefined = the current environment does not support Custom Fields, so the option toggle in Preferences -> Panels to enable the Custom Fields panel is not displayed.\n * @property {number} autosaveInterval How often in seconds the post will be auto-saved via the REST API.\n * @property {number} localAutosaveInterval How often in seconds the post will be backed up to sessionStorage.\n * @property {Array?} availableTemplates The available post templates\n * @property {boolean} disablePostFormats Whether or not the post formats are disabled\n * @property {Array?} allowedMimeTypes List of allowed mime types and file extensions\n * @property {number} maxUploadFileSize Maximum upload file size\n * @property {boolean} supportsLayout Whether the editor supports layouts.\n */\nexport const EDITOR_SETTINGS_DEFAULTS = {\n\t...SETTINGS_DEFAULTS,\n\n\trichEditingEnabled: true,\n\tcodeEditingEnabled: true,\n\tenableCustomFields: undefined,\n};\n"]}
@@ -694,7 +694,7 @@ export function isPreviewingPost(state) {
694
694
  *
695
695
  * @param {Object} state Global application state.
696
696
  *
697
- * @return {string?} Preview Link.
697
+ * @return {string | undefined} Preview Link.
698
698
  */
699
699
 
700
700
  export function getEditedPostPreviewLink(state) {