Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit be34a48

Browse files
Merge pull request #142 from storyblok/fix/resolverInstance
fix: add resolverInstance for Nuxt, Astro and other SDKs
2 parents a104889 + a0f957e commit be34a48

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Richtext,
99
StoryblokComponentType,
1010
SbRichTextOptions,
11+
RichtextInstance,
1112
} from "./types";
1213

1314
import RichTextResolver from "storyblok-js-client/source/richTextResolver";
@@ -110,9 +111,11 @@ const setComponentResolver = (resolver, resolveFn) => {
110111

111112
export const renderRichText = (
112113
data: Richtext,
113-
options?: SbRichTextOptions
114+
options?: SbRichTextOptions,
115+
resolverInstance?: RichtextInstance,
114116
): string => {
115-
if (!richTextResolver) {
117+
let localResolver = resolverInstance || richTextResolver;
118+
if (!localResolver) {
116119
console.error(
117120
"Please initialize the Storyblok SDK before calling the renderRichText function"
118121
);
@@ -128,7 +131,6 @@ export const renderRichText = (
128131
return "";
129132
}
130133

131-
let localResolver = richTextResolver;
132134
if (options) {
133135
localResolver = new RichTextResolver(options.schema);
134136
if (options.resolver) {

0 commit comments

Comments
 (0)