@wordpress/editor 13.5.0 → 13.7.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 (44) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/editor-help/index.native.js +13 -10
  3. package/build/components/editor-help/index.native.js.map +1 -1
  4. package/build/components/media-categories/index.js +1 -1
  5. package/build/components/media-categories/index.js.map +1 -1
  6. package/build/components/post-locked-modal/index.js +7 -5
  7. package/build/components/post-locked-modal/index.js.map +1 -1
  8. package/build/components/post-publish-panel/postpublish.js +5 -0
  9. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  10. package/build/components/post-type-support-check/index.js.map +1 -1
  11. package/build/components/provider/use-block-editor-settings.js +1 -1
  12. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  13. package/build/components/theme-support-check/index.js.map +1 -1
  14. package/build/utils/terms.js +21 -10
  15. package/build/utils/terms.js.map +1 -1
  16. package/build-module/components/editor-help/index.native.js +13 -9
  17. package/build-module/components/editor-help/index.native.js.map +1 -1
  18. package/build-module/components/media-categories/index.js +1 -1
  19. package/build-module/components/media-categories/index.js.map +1 -1
  20. package/build-module/components/post-locked-modal/index.js +8 -6
  21. package/build-module/components/post-locked-modal/index.js.map +1 -1
  22. package/build-module/components/post-publish-panel/postpublish.js +5 -0
  23. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  24. package/build-module/components/post-type-support-check/index.js.map +1 -1
  25. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  26. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  27. package/build-module/components/theme-support-check/index.js.map +1 -1
  28. package/build-module/utils/terms.js +20 -8
  29. package/build-module/utils/terms.js.map +1 -1
  30. package/build-style/style-rtl.css +1 -4
  31. package/build-style/style.css +1 -4
  32. package/package.json +30 -30
  33. package/src/components/autosave-monitor/test/index.js +4 -4
  34. package/src/components/editor-help/index.native.js +21 -14
  35. package/src/components/media-categories/index.js +1 -1
  36. package/src/components/post-locked-modal/index.js +56 -60
  37. package/src/components/post-locked-modal/style.scss +1 -5
  38. package/src/components/post-publish-panel/postpublish.js +5 -0
  39. package/src/components/post-text-editor/test/index.js +0 -2
  40. package/src/components/post-type-support-check/index.js +1 -1
  41. package/src/components/provider/use-block-editor-settings.js +1 -0
  42. package/src/components/theme-support-check/index.js +1 -1
  43. package/src/store/test/actions.js +0 -2
  44. package/src/utils/terms.js +17 -7
@@ -1,11 +1,6 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { groupBy } from 'lodash';
5
1
  /**
6
2
  * WordPress dependencies
7
3
  */
8
-
9
4
  import { decodeEntities } from '@wordpress/html-entities';
