Skip to content

Commit

Permalink
Merge pull request #845 from storyblok/feature/PRO-425-deprecation-wa…
Browse files Browse the repository at this point in the history
…rnings-legacy-richtext

feat: pro 425 deprecation warnings legacy richtext
  • Loading branch information
alvarosabu authored Jul 31, 2024
2 parents 8a938c3 + 3f7b755 commit e49e1cf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ gitcommit.fish

.env.test
.env
.next
.next

old-tests/
6 changes: 4 additions & 2 deletions playground/main.ts
Original file line number Diff line number Diff line change
@@ -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())
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>
Expand Down
3 changes: 3 additions & 0 deletions src/richTextResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''

Expand Down

0 comments on commit e49e1cf

Please sign in to comment.