@plone/volto 14.0.0-alpha.13 → 14.0.0-alpha.14

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
@@ -1,5 +1,16 @@
1
1
  # Change Log
2
2
 
3
+ ## 14.0.0-alpha.14 (2021-10-01)
4
+
5
+ ### Bugfix
6
+
7
+ - Get `blocks` and `blocks_layout` defaults from existing behavior when enabling TTW editable DX Layout @avoinea
8
+
9
+ ### Internal
10
+
11
+ - Add development dependency on use-trace-update, useful for performance debugging @tiberiuichim
12
+ - Upgrade to `@plone/scripts` 1.0.3 @sneridagh
13
+
3
14
  ## 14.0.0-alpha.13 (2021-09-30)
4
15
 
5
16
  ### Feature
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "14.0.0-alpha.13",
12
+ "version": "14.0.0-alpha.14",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -247,7 +247,7 @@
247
247
  "@loadable/component": "5.14.1",
248
248
  "@loadable/server": "5.14.0",
249
249
  "@loadable/webpack-plugin": "5.14.0",
250
- "@plone/scripts": "1.0.0",
250
+ "@plone/scripts": "1.0.3",
251
251
  "@sentry/browser": "5.12.1",
252
252
  "@sentry/integrations": "5.27.3",
253
253
  "@sentry/node": "5.12.3",
@@ -404,7 +404,8 @@
404
404
  "identity-obj-proxy": "3.0.0",
405
405
  "jest-environment-jsdom-sixteen": "1.0.3",
406
406
  "react-is": "^16.13.1",
407
- "tmp": "0.2.1"
407
+ "tmp": "0.2.1",
408
+ "use-trace-update": "1.3.2"
408
409
  },
409
410
  "resolutions": {
410
411
  "http-proxy": "^1.18.1",
@@ -159,11 +159,10 @@ class ContentTypeLayout extends Component {
159
159
 
160
160
  // Schema GET
161
161
  if (this.props.schemaRequest.loading && nextProps.schemaRequest.loaded) {
162
- let properties = nextProps.schema?.properties || {};
163
- let content = {};
164
- let value, key;
165
- for (key in properties) {
166
- value = properties[key].default;
162
+ const properties = nextProps.schema?.properties || {};
163
+ const content = {};
164
+ for (const key in properties) {
165
+ const value = properties[key].default;
167
166
  if (value) {
168
167
  content[key] = value;
169
168
  }
@@ -229,7 +228,7 @@ class ContentTypeLayout extends Component {
229
228
  * @returns {undefined}
230
229
  */
231
230
  onSubmit(data) {
232
- let schema = { properties: {} };
231
+ const schema = { properties: {} };
233
232
  Object.keys(data)
234
233
  .filter((k) => data[k])
235
234
  .forEach((k) => (schema.properties[k] = { default: data[k] }));
@@ -242,7 +241,7 @@ class ContentTypeLayout extends Component {
242
241
  * @returns {undefined}
243
242
  */
244
243
  onCancel() {
245
- let url = getParentUrl(this.props.pathname);
244
+ const url = getParentUrl(this.props.pathname);
246
245
  this.props.history.push(getParentUrl(url));
247
246
  }
248
247
 
@@ -252,7 +251,10 @@ class ContentTypeLayout extends Component {
252
251
  * @returns {undefined}
253
252
  */
254
253
  onEnableBlocks() {
255
- let schema = {
254
+ const { properties = {} } = this.props.schema;
255
+ const blocksFieldName = getBlocksFieldname(properties);
256
+ const blocksLayoutFieldname = getBlocksLayoutFieldname(properties);
257
+ const schema = {
256
258
  fieldsets: [
257
259
  {
258
260
  id: 'layout',
@@ -266,12 +268,14 @@ class ContentTypeLayout extends Component {
266
268
  type: 'dict',
267
269
  widget: 'json',
268
270
  factory: 'JSONField',
271
+ default: properties[blocksFieldName]?.default || {},
269
272
  },
270
273
  blocks_layout: {
271
274
  title: 'Blocks Layout',
272
275
  type: 'dict',
273
276
  widget: 'json',
274
277
  factory: 'JSONField',
278
+ default: properties[blocksLayoutFieldname]?.default || { items: [] },
275
279
  },
276
280
  },
277
281
  };