10
5
  /**
11
6
  * Returns terms in a tree form.
@@ -22,13 +17,30 @@ export function buildTermsTree(flatTerms) {
22
17
  parent: null,
23
18
  ...term
24
19
  };
25
- });
26
- const termsByParent = groupBy(flatTermsWithParentAndChildren, 'parent');
20
+ }); // All terms should have a `parent` because we're about to index them by it.
27
21
 
28
- if (termsByParent.null && termsByParent.null.length) {
22
+ if (flatTermsWithParentAndChildren.some(_ref => {
23
+ let {
24
+ parent
25
+ } = _ref;
26
+ return parent === null;
27
+ })) {
29
28
  return flatTermsWithParentAndChildren;
30
29
  }
31
30
 
31
+ const termsByParent = flatTermsWithParentAndChildren.reduce((acc, term) => {
32
+ const {
33
+ parent
34
+ } = term;
35
+
36
+ if (!acc[parent]) {
37
+ acc[parent] = [];
38
+ }
39
+
40
+ acc[parent].push(term);
41
+ return acc;
42
+ }, {});
43
+
32
44
  const fillWithChildren = terms => {
33
45
  return terms.map(term => {
34
46
  const children = termsByParent[term.id];
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/utils/terms.js"],"names":["groupBy","decodeEntities","buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","term","children","parent","termsByParent","null","length","fillWithChildren","terms","id","unescapeString","arg","unescapeTerm","name","unescapeTerms"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAC3C,QAAMC,8BAA8B,GAAGD,SAAS,CAACE,GAAV,CAAiBC,IAAF,IAAY;AACjE,WAAO;AACNC,MAAAA,QAAQ,EAAE,EADJ;AAENC,MAAAA,MAAM,EAAE,IAFF;AAGN,SAAGF;AAHG,KAAP;AAKA,GANsC,CAAvC;AAQA,QAAMG,aAAa,GAAGT,OAAO,CAAEI,8BAAF,EAAkC,QAAlC,CAA7B;;AACA,MAAKK,aAAa,CAACC,IAAd,IAAsBD,aAAa,CAACC,IAAd,CAAmBC,MAA9C,EAAuD;AACtD,WAAOP,8BAAP;AACA;;AACD,QAAMQ,gBAAgB,GAAKC,KAAF,IAAa;AACrC,WAAOA,KAAK,CAACR,GAAN,CAAaC,IAAF,IAAY;AAC7B,YAAMC,QAAQ,GAAGE,aAAa,CAAEH,IAAI,CAACQ,EAAP,CAA9B;AACA,aAAO,EACN,GAAGR,IADG;AAENC,QAAAA,QAAQ,EACPA,QAAQ,IAAIA,QAAQ,CAACI,MAArB,GACGC,gBAAgB,CAAEL,QAAF,CADnB,GAEG;AALE,OAAP;AAOA,KATM,CAAP;AAUA,GAXD;;AAaA,SAAOK,gBAAgB,CAAEH,aAAa,CAAE,GAAF,CAAb,IAAwB,EAA1B,CAAvB;AACA;AAED,OAAO,MAAMM,cAAc,GAAKC,GAAF,IAAW;AACxC,SAAOf,cAAc,CAAEe,GAAF,CAArB;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAKX,IAAF,IAAY;AACvC,SAAO,EACN,GAAGA,IADG;AAENY,IAAAA,IAAI,EAAEH,cAAc,CAAET,IAAI,CAACY,IAAP;AAFd,GAAP;AAIA,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAKN,KAAF,IAAa;AACzC,SAAO,CAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW,EAAX,EAAgBR,GAAhB,CAAqBY,YAArB,CAAP;AACA,CAFM","sourcesContent":["/**\n * External dependencies\n */\nimport { groupBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Returns terms in a tree form.\n *\n * @param {Array} flatTerms Array of terms in flat format.\n *\n * @return {Array} Array of terms in tree format.\n */\nexport function buildTermsTree( flatTerms ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\tparent: null,\n\t\t\t...term,\n\t\t};\n\t} );\n\n\tconst termsByParent = groupBy( flatTermsWithParentAndChildren, 'parent' );\n\tif ( termsByParent.null && termsByParent.null.length ) {\n\t\treturn flatTermsWithParentAndChildren;\n\t}\n\tconst fillWithChildren = ( terms ) => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const unescapeString = ( arg ) => {\n\treturn decodeEntities( arg );\n};\n\n/**\n * Returns a term object with name unescaped.\n *\n * @param {Object} term The term object to unescape.\n *\n * @return {Object} Term object with name property unescaped.\n */\nexport const unescapeTerm = ( term ) => {\n\treturn {\n\t\t...term,\n\t\tname: unescapeString( term.name ),\n\t};\n};\n\n/**\n * Returns an array of term objects with names unescaped.\n * The unescape of each term is performed using the unescapeTerm function.\n *\n * @param {Object[]} terms Array of term objects to unescape.\n *\n * @return {Object[]} Array of term objects unescaped.\n */\nexport const unescapeTerms = ( terms ) => {\n\treturn ( terms ?? [] ).map( unescapeTerm );\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/utils/terms.js"],"names":["decodeEntities","buildTermsTree","flatTerms","flatTermsWithParentAndChildren","map","term","children","parent","some","termsByParent","reduce","acc","push","fillWithChildren","terms","id","length","unescapeString","arg","unescapeTerm","name","unescapeTerms"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,SAAzB,EAAqC;AAC3C,QAAMC,8BAA8B,GAAGD,SAAS,CAACE,GAAV,CAAiBC,IAAF,IAAY;AACjE,WAAO;AACNC,MAAAA,QAAQ,EAAE,EADJ;AAENC,MAAAA,MAAM,EAAE,IAFF;AAGN,SAAGF;AAHG,KAAP;AAKA,GANsC,CAAvC,CAD2C,CAS3C;;AACA,MACCF,8BAA8B,CAACK,IAA/B,CAAqC;AAAA,QAAE;AAAED,MAAAA;AAAF,KAAF;AAAA,WAAkBA,MAAM,KAAK,IAA7B;AAAA,GAArC,CADD,EAEE;AACD,WAAOJ,8BAAP;AACA;;AAED,QAAMM,aAAa,GAAGN,8BAA8B,CAACO,MAA/B,CACrB,CAAEC,GAAF,EAAON,IAAP,KAAiB;AAChB,UAAM;AAAEE,MAAAA;AAAF,QAAaF,IAAnB;;AACA,QAAK,CAAEM,GAAG,CAAEJ,MAAF,CAAV,EAAuB;AACtBI,MAAAA,GAAG,CAAEJ,MAAF,CAAH,GAAgB,EAAhB;AACA;;AACDI,IAAAA,GAAG,CAAEJ,MAAF,CAAH,CAAcK,IAAd,CAAoBP,IAApB;AACA,WAAOM,GAAP;AACA,GARoB,EASrB,EATqB,CAAtB;;AAYA,QAAME,gBAAgB,GAAKC,KAAF,IAAa;AACrC,WAAOA,KAAK,CAACV,GAAN,CAAaC,IAAF,IAAY;AAC7B,YAAMC,QAAQ,GAAGG,aAAa,CAAEJ,IAAI,CAACU,EAAP,CAA9B;AACA,aAAO,EACN,GAAGV,IADG;AAENC,QAAAA,QAAQ,EACPA,QAAQ,IAAIA,QAAQ,CAACU,MAArB,GACGH,gBAAgB,CAAEP,QAAF,CADnB,GAEG;AALE,OAAP;AAOA,KATM,CAAP;AAUA,GAXD;;AAaA,SAAOO,gBAAgB,CAAEJ,aAAa,CAAE,GAAF,CAAb,IAAwB,EAA1B,CAAvB;AACA;AAED,OAAO,MAAMQ,cAAc,GAAKC,GAAF,IAAW;AACxC,SAAOlB,cAAc,CAAEkB,GAAF,CAArB;AACA,CAFM;AAIP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,YAAY,GAAKd,IAAF,IAAY;AACvC,SAAO,EACN,GAAGA,IADG;AAENe,IAAAA,IAAI,EAAEH,cAAc,CAAEZ,IAAI,CAACe,IAAP;AAFd,GAAP;AAIA,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,aAAa,GAAKP,KAAF,IAAa;AACzC,SAAO,CAAEA,KAAF,aAAEA,KAAF,cAAEA,KAAF,GAAW,EAAX,EAAgBV,GAAhB,CAAqBe,YAArB,CAAP;AACA,CAFM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Returns terms in a tree form.\n *\n * @param {Array} flatTerms Array of terms in flat format.\n *\n * @return {Array} Array of terms in tree format.\n */\nexport function buildTermsTree( flatTerms ) {\n\tconst flatTermsWithParentAndChildren = flatTerms.map( ( term ) => {\n\t\treturn {\n\t\t\tchildren: [],\n\t\t\tparent: null,\n\t\t\t...term,\n\t\t};\n\t} );\n\n\t// All terms should have a `parent` because we're about to index them by it.\n\tif (\n\t\tflatTermsWithParentAndChildren.some( ( { parent } ) => parent === null )\n\t) {\n\t\treturn flatTermsWithParentAndChildren;\n\t}\n\n\tconst termsByParent = flatTermsWithParentAndChildren.reduce(\n\t\t( acc, term ) => {\n\t\t\tconst { parent } = term;\n\t\t\tif ( ! acc[ parent ] ) {\n\t\t\t\tacc[ parent ] = [];\n\t\t\t}\n\t\t\tacc[ parent ].push( term );\n\t\t\treturn acc;\n\t\t},\n\t\t{}\n\t);\n\n\tconst fillWithChildren = ( terms ) => {\n\t\treturn terms.map( ( term ) => {\n\t\t\tconst children = termsByParent[ term.id ];\n\t\t\treturn {\n\t\t\t\t...term,\n\t\t\t\tchildren:\n\t\t\t\t\tchildren && children.length\n\t\t\t\t\t\t? fillWithChildren( children )\n\t\t\t\t\t\t: [],\n\t\t\t};\n\t\t} );\n\t};\n\n\treturn fillWithChildren( termsByParent[ '0' ] || [] );\n}\n\nexport const unescapeString = ( arg ) => {\n\treturn decodeEntities( arg );\n};\n\n/**\n * Returns a term object with name unescaped.\n *\n * @param {Object} term The term object to unescape.\n *\n * @return {Object} Term object with name property unescaped.\n */\nexport const unescapeTerm = ( term ) => {\n\treturn {\n\t\t...term,\n\t\tname: unescapeString( term.name ),\n\t};\n};\n\n/**\n * Returns an array of term objects with names unescaped.\n * The unescape of each term is performed using the unescapeTerm function.\n *\n * @param {Object[]} terms Array of term objects to unescape.\n *\n * @return {Object[]} Array of term objects unescaped.\n */\nexport const unescapeTerms = ( terms ) => {\n\treturn ( terms ?? [] ).map( unescapeTerm );\n};\n"]}
@@ -367,9 +367,6 @@
367
367
  max-width: 480px;
