@plone/aurora 1.0.0-alpha.23 → 1.0.0-alpha.24

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.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,24 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 1.0.0-alpha.24 (2026-11-18)
12
+
13
+ ### Breaking
14
+
15
+ - The page body is now stored in the `main` region of `blocks`, with `"@type": "plate"`, instead of the `__somersault__` block. Content with the old block is renamed when it is read, through the new `contentMigration` utility type, and keeps the new shape once it is saved. The backend must run Plone 6.2 with `plone.restapi` 10.3.0 or later before deploying this version, so that `plate` regions are indexed, checked for link integrity, and get `resolveuid` links. It also needs `plone.volto` 6.2.1 or later with the `plone.volto:aurora` profile applied, so that the Personal tools menu gets the links of Plone Aurora instead of those of the Volto toolbar. With a Nick backend, upgrade to Nick 3.1.0 or later first, which reads the `main` region. See the upgrade guide. @sneridagh [#379](https://github.com/plone/aurora/issues/379)
16
+
17
+ ### Internal
18
+
19
+ - Allowed up to 10 different pixels in the visual regression screenshots in CI, so anti-aliasing noise no longer fails the nightly run. @sneridagh
20
+
21
+ ### Documentation
22
+
23
+ - Say Plate.js blocks instead of Plate-native blocks in the docs. @silviubogan [#231](https://github.com/plone/aurora/issues/231)
24
+ - Updated the control panel and toolbar how-to guides for the `/@@controlpanel` path. @sneridagh [#429](https://github.com/plone/aurora/issues/429)
25
+ - Document the Nick 3.1.0 requirement, and remove the Volto versions, Python support and branch policy from the version policy and the system requirements. @sneridagh
26
+ - Documented the `personal_tools` and `more_menu` actions for the Personal tools and More toolbar menus. @sneridagh
27
+ - Documented the document model of the `@blocks-schema` endpoint, the `document_model` frontmatter of element docs and of the document model docs, and the `type` query parameter. @sneridagh
28
+
11
29
  ## 1.0.0-alpha.23 (2026-11-06)
12
30
 
13
31
  ### Internal
@@ -29,8 +29,8 @@ async function setupImageBlockPage(page: Page) {
29
29
  bodyModifier: (body) => ({
30
30
  ...body,
31
31
  blocks: {
32
- __somersault__: {
33
- '@type': '__somersault__',
32
+ main: {
33
+ '@type': 'plate',
34
34
  value: [
35
35
  { type: 'title', children: [{ text: 'Hydration page' }] },
36
36
  { type: 'p', children: [{ text: 'Text before image' }] },
@@ -1,7 +1,11 @@
1
1
  import { afterEach, describe, expect, it } from 'vitest';
2
2
  import { PLONE_BLOCK_TYPE } from '@plone/helpers';
3
3
  import config from '@plone/registry';
4
- import { SOMERSAULT_KEY } from '@plone/plate/constants';
4
+ import {
5
+ MAIN_REGION,
6
+ PLATE_TYPE,
7
+ SOMERSAULT_KEY,
8
+ } from '@plone/plate/constants';
5
9
  import type { Content, ContentBase } from '@plone/types';
6
10
  import installMigrations from './migrations.server';
7
11
  import { migrateContent } from './content-migrations.server';
@@ -22,9 +26,10 @@ describe('content migrations', () => {
22
26
  const utilities = config.utilities as Partial<Record<string, unknown>>;
23
27
  delete utilities.somersaultBlockMigration;
24
28
  delete utilities.somersaultMigration;
29
+ delete utilities.contentMigration;
25
30
  });
26
31
 
27
- it('migrates title and legacy value blocks into the somersault block', () => {
32
+ it('migrates title and legacy value blocks into the main region', () => {
28
33
  config.blocks = {
29
34
  blocksConfig: {},
30
35
  } as typeof config.blocks;
@@ -49,8 +54,8 @@ describe('content migrations', () => {
49
54
 
50
55
  const migrated = migrateContent(content as unknown as Content);
51
56
 
52
- expect(migrated.blocks?.[SOMERSAULT_KEY]).toEqual({
53
- '@type': SOMERSAULT_KEY,
57
+ expect(migrated.blocks?.[MAIN_REGION]).toEqual({
58
+ '@type': PLATE_TYPE,
54
59
  value: [
55
60
  {
56
61
  blockWidth: 'default',
@@ -100,7 +105,7 @@ describe('content migrations', () => {
100
105
 
101
106
  const migrated = migrateContent(content as unknown as Content);
102
107
  const [blockquote] = (
103
- migrated.blocks?.[SOMERSAULT_KEY] as unknown as { value: any[] }
108
+ migrated.blocks?.[MAIN_REGION] as unknown as { value: any[] }
104
109
  ).value;
105
110
 
106
111
  expect(blockquote).toMatchObject({
@@ -122,7 +127,7 @@ describe('content migrations', () => {
122
127
  expect(blockquote.children).toHaveLength(1);
123
128
  });
124
129
 
125
- it('moves native blocks into the somersault field as ploneBlock nodes', () => {
130
+ it('moves native blocks into the main region as ploneBlock nodes', () => {
126
131
  config.blocks = {
127
132
  blocksConfig: {
128
133
  listing: {},
@@ -197,8 +202,8 @@ describe('content migrations', () => {
197
202
 
198
203
  const migrated = migrateContent(content as unknown as Content);
199
204
 
200
- expect(migrated.blocks?.[SOMERSAULT_KEY]).toEqual({
201
- '@type': SOMERSAULT_KEY,
205
+ expect(migrated.blocks?.[MAIN_REGION]).toEqual({
206
+ '@type': PLATE_TYPE,
202
207
  value: [
203
208
  {
204
209
  blockWidth: 'default',
@@ -237,4 +242,89 @@ describe('content migrations', () => {
237
242
  ],
238
243
  });
239
244
  });
245
+
246
+ describe('legacy __somersault__ block', () => {
247
+ const legacyValue = [
248
+ { type: 'title', children: [{ text: 'Stored title' }] },
249
+ { type: 'p', children: [{ text: 'Stored text' }] },
250
+ ];
251
+
252
+ it('renames it to the main region with the plate type', () => {
253
+ config.blocks = { blocksConfig: {} } as typeof config.blocks;
254
+ installMigrations();
255
+
256
+ const content: TestContent = {
257
+ '@id': 'http://example.com/',
258
+ title: 'Page title',
259
+ blocks: {
260
+ [SOMERSAULT_KEY]: {
261
+ '@type': SOMERSAULT_KEY,
262
+ value: legacyValue,
263
+ discussions: { d1: {} },
264
+ },
265
+ a: {
266
+ '@type': 'slate',
267
+ value: [{ type: 'p', children: [{ text: 'Legacy block' }] }],
268
+ },
269
+ },
270
+ blocks_layout: { items: [SOMERSAULT_KEY, 'a'] },
271
+ };
272
+
273
+ const migrated = migrateContent(content as unknown as Content);
274
+
275
+ expect(migrated).toBe(content);
276
+ expect(migrated.blocks_layout?.items).toEqual(['a']);
277
+ expect(migrated.blocks?.[SOMERSAULT_KEY]).toBeUndefined();
278
+ // The value is kept as stored, not rebuilt from the legacy blocks, and
279
+ // any other data of the block travels with it.
280
+ expect(migrated.blocks?.[MAIN_REGION]).toEqual({
281
+ '@type': PLATE_TYPE,
282
+ value: legacyValue,
283
+ discussions: { d1: {} },
284
+ });
285
+ });
286
+
287
+ it('keeps the main region and drops the legacy block when both exist', () => {
288
+ config.blocks = { blocksConfig: {} } as typeof config.blocks;
289
+ installMigrations();
290
+ const mainValue = [{ type: 'p', children: [{ text: 'New' }] }];
291
+
292
+ const content: TestContent = {
293
+ '@id': 'http://example.com/',
294
+ title: 'Page title',
295
+ blocks: {
296
+ [MAIN_REGION]: { '@type': PLATE_TYPE, value: mainValue },
297
+ [SOMERSAULT_KEY]: { '@type': SOMERSAULT_KEY, value: legacyValue },
298
+ },
299
+ blocks_layout: { items: [] },
300
+ };
301
+
302
+ const migrated = migrateContent(content as unknown as Content);
303
+
304
+ expect(migrated.blocks).toEqual({
305
+ [MAIN_REGION]: { '@type': PLATE_TYPE, value: mainValue },
306
+ });
307
+ });
308
+
309
+ it('is idempotent', () => {
310
+ config.blocks = { blocksConfig: {} } as typeof config.blocks;
311
+ installMigrations();
312
+
313
+ const content: TestContent = {
314
+ '@id': 'http://example.com/',
315
+ title: 'Page title',
316
+ blocks: {
317
+ [SOMERSAULT_KEY]: { '@type': SOMERSAULT_KEY, value: legacyValue },
318
+ },
319
+ blocks_layout: { items: [] },
320
+ };
321
+
322
+ const once = structuredClone(
323
+ migrateContent(content as unknown as Content),
324
+ );
325
+ const twice = migrateContent(content as unknown as Content);
326
+
327
+ expect(twice).toEqual(once);
328
+ });
329
+ });
240
330
  });
@@ -2,7 +2,7 @@ import config from '@plone/registry';
2
2
  import type { Value } from '@plone/plate/components/editor';
3
3
  import type { Content } from '@plone/types';
4
4
  import '../types';
5
- import { SOMERSAULT_KEY } from '@plone/plate/constants';
5
+ import { MAIN_REGION, PLATE_TYPE } from '@plone/plate/constants';
6
6
 
7
7
  type SomersaultValue = Value;
8
8
 
@@ -30,8 +30,27 @@ const createSomersaultValue = (content: Content): SomersaultValue => {
30
30
  });
31
31
  };
32
32
 
33
+ /**
34
+ * Brings content to the shape the editor and the renderer expect, in place.
35
+ *
36
+ * 1. The `contentMigration` utilities run first, in registration order, over
37
+ * the whole content. They upgrade content stored in an older shape, for
38
+ * example the `__somersault__` block, which becomes the `main` region.
39
+ * 2. If the content has no `main` region yet, it is built from the legacy
40
+ * blocks by the `somersaultBlockMigration` utilities, then normalized by
41
+ * the `somersaultMigration` utilities.
42
+ *
43
+ * Returns the same, mutated, content object.
44
+ */
33
45
  export const migrateContent = (content: Content) => {
34
- if (content.blocks?.[SOMERSAULT_KEY]) return content;
46
+ const contentMigrations = config.getUtilities({
47
+ type: 'contentMigration',
48
+ });
49
+ for (const utility of contentMigrations) {
50
+ utility.method({ content });
51
+ }
52
+
53
+ if (content.blocks?.[MAIN_REGION]) return content;
35
54
  if (!content.blocks || !Array.isArray(content.blocks_layout?.items)) {
36
55
  return content;
37
56
  }
@@ -50,8 +69,8 @@ export const migrateContent = (content: Content) => {
50
69
  initialValue,
51
70
  );
52
71
 
53
- content.blocks[SOMERSAULT_KEY] = {
54
- '@type': SOMERSAULT_KEY,
72
+ content.blocks[MAIN_REGION] = {
73
+ '@type': PLATE_TYPE,
55
74
  value: migratedValue,
56
75
  } as (typeof content.blocks)[string];
57
76
 
@@ -13,7 +13,13 @@ import {
13
13
  migrateLegacyListsInValue,
14
14
  migrateLegacyStrikethroughInValue,
15
15
  } from '@plone/plate/migrations';
16
+ import {
17
+ MAIN_REGION,
18
+ PLATE_TYPE,
19
+ SOMERSAULT_KEY,
20
+ } from '@plone/plate/constants';
16
21
  import type {
22
+ ContentMigrationArgs,
17
23
  SomersaultBlockMigrationArgs,
18
24
  SomersaultMigrationArgs,
19
25
  } from '../types';
@@ -52,7 +58,38 @@ const getMigratedPloneBlockWidth = (block: Record<string, unknown>) => {
52
58
  );
53
59
  };
54
60
 
61
+ /**
62
+ * Renames the `__somersault__` block, stored before the page body became a
63
+ * region, to the `main` region with the `plate` type. The editor saves the
64
+ * whole `blocks` field, so a page keeps the new shape once it is edited.
65
+ * If the content has both, `main` wins and the legacy block is dropped.
66
+ *
67
+ * Remove at Plone 7 final, see https://github.com/plone/aurora/issues/379.
68
+ */
69
+ export const migrateSomersaultRegion = ({ content }: ContentMigrationArgs) => {
70
+ const blocks = content.blocks as Record<string, unknown> | undefined;
71
+ if (!blocks || !Object.hasOwn(blocks, SOMERSAULT_KEY)) return;
72
+
73
+ const legacy = blocks[SOMERSAULT_KEY] as Record<string, unknown> | undefined;
74
+ delete blocks[SOMERSAULT_KEY];
75
+ // Regions stay out of `blocks_layout`, but some content lists the legacy
76
+ // block there.
77
+ const items = content.blocks_layout?.items;
78
+ if (Array.isArray(items) && items.includes(SOMERSAULT_KEY)) {
79
+ content.blocks_layout.items = items.filter((id) => id !== SOMERSAULT_KEY);
80
+ }
81
+ if (blocks[MAIN_REGION] || !legacy) return;
82
+
83
+ blocks[MAIN_REGION] = { ...legacy, '@type': PLATE_TYPE };
84
+ };
85
+
55
86
  export default function install() {
87
+ config.registerUtility({
88
+ name: 'contentMigrationSomersaultRegion',
89
+ type: 'contentMigration',
90
+ method: migrateSomersaultRegion,
91
+ });
92
+
56
93
  config.registerUtility({
57
94
  name: 'somersaultBlockMigrationTitle',
58
95
  type: 'somersaultBlockMigration',
@@ -29,6 +29,9 @@ declare module '@plone/types' {
29
29
  // is the `@`-prefixed segment, for example `@blocks-schema`. Resources
30
30
  // without a content path are regular resource routes.
31
31
  contentResource: (args: ContentResourceArgs) => Promise<Response>;
32
+ // A `contentMigration` utility upgrades content stored in an older shape,
33
+ // in place, before the editor value is built. See `migrateContent`.
34
+ contentMigration: (args: ContentMigrationArgs) => void;
32
35
  somersaultBlockMigration: (
33
36
  args: SomersaultBlockMigrationArgs,
34
37
  ) => SomersaultMigrationArgs['value'];
@@ -55,6 +58,10 @@ export interface ContentResourceArgs {
55
58
  subpath?: string;
56
59
  }
57
60
 
61
+ export interface ContentMigrationArgs {
62
+ content: Content;
63
+ }
64
+
58
65
  export interface SomersaultMigrationArgs {
59
66
  content: Content;
60
67
  value: Value;
package/app/root.test.tsx CHANGED
@@ -217,8 +217,8 @@ it('should place the migrated title block in the legacy block order', async () =
217
217
  });
218
218
 
219
219
  expect(somersaultMigration).toHaveBeenCalledTimes(1);
220
- expect(result.data.content.blocks.__somersault__).toEqual({
221
- '@type': '__somersault__',
220
+ expect(result.data.content.blocks.main).toEqual({
221
+ '@type': 'plate',
222
222
  value: [
223
223
  {
224
224
  type: 'p',
@@ -236,7 +236,7 @@ it('should place the migrated title block in the legacy block order', async () =
236
236
  });
237
237
  });
238
238
 
239
- it('should skip somersault migration when the somersault block already exists', async () => {
239
+ it('should skip somersault migration when the main region already exists', async () => {
240
240
  const existingSomersaultValue = [
241
241
  {
242
242
  type: 'title',
@@ -247,8 +247,8 @@ it('should skip somersault migration when the somersault block already exists',
247
247
  '@id': 'http://example.com/',
248
248
  title: 'Page title',
249
249
  blocks: {
250
- __somersault__: {
251
- '@type': '__somersault__',
250
+ main: {
251
+ '@type': 'plate',
252
252
  value: existingSomersaultValue,
253
253
  },
254
254
  a: {
@@ -285,8 +285,8 @@ it('should skip somersault migration when the somersault block already exists',
285
285
  });
286
286
 
287
287
  expect(somersaultMigration).not.toHaveBeenCalled();
288
- expect(result.data.content.blocks.__somersault__).toEqual({
289
- '@type': '__somersault__',
288
+ expect(result.data.content.blocks.main).toEqual({
289
+ '@type': 'plate',
290
290
  value: existingSomersaultValue,
291
291
  });
292
292
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plone/aurora",
3
3
  "description": "Plone Aurora is the next-generation frontend for Plone CMS",
4
- "version": "1.0.0-alpha.23",
4
+ "version": "1.0.0-alpha.24",
5
5
  "maintainers": [
6
6
  {
7
7
  "name": "Plone Foundation",
@@ -33,19 +33,19 @@
33
33
  "type": "module",
34
34
  "dependencies": {
35
35
  "@plone/agave": "1.0.0-alpha.10",
36
- "@plone/blocks": "1.0.0-alpha.19",
36
+ "@plone/blocks": "1.0.0-alpha.20",
37
37
  "@plone/client": "2.0.0-alpha.11",
38
- "@plone/cmsui": "1.0.0-alpha.16",
38
+ "@plone/cmsui": "1.0.0-alpha.17",
39
39
  "@plone/components": "5.0.0-alpha.7",
40
40
  "@plone/icons": "1.0.0-alpha.3",
41
41
  "@plone/contents": "1.0.0-alpha.6",
42
42
  "@plone/helpers": "2.0.0-alpha.12",
43
- "@plone/layout": "1.0.0-alpha.18",
44
- "@plone/plate": "1.0.0-alpha.26",
45
- "@plone/publicui": "1.0.0-alpha.11",
46
- "@plone/quanta": "1.0.0-alpha.4",
43
+ "@plone/layout": "1.0.0-alpha.19",
44
+ "@plone/plate": "1.0.0-alpha.27",
45
+ "@plone/publicui": "1.0.0-alpha.12",
46
+ "@plone/quanta": "1.0.0-alpha.5",
47
47
  "@plone/react-router": "2.0.0-alpha.8",
48
- "@plone/registry": "4.0.0-alpha.7",
48
+ "@plone/registry": "4.0.0-alpha.8",
49
49
  "@plone/theming": "1.0.0-alpha.10",
50
50
  "@react-router/node": "8.5.0",
51
51
  "@react-router/express": "8.5.0",