Skip to content

Commit

Permalink
Fix some type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh committed May 13, 2024
1 parent 369418b commit db0e008
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions packages/types/src/blocks/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { Location, History } from 'history';

export interface BlocksFormData {
'@type': AvailableBlocks;
variation?: string;
}

export interface BlockViewProps {
Expand Down
42 changes: 21 additions & 21 deletions packages/volto/src/helpers/Blocks/Blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export function emptyBlocksForm() {
* (could be empty, if not type given) and the number of blocks
* @function blocksFormGenerator
* @param {number} number How many blocks to generate of the type (could be "empty", if no type provided)
* @param {number} type The type of the blocks
* @param {string} type The type of the blocks
* @return {Object} blocks/blocks_layout pair filled with the generated blocks
*/
export function blocksFormGenerator(number, type) {
Expand Down Expand Up @@ -483,26 +483,26 @@ export function applySchemaDefaults({ data = {}, schema, intl }) {
[currentField]: schema.properties[currentField].default,
}
: intl &&
schema.properties[currentField].schema &&
!(schema.properties[currentField].widget === 'object_list') // TODO: this should be renamed as itemSchema
? {
...accumulator,
[currentField]: {
...applySchemaDefaults({
data: { ...data[currentField], ...accumulator[currentField] },
schema:
typeof schema.properties[currentField].schema === 'function'
? schema.properties[currentField].schema({
data: accumulator[currentField],
formData: accumulator[currentField],
intl,
})
: schema.properties[currentField].schema,
intl,
}),
},
}
: accumulator;
schema.properties[currentField].schema &&

Check failure on line 486 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
!(schema.properties[currentField].widget === 'object_list') // TODO: this should be renamed as itemSchema

Check failure on line 487 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
? {

Check failure on line 488 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
...accumulator,

Check failure on line 489 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
[currentField]: {

Check failure on line 490 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
...applySchemaDefaults({

Check failure on line 491 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
data: { ...data[currentField], ...accumulator[currentField] },

Check failure on line 492 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
schema:

Check failure on line 493 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Replace `················` with `··················`
typeof schema.properties[currentField].schema === 'function'

Check failure on line 494 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
? schema.properties[currentField].schema({

Check failure on line 495 in packages/volto/src/helpers/Blocks/Blocks.js

View workflow job for this annotation

GitHub Actions / ESlint

Insert `··`
data: accumulator[currentField],
formData: accumulator[currentField],
intl,
})
: schema.properties[currentField].schema,
intl,
}),
},
}
: accumulator;
}, {}),
data,
);
Expand Down

0 comments on commit db0e008

Please sign in to comment.