@wordpress/editor 13.4.0 → 13.6.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 (133) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/document-outline/index.js +7 -1
  3. package/build/components/document-outline/index.js.map +1 -1
  4. package/build/components/editor-help/index.native.js +13 -10
  5. package/build/components/editor-help/index.native.js.map +1 -1
  6. package/build/components/media-categories/index.js +1 -1
  7. package/build/components/media-categories/index.js.map +1 -1
  8. package/build/components/page-attributes/check.js +6 -10
  9. package/build/components/page-attributes/check.js.map +1 -1
  10. package/build/components/page-attributes/parent.js +9 -6
  11. package/build/components/page-attributes/parent.js.map +1 -1
  12. package/build/components/post-author/check.js +3 -7
  13. package/build/components/post-author/check.js.map +1 -1
  14. package/build/components/post-featured-image/index.js +7 -12
  15. package/build/components/post-featured-image/index.js.map +1 -1
  16. package/build/components/post-locked-modal/index.js +1 -7
  17. package/build/components/post-locked-modal/index.js.map +1 -1
  18. package/build/components/post-pending-status/check.js +3 -7
  19. package/build/components/post-pending-status/check.js.map +1 -1
  20. package/build/components/post-preview-button/index.js +3 -3
  21. package/build/components/post-preview-button/index.js.map +1 -1
  22. package/build/components/post-publish-button/index.js +4 -4
  23. package/build/components/post-publish-button/index.js.map +1 -1
  24. package/build/components/post-publish-button/label.js +3 -7
  25. package/build/components/post-publish-button/label.js.map +1 -1
  26. package/build/components/post-publish-panel/index.js +4 -8
  27. package/build/components/post-publish-panel/index.js.map +1 -1
  28. package/build/components/post-publish-panel/maybe-post-format-panel.js +3 -7
  29. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  30. package/build/components/post-publish-panel/postpublish.js +5 -9
  31. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  32. package/build/components/post-publish-panel/prepublish.js +3 -7
  33. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  34. package/build/components/post-schedule/check.js +3 -7
  35. package/build/components/post-schedule/check.js.map +1 -1
  36. package/build/components/post-sticky/check.js +3 -7
  37. package/build/components/post-sticky/check.js.map +1 -1
  38. package/build/components/post-taxonomies/flat-term-selector.js +12 -7
  39. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  40. package/build/components/post-taxonomies/hierarchical-term-selector.js +18 -12
  41. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  42. package/build/components/post-taxonomies/most-used-terms.js +1 -8
  43. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  44. package/build/components/post-visibility/check.js +3 -7
  45. package/build/components/post-visibility/check.js.map +1 -1
  46. package/build/components/provider/use-block-editor-settings.js +1 -1
  47. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  48. package/build/components/theme-support-check/index.js +3 -7
  49. package/build/components/theme-support-check/index.js.map +1 -1
  50. package/build/store/utils/notice-builder.js +4 -8
  51. package/build/store/utils/notice-builder.js.map +1 -1
  52. package/build-module/components/document-outline/index.js +8 -2
  53. package/build-module/components/document-outline/index.js.map +1 -1
  54. package/build-module/components/editor-help/index.native.js +13 -9
  55. package/build-module/components/editor-help/index.native.js.map +1 -1
  56. package/build-module/components/media-categories/index.js +1 -1
  57. package/build-module/components/media-categories/index.js.map +1 -1
  58. package/build-module/components/page-attributes/check.js +6 -9
  59. package/build-module/components/page-attributes/check.js.map +1 -1
  60. package/build-module/components/page-attributes/parent.js +9 -5
  61. package/build-module/components/page-attributes/parent.js.map +1 -1
  62. package/build-module/components/post-author/check.js +3 -6
  63. package/build-module/components/post-author/check.js.map +1 -1
  64. package/build-module/components/post-featured-image/index.js +7 -11
  65. package/build-module/components/post-featured-image/index.js.map +1 -1
  66. package/build-module/components/post-locked-modal/index.js +1 -6
  67. package/build-module/components/post-locked-modal/index.js.map +1 -1
  68. package/build-module/components/post-pending-status/check.js +3 -6
  69. package/build-module/components/post-pending-status/check.js.map +1 -1
  70. package/build-module/components/post-preview-button/index.js +3 -2
  71. package/build-module/components/post-preview-button/index.js.map +1 -1
  72. package/build-module/components/post-publish-button/index.js +4 -3
  73. package/build-module/components/post-publish-button/index.js.map +1 -1
  74. package/build-module/components/post-publish-button/label.js +3 -6
  75. package/build-module/components/post-publish-button/label.js.map +1 -1
  76. package/build-module/components/post-publish-panel/index.js +4 -7
  77. package/build-module/components/post-publish-panel/index.js.map +1 -1
  78. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +3 -6
  79. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  80. package/build-module/components/post-publish-panel/postpublish.js +5 -8
  81. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  82. package/build-module/components/post-publish-panel/prepublish.js +3 -6
  83. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  84. package/build-module/components/post-schedule/check.js +3 -6
  85. package/build-module/components/post-schedule/check.js.map +1 -1
  86. package/build-module/components/post-sticky/check.js +3 -6
  87. package/build-module/components/post-sticky/check.js.map +1 -1
  88. package/build-module/components/post-taxonomies/flat-term-selector.js +12 -6
  89. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  90. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +18 -11
  91. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  92. package/build-module/components/post-taxonomies/most-used-terms.js +1 -7
  93. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  94. package/build-module/components/post-visibility/check.js +3 -6
  95. package/build-module/components/post-visibility/check.js.map +1 -1
  96. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  97. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  98. package/build-module/components/theme-support-check/index.js +3 -6
  99. package/build-module/components/theme-support-check/index.js.map +1 -1
  100. package/build-module/store/utils/notice-builder.js +4 -7
  101. package/build-module/store/utils/notice-builder.js.map +1 -1
  102. package/build-style/style-rtl.css +1 -1
  103. package/build-style/style.css +1 -1
  104. package/package.json +30 -30
  105. package/src/components/autosave-monitor/test/index.js +4 -4
  106. package/src/components/document-outline/index.js +6 -3
  107. package/src/components/editor-help/index.native.js +21 -14
  108. package/src/components/media-categories/index.js +1 -1
  109. package/src/components/page-attributes/check.js +3 -12
  110. package/src/components/page-attributes/parent.js +41 -41
  111. package/src/components/post-author/check.js +2 -10
  112. package/src/components/post-featured-image/index.js +5 -10
  113. package/src/components/post-locked-modal/index.js +1 -6
  114. package/src/components/post-pending-status/check.js +2 -10
  115. package/src/components/post-preview-button/index.js +1 -2
  116. package/src/components/post-publish-button/index.js +3 -7
  117. package/src/components/post-publish-button/label.js +2 -10
  118. package/src/components/post-publish-panel/index.js +3 -11
  119. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -10
  120. package/src/components/post-publish-panel/postpublish.js +3 -8
  121. package/src/components/post-publish-panel/prepublish.js +2 -10
  122. package/src/components/post-publish-panel/style.scss +1 -1
  123. package/src/components/post-schedule/check.js +2 -10
  124. package/src/components/post-sticky/check.js +1 -10
  125. package/src/components/post-taxonomies/flat-term-selector.js +14 -32
  126. package/src/components/post-taxonomies/hierarchical-term-selector.js +15 -37
  127. package/src/components/post-taxonomies/most-used-terms.js +1 -7
  128. package/src/components/post-text-editor/test/index.js +0 -2
  129. package/src/components/post-visibility/check.js +2 -10
  130. package/src/components/provider/use-block-editor-settings.js +1 -0
  131. package/src/components/theme-support-check/index.js +1 -6
  132. package/src/store/test/actions.js +0 -2
  133. package/src/store/utils/notice-builder.js +2 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/hierarchical-term-selector.js"],"names":["get","__","_n","_x","sprintf","useMemo","useState","Button","CheckboxControl","TextControl","TreeSelect","withFilters","__experimentalVStack","VStack","useDispatch","useSelect","useDebounce","store","coreStore","speak","decodeEntities","buildTermsTree","editorStore","DEFAULT_QUERY","per_page","orderby","order","_fields","context","MIN_TERMS_COUNT_FOR_FILTER","EMPTY_ARRAY","sortBySelected","termsTree","terms","treeHasSelection","termTree","indexOf","id","undefined","children","map","filter","child","length","termOrChildIsSelected","termA","termB","termASelected","termBSelected","newTermTree","sort","findTerm","parent","name","find","term","parseInt","toLowerCase","getFilterMatcher","filterValue","matchTermsForFilter","originalTerm","HierarchicalTermSelector","slug","adding","setAdding","formName","setFormName","formParent","setFormParent","showForm","setShowForm","setFilterValue","filteredTermsTree","setFilteredTermsTree","debouncedSpeak","hasCreateAction","hasAssignAction","loading","availableTerms","taxonomy","select","getCurrentPost","getEditedPostAttribute","getTaxonomy","getEntityRecords","isResolving","_taxonomy","rest_base","editPost","saveEntityRecord","availableTermsTree","addTerm","onUpdateTerms","termIds","onChange","termId","hasTerm","includes","newTerms","onChangeFormName","value","onChangeFormParent","parentId","onToggleForm","onAddTerm","event","preventDefault","existingTerm","some","newTerm","termAddedMessage","setFilter","newFilteredTermsTree","getResultCount","count","i","resultCount","resultsFoundMessage","renderTerms","renderedTerms","labelWithFallback","labelProperty","fallbackIsCategory","fallbackIsNotCategory","newTermButtonLabel","newTermLabel","parentSelectLabel","noParentOption","newTermSubmitLabel","filterLabel","groupLabel","showFilter"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,EAAjB,EAAqBC,OAArB,QAAoC,iBAApC;AACA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,oBAAlC;AACA,SACCC,MADD,EAECC,eAFD,EAGCC,WAHD,EAICC,UAJD,EAKCC,WALD,EAMCC,oBAAoB,IAAIC,MANzB,QAOO,uBAPP;AAQA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASJ,KAAK,IAAIK,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;;A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;AAIC,kBAAamB;AAJd,KAMGZ,WAAW,CACZ,OAAO5D,WAAP,GAAqBc,iBAArB,GAAyCkB,kBAD7B,CANd,CAVD,EAoBG,CAAEb,OAAF,IAAaF,eAAb,IACD,cAAC,MAAD;AACC,IAAA,OAAO,EAAG4B,YADX;AAEC,IAAA,SAAS,EAAC,gDAFX;AAGC,qBAAgBlC,QAHjB;AAIC,IAAA,OAAO,EAAC;AAJT,KAMGuD,kBANH,CArBF,EA8BGvD,QAAQ,IACT;AAAM,IAAA,QAAQ,EAAGmC;AAAjB,KACC,cAAC,MAAD,QACC,cAAC,WAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,kDAFX;AAGC,IAAA,KAAK,EAAGqB,YAHT;AAIC,IAAA,KAAK,EAAG5D,QAJT;AAKC,IAAA,QAAQ,EAAGkC,gBALZ;AAMC,IAAA,QAAQ;AANT,IADD,EASG,CAAC,CAAErB,cAAc,CAACpC,MAAlB,IACD,cAAC,UAAD;AACC,IAAA,KAAK,EAAGoF,iBADT;AAEC,IAAA,aAAa,EAAGC,cAFjB;AAGC,IAAA,QAAQ,EAAG1B,kBAHZ;AAIC,IAAA,UAAU,EAAGlC,UAJd;AAKC,IAAA,IAAI,EAAGuB;AALR,IAVF,CADD,EAoBC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGsC,kBALH,CApBD,CA/BF,CADD;AA+DA;AAED,eAAetH,WAAW,CAAE,yBAAF,CAAX,CACdmD,wBADc,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tCheckboxControl,\n\tTextControl,\n\tTreeSelect,\n\twithFilters,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useDebounce } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst DEFAULT_QUERY = {\n\tper_page: -1,\n\torderby: 'name',\n\torder: 'asc',\n\t_fields: 'id,name,parent',\n\tcontext: 'view',\n};\n\nconst MIN_TERMS_COUNT_FOR_FILTER = 8;\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Sort Terms by Selected.\n *\n * @param {Object[]} termsTree Array of terms in tree format.\n * @param {number[]} terms Selected terms.\n *\n * @return {Object[]} Sorted array of terms.\n */\nexport function sortBySelected( termsTree, terms ) {\n\tconst treeHasSelection = ( termTree ) => {\n\t\tif ( terms.indexOf( termTree.id ) !== -1 ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( undefined === termTree.children ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\ttermTree.children\n\t\t\t\t.map( treeHasSelection )\n\t\t\t\t.filter( ( child ) => child ).length > 0\n\t\t);\n\t};\n\tconst termOrChildIsSelected = ( termA, termB ) => {\n\t\tconst termASelected = treeHasSelection( termA );\n\t\tconst termBSelected = treeHasSelection( termB );\n\n\t\tif ( termASelected === termBSelected ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif ( termASelected && ! termBSelected ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif ( ! termASelected && termBSelected ) {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\tconst newTermTree = [ ...termsTree ];\n\tnewTermTree.sort( termOrChildIsSelected );\n\treturn newTermTree;\n}\n\n/**\n * Find term by parent id or name.\n *\n * @param {Object[]} terms Array of Terms.\n * @param {number|string} parent id.\n * @param {string} name Term name.\n * @return {Object} Term object.\n */\nexport function findTerm( terms, parent, name ) {\n\treturn terms.find( ( term ) => {\n\t\treturn (\n\t\t\t( ( ! term.parent && ! parent ) ||\n\t\t\t\tparseInt( term.parent ) === parseInt( parent ) ) &&\n\t\t\tterm.name.toLowerCase() === name.toLowerCase()\n\t\t);\n\t} );\n}\n\n/**\n * Get filter matcher function.\n *\n * @param {string} filterValue Filter value.\n * @return {(function(Object): (Object|boolean))} Matcher function.\n */\nexport function getFilterMatcher( filterValue ) {\n\tconst matchTermsForFilter = ( originalTerm ) => {\n\t\tif ( '' === filterValue ) {\n\t\t\treturn originalTerm;\n\t\t}\n\n\t\t// Shallow clone, because we'll be filtering the term's children and\n\t\t// don't want to modify the original term.\n\t\tconst term = { ...originalTerm };\n\n\t\t// Map and filter the children, recursive so we deal with grandchildren\n\t\t// and any deeper levels.\n\t\tif ( term.children.length > 0 ) {\n\t\t\tterm.children = term.children\n\t\t\t\t.map( matchTermsForFilter )\n\t\t\t\t.filter( ( child ) => child );\n\t\t}\n\n\t\t// If the term's name contains the filterValue, or it has children\n\t\t// (i.e. some child matched at some point in the tree) then return it.\n\t\tif (\n\t\t\t-1 !==\n\t\t\t\tterm.name.toLowerCase().indexOf( filterValue.toLowerCase() ) ||\n\t\t\tterm.children.length > 0\n\t\t) {\n\t\t\treturn term;\n\t\t}\n\n\t\t// Otherwise, return false. After mapping, the list of terms will need\n\t\t// to have false values filtered out.\n\t\treturn false;\n\t};\n\treturn matchTermsForFilter;\n}\n\n/**\n * Hierarchical term selector.\n *\n * @param {Object} props Component props.\n * @param {string} props.slug Taxonomy slug.\n * @return {WPElement} Hierarchical term selector component.\n */\nexport function HierarchicalTermSelector( { slug } ) {\n\tconst [ adding, setAdding ] = useState( false );\n\tconst [ formName, setFormName ] = useState( '' );\n\t/**\n\t * @type {[number|'', Function]}\n\t */\n\tconst [ formParent, setFormParent ] = useState( '' );\n\tconst [ showForm, setShowForm ] = useState( false );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ filteredTermsTree, setFilteredTermsTree ] = useState( [] );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst {\n\t\thasCreateAction,\n\t\thasAssignAction,\n\t\tterms,\n\t\tloading,\n\t\tavailableTerms,\n\t\ttaxonomy,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getTaxonomy, getEntityRecords, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tgetCurrentPost(),\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? get(\n\t\t\t\t\t\t\tgetCurrentPost(),\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base,\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t )\n\t\t\t\t\t: false,\n\t\t\t\tterms: _taxonomy\n\t\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\tloading: isResolving( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tDEFAULT_QUERY,\n\t\t\t\t] ),\n\t\t\t\tavailableTerms:\n\t\t\t\t\tgetEntityRecords( 'taxonomy', slug, DEFAULT_QUERY ) ||\n\t\t\t\t\tEMPTY_ARRAY,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst availableTermsTree = useMemo(\n\t\t() => sortBySelected( buildTermsTree( availableTerms ), terms ),\n\t\t// Remove `terms` from the dependency list to avoid reordering every time\n\t\t// checking or unchecking a term.\n\t\t[ availableTerms ]\n\t);\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Append new term.\n\t *\n\t * @param {Object} term Term object.\n\t * @return {Promise} A promise that resolves to save term object.\n\t */\n\tconst addTerm = ( term ) => {\n\t\treturn saveEntityRecord( 'taxonomy', slug, term );\n\t};\n\n\t/**\n\t * Update terms for post.\n\t *\n\t * @param {number[]} termIds Term ids.\n\t */\n\tconst onUpdateTerms = ( termIds ) => {\n\t\teditPost( { [ taxonomy.rest_base ]: termIds } );\n\t};\n\n\t/**\n\t * Handler for checking term.\n\t *\n\t * @param {number} termId\n\t */\n\tconst onChange = ( termId ) => {\n\t\tconst hasTerm = terms.includes( termId );\n\t\tconst newTerms = hasTerm\n\t\t\t? terms.filter( ( id ) => id !== termId )\n\t\t\t: [ ...terms, termId ];\n\t\tonUpdateTerms( newTerms );\n\t};\n\n\tconst onChangeFormName = ( value ) => {\n\t\tsetFormName( value );\n\t};\n\n\t/**\n\t * Handler for changing form parent.\n\t *\n\t * @param {number|''} parentId Parent post id.\n\t */\n\tconst onChangeFormParent = ( parentId ) => {\n\t\tsetFormParent( parentId );\n\t};\n\n\tconst onToggleForm = () => {\n\t\tsetShowForm( ! showForm );\n\t};\n\n\tconst onAddTerm = async ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( formName === '' || adding ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if the term we are adding already exists.\n\t\tconst existingTerm = findTerm( availableTerms, formParent, formName );\n\t\tif ( existingTerm ) {\n\t\t\t// If the term we are adding exists but is not selected select it.\n\t\t\tif ( ! terms.some( ( term ) => term === existingTerm.id ) ) {\n\t\t\t\tonUpdateTerms( [ ...terms, existingTerm.id ] );\n\t\t\t}\n\n\t\t\tsetFormName( '' );\n\t\t\tsetFormParent( '' );\n\n\t\t\treturn;\n\t\t}\n\t\tsetAdding( true );\n\n\t\tconst newTerm = await addTerm( {\n\t\t\tname: formName,\n\t\t\tparent: formParent ? formParent : undefined,\n\t\t} );\n\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: taxonomy name */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\tget(\n\t\t\t\ttaxonomy,\n\t\t\t\t[ 'labels', 'singular_name' ],\n\t\t\t\tslug === 'category' ? __( 'Category' ) : __( 'Term' )\n\t\t\t)\n\t\t);\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tsetAdding( false );\n\t\tsetFormName( '' );\n\t\tsetFormParent( '' );\n\t\tonUpdateTerms( [ ...terms, newTerm.id ] );\n\t};\n\n\tconst setFilter = ( value ) => {\n\t\tconst newFilteredTermsTree = availableTermsTree\n\t\t\t.map( getFilterMatcher( value ) )\n\t\t\t.filter( ( term ) => term );\n\t\tconst getResultCount = ( termsTree ) => {\n\t\t\tlet count = 0;\n\t\t\tfor ( let i = 0; i < termsTree.length; i++ ) {\n\t\t\t\tcount++;\n\t\t\t\tif ( undefined !== termsTree[ i ].children ) {\n\t\t\t\t\tcount += getResultCount( termsTree[ i ].children );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn count;\n\t\t};\n\n\t\tsetFilterValue( value );\n\t\tsetFilteredTermsTree( newFilteredTermsTree );\n\n\t\tconst resultCount = getResultCount( newFilteredTermsTree );\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results */\n\t\t\t_n( '%d result found.', '%d results found.', resultCount ),\n\t\t\tresultCount\n\t\t);\n\n\t\tdebouncedSpeak( resultsFoundMessage, 'assertive' );\n\t};\n\n\tconst renderTerms = ( renderedTerms ) => {\n\t\treturn renderedTerms.map( ( term ) => {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tkey={ term.id }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-choice\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tchecked={ terms.indexOf( term.id ) !== -1 }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tconst termId = parseInt( term.id, 10 );\n\t\t\t\t\t\t\tonChange( termId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ decodeEntities( term.name ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ !! term.children.length && (\n\t\t\t\t\t\t<div className=\"editor-post-taxonomies__hierarchical-terms-subchoices\">\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t};\n\n\tconst labelWithFallback = (\n\t\tlabelProperty,\n\t\tfallbackIsCategory,\n\t\tfallbackIsNotCategory\n\t) =>\n\t\tget(\n\t\t\ttaxonomy,\n\t\t\t[ 'labels', labelProperty ],\n\t\t\tslug === 'category' ? fallbackIsCategory : fallbackIsNotCategory\n\t\t);\n\tconst newTermButtonLabel = labelWithFallback(\n\t\t'add_new_item',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst newTermLabel = labelWithFallback(\n\t\t'new_item_name',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst parentSelectLabel = labelWithFallback(\n\t\t'parent_item',\n\t\t__( 'Parent Category' ),\n\t\t__( 'Parent Term' )\n\t);\n\tconst noParentOption = `— ${ parentSelectLabel } —`;\n\tconst newTermSubmitLabel = newTermButtonLabel;\n\tconst filterLabel = get(\n\t\ttaxonomy,\n\t\t[ 'labels', 'search_items' ],\n\t\t__( 'Search Terms' )\n\t);\n\tconst groupLabel = get( taxonomy, [ 'name' ], __( 'Terms' ) );\n\tconst showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;\n\n\treturn (\n\t\t<>\n\t\t\t{ showFilter && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-filter\"\n\t\t\t\t\tlabel={ filterLabel }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tonChange={ setFilter }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-list\"\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"group\"\n\t\t\t\taria-label={ groupLabel }\n\t\t\t>\n\t\t\t\t{ renderTerms(\n\t\t\t\t\t'' !== filterValue ? filteredTermsTree : availableTermsTree\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ ! loading && hasCreateAction && (\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ onToggleForm }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-add\"\n\t\t\t\t\taria-expanded={ showForm }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t>\n\t\t\t\t\t{ newTermButtonLabel }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ showForm && (\n\t\t\t\t<form onSubmit={ onAddTerm }>\n\t\t\t\t\t<VStack>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-input\"\n\t\t\t\t\t\t\tlabel={ newTermLabel }\n\t\t\t\t\t\t\tvalue={ formName }\n\t\t\t\t\t\t\tonChange={ onChangeFormName }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ !! availableTerms.length && (\n\t\t\t\t\t\t\t<TreeSelect\n\t\t\t\t\t\t\t\tlabel={ parentSelectLabel }\n\t\t\t\t\t\t\t\tnoOptionLabel={ noParentOption }\n\t\t\t\t\t\t\t\tonChange={ onChangeFormParent }\n\t\t\t\t\t\t\t\tselectedId={ formParent }\n\t\t\t\t\t\t\t\ttree={ availableTermsTree }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-submit\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ newTermSubmitLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )(\n\tHierarchicalTermSelector\n);\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/hierarchical-term-selector.js"],"names":["__","_n","_x","sprintf","useMemo","useState","Button","CheckboxControl","TextControl","TreeSelect","withFilters","__experimentalVStack","VStack","useDispatch","useSelect","useDebounce","store","coreStore","speak","decodeEntities","buildTermsTree","editorStore","DEFAULT_QUERY","per_page","orderby","order","_fields","context","MIN_TERMS_COUNT_FOR_FILTER","EMPTY_ARRAY","sortBySelected","termsTree","terms","treeHasSelection","termTree","indexOf","id","undefined","children","map","filter","child","length","termOrChildIsSelected","termA","termB","termASelected","termBSelected","newTermTree","sort","findTerm","parent","name","find","term","parseInt","toLowerCase","getFilterMatcher","filterValue","matchTermsForFilter","originalTerm","HierarchicalTermSelector","slug","adding","setAdding","formName","setFormName","formParent","setFormParent","showForm","setShowForm","setFilterValue","filteredTermsTree","setFilteredTermsTree","debouncedSpeak","hasCreateAction","hasAssignAction","loading","availableTerms","taxonomy","select","getCurrentPost","getEditedPostAttribute","getTaxonomy","getEntityRecords","isResolving","_taxonomy","post","_links","rest_base","editPost","saveEntityRecord","availableTermsTree","addTerm","onUpdateTerms","termIds","onChange","termId","hasTerm","includes","newTerms","onChangeFormName","value","onChangeFormParent","parentId","onToggleForm","onAddTerm","event","preventDefault","existingTerm","some","newTerm","defaultName","termAddedMessage","labels","singular_name","setFilter","newFilteredTermsTree","getResultCount","count","i","resultCount","resultsFoundMessage","renderTerms","renderedTerms","labelWithFallback","labelProperty","fallbackIsCategory","fallbackIsNotCategory","newTermButtonLabel","newTermLabel","parentSelectLabel","noParentOption","newTermSubmitLabel","filterLabel","search_items","groupLabel","showFilter"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,EAAiBC,EAAjB,EAAqBC,OAArB,QAAoC,iBAApC;AACA,SAASC,OAAT,EAAkBC,QAAlB,QAAkC,oBAAlC;AACA,SACCC,MADD,EAECC,eAFD,EAGCC,WAHD,EAICC,UAJD,EAKCC,WALD,EAMCC,oBAAoB,IAAIC,MANzB,QAOO,uBAPP;AAQA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,KAAT,QAAsB,iBAAtB;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,mBAA/B;AACA,SAASJ,KAAK,IAAIK,WAAlB,QAAqC,aAArC;AAEA;AACA;AACA;;AACA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAE,CAAC,CADU;AAErBC,EAAAA,OAAO,EAAE,MAFY;AAGrBC,EAAAA,KAAK,EAAE,KAHc;AAIrBC,EAAAA,OAAO,EAAE,gBAJY;AAKrBC,EAAAA,OAAO,EAAE;AALY,CAAtB;AAQA,MAAMC,0BAA0B,GAAG,CAAnC;AAEA,MAAMC,WAAW,GAAG,EAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAoCC,KAApC,EAA4C;AAClD,QAAMC,gBAAgB,GAAKC,QAAF,IAAgB;AACxC,QAAKF,KAAK,CAACG,OA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ACT;AAAM,IAAA,QAAQ,EAAGqC;AAAjB,KACC,cAAC,MAAD,QACC,cAAC,WAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,SAAS,EAAC,kDAFX;AAGC,IAAA,KAAK,EAAGwB,YAHT;AAIC,IAAA,KAAK,EAAGjE,QAJT;AAKC,IAAA,QAAQ,EAAGoC,gBALZ;AAMC,IAAA,QAAQ;AANT,IADD,EASG,CAAC,CAAEvB,cAAc,CAACpC,MAAlB,IACD,cAAC,UAAD;AACC,IAAA,KAAK,EAAGyF,iBADT;AAEC,IAAA,aAAa,EAAGC,cAFjB;AAGC,IAAA,QAAQ,EAAG7B,kBAHZ;AAIC,IAAA,UAAU,EAAGpC,UAJd;AAKC,IAAA,IAAI,EAAGyB;AALR,IAVF,CADD,EAoBC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,WADT;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,IAAA,SAAS,EAAC;AAHX,KAKGyC,kBALH,CApBD,CA/BF,CADD;AA+DA;AAED,eAAe3H,WAAW,CAAE,yBAAF,CAAX,CACdmD,wBADc,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tCheckboxControl,\n\tTextControl,\n\tTreeSelect,\n\twithFilters,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useDebounce } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { buildTermsTree } from '../../utils/terms';\nimport { store as editorStore } from '../../store';\n\n/**\n * Module Constants\n */\nconst DEFAULT_QUERY = {\n\tper_page: -1,\n\torderby: 'name',\n\torder: 'asc',\n\t_fields: 'id,name,parent',\n\tcontext: 'view',\n};\n\nconst MIN_TERMS_COUNT_FOR_FILTER = 8;\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Sort Terms by Selected.\n *\n * @param {Object[]} termsTree Array of terms in tree format.\n * @param {number[]} terms Selected terms.\n *\n * @return {Object[]} Sorted array of terms.\n */\nexport function sortBySelected( termsTree, terms ) {\n\tconst treeHasSelection = ( termTree ) => {\n\t\tif ( terms.indexOf( termTree.id ) !== -1 ) {\n\t\t\treturn true;\n\t\t}\n\t\tif ( undefined === termTree.children ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn (\n\t\t\ttermTree.children\n\t\t\t\t.map( treeHasSelection )\n\t\t\t\t.filter( ( child ) => child ).length > 0\n\t\t);\n\t};\n\tconst termOrChildIsSelected = ( termA, termB ) => {\n\t\tconst termASelected = treeHasSelection( termA );\n\t\tconst termBSelected = treeHasSelection( termB );\n\n\t\tif ( termASelected === termBSelected ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tif ( termASelected && ! termBSelected ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif ( ! termASelected && termBSelected ) {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn 0;\n\t};\n\tconst newTermTree = [ ...termsTree ];\n\tnewTermTree.sort( termOrChildIsSelected );\n\treturn newTermTree;\n}\n\n/**\n * Find term by parent id or name.\n *\n * @param {Object[]} terms Array of Terms.\n * @param {number|string} parent id.\n * @param {string} name Term name.\n * @return {Object} Term object.\n */\nexport function findTerm( terms, parent, name ) {\n\treturn terms.find( ( term ) => {\n\t\treturn (\n\t\t\t( ( ! term.parent && ! parent ) ||\n\t\t\t\tparseInt( term.parent ) === parseInt( parent ) ) &&\n\t\t\tterm.name.toLowerCase() === name.toLowerCase()\n\t\t);\n\t} );\n}\n\n/**\n * Get filter matcher function.\n *\n * @param {string} filterValue Filter value.\n * @return {(function(Object): (Object|boolean))} Matcher function.\n */\nexport function getFilterMatcher( filterValue ) {\n\tconst matchTermsForFilter = ( originalTerm ) => {\n\t\tif ( '' === filterValue ) {\n\t\t\treturn originalTerm;\n\t\t}\n\n\t\t// Shallow clone, because we'll be filtering the term's children and\n\t\t// don't want to modify the original term.\n\t\tconst term = { ...originalTerm };\n\n\t\t// Map and filter the children, recursive so we deal with grandchildren\n\t\t// and any deeper levels.\n\t\tif ( term.children.length > 0 ) {\n\t\t\tterm.children = term.children\n\t\t\t\t.map( matchTermsForFilter )\n\t\t\t\t.filter( ( child ) => child );\n\t\t}\n\n\t\t// If the term's name contains the filterValue, or it has children\n\t\t// (i.e. some child matched at some point in the tree) then return it.\n\t\tif (\n\t\t\t-1 !==\n\t\t\t\tterm.name.toLowerCase().indexOf( filterValue.toLowerCase() ) ||\n\t\t\tterm.children.length > 0\n\t\t) {\n\t\t\treturn term;\n\t\t}\n\n\t\t// Otherwise, return false. After mapping, the list of terms will need\n\t\t// to have false values filtered out.\n\t\treturn false;\n\t};\n\treturn matchTermsForFilter;\n}\n\n/**\n * Hierarchical term selector.\n *\n * @param {Object} props Component props.\n * @param {string} props.slug Taxonomy slug.\n * @return {WPElement} Hierarchical term selector component.\n */\nexport function HierarchicalTermSelector( { slug } ) {\n\tconst [ adding, setAdding ] = useState( false );\n\tconst [ formName, setFormName ] = useState( '' );\n\t/**\n\t * @type {[number|'', Function]}\n\t */\n\tconst [ formParent, setFormParent ] = useState( '' );\n\tconst [ showForm, setShowForm ] = useState( false );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ filteredTermsTree, setFilteredTermsTree ] = useState( [] );\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\n\tconst {\n\t\thasCreateAction,\n\t\thasAssignAction,\n\t\tterms,\n\t\tloading,\n\t\tavailableTerms,\n\t\ttaxonomy,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentPost, getEditedPostAttribute } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst { getTaxonomy, getEntityRecords, isResolving } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst _taxonomy = getTaxonomy( slug );\n\t\t\tconst post = getCurrentPost();\n\n\t\t\treturn {\n\t\t\t\thasCreateAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-create-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\thasAssignAction: _taxonomy\n\t\t\t\t\t? post._links?.[\n\t\t\t\t\t\t\t'wp:action-assign-' + _taxonomy.rest_base\n\t\t\t\t\t ] ?? false\n\t\t\t\t\t: false,\n\t\t\t\tterms: _taxonomy\n\t\t\t\t\t? getEditedPostAttribute( _taxonomy.rest_base )\n\t\t\t\t\t: EMPTY_ARRAY,\n\t\t\t\tloading: isResolving( 'getEntityRecords', [\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\tslug,\n\t\t\t\t\tDEFAULT_QUERY,\n\t\t\t\t] ),\n\t\t\t\tavailableTerms:\n\t\t\t\t\tgetEntityRecords( 'taxonomy', slug, DEFAULT_QUERY ) ||\n\t\t\t\t\tEMPTY_ARRAY,\n\t\t\t\ttaxonomy: _taxonomy,\n\t\t\t};\n\t\t},\n\t\t[ slug ]\n\t);\n\n\tconst { editPost } = useDispatch( editorStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst availableTermsTree = useMemo(\n\t\t() => sortBySelected( buildTermsTree( availableTerms ), terms ),\n\t\t// Remove `terms` from the dependency list to avoid reordering every time\n\t\t// checking or unchecking a term.\n\t\t[ availableTerms ]\n\t);\n\n\tif ( ! hasAssignAction ) {\n\t\treturn null;\n\t}\n\n\t/**\n\t * Append new term.\n\t *\n\t * @param {Object} term Term object.\n\t * @return {Promise} A promise that resolves to save term object.\n\t */\n\tconst addTerm = ( term ) => {\n\t\treturn saveEntityRecord( 'taxonomy', slug, term );\n\t};\n\n\t/**\n\t * Update terms for post.\n\t *\n\t * @param {number[]} termIds Term ids.\n\t */\n\tconst onUpdateTerms = ( termIds ) => {\n\t\teditPost( { [ taxonomy.rest_base ]: termIds } );\n\t};\n\n\t/**\n\t * Handler for checking term.\n\t *\n\t * @param {number} termId\n\t */\n\tconst onChange = ( termId ) => {\n\t\tconst hasTerm = terms.includes( termId );\n\t\tconst newTerms = hasTerm\n\t\t\t? terms.filter( ( id ) => id !== termId )\n\t\t\t: [ ...terms, termId ];\n\t\tonUpdateTerms( newTerms );\n\t};\n\n\tconst onChangeFormName = ( value ) => {\n\t\tsetFormName( value );\n\t};\n\n\t/**\n\t * Handler for changing form parent.\n\t *\n\t * @param {number|''} parentId Parent post id.\n\t */\n\tconst onChangeFormParent = ( parentId ) => {\n\t\tsetFormParent( parentId );\n\t};\n\n\tconst onToggleForm = () => {\n\t\tsetShowForm( ! showForm );\n\t};\n\n\tconst onAddTerm = async ( event ) => {\n\t\tevent.preventDefault();\n\t\tif ( formName === '' || adding ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if the term we are adding already exists.\n\t\tconst existingTerm = findTerm( availableTerms, formParent, formName );\n\t\tif ( existingTerm ) {\n\t\t\t// If the term we are adding exists but is not selected select it.\n\t\t\tif ( ! terms.some( ( term ) => term === existingTerm.id ) ) {\n\t\t\t\tonUpdateTerms( [ ...terms, existingTerm.id ] );\n\t\t\t}\n\n\t\t\tsetFormName( '' );\n\t\t\tsetFormParent( '' );\n\n\t\t\treturn;\n\t\t}\n\t\tsetAdding( true );\n\n\t\tconst newTerm = await addTerm( {\n\t\t\tname: formName,\n\t\t\tparent: formParent ? formParent : undefined,\n\t\t} );\n\n\t\tconst defaultName =\n\t\t\tslug === 'category' ? __( 'Category' ) : __( 'Term' );\n\t\tconst termAddedMessage = sprintf(\n\t\t\t/* translators: %s: taxonomy name */\n\t\t\t_x( '%s added', 'term' ),\n\t\t\ttaxonomy?.labels?.singular_name ?? defaultName\n\t\t);\n\t\tspeak( termAddedMessage, 'assertive' );\n\t\tsetAdding( false );\n\t\tsetFormName( '' );\n\t\tsetFormParent( '' );\n\t\tonUpdateTerms( [ ...terms, newTerm.id ] );\n\t};\n\n\tconst setFilter = ( value ) => {\n\t\tconst newFilteredTermsTree = availableTermsTree\n\t\t\t.map( getFilterMatcher( value ) )\n\t\t\t.filter( ( term ) => term );\n\t\tconst getResultCount = ( termsTree ) => {\n\t\t\tlet count = 0;\n\t\t\tfor ( let i = 0; i < termsTree.length; i++ ) {\n\t\t\t\tcount++;\n\t\t\t\tif ( undefined !== termsTree[ i ].children ) {\n\t\t\t\t\tcount += getResultCount( termsTree[ i ].children );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn count;\n\t\t};\n\n\t\tsetFilterValue( value );\n\t\tsetFilteredTermsTree( newFilteredTermsTree );\n\n\t\tconst resultCount = getResultCount( newFilteredTermsTree );\n\t\tconst resultsFoundMessage = sprintf(\n\t\t\t/* translators: %d: number of results */\n\t\t\t_n( '%d result found.', '%d results found.', resultCount ),\n\t\t\tresultCount\n\t\t);\n\n\t\tdebouncedSpeak( resultsFoundMessage, 'assertive' );\n\t};\n\n\tconst renderTerms = ( renderedTerms ) => {\n\t\treturn renderedTerms.map( ( term ) => {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tkey={ term.id }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-choice\"\n\t\t\t\t>\n\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tchecked={ terms.indexOf( term.id ) !== -1 }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tconst termId = parseInt( term.id, 10 );\n\t\t\t\t\t\t\tonChange( termId );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ decodeEntities( term.name ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ !! term.children.length && (\n\t\t\t\t\t\t<div className=\"editor-post-taxonomies__hierarchical-terms-subchoices\">\n\t\t\t\t\t\t\t{ renderTerms( term.children ) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t);\n\t\t} );\n\t};\n\n\tconst labelWithFallback = (\n\t\tlabelProperty,\n\t\tfallbackIsCategory,\n\t\tfallbackIsNotCategory\n\t) =>\n\t\ttaxonomy?.labels?.[ labelProperty ] ??\n\t\t( slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory );\n\n\tconst newTermButtonLabel = labelWithFallback(\n\t\t'add_new_item',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst newTermLabel = labelWithFallback(\n\t\t'new_item_name',\n\t\t__( 'Add new category' ),\n\t\t__( 'Add new term' )\n\t);\n\tconst parentSelectLabel = labelWithFallback(\n\t\t'parent_item',\n\t\t__( 'Parent Category' ),\n\t\t__( 'Parent Term' )\n\t);\n\tconst noParentOption = `— ${ parentSelectLabel } —`;\n\tconst newTermSubmitLabel = newTermButtonLabel;\n\tconst filterLabel = taxonomy?.labels?.search_items ?? __( 'Search Terms' );\n\tconst groupLabel = taxonomy?.name ?? __( 'Terms' );\n\tconst showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;\n\n\treturn (\n\t\t<>\n\t\t\t{ showFilter && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-filter\"\n\t\t\t\t\tlabel={ filterLabel }\n\t\t\t\t\tvalue={ filterValue }\n\t\t\t\t\tonChange={ setFilter }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div\n\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-list\"\n\t\t\t\ttabIndex=\"0\"\n\t\t\t\trole=\"group\"\n\t\t\t\taria-label={ groupLabel }\n\t\t\t>\n\t\t\t\t{ renderTerms(\n\t\t\t\t\t'' !== filterValue ? filteredTermsTree : availableTermsTree\n\t\t\t\t) }\n\t\t\t</div>\n\t\t\t{ ! loading && hasCreateAction && (\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ onToggleForm }\n\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-add\"\n\t\t\t\t\taria-expanded={ showForm }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t>\n\t\t\t\t\t{ newTermButtonLabel }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ showForm && (\n\t\t\t\t<form onSubmit={ onAddTerm }>\n\t\t\t\t\t<VStack>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-input\"\n\t\t\t\t\t\t\tlabel={ newTermLabel }\n\t\t\t\t\t\t\tvalue={ formName }\n\t\t\t\t\t\t\tonChange={ onChangeFormName }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{ !! availableTerms.length && (\n\t\t\t\t\t\t\t<TreeSelect\n\t\t\t\t\t\t\t\tlabel={ parentSelectLabel }\n\t\t\t\t\t\t\t\tnoOptionLabel={ noParentOption }\n\t\t\t\t\t\t\t\tonChange={ onChangeFormParent }\n\t\t\t\t\t\t\t\tselectedId={ formParent }\n\t\t\t\t\t\t\t\ttree={ availableTermsTree }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName=\"editor-post-taxonomies__hierarchical-terms-submit\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ newTermSubmitLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</form>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default withFilters( 'editor.PostTaxonomyType' )(\n\tHierarchicalTermSelector\n);\n"]}
@@ -1,13 +1,8 @@
1
1
  import { createElement } from "@wordpress/element";
2
2
 
3
- /**
4
- * External dependencies
5
- */
6
- import { get } from 'lodash';
7
3
  /**
8
4
  * WordPress dependencies
9
5
  */
10
-
11
6
  import { BaseControl, Button } from '@wordpress/components';
12
7
  import { useSelect } from '@wordpress/data';
13
8
  import { store as coreStore } from '@wordpress/core-data';
@@ -46,13 +41,12 @@ export default function MostUsedTerms(_ref) {
46
41
  }
47
42
 
48
43
  const terms = unescapeTerms(_terms);
49
- const label = get(taxonomy, ['labels', 'most_used']);
50
44
  return createElement("div", {
51
45
  className: "editor-post-taxonomies__flat-term-most-used"
52
46
  }, createElement(BaseControl.VisualLabel, {
53
47
  as: "h3",
54
48
  className: "editor-post-taxonomies__flat-term-most-used-label"
55
- }, label), createElement("ul", {
49
+ }, taxonomy.labels.most_used), createElement("ul", {
56
50
  role: "list",
57
51
  className: "editor-post-taxonomies__flat-term-most-used-list"
58
52
  }, terms.map(term => createElement("li", {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/most-used-terms.js"],"names":["get","BaseControl","Button","useSelect","store","coreStore","unescapeTerms","MIN_MOST_USED_TERMS","DEFAULT_QUERY","per_page","orderby","order","hide_empty","_fields","context","MostUsedTerms","onSelect","taxonomy","_terms","showTerms","select","mostUsedTerms","getEntityRecords","slug","length","terms","label","map","term","id","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,mBAA9B;AAEA,MAAMC,mBAAmB,GAAG,CAA5B;AACA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAE,EADW;AAErBC,EAAAA,OAAO,EAAE,OAFY;AAGrBC,EAAAA,KAAK,EAAE,MAHc;AAIrBC,EAAAA,UAAU,EAAE,IAJS;AAKrBC,EAAAA,OAAO,EAAE,eALY;AAMrBC,EAAAA,OAAO,EAAE;AANY,CAAtB;AASA,eAAe,SAASC,aAAT,OAAiD;AAAA,MAAzB;A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button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unescapeTerms } from '../../utils/terms';\n\nconst MIN_MOST_USED_TERMS = 3;\nconst DEFAULT_QUERY = {\n\tper_page: 10,\n\torderby: 'count',\n\torder: 'desc',\n\thide_empty: true,\n\t_fields: 'id,name,count',\n\tcontext: 'view',\n};\n\nexport default function MostUsedTerms( { onSelect, taxonomy } ) {\n\tconst { _terms, showTerms } = useSelect(\n\t\t( select ) => {\n\t\t\tconst mostUsedTerms = select( coreStore ).getEntityRecords(\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\tDEFAULT_QUERY\n\t\t\t);\n\t\t\treturn {\n\t\t\t\t_terms: mostUsedTerms,\n\t\t\t\tshowTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS,\n\t\t\t};\n\t\t},\n\t\t[ taxonomy.slug ]\n\t);\n\n\tif ( ! showTerms ) {\n\t\treturn null;\n\t}\n\n\tconst terms = unescapeTerms( _terms );\n\tconst label = get( taxonomy, [ 'labels', 'most_used' ] );\n\n\treturn (\n\t\t<div className=\"editor-post-taxonomies__flat-term-most-used\">\n\t\t\t<BaseControl.VisualLabel\n\t\t\t\tas=\"h3\"\n\t\t\t\tclassName=\"editor-post-taxonomies__flat-term-most-used-label\"\n\t\t\t>\n\t\t\t\t{ label }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */\n\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\trole=\"list\"\n\t\t\t\tclassName=\"editor-post-taxonomies__flat-term-most-used-list\"\n\t\t\t>\n\t\t\t\t{ terms.map( ( term ) => (\n\t\t\t\t\t<li key={ term.id }>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () => onSelect( term ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ term.name }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/most-used-terms.js"],"names":["BaseControl","Button","useSelect","store","coreStore","unescapeTerms","MIN_MOST_USED_TERMS","DEFAULT_QUERY","per_page","orderby","order","hide_empty","_fields","context","MostUsedTerms","onSelect","taxonomy","_terms","showTerms","select","mostUsedTerms","getEntityRecords","slug","length","terms","labels","most_used","map","term","id","name"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,MAAtB,QAAoC,uBAApC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,mBAA9B;AAEA,MAAMC,mBAAmB,GAAG,CAA5B;AACA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAE,EADW;AAErBC,EAAAA,OAAO,EAAE,OAFY;AAGrBC,EAAAA,KAAK,EAAE,MAHc;AAIrBC,EAAAA,UAAU,EAAE,IAJS;AAKrBC,EAAAA,OAAO,EAAE,eALY;AAMrBC,EAAAA,OAAO,EAAE;AANY,CAAtB;AASA,eAAe,SAASC,aAAT,OAAiD;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;AAC/D,QAAM;AAAEC,IAAAA,MAAF;AAAUC,IAAAA;AAAV,MAAwBhB,SAAS,CACpCiB,MAAF,IAAc;AACb,UAAMC,aAAa,GAAGD,MAAM,CAAEf,SAAF,CAAN,CAAoBiB,gBAApB,CACrB,UADqB,EAErBL,QAAQ,CAACM,IAFY,EAGrBf,aAHqB,CAAtB;AAKA,WAAO;AACNU,MAAAA,MAAM,EAAEG,aADF;AAENF,MAAAA,SAAS,EAAE,CAAAE,aAAa,SAAb,IAAAA,aAAa,WAAb,YAAAA,aAAa,CAAEG,MAAf,KAAyBjB;AAF9B,KAAP;AAIA,GAXqC,EAYtC,CAAEU,QAAQ,CAACM,IAAX,CAZsC,CAAvC;;AAeA,MAAK,CAAEJ,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMM,KAAK,GAAGnB,aAAa,CAAEY,MAAF,CAA3B;AAEA,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,WAAD,CAAa,WAAb;AACC,IAAA,EAAE,EAAC,IADJ;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGD,QAAQ,CAACS,MAAT,CAAgBC,SAJnB,CADD,EAYC;AACC,IAAA,IAAI,EAAC,MADN;AAEC,IAAA,SAAS,EAAC;AAFX,KAIGF,KAAK,CAACG,GAAN,CAAaC,IAAF,IACZ;AAAI,IAAA,GAAG,EAAGA,IAAI,CAACC;AAAf,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,MADT;AAEC,IAAA,OAAO,EAAG,MAAMd,QAAQ,CAAEa,IAAF;AAFzB,KAIGA,IAAI,CAACE,IAJR,CADD,CADC,CAJH,CAZD,CADD;AA+BA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BaseControl, Button } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unescapeTerms } from '../../utils/terms';\n\nconst MIN_MOST_USED_TERMS = 3;\nconst DEFAULT_QUERY = {\n\tper_page: 10,\n\torderby: 'count',\n\torder: 'desc',\n\thide_empty: true,\n\t_fields: 'id,name,count',\n\tcontext: 'view',\n};\n\nexport default function MostUsedTerms( { onSelect, taxonomy } ) {\n\tconst { _terms, showTerms } = useSelect(\n\t\t( select ) => {\n\t\t\tconst mostUsedTerms = select( coreStore ).getEntityRecords(\n\t\t\t\t'taxonomy',\n\t\t\t\ttaxonomy.slug,\n\t\t\t\tDEFAULT_QUERY\n\t\t\t);\n\t\t\treturn {\n\t\t\t\t_terms: mostUsedTerms,\n\t\t\t\tshowTerms: mostUsedTerms?.length >= MIN_MOST_USED_TERMS,\n\t\t\t};\n\t\t},\n\t\t[ taxonomy.slug ]\n\t);\n\n\tif ( ! showTerms ) {\n\t\treturn null;\n\t}\n\n\tconst terms = unescapeTerms( _terms );\n\n\treturn (\n\t\t<div className=\"editor-post-taxonomies__flat-term-most-used\">\n\t\t\t<BaseControl.VisualLabel\n\t\t\t\tas=\"h3\"\n\t\t\t\tclassName=\"editor-post-taxonomies__flat-term-most-used-label\"\n\t\t\t>\n\t\t\t\t{ taxonomy.labels.most_used }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t{ /*\n\t\t\t * Disable reason: The `list` ARIA role is redundant but\n\t\t\t * Safari+VoiceOver won't announce the list otherwise.\n\t\t\t */\n\t\t\t/* eslint-disable jsx-a11y/no-redundant-roles */ }\n\t\t\t<ul\n\t\t\t\trole=\"list\"\n\t\t\t\tclassName=\"editor-post-taxonomies__flat-term-most-used-list\"\n\t\t\t>\n\t\t\t\t{ terms.map( ( term ) => (\n\t\t\t\t\t<li key={ term.id }>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\tonClick={ () => onSelect( term ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ term.name }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t\t{ /* eslint-enable jsx-a11y/no-redundant-roles */ }\n\t\t</div>\n\t);\n}\n"]}
@@ -1,11 +1,6 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
1
  /**
6
2
  * WordPress dependencies
7
3
  */
8
-
9
4
  import { compose } from '@wordpress/compose';
10
5
  import { withSelect } from '@wordpress/data';
11
6
  /**
@@ -24,12 +19,14 @@ export function PostVisibilityCheck(_ref) {
24
19
  });
25
20
  }
26
21
  export default compose([withSelect(select => {
22
+ var _getCurrentPost$_link, _getCurrentPost$_link2;
23
+
27
24
  const {
28
25
  getCurrentPost,
29
26
  getCurrentPostType
30
27
  } = select(editorStore);
31
28
  return {
32
- hasPublishAction: get(getCurrentPost(), ['_links', 'wp:action-publish'], false),
29
+ hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost$_link2 = getCurrentPost()._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false,
33
30
  postType: getCurrentPostType()
34
31
  };
35
32
  })])(PostVisibilityCheck);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/check.js"],"names":["get","compose","withSelect","store","editorStore","PostVisibilityCheck","hasPublishAction","render","canEdit","select","getCurrentPost","getCurrentPostType","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,mBAAT,OAA6D;AAAA,MAA/B;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAA+B;AACnE,QAAMC,OAAO,GAAGF,gBAAhB;AACA,SAAOC,MAAM,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAAb;AACA;AAED,eAAeP,OAAO,CAAE,CACvBC,UAAU,CAAIO,MAAF,IAAc;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAyCF,MAAM,CAAEL,WAAF,CAArD;AACA,SAAO;AACNE,IAAAA,gBAAgB,EAAEN,GAAG,CACpBU,cAAc,EADM,EAEpB,CAAE,QAAF,EAAY,mBAAZ,CAFoB,EAGpB,KAHoB,CADf;AAMNE,IAAAA,QAAQ,EAAED,kBAAkB;AANtB,GAAP;AAQA,CAVS,CADa,CAAF,CAAP,CAYVN,mBAZU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostVisibilityCheck( { hasPublishAction, render } ) {\n\tconst canEdit = hasPublishAction;\n\treturn render( { canEdit } );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction: get(\n\t\t\t\tgetCurrentPost(),\n\t\t\t\t[ '_links', 'wp:action-publish' ],\n\t\t\t\tfalse\n\t\t\t),\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostVisibilityCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-visibility/check.js"],"names":["compose","withSelect","store","editorStore","PostVisibilityCheck","hasPublishAction","render","canEdit","select","getCurrentPost","getCurrentPostType","_links","postType"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,mBAAT,OAA6D;AAAA,MAA/B;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,GAA+B;AACnE,QAAMC,OAAO,GAAGF,gBAAhB;AACA,SAAOC,MAAM,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAAb;AACA;AAED,eAAeP,OAAO,CAAE,CACvBC,UAAU,CAAIO,MAAF,IAAc;AAAA;;AACzB,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA;AAAlB,MAAyCF,MAAM,CAAEL,WAAF,CAArD;AACA,SAAO;AACNE,IAAAA,gBAAgB,qDACfI,cAAc,GAAGE,MADF,2DACf,uBAA2B,mBAA3B,CADe,yEACqC,KAF/C;AAGNC,IAAAA,QAAQ,EAAEF,kBAAkB;AAHtB,GAAP;AAKA,CAPS,CADa,CAAF,CAAP,CASVN,mBATU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { withSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function PostVisibilityCheck( { hasPublishAction, render } ) {\n\tconst canEdit = hasPublishAction;\n\treturn render( { canEdit } );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\tconst { getCurrentPost, getCurrentPostType } = select( editorStore );\n\t\treturn {\n\t\t\thasPublishAction:\n\t\t\t\tgetCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,\n\t\t\tpostType: getCurrentPostType(),\n\t\t};\n\t} ),\n] )( PostVisibilityCheck );\n"]}
@@ -13,7 +13,7 @@ import inserterMediaCategories from '../media-categories';
13
13
  import { mediaUpload } from '../../utils';
14
14
  import { store as editorStore } from '../../store';
15
15
  const EMPTY_BLOCKS_LIST = [];
16
- const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__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', '__unstableIsBlockBasedTheme'];
16
+ const BLOCK_EDITOR_SETTINGS = ['__experimentalBlockDirectory', '__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', 'postContentAttributes', 'postsPerPage', 'readOnly', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock', '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', '__unstableIsBlockBasedTheme'];
17
17
  /**
18
18
  * React hook used to compute the block editor settings to use for the post editor.
19
19
  *
@@ -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","__","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,EAE7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Y,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'__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\t'__unstableIsBlockBasedTheme',\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"]}
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,kCAF6B,EAG7B,wBAH6B,EAI7B,sCAJ6B,EAK7B,wCAL6B,EAM7B,mCAN6B,EAO7B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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'__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'postContentAttributes',\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\t'__unstableIsBlockBasedTheme',\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"]}
@@ -1,11 +1,6 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
1
  /**
6
2
  * WordPress dependencies
7
3
  */
8
-
9
4
  import { withSelect } from '@wordpress/data';
10
5
  import { store as coreStore } from '@wordpress/core-data';
11
6
  /**
@@ -21,7 +16,9 @@ export function ThemeSupportCheck(_ref) {
21
16
  supportKeys
22
17
  } = _ref;
23
18
  const isSupported = (Array.isArray(supportKeys) ? supportKeys : [supportKeys]).some(key => {
24
- const supported = get(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types.
19
+ var _themeSupports$key;
20
+
21
+ const supported = (_themeSupports$key = themeSupports === null || themeSupports === void 0 ? void 0 : themeSupports[key]) !== null && _themeSupports$key !== void 0 ? _themeSupports$key : false; // 'post-thumbnails' can be boolean or an array of post types.
25
22
  // In the latter case, we need to verify `postType` exists
26
23
  // within `supported`. If `postType` isn't passed, then the check
27
24
  // should fail.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["get","withSelect","store","coreStore","editorStore","ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","Array","isArray","some","key","supported","includes","select","getThemeSupports","getEditedPostAttribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,OAKH;AAAA,MAL+B;AAClCC,IAAAA,aADkC;AAElCC,IAAAA,QAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAN,CAAeH,WAAf,IAA+BA,WAA/B,GAA6C,CAAEA,WAAF,CAD1B,EAEjBI,IAFiB,CAETC,GAAF,IAAW;AACnB,UAAMC,SAAS,GAAGf,GAAG,CAAEM,aAAF,EAAiB,CAAEQ,GAAF,CAAjB,EAA0B,KAA1B,CAArB,CADmB,CAEnB;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,IAA6BH,KAAK,CAACC,OAAN,CAAeG,SAAf,CAAlC,EAA+D;AAC9D,aAAOA,SAAS,CAACC,QAAV,CAAoBR,QAApB,CAAP;AACA;;AACD,WAAOO,SAAP;AACA,GAZmB,CAApB;;AAcA,MAAK,CAAEL,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOH,QAAP;AACA;AAED,eAAeN,UAAU,CAAIgB,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,MAAM,CAAEd,SAAF,CAAnC;AACA,QAAM;AAAEgB,IAAAA;AAAF,MAA6BF,MAAM,CAAEb,WAAF,CAAzC;AACA,SAAO;AACNI,IAAAA,QAAQ,EAAEW,sBAAsB,CAAE,MAAF,CAD1B;AAENb,IAAAA,aAAa,EAAEY,gBAAgB;AAFzB,GAAP;AAIA,CAPwB,CAAV,CAOVb,iBAPU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t ).some( ( key ) => {\n\t\tconst supported = get( themeSupports, [ key ], false );\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/theme-support-check/index.js"],"names":["withSelect","store","coreStore","editorStore","ThemeSupportCheck","themeSupports","children","postType","supportKeys","isSupported","Array","isArray","some","key","supported","includes","select","getThemeSupports","getEditedPostAttribute"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,QAA2B,iBAA3B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASD,KAAK,IAAIE,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,iBAAT,OAKH;AAAA,MAL+B;AAClCC,IAAAA,aADkC;AAElCC,IAAAA,QAFkC;AAGlCC,IAAAA,QAHkC;AAIlCC,IAAAA;AAJkC,GAK/B;AACH,QAAMC,WAAW,GAAG,CACnBC,KAAK,CAACC,OAAN,CAAeH,WAAf,IAA+BA,WAA/B,GAA6C,CAAEA,WAAF,CAD1B,EAEjBI,IAFiB,CAETC,GAAF,IAAW;AAAA;;AACnB,UAAMC,SAAS,yBAAGT,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAIQ,GAAJ,CAAhB,mEAA6B,KAA5C,CADmB,CAEnB;AACA;AACA;AACA;;AACA,QAAK,sBAAsBA,GAAtB,IAA6BH,KAAK,CAACC,OAAN,CAAeG,SAAf,CAAlC,EAA+D;AAC9D,aAAOA,SAAS,CAACC,QAAV,CAAoBR,QAApB,CAAP;AACA;;AACD,WAAOO,SAAP;AACA,GAZmB,CAApB;;AAcA,MAAK,CAAEL,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AAED,SAAOH,QAAP;AACA;AAED,eAAeN,UAAU,CAAIgB,MAAF,IAAc;AACxC,QAAM;AAAEC,IAAAA;AAAF,MAAuBD,MAAM,CAAEd,SAAF,CAAnC;AACA,QAAM;AAAEgB,IAAAA;AAAF,MAA6BF,MAAM,CAAEb,WAAF,CAAzC;AACA,SAAO;AACNI,IAAAA,QAAQ,EAAEW,sBAAsB,CAAE,MAAF,CAD1B;AAENb,IAAAA,aAAa,EAAEY,gBAAgB;AAFzB,GAAP;AAIA,CAPwB,CAAV,CAOVb,iBAPU,CAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\n\nexport function ThemeSupportCheck( {\n\tthemeSupports,\n\tchildren,\n\tpostType,\n\tsupportKeys,\n} ) {\n\tconst isSupported = (\n\t\tArray.isArray( supportKeys ) ? supportKeys : [ supportKeys ]\n\t ).some( ( key ) => {\n\t\tconst supported = themeSupports?.[ key ] ?? false;\n\t\t// 'post-thumbnails' can be boolean or an array of post types.\n\t\t// In the latter case, we need to verify `postType` exists\n\t\t// within `supported`. If `postType` isn't passed, then the check\n\t\t// should fail.\n\t\tif ( 'post-thumbnails' === key && Array.isArray( supported ) ) {\n\t\t\treturn supported.includes( postType );\n\t\t}\n\t\treturn supported;\n\t} );\n\n\tif ( ! isSupported ) {\n\t\treturn null;\n\t}\n\n\treturn children;\n}\n\nexport default withSelect( ( select ) => {\n\tconst { getThemeSupports } = select( coreStore );\n\tconst { getEditedPostAttribute } = select( editorStore );\n\treturn {\n\t\tpostType: getEditedPostAttribute( 'type' ),\n\t\tthemeSupports: getThemeSupports(),\n\t};\n} )( ThemeSupportCheck );\n"]}
@@ -7,11 +7,6 @@ import { __ } from '@wordpress/i18n';
7
7
  */
8
8
 
9
9
  import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';
10
- /**
11
- * External dependencies
12
- */
13
-
14
- import { get } from 'lodash';
15
10
  /**
16
11
  * Builds the arguments for a success notification dispatch.
17
12
  *
@@ -22,13 +17,15 @@ import { get } from 'lodash';
22
17
  */
23
18
 
24
19
  export function getNotificationArgumentsForSaveSuccess(data) {
20
+ var _data$options, _postType$viewable;
21
+
25
22
  const {
26
23
  previousPost,
27
24
  post,
28
25
  postType
29
26
  } = data; // Autosaves are neither shown a notice nor redirected.
30
27
 
31
- if (get(data.options, ['isAutosave'])) {
28
+ if ((_data$options = data.options) !== null && _data$options !== void 0 && _data$options.isAutosave) {
32
29
  return [];
33
30
  } // No notice is shown after trashing a post
34
31
 
@@ -41,7 +38,7 @@ export function getNotificationArgumentsForSaveSuccess(data) {
41
38
  const isPublished = publishStatus.includes(previousPost.status);
42
39
  const willPublish = publishStatus.includes(post.status);
43
40
  let noticeMessage;
44
- let shouldShowLink = get(postType, ['viewable'], false);
41
+ let shouldShowLink = (_postType$viewable = postType === null || postType === void 0 ? void 0 : postType.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false;
45
42
  let isDraft; // Always should a notice, which will be spoken for accessibility.
46
43
 
47
44
  if (!isPublished && !willPublish) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","get","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsForTrashFail"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,mBAAT,EAA8BC,oBAA9B,QAA0D,cAA1D;AAEA;AACA;AACA;;AACA,SAASC,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sCAAT,CAAiDC,IAAjD,EAAwD;AAC9D,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAA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Aa,GAChB,CAAEH,WAAF,IAAiBD,aAAa,CAAC4B,OAAd,CAAuBH,KAAK,CAAC1B,MAA7B,MAA0C,CAAC,CAA5D,GACG8B,QAAQ,CAAEJ,KAAK,CAAC1B,MAAR,CADX,GAEGV,EAAE,CAAE,kBAAF,CAHN,CAjB2D,CAsB3D;AACA;;AACA,MAAKqC,KAAK,CAACI,OAAN,IAAiB,CAAE,aAAaC,IAAb,CAAmBL,KAAK,CAACI,OAAzB,CAAxB,EAA6D;AAC5D1B,IAAAA,aAAa,GAAG,CAAEA,aAAF,EAAiBsB,KAAK,CAACI,OAAvB,EAAiCE,IAAjC,CAAuC,GAAvC,CAAhB;AACA;;AACD,SAAO,CACN5B,aADM,EAEN;AACCkB,IAAAA,EAAE,EAAEhC;AADL,GAFM,CAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS2C,oCAAT,CAA+CvC,IAA/C,EAAsD;AAC5D,SAAO,CACNA,IAAI,CAACgC,KAAL,CAAWI,OAAX,IAAsBpC,IAAI,CAACgC,KAAL,CAAWC,IAAX,KAAoB,eAA1C,GACGjC,IAAI,CAACgC,KAAL,CAAWI,OADd,GAEGzC,EAAE,CAAE,iBAAF,CAHC,EAIN;AACCiC,IAAAA,EAAE,EAAE/B;AADL,GAJM,CAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( get( data.options, [ 'isAutosave' ] ) ) {\n\t\treturn [];\n\t}\n\n\t// No notice is shown after trashing a post\n\tif ( post.status === 'trash' && previousPost.status !== 'trash' ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = get( postType, [ 'viewable' ], false );\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice.\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message.\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice.\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: isDraft ? __( 'View Preview' ) : postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message.\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/store/utils/notice-builder.js"],"names":["__","SAVE_POST_NOTICE_ID","TRASH_POST_NOTICE_ID","getNotificationArgumentsForSaveSuccess","data","previousPost","post","postType","options","isAutosave","status","publishStatus","isPublished","includes","willPublish","noticeMessage","shouldShowLink","viewable","isDraft","labels","item_reverted_to_draft","publish","item_published","private","item_published_privately","future","item_scheduled","item_updated","actions","push","label","view_item","url","link","id","type","getNotificationArgumentsForSaveFail","edits","error","code","indexOf","messages","message","test","join","getNotificationArgumentsFor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MAAyC,CAAC,CAA9D,CAT2D,CAU3D;AACA;;AACA,QAAM+B,QAAQ,GAAG;AAChBpB,IAAAA,OAAO,EAAErB,EAAE,CAAE,oBAAF,CADK;AAEhBuB,IAAAA,OAAO,EAAEvB,EAAE,CAAE,oBAAF,CAFK;AAGhByB,IAAAA,MAAM,EAAEzB,EAAE,CAAE,oBAAF;AAHM,GAAjB;AAKA,MAAIe,aAAa,GAChB,CAAEH,WAAF,IAAiBD,aAAa,CAAC6B,OAAd,CAAuBH,KAAK,CAAC3B,MAA7B,MAA0C,CAAC,CAA5D,GACG+B,QAAQ,CAAEJ,KAAK,CAAC3B,MAAR,CADX,GAEGV,EAAE,CAAE,kBAAF,CAHN,CAjB2D,CAsB3D;AACA;;AACA,MAAKsC,KAAK,CAACI,OAAN,IAAiB,CAAE,aAAaC,IAAb,CAAmBL,KAAK,CAACI,OAAzB,CAAxB,EAA6D;AAC5D3B,IAAAA,aAAa,GAAG,CAAEA,aAAF,EAAiBuB,KAAK,CAACI,OAAvB,EAAiCE,IAAjC,CAAuC,GAAvC,CAAhB;AACA;;AACD,SAAO,CACN7B,aADM,EAEN;AACCmB,IAAAA,EAAE,EAAEjC;AADL,GAFM,CAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAAS4C,oCAAT,CAA+CzC,IAA/C,EAAsD;AAC5D,SAAO,CACNA,IAAI,CAACkC,KAAL,CAAWI,OAAX,IAAsBtC,IAAI,CAACkC,KAAL,CAAWC,IAAX,KAAoB,eAA1C,GACGnC,IAAI,CAACkC,KAAL,CAAWI,OADd,GAEG1C,EAAE,CAAE,iBAAF,CAHC,EAIN;AACCkC,IAAAA,EAAE,EAAEhC;AADL,GAJM,CAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';\n\n/**\n * Builds the arguments for a success notification dispatch.\n *\n * @param {Object} data Incoming data to build the arguments from.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveSuccess( data ) {\n\tconst { previousPost, post, postType } = data;\n\t// Autosaves are neither shown a notice nor redirected.\n\tif ( data.options?.isAutosave ) {\n\t\treturn [];\n\t}\n\n\t// No notice is shown after trashing a post\n\tif ( post.status === 'trash' && previousPost.status !== 'trash' ) {\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.includes( previousPost.status );\n\tconst willPublish = publishStatus.includes( post.status );\n\n\tlet noticeMessage;\n\tlet shouldShowLink = postType?.viewable ?? false;\n\tlet isDraft;\n\n\t// Always should a notice, which will be spoken for accessibility.\n\tif ( ! isPublished && ! willPublish ) {\n\t\t// If saving a non-published post, don't show notice.\n\t\tnoticeMessage = __( 'Draft saved.' );\n\t\tisDraft = true;\n\t} else if ( isPublished && ! willPublish ) {\n\t\t// If undoing publish status, show specific notice.\n\t\tnoticeMessage = postType.labels.item_reverted_to_draft;\n\t\tshouldShowLink = false;\n\t} else if ( ! isPublished && willPublish ) {\n\t\t// If publishing or scheduling a post, show the corresponding\n\t\t// publish message.\n\t\tnoticeMessage = {\n\t\t\tpublish: postType.labels.item_published,\n\t\t\tprivate: postType.labels.item_published_privately,\n\t\t\tfuture: postType.labels.item_scheduled,\n\t\t}[ post.status ];\n\t} else {\n\t\t// Generic fallback notice.\n\t\tnoticeMessage = postType.labels.item_updated;\n\t}\n\n\tconst actions = [];\n\tif ( shouldShowLink ) {\n\t\tactions.push( {\n\t\t\tlabel: isDraft ? __( 'View Preview' ) : postType.labels.view_item,\n\t\t\turl: post.link,\n\t\t} );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t\ttype: 'snackbar',\n\t\t\tactions,\n\t\t},\n\t];\n}\n\n/**\n * Builds the fail notification arguments for dispatch.\n *\n * @param {Object} data Incoming data to build the arguments with.\n *\n * @return {Array} Arguments for dispatch. An empty array signals no\n * notification should be sent.\n */\nexport function getNotificationArgumentsForSaveFail( data ) {\n\tconst { post, edits, error } = data;\n\tif ( error && 'rest_autosave_no_changes' === error.code ) {\n\t\t// Autosave requested a new autosave, but there were no changes. This shouldn't\n\t\t// result in an error notice for the user.\n\t\treturn [];\n\t}\n\n\tconst publishStatus = [ 'publish', 'private', 'future' ];\n\tconst isPublished = publishStatus.indexOf( post.status ) !== -1;\n\t// If the post was being published, we show the corresponding publish error message\n\t// Unless we publish an \"updating failed\" message.\n\tconst messages = {\n\t\tpublish: __( 'Publishing failed.' ),\n\t\tprivate: __( 'Publishing failed.' ),\n\t\tfuture: __( 'Scheduling failed.' ),\n\t};\n\tlet noticeMessage =\n\t\t! isPublished && publishStatus.indexOf( edits.status ) !== -1\n\t\t\t? messages[ edits.status ]\n\t\t\t: __( 'Updating failed.' );\n\n\t// Check if message string contains HTML. Notice text is currently only\n\t// supported as plaintext, and stripping the tags may muddle the meaning.\n\tif ( error.message && ! /<\\/?[^>]*>/.test( error.message ) ) {\n\t\tnoticeMessage = [ noticeMessage, error.message ].join( ' ' );\n\t}\n\treturn [\n\t\tnoticeMessage,\n\t\t{\n\t\t\tid: SAVE_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n\n/**\n * Builds the trash fail notification arguments for dispatch.\n *\n * @param {Object} data\n *\n * @return {Array} Arguments for dispatch.\n */\nexport function getNotificationArgumentsForTrashFail( data ) {\n\treturn [\n\t\tdata.error.message && data.error.code !== 'unknown_error'\n\t\t\t? data.error.message\n\t\t\t: __( 'Trashing failed' ),\n\t\t{\n\t\t\tid: TRASH_POST_NOTICE_ID,\n\t\t},\n\t];\n}\n"]}
@@ -448,7 +448,7 @@
448
448
 
449
449
  .editor-post-publish-panel__header-publish-button,
450
450
  .editor-post-publish-panel__header-cancel-button {
451
- flex-grow: 1;
451
+ flex: 1;
452
452
  }
453
453
  @media (min-width: 480px) {
454
454
  .editor-post-publish-panel__header-publish-button,
@@ -448,7 +448,7 @@
448
448
 
449
449
  .editor-post-publish-panel__header-publish-button,
450
450
  .editor-post-publish-panel__header-cancel-button {
451
- flex-grow: 1;
451
+ flex: 1;
452
452
  }
453
453
  @media (min-width: 480px) {
454
454
  .editor-post-publish-panel__header-publish-button,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.4.0",
3
+ "version": "13.6.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,34 +31,34 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.27.0",
35
- "@wordpress/api-fetch": "^6.24.0",
36
- "@wordpress/blob": "^3.27.0",
37
- "@wordpress/block-editor": "^11.4.0",
38
- "@wordpress/blocks": "^12.4.0",
39
- "@wordpress/components": "^23.4.0",
40
- "@wordpress/compose": "^6.4.0",
41
- "@wordpress/core-data": "^6.4.0",
42
- "@wordpress/data": "^8.4.0",
43
- "@wordpress/date": "^4.27.0",
44
- "@wordpress/deprecated": "^3.27.0",
45
- "@wordpress/dom": "^3.27.0",
46
- "@wordpress/element": "^5.4.0",
47
- "@wordpress/hooks": "^3.27.0",
48
- "@wordpress/html-entities": "^3.27.0",
49
- "@wordpress/i18n": "^4.27.0",
50
- "@wordpress/icons": "^9.18.0",
51
- "@wordpress/keyboard-shortcuts": "^4.4.0",
52
- "@wordpress/keycodes": "^3.27.0",
53
- "@wordpress/media-utils": "^4.18.0",
54
- "@wordpress/notices": "^3.27.0",
55
- "@wordpress/preferences": "^3.4.0",
56
- "@wordpress/private-apis": "^0.9.0",
57
- "@wordpress/reusable-blocks": "^4.4.0",
58
- "@wordpress/rich-text": "^6.4.0",
59
- "@wordpress/server-side-render": "^4.4.0",
60
- "@wordpress/url": "^3.28.0",
61
- "@wordpress/wordcount": "^3.27.0",
34
+ "@wordpress/a11y": "^3.29.0",
35
+ "@wordpress/api-fetch": "^6.26.0",
36
+ "@wordpress/blob": "^3.29.0",
37
+ "@wordpress/block-editor": "^11.6.0",
38
+ "@wordpress/blocks": "^12.6.0",
39
+ "@wordpress/components": "^23.6.0",
40
+ "@wordpress/compose": "^6.6.0",
41
+ "@wordpress/core-data": "^6.6.0",
42
+ "@wordpress/data": "^8.6.0",
43
+ "@wordpress/date": "^4.29.0",
44
+ "@wordpress/deprecated": "^3.29.0",
45
+ "@wordpress/dom": "^3.29.0",
46
+ "@wordpress/element": "^5.6.0",
47
+ "@wordpress/hooks": "^3.29.0",
48
+ "@wordpress/html-entities": "^3.29.0",
49
+ "@wordpress/i18n": "^4.29.0",
50
+ "@wordpress/icons": "^9.20.0",
51
+ "@wordpress/keyboard-shortcuts": "^4.6.0",
52
+ "@wordpress/keycodes": "^3.29.0",
53
+ "@wordpress/media-utils": "^4.20.0",
54
+ "@wordpress/notices": "^3.29.0",
55
+ "@wordpress/preferences": "^3.6.0",
56
+ "@wordpress/private-apis": "^0.11.0",
57
+ "@wordpress/reusable-blocks": "^4.6.0",
58
+ "@wordpress/rich-text": "^6.6.0",
59
+ "@wordpress/server-side-render": "^4.6.0",
60
+ "@wordpress/url": "^3.30.0",
61
+ "@wordpress/wordcount": "^3.29.0",
62
62
  "classnames": "^2.3.1",
63
63
  "date-fns": "^2.28.0",
64
64
  "escape-html": "^1.0.3",
@@ -75,5 +75,5 @@
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "c25ff895413bad4354c55c0c2d732552618b0d56"
78
+ "gitHead": "9534a7b3bbf07c1d40b94fdb7a3d091f297bfb06"
79
79
  }
@@ -8,10 +8,13 @@ import { render } from '@testing-library/react';
8
8
  */
9
9
  import { AutosaveMonitor } from '../';
10
10
 
11
+ jest.useFakeTimers();
12
+ jest.spyOn( global, 'clearTimeout' );
13
+ jest.spyOn( global, 'setTimeout' );
14
+
11
15
  describe( 'AutosaveMonitor', () => {
12
16
  let setAutosaveTimerSpy;
13
17
  beforeEach( () => {
14
- jest.useFakeTimers( 'legacy' );
15
18
  setAutosaveTimerSpy = jest.spyOn(
16
19
  AutosaveMonitor.prototype,
17
20
  'setAutosaveTimer'
@@ -19,9 +22,6 @@ describe( 'AutosaveMonitor', () => {
19
22
  } );
20
23
 
21
24
  afterEach( () => {
22
- jest.runOnlyPendingTimers();
23
- jest.useRealTimers();
24
-
25
25
  setAutosaveTimerSpy.mockClear();
26
26
  } );
27
27
 
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { compose } from '@wordpress/compose';
6
- import { withSelect } from '@wordpress/data';
6
+ import { withSelect, useDispatch } from '@wordpress/data';
7
7
  import { create, getTextContent } from '@wordpress/rich-text';
8
8
  import { store as blockEditorStore } from '@wordpress/block-editor';
9
9
  import { store as coreStore } from '@wordpress/core-data';
@@ -68,7 +68,7 @@ export const DocumentOutline = ( {
68
68
  hasOutlineItemsDisabled,
69
69
  } ) => {
70
70
  const headings = computeOutlineHeadings( blocks );
71
-
71
+ const { selectBlock } = useDispatch( blockEditorStore );
72
72
  if ( headings.length < 1 ) {
73
73
  return null;
74
74
  }
@@ -121,7 +121,10 @@ export const DocumentOutline = ( {
121
121
  isValid={ isValid }
122
122
  isDisabled={ hasOutlineItemsDisabled }
123
123
  href={ `#block-${ item.clientId }` }
124
- onSelect={ onSelect }
124
+ onSelect={ () => {
125
+ selectBlock( item.clientId );
126
+ onSelect?.();
127
+ } }
125
128
  >
126
129
  { item.isEmpty
127
130
  ? emptyHeadingContent