From 43be59a36196d469eb475675638854d80d15f62d Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 24 Jul 2024 23:25:09 +0200 Subject: [PATCH] Change infobox to be its own type --- .../content-types/blog-post/schema.json | 3 ++- src/components/content/infobox.json | 15 +++++++++++++++ src/components/content/text-markdown.json | 11 +---------- types/generated/components.d.ts | 17 +++++++++++++---- types/generated/contentTypes.d.ts | 7 ++++++- 5 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 src/components/content/infobox.json diff --git a/src/api/blog-post/content-types/blog-post/schema.json b/src/api/blog-post/content-types/blog-post/schema.json index 4a02029..dc34ec1 100644 --- a/src/api/blog-post/content-types/blog-post/schema.json +++ b/src/api/blog-post/content-types/blog-post/schema.json @@ -40,7 +40,8 @@ "components": [ "content.gallery", "content.image", - "content.text-markdown" + "content.text-markdown", + "content.infobox" ], "pluginOptions": { "i18n": { diff --git a/src/components/content/infobox.json b/src/components/content/infobox.json new file mode 100644 index 0000000..b40e09e --- /dev/null +++ b/src/components/content/infobox.json @@ -0,0 +1,15 @@ +{ + "collectionName": "components_content_infoboxes", + "info": { + "displayName": "Infobox" + }, + "options": {}, + "attributes": { + "title": { + "type": "string" + }, + "value": { + "type": "richtext" + } + } +} diff --git a/src/components/content/text-markdown.json b/src/components/content/text-markdown.json index d99f707..61c13f2 100644 --- a/src/components/content/text-markdown.json +++ b/src/components/content/text-markdown.json @@ -1,22 +1,13 @@ { "collectionName": "components_content_text_markdowns", "info": { - "displayName": "Text - Markdown", + "displayName": "Paragraph", "description": "" }, "options": {}, "attributes": { "value": { "type": "richtext" - }, - "type": { - "type": "enumeration", - "enum": [ - "paragraph", - "infobox" - ], - "default": "paragraph", - "required": true } } } diff --git a/types/generated/components.d.ts b/types/generated/components.d.ts index a3fdfec..2038bb3 100644 --- a/types/generated/components.d.ts +++ b/types/generated/components.d.ts @@ -20,17 +20,25 @@ export interface ContentImage extends Schema.Component { }; } +export interface ContentInfobox extends Schema.Component { + collectionName: 'components_content_infoboxes'; + info: { + displayName: 'Infobox'; + }; + attributes: { + title: Attribute.String; + value: Attribute.RichText; + }; +} + export interface ContentTextMarkdown extends Schema.Component { collectionName: 'components_content_text_markdowns'; info: { - displayName: 'Text - Markdown'; + displayName: 'Paragraph'; description: ''; }; attributes: { value: Attribute.RichText; - type: Attribute.Enumeration<['paragraph', 'infobox']> & - Attribute.Required & - Attribute.DefaultTo<'paragraph'>; }; } @@ -39,6 +47,7 @@ declare module '@strapi/types' { export interface Components { 'content.gallery': ContentGallery; 'content.image': ContentImage; + 'content.infobox': ContentInfobox; 'content.text-markdown': ContentTextMarkdown; } } diff --git a/types/generated/contentTypes.d.ts b/types/generated/contentTypes.d.ts index a10c6e4..dd4ef77 100644 --- a/types/generated/contentTypes.d.ts +++ b/types/generated/contentTypes.d.ts @@ -961,7 +961,12 @@ export interface ApiBlogPostBlogPost extends Schema.CollectionType { 'api::author.author' >; content: Attribute.DynamicZone< - ['content.gallery', 'content.image', 'content.text-markdown'] + [ + 'content.gallery', + 'content.image', + 'content.text-markdown', + 'content.infobox' + ] > & Attribute.SetPluginOptions<{ i18n: {