diff --git a/sanityv3/migrations/issue-2533/index.ts b/sanityv3/migrations/issue-2533/index.ts new file mode 100644 index 000000000..1d962f5d1 --- /dev/null +++ b/sanityv3/migrations/issue-2533/index.ts @@ -0,0 +1,21 @@ +import { at, defineMigration, unset, insertBefore } from 'sanity/migrate' + +export default defineMigration({ + title: 'Issue 2533', + documentTypes: ['page', 'magazine'], + + migrate: { + array(node, path, _context) { + if (path[0] === 'content') + return node + .filter((it) => (it._type === 'textBlock' || it._type === 'accordion') && it.anchor != null) + .filter((e) => !!e) + .map((item) => { + return [ + insertBefore([{ _type: 'anchorLink', anchorReference: item.anchor }], { _key: item._key }), + at([{ _key: item._key }, 'anchor'], unset()), + ] + }) + }, + }, +}) diff --git a/sanityv3/schemas/objects/accordion.tsx b/sanityv3/schemas/objects/accordion.tsx index fa27b7503..33d22683e 100644 --- a/sanityv3/schemas/objects/accordion.tsx +++ b/sanityv3/schemas/objects/accordion.tsx @@ -5,7 +5,6 @@ import { AccordionComponent } from '../../icons' import CompactBlockEditor from '../components/CompactBlockEditor' import { configureTitleBlockContent } from '../editors' import { configureBlockContent } from '../editors/blockContentType' -import { validateComponentAnchor } from '../validations/validateAnchorReference' import type { ColorSelectorValue } from '../components/ColorSelector' export type Accordion = { @@ -80,18 +79,6 @@ export default { hotspot: true, }, }, - { - name: 'anchor', - type: 'anchorReferenceField', - title: 'Anchor reference', - validation: (Rule: Rule) => [ - Rule.max(0).warning('Clear this field and use anchor link component instead.'), - // @ts-ignore - Rule.custom((value: string, context: any) => validateComponentAnchor(value, context)), - ], - fieldset: 'anchor', - readOnly: ({ value }: { value?: string }) => !value, - }, { title: 'Accordion items', name: 'accordion', diff --git a/web/components/src/Backgrounds/ImageBackgroundContainer.tsx b/web/components/src/Backgrounds/ImageBackgroundContainer.tsx index 58a0f511e..baa15977e 100644 --- a/web/components/src/Backgrounds/ImageBackgroundContainer.tsx +++ b/web/components/src/Backgrounds/ImageBackgroundContainer.tsx @@ -23,6 +23,7 @@ export const ImageBackgroundContainer = forwardRef {/** Scrim */}
) : isMobile && !dontSplit ? ( -
+
{/** Scrim */}
{ ${markDefs}, } }, - anchor, "designOptions": { ${background}, } diff --git a/web/pageComponents/topicPages/Accordion/AccordionBlock.tsx b/web/pageComponents/topicPages/Accordion/AccordionBlock.tsx index c687bf73d..5db38f574 100644 --- a/web/pageComponents/topicPages/Accordion/AccordionBlock.tsx +++ b/web/pageComponents/topicPages/Accordion/AccordionBlock.tsx @@ -41,7 +41,7 @@ const AccordionBlock = ({ data, anchor, className }: AccordionBlockProps) => { return ( <> - +