From abdd5ee604125222ea34a84730b303e90ad095ca Mon Sep 17 00:00:00 2001 From: alvarosabu Date: Wed, 31 Jul 2024 10:07:59 +0200 Subject: [PATCH 1/2] feat: add deprecation warning for legacy `RichtextResolver` --- .gitignore | 4 +++- playground/main.ts | 6 ++++-- src/richTextResolver.ts | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7374b1c8..c810fce3 100755 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ gitcommit.fish .env.test .env -.next \ No newline at end of file +.next + +old-tests/ \ No newline at end of file diff --git a/playground/main.ts b/playground/main.ts index 8c25e209..0aa2d3de 100644 --- a/playground/main.ts +++ b/playground/main.ts @@ -1,4 +1,6 @@ -import StoryblokClient, { RichtextSchema } from '../' +import StoryblokClient, { RichtextResolver, RichtextSchema } from '../' const client = new StoryblokClient({}) -console.log(client, RichtextSchema) + +// TODO: Remove when deprecation of `RichtextResolver` is done +console.log(new RichtextResolver().render()) \ No newline at end of file diff --git a/src/richTextResolver.ts b/src/richTextResolver.ts index d8b67eb3..ba624ea5 100644 --- a/src/richTextResolver.ts +++ b/src/richTextResolver.ts @@ -83,6 +83,9 @@ class RichTextResolver { data?: ISbRichtext, options: RenderOptions = { optimizeImages: false } ) { + console.warn( + "Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` instead. https://github.com/storyblok/richtext/" + ); if (data && data.content && Array.isArray(data.content)) { let html = '' From 3f7b755e4457ad5ff0e40a0d7b4b64055175e3a6 Mon Sep 17 00:00:00 2001 From: alvarosabu Date: Wed, 31 Jul 2024 10:09:25 +0200 Subject: [PATCH 2/2] chore: added todo comment to completly remove richtextResolver on v7 --- src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.ts b/src/index.ts index 9b03ffa5..74053c13 100755 --- a/src/index.ts +++ b/src/index.ts @@ -75,6 +75,7 @@ class Storyblok { private resolveCounter: number public relations: RelationsType public links: LinksType + // TODO: Remove on v7.x.x public richTextResolver: RichTextResolver public resolveNestedRelations: boolean private stringifiedStoriesCache: Record