Skip to content

Commit

Permalink
fix(core): inherit readOnly state from ancestors in copyPaste function
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin committed Oct 21, 2024
1 parent 01d0313 commit d28d580
Show file tree
Hide file tree
Showing 4 changed files with 319 additions and 1 deletion.
85 changes: 85 additions & 0 deletions dev/test-studio/schema/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,90 @@ export default defineType({
title: 'Image',
type: 'image',
},
{
name: 'readOnlyObject',
title: 'Read only object',
type: 'object',
readOnly: true,
fields: [
{
name: 'selfDefinedReadOnlyField',
title: 'Read only field',
description: 'ReadOnly defined in field',
type: 'string',
readOnly: true,
},
{
name: 'inheritedReadOnlyField',
title: 'Read only field',
description: 'ReadOnly inherited from object',
type: 'string',
},
],
},
{
name: 'sections',
title: 'Sections',
type: 'array',
of: [
{
type: 'object',
name: 'blocks',
fields: [
{
type: 'array',
name: 'blocks',
title: 'Grid',
of: [{type: 'playlistTrack'}],
},
],
readOnly: () => {
return true
},
},
{
type: 'object',
name: 'textBlocks',
fields: [
{
type: 'text',
name: 'text',
title: 'Text',
},
],
},
],
},
{
name: 'sectionsReadOnly',
title: 'Sections (read only)',
type: 'array',
readOnly: true,
of: [
{
type: 'object',
name: 'blocks',
fields: [
{
type: 'array',
name: 'blocks',
title: 'Grid',
of: [{type: 'playlistTrack'}],
},
],
},
{
type: 'object',
name: 'textBlocks',
fields: [
{
type: 'text',
name: 'text',
title: 'Text',
},
],
},
],
},
],
})
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export const CopyPasteProvider: React.FC<{

const targetSchemaTypeTitle = targetSchemaType.title || targetSchemaType.name
const transferValueOptions = {
targetDocumentSchemaType: targetDocumentSchemaType,
sourceRootSchemaType: sourceSchemaType,
sourcePath: [],
sourceRootPath: clipboardItem.valuePath,
Expand Down
Loading

0 comments on commit d28d580

Please sign in to comment.