Skip to content

Commit

Permalink
Merge pull request #132 from storyblok/use-storyblok-bridge-not-hook
Browse files Browse the repository at this point in the history
fix: useStoryblokBridge is not a hook
  • Loading branch information
fgiuliani authored Sep 8, 2022
2 parents d4f9612 + bcb1922 commit 33f6fd4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const { data } = await storyblokApi.get("cdn/stories", { version: "draft" });
#### 2. Listen to Storyblok Visual Editor events

Use `useStoryblokBridge` to get the new story every time is triggered a `change` event from the Visual Editor. You need to pass the story id as first param, and a callback function as second param to update the new story:
Use `useStoryblokBridge` or `registerStoryblokBridge` to get the new story every time is triggered a `change` event from the Visual Editor. You need to pass the story id as first param, and a callback function as second param to update the new story:

```js
import { storyblokInit, apiPlugin, useStoryblokBridge } from "@storyblok/js";
Expand Down Expand Up @@ -180,7 +180,7 @@ const { storyblokApi } = storyblokInit({
});
```

If you don't use `useStoryblokBridge`, you have still access to the raw `window.StoryblokBridge`:
If you don't use `useStoryblokBridge` or `registerStoryblokBridge`, you have still access to the raw `window.StoryblokBridge`:

```js
const sbBridge = new window.StoryblokBridge(options);
Expand Down
2 changes: 2 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export const useStoryblokBridge = <
});
};

export { useStoryblokBridge as registerStoryblokBridge };

export { default as apiPlugin } from "./modules/api";
export { default as storyblokEditable } from "./modules/editable";

Expand Down

0 comments on commit 33f6fd4

Please sign in to comment.