Skip to content

Commit 7acf411

Browse files
authored
Plate september update (#7393)
1 parent 4ad365d commit 7acf411

File tree

355 files changed

+26288
-18047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+26288
-18047
lines changed

apps/seven/news/7393.internal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make plate configure itself before blocks at the top. @sneridagh

apps/seven/registry.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const addons = [
22
'@plone/theming',
3+
'@plone/plate',
34
'@plone/blocks',
45
'@plone/layout',
56
'@plone/cmsui',
67
'@plone/publicui',
78
'@plone/agave',
8-
'@plone/plate',
99
];
1010
const theme = '';
1111

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"cypress",
5555
"esbuild",
5656
"lightningcss-cli",
57+
"msgpackr-extract",
5758
"unrs-resolver"
5859
]
5960
}

packages/blocks/Text/TextBlockEdit.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import type { BlockEditProps } from '@plone/types';
2-
import { PlateEditor } from '@plone/plate/components/editor/plate-editor';
3-
import { SettingsProvider } from '@plone/plate/components/editor/settings';
2+
import { PlateEditor, type Value } from '@plone/plate/components/editor';
3+
import plateBlockConfig from '@plone/plate/config/presets/block';
44

55
const TextBlockEdit = (props: BlockEditProps) => {
66
const { data, setBlock } = props;
77

88
return (
9-
<SettingsProvider>
10-
<PlateEditor
11-
value={data.value}
12-
onChange={(options) => {
13-
setBlock({ ...data, value: options.value });
14-
}}
15-
/>
16-
</SettingsProvider>
9+
<PlateEditor
10+
editorConfig={plateBlockConfig.editorConfig}
11+
value={data.value as Value}
12+
onChange={(options) => {
13+
setBlock({ ...data, value: options.value });
14+
}}
15+
/>
1716
);
1817
};
1918

packages/blocks/Text/TextBlockView.tsx

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
import type { BlockViewProps } from '@plone/types';
2-
import { renderSlate } from './slate';
3-
import config from '@plone/registry';
2+
import { PlateRenderer, type Value } from '@plone/plate/components/editor';
3+
import plateBlockConfig from '@plone/plate/config/presets/block';
44

55
const TextBlockView = (props: BlockViewProps) => {
6-
const { id, data } = props;
7-
const metadata = props.metadata || props.properties;
6+
const { data } = props;
87

98
return data?.value ? (
10-
<>
11-
{renderSlate(
12-
id,
13-
config.settings.slate.elements,
14-
config.settings.slate.topLevelTargetElements,
15-
data.value,
16-
data?.override_toc,
17-
metadata,
18-
)}
19-
</>
9+
<PlateRenderer
10+
editorConfig={plateBlockConfig.rendererConfig}
11+
value={data.value as Value}
12+
/>
2013
) : null;
2114
};
2215

packages/blocks/Text/slate.tsx

Lines changed: 0 additions & 140 deletions
This file was deleted.

packages/blocks/config/slate.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

packages/blocks/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import type { ConfigType } from '@plone/registry';
2-
import { slate } from './config/slate';
2+
33
import TitleBlockInfo from './Title';
44
import TextBlockInfo from './Text';
55
import ImageBlockInfo from './Image';
66
import TeaserBlockInfo from './Teaser';
77

88
export default function install(config: ConfigType) {
9-
config.settings.slate = slate;
109
// @ts-expect-error this is a quick hack for now
1110
// Initializing blocksConfig to empty.
1211
// We of course are assuming that this package will be installed before any

packages/blocks/news/7393.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove all slate related components. Use the new plate unified configuration in `@plone/plate`. @sneridagh

packages/blocks/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
"@plone/components": "workspace:*",
5252
"@plone/plate": "workspace:*",
5353
"@plone/registry": "workspace:*",
54-
"clsx": "^2.1.1"
54+
"clsx": "^2.1.1",
55+
"lodash.clonedeep": "^4.5.0"
5556
},
5657
"devDependencies": {
5758
"@plone/helpers": "workspace:*",
@@ -61,6 +62,7 @@
6162
"@testing-library/jest-dom": "6.4.2",
6263
"@testing-library/react": "catalog:",
6364
"@types/jest-axe": "^3.5.7",
65+
"@types/lodash.clonedeep": "4.5.6",
6466
"@types/node": "catalog:",
6567
"@types/react": "catalog:",
6668
"@types/react-dom": "catalog:",

0 commit comments

Comments
 (0)