368
368
  }
369
369
  }
370
- .editor-post-locked-modal .components-modal__content {
371
- display: flex;
372
- }
373
370
 
374
371
  .editor-post-locked-modal__buttons {
375
372
  margin-top: 24px;
@@ -378,7 +375,7 @@
378
375
  .editor-post-locked-modal__avatar {
379
376
  border-radius: 2px;
380
377
  margin-top: 16px;
381
- margin-left: 24px;
378
+ min-width: initial !important;
382
379
  }
383
380
 
384
381
  .editor-post-publish-button__button.has-changes-dot::before {
@@ -367,9 +367,6 @@
367
367
  max-width: 480px;
368
368
  }
369
369
  }
370
- .editor-post-locked-modal .components-modal__content {
371
- display: flex;
372
- }
373
370
 
374
371
  .editor-post-locked-modal__buttons {
375
372
  margin-top: 24px;
@@ -378,7 +375,7 @@
378
375
  .editor-post-locked-modal__avatar {
379
376
  border-radius: 2px;
380
377
  margin-top: 16px;
381
- margin-right: 24px;
378
+ min-width: initial !important;
382
379
  }
383
380
 
384
381
  .editor-post-publish-button__button.has-changes-dot::before {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.5.0",
3
+ "version": "13.7.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.28.0",
35
- "@wordpress/api-fetch": "^6.25.0",
36
- "@wordpress/blob": "^3.28.0",
37
- "@wordpress/block-editor": "^11.5.0",
38
- "@wordpress/blocks": "^12.5.0",
39
- "@wordpress/components": "^23.5.0",
40
- "@wordpress/compose": "^6.5.0",
41
- "@wordpress/core-data": "^6.5.0",
42
- "@wordpress/data": "^8.5.0",
43
- "@wordpress/date": "^4.28.0",
44
- "@wordpress/deprecated": "^3.28.0",
45
- "@wordpress/dom": "^3.28.0",
46
- "@wordpress/element": "^5.5.0",
47
- "@wordpress/hooks": "^3.28.0",
48
- "@wordpress/html-entities": "^3.28.0",
49
- "@wordpress/i18n": "^4.28.0",
50
- "@wordpress/icons": "^9.19.0",
51
- "@wordpress/keyboard-shortcuts": "^4.5.0",
52
- "@wordpress/keycodes": "^3.28.0",
53
- "@wordpress/media-utils": "^4.19.0",
54
- "@wordpress/notices": "^3.28.0",
55
- "@wordpress/preferences": "^3.5.0",
56
- "@wordpress/private-apis": "^0.10.0",
57
- "@wordpress/reusable-blocks": "^4.5.0",
58
- "@wordpress/rich-text": "^6.5.0",
59
- "@wordpress/server-side-render": "^4.5.0",
60
- "@wordpress/url": "^3.29.0",
61
- "@wordpress/wordcount": "^3.28.0",
34
+ "@wordpress/a11y": "^3.30.0",
35
+ "@wordpress/api-fetch": "^6.27.0",
36
+ "@wordpress/blob": "^3.30.0",
37
+ "@wordpress/block-editor": "^11.7.0",
38
+ "@wordpress/blocks": "^12.7.0",
39
+ "@wordpress/components": "^23.7.0",
40
+ "@wordpress/compose": "^6.7.0",
41
+ "@wordpress/core-data": "^6.7.0",
42
+ "@wordpress/data": "^9.0.0",
43
+ "@wordpress/date": "^4.30.0",
44
+ "@wordpress/deprecated": "^3.30.0",
45
+ "@wordpress/dom": "^3.30.0",
46
+ "@wordpress/element": "^5.7.0",
47
+ "@wordpress/hooks": "^3.30.0",
48
+ "@wordpress/html-entities": "^3.30.0",
49
+ "@wordpress/i18n": "^4.30.0",
50
+ "@wordpress/icons": "^9.21.0",
51
+ "@wordpress/keyboard-shortcuts": "^4.7.0",
52
+ "@wordpress/keycodes": "^3.30.0",
53
+ "@wordpress/media-utils": "^4.21.0",
54
+ "@wordpress/notices": "^3.30.0",
55
+ "@wordpress/preferences": "^3.7.0",
56
+ "@wordpress/private-apis": "^0.12.0",
57
+ "@wordpress/reusable-blocks": "^4.7.0",
58
+ "@wordpress/rich-text": "^6.7.0",
59
+ "@wordpress/server-side-render": "^4.7.0",
60
+ "@wordpress/url": "^3.31.0",
61
+ "@wordpress/wordcount": "^3.30.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": "d5e03a74b79e3ca84afda24375474a103a063ee4"
78
+ "gitHead": "d5c28a67b11e91e3e4b8e90346bfcb90909364d6"
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
 
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { kebabCase } from 'lodash';
5
4
  import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
6
5
  import { TransitionPresets } from '@react-navigation/stack';
7
6
 
@@ -40,18 +39,31 @@ import HelpSectionTitle from './help-section-title';
40
39
  const HELP_TOPICS = [
41
40
  {
42
41
  label: __( 'What is a block?' ),
42
+ slug: 'what-is-a-block',
43
43
  icon: helpFilled,
44
44
  view: <IntroToBlocks />,
45
45
  },
46
46
  {
47
47
  label: __( 'Add blocks' ),
48
+ slug: 'add-blocks',
48
49
  icon: plusCircleFilled,
49
50
  view: <AddBlocks />,
50
51
  },
51
- { label: __( 'Move blocks' ), icon: moveBlocksIcon, view: <MoveBlocks /> },
52
- { label: __( 'Remove blocks' ), icon: trash, view: <RemoveBlocks /> },
52
+ {
53
+ label: __( 'Move blocks' ),
54
+ slug: 'move-blocks',
55
+ icon: moveBlocksIcon,
56
+ view: <MoveBlocks />,
57
+ },
58
+ {
59
+ label: __( 'Remove blocks' ),
60
+ slug: 'remove-blocks',
61
+ icon: trash,
62
+ view: <RemoveBlocks />,
63
+ },
53
64
  {
54
65
  label: __( 'Customize blocks' ),
66
+ slug: 'customize-blocks',
55
67
  icon: cog,
56
68
  view: <CustomizeBlocks />,
57
69
  },
@@ -141,24 +153,20 @@ function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
141
153
  { /* Print out help topics. */ }
142
154
  { HELP_TOPICS.map(
143
155
  (
144
- { label, icon },
156
+ { label, icon, slug },
145
157
  index
146
158
  ) => {
147
- const labelSlug =
148
- kebabCase( label );
149
159
  const isLastItem =
150
160
  index ===
151
161
  HELP_TOPICS.length -
152
162
  1;
153
163
  return (
154
164
  <HelpTopicRow
155
- key={
156
- labelSlug
157
- }
165
+ key={ slug }
158
166
  label={ label }
159
167
  icon={ icon }
160
168
  screenName={
161
- labelSlug
169
+ slug
162
170
  }
163
171
  isLastItem={
164
172
  isLastItem
@@ -177,12 +185,11 @@ function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
177
185
  </View>
178
186
  </BottomSheet.NavigationScreen>
179
187
  { /* Print out help detail screens. */ }
180
- { HELP_TOPICS.map( ( { view, label } ) => {
181
- const labelSlug = kebabCase( label );
188
+ { HELP_TOPICS.map( ( { view, label, slug } ) => {
182
189
  return (
183
190
  <HelpDetailNavigationScreen
184
- key={ labelSlug }
185
- name={ labelSlug }
191
+ key={ slug }
192
+ name={ slug }
186
193
  content={ view }
187
194
  label={ label }
188
195
  options={ {
@@ -131,7 +131,7 @@ const getOpenverseCaption = ( item ) => {
131
131
  )
132
132
  : sprintf(
133
133
  // translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0".
134
- _x( '<a %1$s>Work</a>/ %3$s', 'caption' ),
134
+ _x( '<a %1$s>Work</a>/ %2$s', 'caption' ),
135
135
  getExternalLinkAttributes( foreignLandingUrl ),
136
136
  licenseUrl
137
137
  ? getExternalLink(
@@ -6,8 +6,7 @@ import {
6
6
  Modal,
7
7
  Button,
8
8
  ExternalLink,
9
- Flex,
10
- FlexItem,
9
+ __experimentalHStack as HStack,
11
10
  } from '@wordpress/components';
12
11
  import { useSelect, useDispatch } from '@wordpress/data';
13
12
  import { addQueryArgs } from '@wordpress/url';
@@ -175,55 +174,30 @@ export default function PostLockedModal() {
175
174
  isDismissible={ false }
176
175
  className="editor-post-locked-modal"
177
176
  >
178
- { !! userAvatar && (
179
- <img
180
- src={ userAvatar }
181
- alt={ __( 'Avatar' ) }
182
- className="editor-post-locked-modal__avatar"
183
- width={ 64 }
184
- height={ 64 }
185
- />
186
- ) }
187
- <div>
188
- { !! isTakeover && (
189
- <p>
190
- { createInterpolateElement(
191
- userDisplayName
192
- ? sprintf(
193
- /* translators: %s: user's display name */
194
- __(
195
- '<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
196
- ),
197
- userDisplayName
198
- )
199
- : __(
200
- 'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
201
- ),
202
- {
203
- strong: <strong />,
204
- PreviewLink: (
205
- <ExternalLink href={ previewLink }>
206
- { __( 'preview' ) }
207
- </ExternalLink>
208
- ),
209
- }
210
- ) }
211
- </p>
177
+ <HStack alignment="top" spacing={ 6 }>
178
+ { !! userAvatar && (
179
+ <img
180
+ src={ userAvatar }
181
+ alt={ __( 'Avatar' ) }
182
+ className="editor-post-locked-modal__avatar"
183
+ width={ 64 }
184
+ height={ 64 }
185
+ />
212
186
  ) }
213
- { ! isTakeover && (
214
- <>
187
+ <div>
188
+ { !! isTakeover && (
215
189
  <p>
216
190
  { createInterpolateElement(
217
191
  userDisplayName
218
192
  ? sprintf(
219
193
  /* translators: %s: user's display name */
220
194
  __(
221
- '<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'
195
+ '<strong>%s</strong> now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
222
196
  ),
223
197
  userDisplayName
224
198
  )
225
199
  : __(
226
- 'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'
200
+ 'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
227
201
  ),
228
202
  {
229
203
  strong: <strong />,
@@ -235,33 +209,55 @@ export default function PostLockedModal() {
235
209
  }
236
210
  ) }
237
211
  </p>
238
- <p>
239
- { __(
240
- 'If you take over, the other user will lose editing control to the post, but their changes will be saved.'
241
- ) }
242
- </p>
243
- </>
244
- ) }
245
-
246
- <Flex
247
- className="editor-post-locked-modal__buttons"
248
- justify="flex-end"
249
- expanded={ false }
250
- >
212
+ ) }
251
213
  { ! isTakeover && (
252
- <FlexItem>
214
+ <>
215
+ <p>
216
+ { createInterpolateElement(
217
+ userDisplayName
218
+ ? sprintf(
219
+ /* translators: %s: user's display name */
220
+ __(
221
+ '<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'
222
+ ),
223
+ userDisplayName
224
+ )
225
+ : __(
226
+ 'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'
227
+ ),
228
+ {
229
+ strong: <strong />,
230
+ PreviewLink: (
231
+ <ExternalLink href={ previewLink }>
232
+ { __( 'preview' ) }
233
+ </ExternalLink>
234
+ ),
235
+ }
236
+ ) }
237
+ </p>
238
+ <p>
239
+ { __(
240
+ 'If you take over, the other user will lose editing control to the post, but their changes will be saved.'
241
+ ) }
242
+ </p>
243
+ </>
244
+ ) }
245
+
246
+ <HStack
247
+ className="editor-post-locked-modal__buttons"
248
+ justify="flex-end"
249
+ >
250
+ { ! isTakeover && (
253
251
  <Button variant="tertiary" href={ unlockUrl }>
254
252
  { __( 'Take over' ) }
255
253
  </Button>
256
- </FlexItem>
257
- ) }
258
- <FlexItem>
254
+ ) }
259
255
  <Button variant="primary" href={ allPostsUrl }>
260
256
  { allPostsLabel }
261
257
  </Button>
262
- </FlexItem>
263
- </Flex>
264
- </div>
258
+ </HStack>
259
+ </div>
260
+ </HStack>
265
261
  </Modal>
266
262
  );
267
263
  }
@@ -2,10 +2,6 @@
2
2
  @include break-small() {
3
3
  max-width: $break-mobile;
4
4
  }
5
-
6
- .components-modal__content {
7
- display: flex;
8
- }
9
5
  }
10
6
 
11
7
  .editor-post-locked-modal__buttons {
@@ -15,5 +11,5 @@
15
11
  .editor-post-locked-modal__avatar {
16
12
  border-radius: $radius-block-ui;
17
13
  margin-top: $grid-unit-20;
18
- margin-right: $grid-unit-30;
14
+ min-width: initial !important;
19
15
  }
@@ -17,6 +17,7 @@ import PostScheduleLabel from '../post-schedule/label';
17
17
  import { store as editorStore } from '../../store';
18
18
 
19
19
  const POSTNAME = '%postname%';
20
+ const PAGENAME = '%pagename%';
20
21
 
21
22
  /**
22
23
  * Returns URL for a future post.
@@ -33,6 +34,10 @@ const getFuturePostUrl = ( post ) => {
33
34
  return post.permalink_template.replace( POSTNAME, slug );
34
35
  }
35
36
 
37
+ if ( post.permalink_template.includes( PAGENAME ) ) {
38
+ return post.permalink_template.replace( PAGENAME, slug );
39
+ }
40
+
36
41
  return post.permalink_template;
37
42
  };
38
43
 
@@ -38,8 +38,6 @@ jest.mock( '@wordpress/data/src/components/use-dispatch', () => {
38
38
  };
39
39
  } );
40
40
 
41
- jest.useRealTimers();
42
-
43
41
  describe( 'PostTextEditor', () => {
44
42
  beforeEach( () => {
45
43
  useSelect.mockImplementation( () => 'Hello World' );
@@ -27,7 +27,7 @@ export function PostTypeSupportCheck( { postType, children, supportKeys } ) {
27
27
  if ( postType ) {
28
28
  isSupported = (
29
29
  Array.isArray( supportKeys ) ? supportKeys : [ supportKeys ]
30
- ).some( ( key ) => !! postType.supports[ key ] );
30
+ ).some( ( key ) => !! postType.supports[ key ] );
31
31
  }
32
32
 
33
33
  if ( ! isSupported ) {
@@ -62,6 +62,7 @@ const BLOCK_EDITOR_SETTINGS = [
62
62
  'locale',
63
63
  'maxWidth',
64
64
  'onUpdateDefaultBlockStyles',
65
+ 'postContentAttributes',
65
66
  'postsPerPage',
66
67
  'readOnly',
67
68
  'styles',
@@ -17,7 +17,7 @@ export function ThemeSupportCheck( {
17
17
  } ) {
18
18
  const isSupported = (
19
19
  Array.isArray( supportKeys ) ? supportKeys : [ supportKeys ]
20
- ).some( ( key ) => {
20
+ ).some( ( key ) => {
21
21
  const supported = themeSupports?.[ key ] ?? false;
22
22
  // 'post-thumbnails' can be boolean or an array of post types.
23
23
  // In the latter case, we need to verify `postType` exists
@@ -15,8 +15,6 @@ import { store as preferencesStore } from '@wordpress/preferences';
15
15
  import * as actions from '../actions';
16
16
  import { store as editorStore } from '..';
17
17
 
18
- jest.useRealTimers();
19
-
20
18
  const postId = 44;
21
19
 
22
20
  const postTypeConfig = {
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { groupBy } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -24,10 +19,25 @@ export function buildTermsTree( flatTerms ) {
24
19
  };
25
20
  } );
26
21
 
27
- const termsByParent = groupBy( flatTermsWithParentAndChildren, 'parent' );
28
- if ( termsByParent.null && termsByParent.null.length ) {
22
+ // All terms should have a `parent` because we're about to index them by it.
23
+ if (
24
+ flatTermsWithParentAndChildren.some( ( { parent } ) => parent === null )
25
+ ) {
29
26
  return flatTermsWithParentAndChildren;
30
27
  }
28
+
29
+ const termsByParent = flatTermsWithParentAndChildren.reduce(
30
+ ( acc, term ) => {
31
+ const { parent } = term;
32
+ if ( ! acc[ parent ] ) {
33
+ acc[ parent ] = [];
34
+ }
35
+ acc[ parent ].push( term );
36
+ return acc;
37
+ },
38
+ {}
39
+ );
40
+
31
41
  const fillWithChildren = ( terms ) => {
32
42
  return terms.map( ( term ) => {
33
43
  const children = termsByParent[ term.id ];